diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2004-05-17 20:19:03 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2004-05-17 20:19:03 (GMT) |
commit | 6e92a0d3db80c3d93a35efbe52d45c73b8303e45 (patch) | |
tree | 5c4df5008d6c8033ded1f60fbb87461e666c8f1c /src/rtfdocvisitor.cpp | |
parent | 53da67394cd52ea7301f306ad766107b38ffd2ae (diff) | |
download | Doxygen-6e92a0d3db80c3d93a35efbe52d45c73b8303e45.zip Doxygen-6e92a0d3db80c3d93a35efbe52d45c73b8303e45.tar.gz Doxygen-6e92a0d3db80c3d93a35efbe52d45c73b8303e45.tar.bz2 |
Release-1.3.7-20040517
Diffstat (limited to 'src/rtfdocvisitor.cpp')
-rw-r--r-- | src/rtfdocvisitor.cpp | 264 |
1 files changed, 206 insertions, 58 deletions
diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index 2f2dd25..a878abc 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -28,8 +28,13 @@ #include "message.h" #include <qfileinfo.h> + +#define DBG_RTF(x) m_t << x +//#define DBG_RTF(x) do {} while(0) + RTFDocVisitor::RTFDocVisitor(QTextStream &t,BaseCodeDocInterface &ci) - : DocVisitor(DocVisitor_RTF), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE), m_indentLevel(1) + : DocVisitor(DocVisitor_RTF), m_t(t), m_ci(ci), m_insidePre(FALSE), + m_hide(FALSE), m_indentLevel(0), m_lastIsPara(FALSE) { } @@ -49,7 +54,7 @@ void RTFDocVisitor::incIndentLevel() void RTFDocVisitor::decIndentLevel() { - if (m_indentLevel>1) m_indentLevel--; + if (m_indentLevel>0) m_indentLevel--; } //-------------------------------------- @@ -59,20 +64,25 @@ void RTFDocVisitor::decIndentLevel() void RTFDocVisitor::visit(DocWord *w) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visit(DocWord)}\n"); filter(w->word()); + m_lastIsPara=FALSE; } void RTFDocVisitor::visit(DocLinkedWord *w) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visit(DocLinkedWord)}\n"); startLink(w->ref(),w->file(),w->anchor()); filter(w->word()); endLink(w->ref()); + m_lastIsPara=FALSE; } void RTFDocVisitor::visit(DocWhiteSpace *w) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visit(DocWhiteSpace)}\n"); if (m_insidePre) { m_t << w->chars(); @@ -81,11 +91,13 @@ void RTFDocVisitor::visit(DocWhiteSpace *w) { m_t << " "; } + m_lastIsPara=FALSE; } void RTFDocVisitor::visit(DocSymbol *s) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visit(DocSymbol)}\n"); switch(s->symbol()) { case DocSymbol::BSlash: m_t << "\\\\"; break; @@ -202,11 +214,13 @@ void RTFDocVisitor::visit(DocSymbol *s) default: err("Error: unknown symbol found\n"); } + m_lastIsPara=FALSE; } void RTFDocVisitor::visit(DocURL *u) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visit(DocURL)}\n"); if (Config_getBool("RTF_HYPERLINKS")) { m_t << "{\\field " @@ -230,23 +244,30 @@ void RTFDocVisitor::visit(DocURL *u) filter(u->url()); m_t << "}"; } + m_lastIsPara=FALSE; } void RTFDocVisitor::visit(DocLineBreak *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visit(DocLineBreak)}\n"); m_t << "\\par\n"; + m_lastIsPara=TRUE; } void RTFDocVisitor::visit(DocHorRuler *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visit(DocHorRuler)}\n"); m_t << "{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw5\\brsp20 \\adjustright \\par}" << endl; + m_lastIsPara=TRUE; } void RTFDocVisitor::visit(DocStyleChange *s) { if (m_hide) return; + m_lastIsPara=FALSE; + DBG_RTF("{\\comment RTFDocVisitor::visit(DocStyleChange)}\n"); switch (s->style()) { case DocStyleChange::Bold: @@ -284,6 +305,7 @@ void RTFDocVisitor::visit(DocStyleChange *s) m_t << "\\par" << endl; m_t << "}" << endl; } + m_lastIsPara=TRUE; break; case DocStyleChange::Div: /* HTML only */ break; case DocStyleChange::Span: /* HTML only */ break; @@ -293,6 +315,7 @@ void RTFDocVisitor::visit(DocStyleChange *s) void RTFDocVisitor::visit(DocVerbatim *s) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visit(DocVerbatim)}\n"); switch(s->type()) { case DocVerbatim::Code: // fall though @@ -340,11 +363,13 @@ void RTFDocVisitor::visit(DocVerbatim *s) } break; } + m_lastIsPara=FALSE; } void RTFDocVisitor::visit(DocAnchor *anc) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visit(DocAnchor)}\n"); QString anchor; if (!anc->file().isEmpty()) { @@ -360,11 +385,13 @@ void RTFDocVisitor::visit(DocAnchor *anc) } m_t << "{\\bkmkstart " << rtfFormatBmkStr(anchor) << "}" << endl; m_t << "{\\bkmkend " << rtfFormatBmkStr(anchor) << "}" << endl; + m_lastIsPara=FALSE; } void RTFDocVisitor::visit(DocInclude *inc) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visit(DocInclude)}\n"); switch(inc->type()) { case DocInclude::IncWithLines: @@ -400,12 +427,14 @@ void RTFDocVisitor::visit(DocInclude *inc) m_t << "}" << endl; break; } + m_lastIsPara=TRUE; } void RTFDocVisitor::visit(DocIncOperator *op) { //printf("DocIncOperator: type=%d first=%d, last=%d text=`%s'\n", // op->type(),op->isFirst(),op->isLast(),op->text().data()); + DBG_RTF("{\\comment RTFDocVisitor::visit(DocIncOperator)}\n"); if (op->isFirst()) { if (!m_hide) @@ -432,10 +461,12 @@ void RTFDocVisitor::visit(DocIncOperator *op) m_t << "\\par" << endl; m_t << "}" << endl; } + m_lastIsPara=TRUE; } else { if (!m_hide) m_t << endl; + m_lastIsPara=FALSE; } } @@ -443,13 +474,17 @@ void RTFDocVisitor::visit(DocFormula *f) { if (m_hide) return; // TODO: do something sensible here, like including a bitmap + DBG_RTF("{\\comment RTFDocVisitor::visit(DocFormula)}\n"); m_t << f->text(); + m_lastIsPara=FALSE; } void RTFDocVisitor::visit(DocIndexEntry *i) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visit(DocIndexEntry)}\n"); m_t << "{\\xe \\v " << i->entry() << "}" << endl; + m_lastIsPara=FALSE; } //-------------------------------------- @@ -459,24 +494,27 @@ void RTFDocVisitor::visit(DocIndexEntry *i) void RTFDocVisitor::visitPre(DocAutoList *l) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocAutoList)}\n"); m_t << "{" << endl; - incIndentLevel(); rtf_listItemInfo[m_indentLevel].isEnum = l->isEnumList(); rtf_listItemInfo[m_indentLevel].number = 1; + m_lastIsPara=FALSE; } void RTFDocVisitor::visitPost(DocAutoList *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocAutoList)}\n"); m_t << "\\par" << endl; m_t << "}" << endl; - decIndentLevel(); + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPre(DocAutoListItem *) { if (m_hide) return; - m_t << "\\par" << endl; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocAutoListItem)}\n"); + if (!m_lastIsPara) m_t << "\\par" << endl; m_t << rtf_Style_Reset; if (rtf_listItemInfo[m_indentLevel].isEnum) { @@ -488,40 +526,62 @@ void RTFDocVisitor::visitPre(DocAutoListItem *) { m_t << getStyle("ListBullet") << endl; } + incIndentLevel(); + m_lastIsPara=FALSE; } void RTFDocVisitor::visitPost(DocAutoListItem *) { + decIndentLevel(); + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocAutoListItem)}\n"); } void RTFDocVisitor::visitPre(DocPara *) { + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocPara)}\n"); } void RTFDocVisitor::visitPost(DocPara *p) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocPara)}\n"); if (!p->isLast() && // omit <p> for last paragraph !(p->parent() && // and for parameter sections p->parent()->kind()==DocNode::Kind_ParamSect ) - ) m_t << "\\par" << endl; + ) + { + m_t << "\\par" << endl; + m_lastIsPara=TRUE; + } } -void RTFDocVisitor::visitPre(DocRoot *) +void RTFDocVisitor::visitPre(DocRoot *r) { + if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocRoot)}\n"); + if (r->indent()) incIndentLevel(); + m_t << "{" << rtf_Style["BodyText"]->reference << endl; } -void RTFDocVisitor::visitPost(DocRoot *) +void RTFDocVisitor::visitPost(DocRoot *r) { + if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocRoot)}\n"); + if (!m_lastIsPara && !r->singleLine()) m_t << "\\par" << endl; + m_t << "}"; + m_lastIsPara=TRUE; + if (r->indent()) decIndentLevel(); } void RTFDocVisitor::visitPre(DocSimpleSect *s) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSimpleSect)}\n"); + if (!m_lastIsPara) m_t << "\\par" << endl; m_t << "{"; // start desc - m_t << "{\\b "; // start bold - m_t << "\\par" << endl; + //m_t << "{\\b "; // start bold + m_t << "{" << rtf_Style["Heading5"]->reference << endl; switch(s->type()) { case DocSimpleSect::See: @@ -560,65 +620,80 @@ void RTFDocVisitor::visitPre(DocSimpleSect *s) // special case 1: user defined title if (s->type()!=DocSimpleSect::User && s->type()!=DocSimpleSect::Rcs) { - m_t << ":}"; // end bold + m_t << ":"; m_t << "\\par" << endl; + m_t << "}"; // end bold incIndentLevel(); m_t << rtf_Style_Reset << getStyle("DescContinue"); } + m_lastIsPara=FALSE; } void RTFDocVisitor::visitPost(DocSimpleSect *) { if (m_hide) return; - m_t << "\\par" << endl; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSimpleSect)}\n"); + if (!m_lastIsPara) m_t << "\\par" << endl; decIndentLevel(); m_t << "}"; // end desc + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPre(DocTitle *) { + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocTitle)}\n"); } void RTFDocVisitor::visitPost(DocTitle *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocTitle)}\n"); m_t << "}"; // end bold m_t << "\\par" << endl; incIndentLevel(); m_t << rtf_Style_Reset << getStyle("DescContinue"); + m_lastIsPara=FALSE; } void RTFDocVisitor::visitPre(DocSimpleList *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSimpleSect)}\n"); m_t << "{" << endl; - incIndentLevel(); rtf_listItemInfo[m_indentLevel].isEnum = FALSE; + m_lastIsPara=FALSE; } void RTFDocVisitor::visitPost(DocSimpleList *) { if (m_hide) return; - decIndentLevel(); - m_t << "\\par" << endl; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSimpleSect)}\n"); + if (!m_lastIsPara) m_t << "\\par" << endl; m_t << "}" << endl; + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPre(DocSimpleListItem *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSimpleListItem)}\n"); m_t << "\\par" << rtf_Style_Reset << getStyle("ListBullet") << endl; + m_lastIsPara=FALSE; + incIndentLevel(); } void RTFDocVisitor::visitPost(DocSimpleListItem *) { + decIndentLevel(); + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSimpleListItem)}\n"); } void RTFDocVisitor::visitPre(DocSection *s) { if (m_hide) return; - m_t << "\\par" << endl << - "{{" // start section + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSection)}\n"); + if (!m_lastIsPara) m_t << "\\par" << endl; + m_t << "{{" // start section << rtf_Style_Reset; QString heading; int level = QMIN(s->level()+1,4); @@ -631,33 +706,39 @@ void RTFDocVisitor::visitPre(DocSection *s) m_t << "{\\tc\\tcl" << level << " \\v "; filter(s->title()); m_t << "}" << endl; + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPost(DocSection *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSection)}\n"); m_t << "}" << endl; // end section + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPre(DocHtmlList *l) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlList)}\n"); m_t << "{" << endl; - incIndentLevel(); rtf_listItemInfo[m_indentLevel].isEnum = l->type()==DocHtmlList::Ordered; rtf_listItemInfo[m_indentLevel].number = 1; + m_lastIsPara=FALSE; } void RTFDocVisitor::visitPost(DocHtmlList *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlList)}\n"); m_t << "\\par" << endl << "}" << endl; - decIndentLevel(); + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPre(DocHtmlListItem *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlListItem)}\n"); m_t << "\\par" << endl; m_t << rtf_Style_Reset; if (rtf_listItemInfo[m_indentLevel].isEnum) @@ -670,92 +751,101 @@ void RTFDocVisitor::visitPre(DocHtmlListItem *) { m_t << getStyle("ListBullet") << endl; } + incIndentLevel(); + m_lastIsPara=FALSE; } void RTFDocVisitor::visitPost(DocHtmlListItem *) { + decIndentLevel(); + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlListItem)}\n"); } -//void RTFDocVisitor::visitPre(DocHtmlPre *) -//{ -// m_t << "{" << endl; -// m_t << "\\par" << endl; -// m_t << rtf_Style_Reset << getStyle("CodeExample"); -// m_insidePre=TRUE; -//} - -//void RTFDocVisitor::visitPost(DocHtmlPre *) -//{ -// m_insidePre=FALSE; -// m_t << "\\par" << endl; -// m_t << "}" << endl; -//} - void RTFDocVisitor::visitPre(DocHtmlDescList *) { if (m_hide) return; - m_t << "{" << endl; - m_t << rtf_Style_Reset << getStyle("ListContinue"); + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlDescList)}\n"); + //m_t << "{" << endl; + //m_t << rtf_Style_Reset << getStyle("ListContinue"); + //m_lastIsPara=FALSE; } void RTFDocVisitor::visitPost(DocHtmlDescList *) { if (m_hide) return; - m_t << "}" << endl; - m_t << "\\par" << endl; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlDescList)}\n"); + //m_t << "}" << endl; + //m_t << "\\par" << endl; + //m_lastIsPara=TRUE; } void RTFDocVisitor::visitPre(DocHtmlDescTitle *) { if (m_hide) return; - m_t << "\\par" << endl; - m_t << "{\\b "; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlDescTitle)}\n"); + //m_t << "\\par" << endl; + //m_t << "{\\b "; + m_t << "{" << rtf_Style["Heading5"]->reference << endl; + m_lastIsPara=FALSE; } void RTFDocVisitor::visitPost(DocHtmlDescTitle *) { if (m_hide) return; - m_t << "}" << endl; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlDescTitle)}\n"); m_t << "\\par" << endl; + m_t << "}" << endl; + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPre(DocHtmlDescData *) { + if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlDescData)}\n"); + incIndentLevel(); + m_t << "{" << rtf_Style_Reset << getStyle("DescContinue"); } void RTFDocVisitor::visitPost(DocHtmlDescData *) { + if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlDescData)}\n"); + m_t << "\\par" << endl; + m_t << "}" << endl; + decIndentLevel(); + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPre(DocHtmlTable *) { if (m_hide) return; - m_t << "\\par" << endl; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlTable)}\n"); + if (!m_lastIsPara) m_t << "\\par" << endl; + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPost(DocHtmlTable *) { if (m_hide) return; - //if (!t->hasCaption()) - //{ - // m_t << endl; - // m_t << "\\pard \\widctlpar\\intbl\\adjustright" << endl; - // m_t << "{\\row }" << endl; - //} + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlTable)}\n"); m_t << "\\pard" << endl; + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPre(DocHtmlCaption *) { + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlCaption)}\n"); } void RTFDocVisitor::visitPost(DocHtmlCaption *) { + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlCaption)}\n"); } void RTFDocVisitor::visitPre(DocHtmlRow *r) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlRow)}\n"); uint i,columnWidth=rtf_pageWidth/r->numCells(); m_t << "\\trowd \\trgaph108\\trleft-108" "\\trbrdrt\\brdrs\\brdrw10 " @@ -774,31 +864,39 @@ void RTFDocVisitor::visitPre(DocHtmlRow *r) "\\cellx" << ((i+1)*columnWidth) << endl; } m_t << "\\pard \\widctlpar\\intbl\\adjustright" << endl; + m_lastIsPara=FALSE; } void RTFDocVisitor::visitPost(DocHtmlRow *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlRow)}\n"); m_t << endl; m_t << "\\pard \\widctlpar\\intbl\\adjustright" << endl; m_t << "{\\row }" << endl; + m_lastIsPara=FALSE; } void RTFDocVisitor::visitPre(DocHtmlCell *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlCell)}\n"); m_t << "{"; + m_lastIsPara=FALSE; } void RTFDocVisitor::visitPost(DocHtmlCell *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlCell)}\n"); m_t << "\\cell }"; + m_lastIsPara=FALSE; } void RTFDocVisitor::visitPre(DocInternal *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocInternal)}\n"); m_t << "{"; // start desc m_t << "{\\b "; // start bold m_t << theTranslator->trForInternalUseOnly(); @@ -806,19 +904,23 @@ void RTFDocVisitor::visitPre(DocInternal *) m_t << "\\par" << endl; incIndentLevel(); m_t << rtf_Style_Reset << getStyle("DescContinue"); + m_lastIsPara=FALSE; } void RTFDocVisitor::visitPost(DocInternal *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocInternal)}\n"); m_t << "\\par" << endl; decIndentLevel(); m_t << "}"; // end desc + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPre(DocHRef *href) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHRef)}\n"); if (Config_getBool("RTF_HYPERLINKS")) { m_t << "{\\field " @@ -834,11 +936,13 @@ void RTFDocVisitor::visitPre(DocHRef *href) { m_t << "{\\f2 "; } + m_lastIsPara=FALSE; } void RTFDocVisitor::visitPost(DocHRef *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHRef)}\n"); if (Config_getBool("RTF_HYPERLINKS")) { m_t << "}" @@ -849,11 +953,13 @@ void RTFDocVisitor::visitPost(DocHRef *) { m_t << "}"; } + m_lastIsPara=FALSE; } void RTFDocVisitor::visitPre(DocHtmlHeader *header) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlHeader)}\n"); m_t << "{" // start section << rtf_Style_Reset; QString heading; @@ -863,18 +969,22 @@ void RTFDocVisitor::visitPre(DocHtmlHeader *header) m_t << rtf_Style[heading]->reference; // make table of contents entry m_t << "{\\tc\\tcl \\v " << level << "}"; + m_lastIsPara=FALSE; } void RTFDocVisitor::visitPost(DocHtmlHeader *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlHeader)}\n"); m_t << "\\par" << endl; m_t << "}" << endl; // end section + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPre(DocImage *img) { + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocImage)}\n"); if (img->type()==DocImage::Rtf) { m_t << "\\par" << endl; @@ -884,7 +994,7 @@ void RTFDocVisitor::visitPre(DocImage *img) m_t << img->name(); m_t << " \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl; m_t << "}" << endl; - + m_lastIsPara=TRUE; } else // other format -> skip { @@ -896,11 +1006,13 @@ void RTFDocVisitor::visitPre(DocImage *img) void RTFDocVisitor::visitPost(DocImage *) { + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocImage)}\n"); popEnabled(); } void RTFDocVisitor::visitPre(DocDotFile *df) { + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocDotFile)}\n"); writeDotFile(df->file()); // hide caption since it is not supported at the moment @@ -910,24 +1022,28 @@ void RTFDocVisitor::visitPre(DocDotFile *df) void RTFDocVisitor::visitPost(DocDotFile *) { + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocDotFile)}\n"); popEnabled(); } void RTFDocVisitor::visitPre(DocLink *lnk) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocLink)}\n"); startLink(lnk->ref(),lnk->file(),lnk->anchor()); } void RTFDocVisitor::visitPost(DocLink *lnk) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocLink)}\n"); endLink(lnk->ref()); } void RTFDocVisitor::visitPre(DocRef *ref) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocRef)}\n"); if (!ref->file().isEmpty()) startLink(ref->ref(),ref->file(),ref->anchor()); if (!ref->hasLinkText()) filter(ref->targetTitle()); } @@ -935,6 +1051,7 @@ void RTFDocVisitor::visitPre(DocRef *ref) void RTFDocVisitor::visitPost(DocRef *ref) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocRef)}\n"); if (!ref->file().isEmpty()) endLink(ref->ref()); m_t << " "; } @@ -942,31 +1059,38 @@ void RTFDocVisitor::visitPost(DocRef *ref) void RTFDocVisitor::visitPre(DocSecRefItem *) { + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSecRefItem)}\n"); } void RTFDocVisitor::visitPost(DocSecRefItem *) { + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSecRefItem)}\n"); } void RTFDocVisitor::visitPre(DocSecRefList *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSecRefList)}\n"); m_t << "{" << endl; incIndentLevel(); m_t << rtf_Style_Reset << getStyle("LatexTOC") << endl; m_t << "\\par" << endl; + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPost(DocSecRefList *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSecRefList)}\n"); decIndentLevel(); m_t << "\\par" << endl; m_t << "}"; + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPre(DocLanguage *l) { + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocLanguage)}\n"); QString langId = Config_getEnum("OUTPUT_LANGUAGE"); if (l->id().lower()!=langId.lower()) { @@ -977,6 +1101,7 @@ void RTFDocVisitor::visitPre(DocLanguage *l) void RTFDocVisitor::visitPost(DocLanguage *l) { + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocLanguage)}\n"); QString langId = Config_getEnum("OUTPUT_LANGUAGE"); if (l->id().lower()!=langId.lower()) { @@ -987,9 +1112,11 @@ void RTFDocVisitor::visitPost(DocLanguage *l) void RTFDocVisitor::visitPre(DocParamSect *s) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocParamSect)}\n"); m_t << "{"; // start param list - m_t << "\\par" << endl; - m_t << "{\\b "; // start bold + if (!m_lastIsPara) m_t << "\\par" << endl; + //m_t << "{\\b "; // start bold + m_t << "{" << rtf_Style["Heading5"]->reference << endl; switch(s->type()) { case DocParamSect::Param: @@ -1001,15 +1128,18 @@ void RTFDocVisitor::visitPre(DocParamSect *s) default: ASSERT(0); } - m_t << ":}" << endl; + m_t << ":"; m_t << "\\par" << endl; + m_t << "}" << endl; incIndentLevel(); m_t << rtf_Style_Reset << getStyle("DescContinue"); + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPost(DocParamSect *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocParamSect)}\n"); //m_t << "\\par" << endl; decIndentLevel(); m_t << "}" << endl; @@ -1018,6 +1148,7 @@ void RTFDocVisitor::visitPost(DocParamSect *) void RTFDocVisitor::visitPre(DocParamList *pl) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocParamList)}\n"); m_t << "{\\i "; QStrListIterator li(pl->parameters()); const char *s; @@ -1028,20 +1159,24 @@ void RTFDocVisitor::visitPre(DocParamList *pl) filter(s); } m_t << "} "; + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPost(DocParamList *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocParamList)}\n"); m_t << "\\par" << endl; + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPre(DocXRefItem *x) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocXRefItem)}\n"); m_t << "{"; // start param list - m_t << "{\\b "; // start bold - m_t << "\\par" << endl; + //m_t << "{\\b "; // start bold + m_t << "{" << rtf_Style["Heading5"]->reference << endl; if (Config_getBool("RTF_HYPERLINKS")) { QString refName; @@ -1074,47 +1209,57 @@ void RTFDocVisitor::visitPre(DocXRefItem *x) { filter(x->title()); } - m_t << ":}"; // end bold + m_t << ":"; m_t << "\\par" << endl; + m_t << "}"; // end bold incIndentLevel(); m_t << rtf_Style_Reset << getStyle("DescContinue"); + m_lastIsPara=FALSE; } void RTFDocVisitor::visitPost(DocXRefItem *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocXRefItem)}\n"); m_t << "\\par" << endl; decIndentLevel(); m_t << "}" << endl; // end xref item + m_lastIsPara=TRUE; } void RTFDocVisitor::visitPre(DocInternalRef *ref) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocInternalRef)}\n"); startLink("",ref->file(),ref->anchor()); } void RTFDocVisitor::visitPost(DocInternalRef *) { if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocInternalRef)}\n"); endLink(""); m_t << " "; } void RTFDocVisitor::visitPre(DocCopy *) { + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocCopy)}\n"); } void RTFDocVisitor::visitPost(DocCopy *) { + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocCopy)}\n"); } void RTFDocVisitor::visitPre(DocText *) { + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocText)}\n"); } void RTFDocVisitor::visitPost(DocText *) { + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocText)}\n"); } static char* getMultiByte(int c) @@ -1194,6 +1339,7 @@ void RTFDocVisitor::startLink(const QString &ref,const QString &file,const QStri { m_t << "{\\b "; } + m_lastIsPara=FALSE; } void RTFDocVisitor::endLink(const QString &ref) @@ -1206,6 +1352,7 @@ void RTFDocVisitor::endLink(const QString &ref) { m_t << "}"; } + m_lastIsPara=FALSE; } void RTFDocVisitor::pushEnabled() @@ -1231,13 +1378,14 @@ void RTFDocVisitor::writeDotFile(const QString &fileName) } QString outDir = Config_getString("RTF_OUTPUT"); writeDotGraphFromFile(fileName,outDir,baseName,BITMAP); - m_t << "\\par" << endl; + if (!m_lastIsPara) m_t << "\\par" << endl; m_t << "{" << endl; - m_t << rtf_Style_Reset << endl; - m_t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE "; + m_t << rtf_Style_Reset; + m_t << "\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE "; m_t << baseName << "." << Config_getEnum("DOT_IMAGE_FORMAT"); m_t << " \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl; m_t << "}" << endl; + m_lastIsPara=TRUE; } |