My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
DocHtmlCell Class Reference

#include <docparser.h>

Inheritance diagram for DocHtmlCell:
CompAccept< DocHtmlCell > DocNode

Public Types

enum  Alignment { Left, Right, Center }
 
- Public Types inherited from DocNode
enum  Kind {
  Kind_Root = 0, Kind_Word = 1, Kind_WhiteSpace = 2, Kind_Para = 3,
  Kind_AutoList = 4, Kind_AutoListItem = 5, Kind_Symbol = 6, Kind_URL = 7,
  Kind_StyleChange = 8, Kind_SimpleSect = 9, Kind_Title = 10, Kind_SimpleList = 11,
  Kind_SimpleListItem = 12, Kind_Section = 13, Kind_Verbatim = 14, Kind_XRefItem = 15,
  Kind_HtmlList = 16, Kind_HtmlListItem = 17, Kind_HtmlDescList = 18, Kind_HtmlDescData = 19,
  Kind_HtmlDescTitle = 20, Kind_HtmlTable = 21, Kind_HtmlRow = 22, Kind_HtmlCell = 23,
  Kind_HtmlCaption = 24, Kind_LineBreak = 25, Kind_HorRuler = 26, Kind_Anchor = 27,
  Kind_IndexEntry = 28, Kind_Internal = 29, Kind_HRef = 30, Kind_Include = 31,
  Kind_IncOperator = 32, Kind_HtmlHeader = 33, Kind_Image = 34, Kind_DotFile = 35,
  Kind_Link = 36, Kind_Ref = 37, Kind_Formula = 38, Kind_SecRefItem = 39,
  Kind_SecRefList = 40, Kind_SimpleSectSep = 41, Kind_LinkedWord = 42, Kind_ParamSect = 43,
  Kind_ParamList = 44, Kind_InternalRef = 45, Kind_Copy = 46, Kind_Text = 47,
  Kind_MscFile = 48, Kind_HtmlBlockQuote = 49, Kind_VhdlFlow = 50, Kind_ParBlock = 51,
  Kind_DiaFile = 52
}
 

Public Member Functions

 DocHtmlCell (DocNode *parent, const HtmlAttribList &attribs, bool isHeading)
 
bool isHeading () const
 
bool isFirst () const
 
bool isLast () const
 
Kind kind () const
 
void accept (DocVisitor *v)
 
void markFirst (bool v=TRUE)
 
void markLast (bool v=TRUE)
 
const HtmlAttribListattribs () const
 
int parse ()
 
int parseXml ()
 
int rowIndex () const
 
int columnIndex () const
 
int rowSpan () const
 
int colSpan () const
 
Alignment alignment () const
 
- Public Member Functions inherited from CompAccept< DocHtmlCell >
 CompAccept ()
 
virtual ~CompAccept ()
 
void accept (DocHtmlCell *obj, DocVisitor *v)
 
const QList< DocNode > & children () const
 
QList< DocNode > & children ()
 
- Public Member Functions inherited from DocNode
 DocNode ()
 
virtual ~DocNode ()
 
DocNodeparent () const
 
void setParent (DocNode *parent)
 
bool isPreformatted () const
 

Private Member Functions

void setRowIndex (int idx)
 
void setColumnIndex (int idx)
 

Private Attributes

bool m_isHeading
 
bool m_isFirst
 
bool m_isLast
 
HtmlAttribList m_attribs
 
int m_rowIdx
 
int m_colIdx
 

Friends

class DocHtmlTable
 

Additional Inherited Members

- Protected Member Functions inherited from DocNode
void setInsidePreformatted (bool p)
 
- Protected Attributes inherited from CompAccept< DocHtmlCell >
QList< DocNodem_children
 
- Protected Attributes inherited from DocNode
DocNodem_parent
 

Detailed Description

Node representing a HTML table cell

Definition at line 1251 of file docparser.h.

Member Enumeration Documentation

Enumerator
Left 
Right 
Center 

Definition at line 1255 of file docparser.h.

Constructor & Destructor Documentation

DocHtmlCell::DocHtmlCell ( DocNode parent,
const HtmlAttribList attribs,
bool  isHeading 
)
inline

Definition at line 1256 of file docparser.h.

References DocNode::m_parent, and DocNode::parent().

:
m_isFirst(FALSE), m_isLast(FALSE), m_attribs(attribs),
m_rowIdx(-1), m_colIdx(-1) { m_parent = parent; }

Member Function Documentation

void DocHtmlCell::accept ( DocVisitor v)
inlinevirtual

Acceptor function for node visitors. Part of the visitor pattern.

Parameters
vAbstract visitor.

Implements DocNode.

Definition at line 1264 of file docparser.h.

References CompAccept< T >::accept().

DocHtmlCell::Alignment DocHtmlCell::alignment ( ) const

Definition at line 3480 of file docparser.cpp.

References attribs(), Center, Left, and Right.

Referenced by LatexDocVisitor::visitPre().

{
uint i;
for (i=0; i<attrs.count(); ++i)
{
if (attrs.at(i)->name.lower()=="align")
{
if (attrs.at(i)->value.lower()=="center")
return Center;
else if (attrs.at(i)->value.lower()=="right")
return Right;
else return Left;
}
}
return Left;
}
const HtmlAttribList& DocHtmlCell::attribs ( ) const
inline

Definition at line 1267 of file docparser.h.

References m_attribs.

Referenced by align(), alignment(), colSpan(), rowSpan(), and HtmlDocVisitor::visitPre().

{ return m_attribs; }
int DocHtmlCell::colSpan ( ) const

Definition at line 3464 of file docparser.cpp.

References attribs().

Referenced by DocHtmlTable::computeTableGrid(), and LatexDocVisitor::visitPre().

{
int retval = 1;
uint i;
for (i=0; i<attrs.count(); ++i)
{
if (attrs.at(i)->name.lower()=="colspan")
{
retval = QMAX(1,attrs.at(i)->value.toInt());
break;
}
}
return retval;
}
int DocHtmlCell::columnIndex ( ) const
inline

Definition at line 1271 of file docparser.h.

References m_colIdx.

Referenced by LatexDocVisitor::visitPre().

{ return m_colIdx; }
bool DocHtmlCell::isFirst ( ) const
inline

Definition at line 1261 of file docparser.h.

References m_isFirst.

Referenced by parse(), and parseXml().

{ return m_isFirst; }
bool DocHtmlCell::isHeading ( ) const
inline
bool DocHtmlCell::isLast ( ) const
inline

Definition at line 1262 of file docparser.h.

References m_isLast.

Referenced by LatexDocVisitor::visitPost().

{ return m_isLast; }
Kind DocHtmlCell::kind ( ) const
inlinevirtual

Returns the kind of node. Provides runtime type information

Implements DocNode.

Definition at line 1263 of file docparser.h.

References DocNode::Kind_HtmlCell.

{ return Kind_HtmlCell; }
void DocHtmlCell::markFirst ( bool  v = TRUE)
inline

Definition at line 1265 of file docparser.h.

References m_isFirst.

Referenced by DocHtmlRow::parse(), and DocHtmlRow::parseXml().

{ m_isFirst=v; }
void DocHtmlCell::markLast ( bool  v = TRUE)
inline

Definition at line 1266 of file docparser.h.

References m_isLast.

Referenced by DocHtmlRow::parse(), and DocHtmlRow::parseXml().

{ m_isLast=v; }
int DocHtmlCell::parse ( )

Definition at line 3374 of file docparser.cpp.

References DBG, TokenInfo::endTag, g_nodeStack, g_token, HTML_TD, HTML_TH, Mappers::htmlTagMapper, isFirst(), CompAccept< DocHtmlCell >::m_children, Mapper::map(), DocPara::markFirst(), DocPara::markLast(), TokenInfo::name, DocPara::parse(), RetVal_OK, TK_HTMLTAG, and TK_NEWPARA.

Referenced by DocHtmlRow::parse().

{
int retval=RetVal_OK;
g_nodeStack.push(this);
DBG(("DocHtmlCell::parse() start\n"));
// parse one or more paragraphs
bool isFirst=TRUE;
DocPara *par=0;
do
{
par = new DocPara(this);
if (isFirst) { par->markFirst(); isFirst=FALSE; }
m_children.append(par);
retval=par->parse();
if (retval==TK_HTMLTAG)
{
if (tagId==HTML_TD && g_token->endTag) // found </dt> tag
{
retval=TK_NEWPARA; // ignore the tag
}
else if (tagId==HTML_TH && g_token->endTag) // found </th> tag
{
retval=TK_NEWPARA; // ignore the tag
}
}
}
while (retval==TK_NEWPARA);
if (par) par->markLast();
DBG(("DocHtmlCell::parse() end\n"));
DocNode *n=g_nodeStack.pop();
ASSERT(n==this);
return retval;
}
int DocHtmlCell::parseXml ( )

Definition at line 3411 of file docparser.cpp.

References DBG, TokenInfo::endTag, g_nodeStack, g_token, Mappers::htmlTagMapper, isFirst(), CompAccept< DocHtmlCell >::m_children, Mapper::map(), DocPara::markFirst(), DocPara::markLast(), TokenInfo::name, DocPara::parse(), RetVal_OK, TK_HTMLTAG, TK_NEWPARA, XML_DESCRIPTION, and XML_ITEM.

Referenced by DocHtmlRow::parseXml().

{
int retval=RetVal_OK;
g_nodeStack.push(this);
DBG(("DocHtmlCell::parseXml() start\n"));
// parse one or more paragraphs
bool isFirst=TRUE;
DocPara *par=0;
do
{
par = new DocPara(this);
if (isFirst) { par->markFirst(); isFirst=FALSE; }
m_children.append(par);
retval=par->parse();
if (retval==TK_HTMLTAG)
{
if (tagId==XML_ITEM && g_token->endTag) // found </item> tag
{
retval=TK_NEWPARA; // ignore the tag
}
else if (tagId==XML_DESCRIPTION && g_token->endTag) // found </description> tag
{
retval=TK_NEWPARA; // ignore the tag
}
}
}
while (retval==TK_NEWPARA);
if (par) par->markLast();
DBG(("DocHtmlCell::parseXml() end\n"));
DocNode *n=g_nodeStack.pop();
ASSERT(n==this);
return retval;
}
int DocHtmlCell::rowIndex ( ) const
inline

Definition at line 1270 of file docparser.h.

References m_rowIdx.

Referenced by LatexDocVisitor::visitPost().

{ return m_rowIdx; }
int DocHtmlCell::rowSpan ( ) const

Definition at line 3448 of file docparser.cpp.

References attribs().

Referenced by DocHtmlTable::computeTableGrid(), and LatexDocVisitor::visitPre().

{
int retval = 0;
uint i;
for (i=0; i<attrs.count(); ++i)
{
if (attrs.at(i)->name.lower()=="rowspan")
{
retval = attrs.at(i)->value.toInt();
break;
}
}
return retval;
}
void DocHtmlCell::setColumnIndex ( int  idx)
inlineprivate

Definition at line 1278 of file docparser.h.

References m_colIdx.

Referenced by DocHtmlTable::computeTableGrid().

{ m_colIdx = idx; }
void DocHtmlCell::setRowIndex ( int  idx)
inlineprivate

Definition at line 1277 of file docparser.h.

References m_rowIdx.

Referenced by DocHtmlTable::computeTableGrid().

{ m_rowIdx = idx; }

Friends And Related Function Documentation

friend class DocHtmlTable
friend

Definition at line 1253 of file docparser.h.

Member Data Documentation

HtmlAttribList DocHtmlCell::m_attribs
private

Definition at line 1282 of file docparser.h.

Referenced by attribs().

int DocHtmlCell::m_colIdx
private

Definition at line 1284 of file docparser.h.

Referenced by columnIndex(), and setColumnIndex().

bool DocHtmlCell::m_isFirst
private

Definition at line 1280 of file docparser.h.

Referenced by isFirst(), and markFirst().

bool DocHtmlCell::m_isHeading
private

Definition at line 1279 of file docparser.h.

Referenced by isHeading().

bool DocHtmlCell::m_isLast
private

Definition at line 1281 of file docparser.h.

Referenced by isLast(), and markLast().

int DocHtmlCell::m_rowIdx
private

Definition at line 1283 of file docparser.h.

Referenced by rowIndex(), and setRowIndex().


The documentation for this class was generated from the following files: