diff options
Diffstat (limited to 'src/rtfgen.cpp')
-rw-r--r-- | src/rtfgen.cpp | 261 |
1 files changed, 146 insertions, 115 deletions
diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 79411c6..ecf2d32 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * - * + * * * Copyright (C) 1997-2015 by Parker Waechter & Dimitri van Heesch. * @@ -61,7 +61,7 @@ static QCString dateToRTFDateString() d.date().year(), d.date().month(), d.date().day(), d.time().hour(),d.time().minute(),d.time().second()); return result; -} +} RTFGenerator::RTFGenerator() : OutputGenerator() { @@ -79,10 +79,20 @@ RTFGenerator::~RTFGenerator() { } +void RTFGenerator::setRelativePath(const QCString &path) +{ + m_relPath = path; +} + +void RTFGenerator::setSourceFileName(const QCString &name) +{ + m_sourceFileName = name; +} + void RTFGenerator::writeStyleSheetFile(QFile &file) { FTextStream t(&file); - t << "# Generated by doxygen " << getVersion() << "\n\n"; + t << "# Generated by doxygen " << getDoxygenVersion() << "\n\n"; t << "# This file describes styles used for generating RTF output.\n"; t << "# All text after a hash (#) is considered a comment and will be ignored.\n"; t << "# Remove a hash to activate a line.\n\n"; @@ -99,7 +109,7 @@ void RTFGenerator::writeStyleSheetFile(QFile &file) void RTFGenerator::writeExtensionsFile(QFile &file) { FTextStream t(&file); - t << "# Generated by doxygen " << getVersion() << "\n\n"; + t << "# Generated by doxygen " << getDoxygenVersion() << "\n\n"; t << "# This file describes extensions used for generating RTF output.\n"; t << "# All text after a hash (#) is considered a comment and will be ignored.\n"; t << "# Remove a hash to activate a line.\n\n"; @@ -164,9 +174,14 @@ void RTFGenerator::init() while(def->reference != 0) { if (def->definition == 0) + { err("Internal: rtf_Style_Default[%s] has no definition.\n", def->name); - StyleData* styleData = new StyleData(def->reference, def->definition); - rtf_Style.insert(def->name, styleData); + } + else + { + StyleData* styleData = new StyleData(def->reference, def->definition); + rtf_Style.insert(def->name, styleData); + } def++; } @@ -273,21 +288,20 @@ void RTFGenerator::beginRTFDocument() // sort styles ascending by \s-number via an intermediate QArray QDictIterator<StyleData> iter(rtf_Style); - const StyleData* style; + const StyleData* style = 0; unsigned maxIndex = 0; for(; (style = iter.current()); ++iter) { - unsigned index = style->index; + uint index = style->index(); if (maxIndex < index) maxIndex = index; } - QArray<const StyleData*> array(maxIndex + 1); - array.fill(0); + std::vector<const StyleData*> array(maxIndex + 1, 0); ASSERT(maxIndex < array.size()); iter.toFirst(); for(; (style = iter.current()); ++iter) { - unsigned index = style->index; + uint index = style->index(); if (array.at(index) != 0) { QCString key(iter.currentKey()); @@ -297,12 +311,14 @@ void RTFGenerator::beginRTFDocument() } // write array elements - unsigned size = array.size(); - for(unsigned i = 0; i < size; i++) + size_t size = array.size(); + for(size_t i = 0; i < size; i++) { - const StyleData* style = array.at(i); + style = array.at(i); if (style != 0) - t <<"{" << style->reference << style->definition << ";}\n"; + { + t <<"{" << style->reference() << style->definition() << ";}\n"; + } } t <<"}" << endl; @@ -328,7 +344,7 @@ void RTFGenerator::beginRTFChapter() t <<"\\sect\\sbkpage\n"; //t <<"\\sect\\sectd\\sbkpage\n"; - t << rtf_Style["Heading1"]->reference << "\n"; + t << rtf_Style["Heading1"]->reference() << "\n"; } void RTFGenerator::beginRTFSection() @@ -340,15 +356,15 @@ void RTFGenerator::beginRTFSection() // if we are compact, no extra page breaks... if (Config_getBool(COMPACT_RTF)) { - // t <<"\\sect\\sectd\\sbknone\n"; t <<"\\sect\\sbknone\n"; rtfwriteRuler_emboss(); } else + { t <<"\\sect\\sbkpage\n"; - //t <<"\\sect\\sectd\\sbkpage\n"; + } - t << rtf_Style["Heading2"]->reference << "\n"; + t << rtf_Style["Heading2"]->reference() << "\n"; } void RTFGenerator::startFile(const char *name,const char *,const char *) @@ -359,6 +375,8 @@ void RTFGenerator::startFile(const char *name,const char *,const char *) if (fileName.right(4)!=".rtf" ) fileName+=".rtf"; startPlainFile(fileName); + setRelativePath(m_relPath); + setSourceFileName(stripPath(fileName)); beginRTFDocument(); } @@ -368,6 +386,7 @@ void RTFGenerator::endFile() t << "}"; endPlainFile(); + setSourceFileName(""); } void RTFGenerator::startProjectNumber() @@ -500,7 +519,7 @@ void RTFGenerator::startIndexSection(IndexSections is) bool found=FALSE; for (cli.toFirst();(cd=cli.current()) && !found;++cli) { - if (cd->isLinkableInProject() && + if (cd->isLinkableInProject() && cd->templateMaster()==0 && !cd->isEmbeddedInOuterScope() ) @@ -515,13 +534,9 @@ void RTFGenerator::startIndexSection(IndexSections is) { //File Documentation bool isFirst=TRUE; - FileNameListIterator fnli(*Doxygen::inputNameList); - FileName *fn; - for (fnli.toFirst();(fn=fnli.current());++fnli) + for (const auto &fn : *Doxygen::inputNameLinkedMap) { - FileNameIterator fni(*fn); - FileDef *fd; - for (;(fd=fni.current());++fni) + for (const auto &fd : *fn) { if (fd->isLinkableInProject()) { @@ -561,7 +576,7 @@ void RTFGenerator::startIndexSection(IndexSections is) void RTFGenerator::endIndexSection(IndexSections is) { bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); - bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); + bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); static bool sourceBrowser = Config_getBool(SOURCE_BROWSER); static QCString projectName = Config_getString(PROJECT_NAME); @@ -576,18 +591,18 @@ void RTFGenerator::endIndexSection(IndexSections is) break; case isTitlePageAuthor: { - t << " doxygen.}\n"; + t << " doxygen" << getDoxygenVersion() << ".}\n"; t << "{\\creatim " << dateToRTFDateString() << "}\n}"; DBG_RTF(t << "{\\comment end of infoblock}\n"); // setup for this section t << rtf_Style_Reset <<"\n"; t <<"\\sectd\\pgnlcrm\n"; - t <<"{\\footer "<<rtf_Style["Footer"]->reference << "{\\chpgn}}\n"; + t <<"{\\footer "<<rtf_Style["Footer"]->reference() << "{\\chpgn}}\n"; // the title entry DBG_RTF(t << "{\\comment begin title page}\n") - t << rtf_Style_Reset << rtf_Style["SubTitle"]->reference << endl; // set to title style + t << rtf_Style_Reset << rtf_Style["SubTitle"]->reference() << endl; // set to title style t << "\\vertalc\\qc\\par\\par\\par\\par\\par\\par\\par\n"; if (rtf_logoFilename) @@ -600,7 +615,7 @@ void RTFGenerator::endIndexSection(IndexSections is) t << rtf_company << "\\par\\par\n"; } - t << rtf_Style_Reset << rtf_Style["Title"]->reference << endl; // set to title style + t << rtf_Style_Reset << rtf_Style["Title"]->reference() << endl; // set to title style if (rtf_title) // User has overridden document title in extensions file t << "{\\field\\fldedit {\\*\\fldinst TITLE \\\\*MERGEFORMAT}{\\fldrslt " << rtf_title << "}}\\par" << endl; @@ -610,10 +625,10 @@ void RTFGenerator::endIndexSection(IndexSections is) t << "{\\field\\fldedit {\\*\\fldinst TITLE \\\\*MERGEFORMAT}{\\fldrslt "; writeDoc(root,0,0); t << "}}\\par" << endl; - + } - t << rtf_Style_Reset << rtf_Style["SubTitle"]->reference << endl; // set to title style + t << rtf_Style_Reset << rtf_Style["SubTitle"]->reference() << endl; // set to title style t << "\\par\n"; if (rtf_documentType) { @@ -625,7 +640,7 @@ void RTFGenerator::endIndexSection(IndexSections is) } t << "\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\n"; - t << rtf_Style_Reset << rtf_Style["SubTitle"]->reference << endl; // set to subtitle style + t << rtf_Style_Reset << rtf_Style["SubTitle"]->reference() << endl; // set to subtitle style if (rtf_author) t << "{\\field\\fldedit {\\*\\fldinst AUTHOR \\\\*MERGEFORMAT}{\\fldrslt "<< rtf_author << " }}\\par" << endl; else @@ -641,7 +656,7 @@ void RTFGenerator::endIndexSection(IndexSections is) DBG_RTF(t << "{\\comment Table of contents}\n") t << "\\vertalt\n"; t << rtf_Style_Reset << endl; - t << rtf_Style["Heading1"]->reference; + t << rtf_Style["Heading1"]->reference(); t << theTranslator->trRTFTableOfContents() << "\\par"<< endl; t << rtf_Style_Reset << "\\par" << endl; t << "{\\field\\fldedit {\\*\\fldinst TOC \\\\f \\\\*MERGEFORMAT}{\\fldrslt Table of contents}}\\par\n"; @@ -688,7 +703,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { t << "{\\tc \\v " << theTranslator->trNamespaceIndex() << "}" << endl; } - + t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"namespaces.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isClassHierarchyIndex: @@ -801,7 +816,7 @@ void RTFGenerator::endIndexSection(IndexSections is) } for (cli.toFirst();(cd=cli.current()) && !found;++cli) { - if (cd->isLinkableInProject() && + if (cd->isLinkableInProject() && cd->templateMaster()==0 && !cd->isEmbeddedInOuterScope() ) @@ -815,7 +830,7 @@ void RTFGenerator::endIndexSection(IndexSections is) } for (;(cd=cli.current());++cli) { - if (cd->isLinkableInProject() && + if (cd->isLinkableInProject() && cd->templateMaster()==0 && !cd->isEmbeddedInOuterScope() ) @@ -834,13 +849,9 @@ void RTFGenerator::endIndexSection(IndexSections is) bool isFirst=TRUE; t << "{\\tc \\v " << theTranslator->trFileDocumentation() << "}"<< endl; - FileNameListIterator fnli(*Doxygen::inputNameList); - FileName *fn; - for (fnli.toFirst();(fn=fnli.current());++fnli) + for (const auto &fn : *Doxygen::inputNameLinkedMap) { - FileNameIterator fni(*fn); - FileDef *fd; - for (;(fd=fni.current());++fni) + for (const auto &fd : *fn) { if (fd->isLinkableInProject()) { @@ -927,7 +938,7 @@ void RTFGenerator::endIndexSection(IndexSections is) break; case isEndIndex: beginRTFChapter(); - t << rtf_Style["Heading1"]->reference; + t << rtf_Style["Heading1"]->reference(); t << theTranslator->trRTFGeneralIndex() << "\\par "<< endl; t << rtf_Style_Reset << endl; t << "{\\tc \\v " << theTranslator->trRTFGeneralIndex() << "}" << endl; @@ -953,8 +964,7 @@ void RTFGenerator::lastIndexPage() t <<"\\sect \\sectd \\sbknone\n"; // set new footer with arabic numbers - t <<"{\\footer "<< rtf_Style["Footer"]->reference << "{\\chpgn}}\n"; - //t << rtf_Style["Heading1"]->reference << "\n"; + t <<"{\\footer "<< rtf_Style["Footer"]->reference() << "{\\chpgn}}\n"; } @@ -1212,7 +1222,7 @@ void RTFGenerator::startSubsection() t <<"\n"; DBG_RTF(t << "{\\comment Begin SubSection}\n") t << rtf_Style_Reset; - t << rtf_Style["Heading3"]->reference << "\n"; + t << rtf_Style["Heading3"]->reference() << "\n"; } void RTFGenerator::endSubsection() @@ -1227,7 +1237,7 @@ void RTFGenerator::startSubsubsection() t << "\n"; DBG_RTF(t << "{\\comment Begin SubSubSection}\n") t << "{" << endl; - t << rtf_Style_Reset << rtf_Style["Heading4"]->reference << "\n"; + t << rtf_Style_Reset << rtf_Style["Heading4"]->reference() << "\n"; } void RTFGenerator::endSubsubsection() @@ -1245,22 +1255,22 @@ void RTFGenerator::endSubsubsection() // t << "}"; //} -//void RTFGenerator::startTable(bool,int colNumbers) +//void RTFGenerator::startTable(bool,int colNumbers) //{ // DBG_RTF(t << "{\\comment startTable}\n";) // m_numCols=colNumbers; // t << "\\par\n"; //} // -//void RTFGenerator::endTable(bool hasCaption) -//{ +//void RTFGenerator::endTable(bool hasCaption) +//{ // DBG_RTF(t << "{\\comment endTable}\n";) -// if (!hasCaption) -// t << "\n\\pard \\widctlpar\\intbl\\adjustright\n{\\row }\n"; -// t << "\\pard\n" << endl; +// if (!hasCaption) +// t << "\n\\pard \\widctlpar\\intbl\\adjustright\n{\\row }\n"; +// t << "\\pard\n" << endl; //} // -//void RTFGenerator::startCaption() +//void RTFGenerator::startCaption() //{ // DBG_RTF(t << "{\\comment startCaption}\n";) // endTableRow(); @@ -1269,15 +1279,15 @@ void RTFGenerator::endSubsubsection() // nextTableColumn(); //} // -//void RTFGenerator::endCaption() +//void RTFGenerator::endCaption() //{ // DBG_RTF(t << "{\\comment endCaption}\n";) // endTableColumn(); // endTableRow(); //} // -//void RTFGenerator::nextTableRow() -//{ +//void RTFGenerator::nextTableRow() +//{ // DBG_RTF(t << "{\\comment nextTableRow}\n";) // ASSERT(m_numCols>0 && m_numCols<25); // uint columnWidth=rtf_pageWidth/m_numCols; @@ -1285,7 +1295,7 @@ void RTFGenerator::endSubsubsection() // "\\trbrdrl\\brdrs\\brdrw10 \\trbrdrb\\brdrs\\brdrw10 " // "\\trbrdrr\\brdrs\\brdrw10 \\trbrdrh\\brdrs\\brdrw10 " // "\\trbrdrv\\brdrs\\brdrw10 "<<endl; -// for (int i=0;i<m_numCols;i++) +// for (int i=0;i<m_numCols;i++) // { // t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10 \\clbrdrl\\brdrs\\brdrw10 " // "\\clbrdrb\\brdrs\\brdrw10 \\clbrdrr \\brdrs\\brdrw10 \\cltxlrtb " @@ -1293,21 +1303,21 @@ void RTFGenerator::endSubsubsection() // } // t << "\\pard \\widctlpar\\intbl\\adjustright\n{"; //} -// -//void RTFGenerator::endTableRow() -//{ +// +//void RTFGenerator::endTableRow() +//{ // DBG_RTF(t << "{\\comment endTableRow}\n";) // t << "\n\\pard \\widctlpar\\intbl\\adjustright\n{\\row }\n"; //} -// -//void RTFGenerator::nextTableColumn() +// +//void RTFGenerator::nextTableColumn() //{ // DBG_RTF(t << "{\\comment nextTableColumn}\n";) // t << "{ "; //} // -//void RTFGenerator::endTableColumn() -//{ +//void RTFGenerator::endTableColumn() +//{ // DBG_RTF(t << "{\\comment endTableColumn}\n";) // t << " \\cell }"; //} @@ -1435,7 +1445,7 @@ void RTFGenerator::startTitleHead(const char *) DBG_RTF(t <<"{\\comment startTitleHead}" << endl) // beginRTFSection(); - t << rtf_Style_Reset << rtf_Style["Heading2"]->reference << endl; + t << rtf_Style_Reset << rtf_Style["Heading2"]->reference() << endl; } void RTFGenerator::endTitleHead(const char *fileName,const char *name) @@ -1480,15 +1490,15 @@ void RTFGenerator::startGroupHeader(int extraIndent) t << rtf_Style_Reset; if (extraIndent==2) { - t << rtf_Style["Heading5"]->reference; + t << rtf_Style["Heading5"]->reference(); } else if (extraIndent==1) { - t << rtf_Style["Heading4"]->reference; + t << rtf_Style["Heading4"]->reference(); } else // extraIndent==0 { - t << rtf_Style["Heading3"]->reference; + t << rtf_Style["Heading3"]->reference(); } t << endl; } @@ -1514,10 +1524,10 @@ void RTFGenerator::startMemberDoc(const char *clname, addIndexItem(memname,clname); addIndexItem(clname,memname); } - t << rtf_Style_Reset << rtf_Style[showInline ? "Heading5" : "Heading4"]->reference; + t << rtf_Style_Reset << rtf_Style[showInline ? "Heading5" : "Heading4"]->reference(); //styleStack.push(rtf_Style_Heading4); t << "{" << endl; - //printf("RTFGenerator::startMemberDoc() '%s'\n",rtf_Style["Heading4"]->reference); + //printf("RTFGenerator::startMemberDoc() '%s'\n",rtf_Style["Heading4"]->reference()); startBold(); t << endl; } @@ -1527,7 +1537,7 @@ void RTFGenerator::endMemberDoc(bool) DBG_RTF(t << "{\\comment endMemberDoc}" << endl) //const char *style = styleStack.pop(); //printf("RTFGenerator::endMemberDoc() '%s'\n",style); - //ASSERT(style==rtf_Style["Heading4"]->reference); + //ASSERT(style==rtf_Style["Heading4"]->reference()); endBold(); t << "}" << endl; newParagraph(); @@ -1686,7 +1696,7 @@ void RTFGenerator::endDescForItem() //} -void RTFGenerator::startSection(const char *,const char *title,SectionInfo::SectionType type) +void RTFGenerator::startSection(const char *,const char *title,SectionType type) { DBG_RTF(t << "{\\comment (startSection)}" << endl) t << "{"; @@ -1694,24 +1704,24 @@ void RTFGenerator::startSection(const char *,const char *title,SectionInfo::Sect int num=4; switch(type) { - case SectionInfo::Page: num=2; break; - case SectionInfo::Section: num=3; break; - case SectionInfo::Subsection: num=4; break; - case SectionInfo::Subsubsection: num=4; break; - case SectionInfo::Paragraph: num=4; break; + case SectionType::Page: num=2; break; + case SectionType::Section: num=3; break; + case SectionType::Subsection: num=4; break; + case SectionType::Subsubsection: num=4; break; + case SectionType::Paragraph: num=4; break; default: ASSERT(0); break; } QCString heading; heading.sprintf("Heading%d",num); // set style - t << rtf_Style[heading]->reference; + t << rtf_Style[heading]->reference(); // make table of contents entry t << "{\\tc\\tcl" << num << " \\v "; docify(title); t << "}" << endl; } -void RTFGenerator::endSection(const char *lab,SectionInfo::SectionType) +void RTFGenerator::endSection(const char *lab,SectionType) { DBG_RTF(t << "{\\comment (endSection)}" << endl) // make bookmark @@ -2012,7 +2022,7 @@ void RTFGenerator::startDescTable(const char *title) { DBG_RTF(t << "{\\comment (startDescTable) }" << endl) t << "{\\par" << endl; - t << "{" << rtf_Style["Heading5"]->reference << endl; + t << "{" << rtf_Style["Heading5"]->reference() << endl; docify(title); t << ":\\par}" << endl; t << rtf_Style_Reset << rtf_DList_DepthStyle(); @@ -2100,40 +2110,40 @@ void RTFGenerator::decrementIndentLevel() const char * RTFGenerator::rtf_CList_DepthStyle() { QCString n=makeIndexName("ListContinue",m_listLevel); - return rtf_Style[n]->reference; + return rtf_Style[n]->reference(); } // a style for list formatted as a "latext style" table of contents const char * RTFGenerator::rtf_LCList_DepthStyle() { QCString n=makeIndexName("LatexTOC",m_listLevel); - return rtf_Style[n]->reference; + return rtf_Style[n]->reference(); } // a style for list formatted as a "bullet" style const char * RTFGenerator::rtf_BList_DepthStyle() { QCString n=makeIndexName("ListBullet",m_listLevel); - return rtf_Style[n]->reference; + return rtf_Style[n]->reference(); } // a style for list formatted as a "enumeration" style const char * RTFGenerator::rtf_EList_DepthStyle() { QCString n=makeIndexName("ListEnum",m_listLevel); - return rtf_Style[n]->reference; + return rtf_Style[n]->reference(); } const char * RTFGenerator::rtf_DList_DepthStyle() { QCString n=makeIndexName("DescContinue",m_listLevel); - return rtf_Style[n]->reference; + return rtf_Style[n]->reference(); } const char * RTFGenerator::rtf_Code_DepthStyle() { QCString n=makeIndexName("CodeExample",m_listLevel); - return rtf_Style[n]->reference; + return rtf_Style[n]->reference(); } void RTFGenerator::startTextBlock(bool dense) @@ -2143,11 +2153,11 @@ void RTFGenerator::startTextBlock(bool dense) t << rtf_Style_Reset; if (dense) // no spacing between "paragraphs" { - t << rtf_Style["DenseText"]->reference; + t << rtf_Style["DenseText"]->reference(); } else // some spacing { - t << rtf_Style["BodyText"]->reference; + t << rtf_Style["BodyText"]->reference(); } } @@ -2463,7 +2473,7 @@ static bool preProcessFile(QDir &d,QCString &infName, FTextStream &t, bool bIncl { // null terminate at the last '}' //char *str = strrchr(buffer,'}'); - int pos = lineBuf.findRev('}'); + pos = lineBuf.findRev('}'); if (pos != -1) lineBuf.at(pos) = '\0'; @@ -2681,7 +2691,7 @@ void RTFGenerator::startMemberGroupHeader(bool hasHeader) DBG_RTF(t << "{\\comment startMemberGroupHeader}" << endl) t << "{" << endl; if (hasHeader) incrementIndentLevel(); - t << rtf_Style_Reset << rtf_Style["GroupHeader"]->reference; + t << rtf_Style_Reset << rtf_Style["GroupHeader"]->reference(); } void RTFGenerator::endMemberGroupHeader() @@ -2795,32 +2805,32 @@ void RTFGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *) { RTFDocVisitor *visitor = new RTFDocVisitor(t,*this,ctx?ctx->getDefFileExtension():QCString("")); n->accept(visitor); - delete visitor; + delete visitor; m_omitParagraph = TRUE; } -void RTFGenerator::rtfwriteRuler_doubleline() -{ +void RTFGenerator::rtfwriteRuler_doubleline() +{ DBG_RTF(t << "{\\comment (rtfwriteRuler_doubleline)}" << endl) - t << "{\\pard\\widctlpar\\brdrb\\brdrdb\\brdrw15\\brsp20 \\adjustright \\par}" << endl; + t << "{\\pard\\widctlpar\\brdrb\\brdrdb\\brdrw15\\brsp20 \\adjustright \\par}" << endl; } -void RTFGenerator::rtfwriteRuler_emboss() -{ +void RTFGenerator::rtfwriteRuler_emboss() +{ DBG_RTF(t << "{\\comment (rtfwriteRuler_emboss)}" << endl) - t << "{\\pard\\widctlpar\\brdrb\\brdremboss\\brdrw15\\brsp20 \\adjustright \\par}" << endl; + t << "{\\pard\\widctlpar\\brdrb\\brdremboss\\brdrw15\\brsp20 \\adjustright \\par}" << endl; } -void RTFGenerator::rtfwriteRuler_thick() -{ +void RTFGenerator::rtfwriteRuler_thick() +{ DBG_RTF(t << "{\\comment (rtfwriteRuler_thick)}" << endl) - t << "{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw75\\brsp20 \\adjustright \\par}" << endl; + t << "{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw75\\brsp20 \\adjustright \\par}" << endl; } -void RTFGenerator::rtfwriteRuler_thin() -{ +void RTFGenerator::rtfwriteRuler_thin() +{ DBG_RTF(t << "{\\comment (rtfwriteRuler_thin)}" << endl) - t << "{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw5\\brsp20 \\adjustright \\par}" << endl; + t << "{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw5\\brsp20 \\adjustright \\par}" << endl; } #if 0 @@ -2833,9 +2843,9 @@ void RTFGenerator::postProcess(QByteArray &a) for (i=0;i<a.size();i++) { unsigned char c = (unsigned char)a.at(i); - + // treat characters > 0x80 as multibyte characters, except when they - // are control characters + // are control characters if (c>0x80 || (mbFlag && c!='\\' && c!='{' && c!='}')) { char s[10]; @@ -2858,7 +2868,7 @@ void RTFGenerator::startConstraintList(const char *header) { DBG_RTF(t << "{\\comment (startConstraintList)}" << endl) t << "{"; // ends at endConstraintList - t << "{"; + t << "{"; startBold(); newParagraph(); docify(header); @@ -2926,15 +2936,15 @@ void RTFGenerator::endIndexListItem() t << "\\par" << endl; } -void RTFGenerator::startInlineHeader() +void RTFGenerator::startInlineHeader() { DBG_RTF(t << "{\\comment (startInlineHeader)}" << endl) t << "{" << endl; - t << rtf_Style_Reset << rtf_Style["Heading5"]->reference; + t << rtf_Style_Reset << rtf_Style["Heading5"]->reference(); startBold(); } -void RTFGenerator::endInlineHeader() +void RTFGenerator::endInlineHeader() { DBG_RTF(t << "{\\comment (endInlineHeader)}" << endl) endBold(); @@ -2946,7 +2956,7 @@ void RTFGenerator::startMemberDocSimple(bool isEnum) { DBG_RTF(t << "{\\comment (startMemberDocSimple)}" << endl) t << "{\\par" << endl; - t << "{" << rtf_Style["Heading5"]->reference << endl; + t << "{" << rtf_Style["Heading5"]->reference() << endl; if (isEnum) { t << theTranslator->trEnumerationValues(); @@ -3025,12 +3035,33 @@ void RTFGenerator::endInlineMemberDoc() t << "\\cell }{\\row }" << endl; } -void RTFGenerator::writeLineNumber(const char *,const char *,const char *,int l) +void RTFGenerator::writeLineNumber(const char *ref,const char *fileName,const char *anchor,int l) { + static bool rtfHyperlinks = Config_getBool(RTF_HYPERLINKS); + DoxyCodeLineOpen = TRUE; QCString lineNumber; lineNumber.sprintf("%05d",l); - t << lineNumber << " "; + if (m_prettyCode) + { + if (fileName && !m_sourceFileName.isEmpty() && rtfHyperlinks) + { + QCString lineAnchor; + lineAnchor.sprintf("_l%05d",l); + lineAnchor.prepend(stripExtensionGeneral(m_sourceFileName, ".rtf")); + t << "{\\bkmkstart "; + t << rtfFormatBmkStr(lineAnchor); + t << "}"; + t << "{\\bkmkend "; + t << rtfFormatBmkStr(lineAnchor); + t << "}" << endl; + } + t << lineNumber << " "; + } + else + { + t << l << " "; + } m_col=0; } void RTFGenerator::startCodeLine(bool) |