summaryrefslogtreecommitdiffstats
path: root/src/rtfgen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rtfgen.cpp')
-rw-r--r--src/rtfgen.cpp494
1 files changed, 241 insertions, 253 deletions
diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp
index 79411c6..94b6893 100644
--- a/src/rtfgen.cpp
+++ b/src/rtfgen.cpp
@@ -1,6 +1,6 @@
/******************************************************************************
*
- *
+ *
*
* Copyright (C) 1997-2015 by Parker Waechter & Dimitri van Heesch.
*
@@ -48,8 +48,6 @@
#include "filename.h"
#include "namespacedef.h"
-static bool DoxyCodeLineOpen = FALSE;
-
//#define DBG_RTF(x) x;
#define DBG_RTF(x)
@@ -61,28 +59,45 @@ 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()
+RTFGenerator::RTFGenerator() : OutputGenerator(Config_getString(RTF_OUTPUT))
{
- m_dir=Config_getString(RTF_OUTPUT);
- m_col=0;
- //insideTabbing=FALSE;
- m_listLevel = 0;
- m_bstartedBody = FALSE;
- m_omitParagraph = FALSE;
- m_numCols = 0;
- m_prettyCode=Config_getBool(RTF_SOURCE_CODE);
+}
+
+RTFGenerator::RTFGenerator(const RTFGenerator &og) : OutputGenerator(og)
+{
+}
+
+RTFGenerator &RTFGenerator::operator=(const RTFGenerator &og)
+{
+ OutputGenerator::operator=(og);
+ return *this;
+}
+
+std::unique_ptr<OutputGenerator> RTFGenerator::clone() const
+{
+ return std::make_unique<RTFGenerator>(*this);
}
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 +114,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,21 +179,26 @@ 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++;
}
// overwrite some (or all) definitions from file
- QCString &rtfStyleSheetFile = Config_getString(RTF_STYLESHEET_FILE);
+ QCString rtfStyleSheetFile = Config_getString(RTF_STYLESHEET_FILE);
if (!rtfStyleSheetFile.isEmpty())
{
loadStylesheet(rtfStyleSheetFile, rtf_Style);
}
// If user has defined an extension file, load its contents.
- QCString &rtfExtensionsFile = Config_getString(RTF_EXTENSIONS_FILE);
+ QCString rtfExtensionsFile = Config_getString(RTF_EXTENSIONS_FILE);
if (!rtfExtensionsFile.isEmpty())
{
loadExtensions(rtfExtensionsFile);
@@ -273,21 +293,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 +316,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 +349,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,18 +361,18 @@ 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 *)
+void RTFGenerator::startFile(const char *name,const char *,const char *,int)
{
//setEncoding(QCString().sprintf("CP%s",theTranslator->trRTFansicp()));
QCString fileName=name;
@@ -359,6 +380,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 +391,7 @@ void RTFGenerator::endFile()
t << "}";
endPlainFile();
+ setSourceFileName("");
}
void RTFGenerator::startProjectNumber()
@@ -447,15 +471,12 @@ void RTFGenerator::startIndexSection(IndexSections is)
case isModuleDocumentation:
{
//Module Documentation
- GroupSDict::Iterator gli(*Doxygen::groupSDict);
- GroupDef *gd;
- bool found=FALSE;
- for (gli.toFirst();(gd=gli.current()) && !found;++gli)
+ for (const auto &gd : *Doxygen::groupLinkedMap)
{
if (!gd->isReference())
{
beginRTFChapter();
- found=TRUE;
+ break;
}
}
}
@@ -463,15 +484,12 @@ void RTFGenerator::startIndexSection(IndexSections is)
case isDirDocumentation:
{
//Directory Documentation
- SDict<DirDef>::Iterator dli(*Doxygen::directories);
- DirDef *dd;
- bool found=FALSE;
- for (dli.toFirst();(dd=dli.current()) && !found;++dli)
+ for (const auto &dd : *Doxygen::dirLinkedMap)
{
if (dd->isLinkableInProject())
{
beginRTFChapter();
- found=TRUE;
+ break;
}
}
}
@@ -479,15 +497,12 @@ void RTFGenerator::startIndexSection(IndexSections is)
case isNamespaceDocumentation:
{
// Namespace Documentation
- NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict);
- NamespaceDef *nd;
- bool found=FALSE;
- for (nli.toFirst();(nd=nli.current()) && !found;++nli)
+ for (const auto &nd : *Doxygen::namespaceLinkedMap)
{
if (nd->isLinkableInProject())
{
beginRTFChapter();
- found=TRUE;
+ break;
}
}
}
@@ -495,18 +510,16 @@ void RTFGenerator::startIndexSection(IndexSections is)
case isClassDocumentation:
{
//Compound Documentation
- ClassSDict::Iterator cli(*Doxygen::classSDict);
- ClassDef *cd=0;
- bool found=FALSE;
- for (cli.toFirst();(cd=cli.current()) && !found;++cli)
+ for (const auto &cd : *Doxygen::classLinkedMap)
{
- if (cd->isLinkableInProject() &&
+ if (cd->isLinkableInProject() &&
cd->templateMaster()==0 &&
- !cd->isEmbeddedInOuterScope()
+ !cd->isEmbeddedInOuterScope() &&
+ !cd->isAlias()
)
{
beginRTFChapter();
- found=TRUE;
+ break;
}
}
}
@@ -515,13 +528,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())
{
@@ -533,6 +542,10 @@ void RTFGenerator::startIndexSection(IndexSections is)
}
}
}
+ if (!isFirst)
+ {
+ break;
+ }
}
}
break;
@@ -561,9 +574,9 @@ void RTFGenerator::startIndexSection(IndexSections is)
void RTFGenerator::endIndexSection(IndexSections is)
{
bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN);
- bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL);
- static bool sourceBrowser = Config_getBool(SOURCE_BROWSER);
- static QCString projectName = Config_getString(PROJECT_NAME);
+ bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL);
+ bool sourceBrowser = Config_getBool(SOURCE_BROWSER);
+ QCString projectName = Config_getString(PROJECT_NAME);
switch (is)
{
@@ -576,18 +589,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 +613,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;
@@ -608,12 +621,12 @@ void RTFGenerator::endIndexSection(IndexSections is)
{
DocText *root = validatingParseText(projectName);
t << "{\\field\\fldedit {\\*\\fldinst TITLE \\\\*MERGEFORMAT}{\\fldrslt ";
- writeDoc(root,0,0);
+ writeDoc(root,0,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 +638,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 +654,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 +701,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:
@@ -724,14 +737,18 @@ void RTFGenerator::endIndexSection(IndexSections is)
break;
case isModuleDocumentation:
{
- GroupSDict::Iterator gli(*Doxygen::groupSDict);
- GroupDef *gd;
+ bool first=true;
t << "{\\tc \\v " << theTranslator->trModuleDocumentation() << "}"<< endl;
- for (gli.toFirst();(gd=gli.current());++gli)
+ for (const auto &gd : *Doxygen::groupLinkedMap)
{
if (!gd->isReference())
{
t << "\\par " << rtf_Style_Reset << endl;
+ if (!first)
+ {
+ beginRTFSection();
+ }
+ first=false;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
t << gd->getOutputFileBase();
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
@@ -741,14 +758,18 @@ void RTFGenerator::endIndexSection(IndexSections is)
break;
case isDirDocumentation:
{
- SDict<DirDef>::Iterator dli(*Doxygen::directories);
- DirDef *dd;
+ bool first=true;
t << "{\\tc \\v " << theTranslator->trDirDocumentation() << "}"<< endl;
- for (dli.toFirst();(dd=dli.current());++dli)
+ for (const auto &dd : *Doxygen::dirLinkedMap)
{
if (dd->isLinkableInProject())
{
t << "\\par " << rtf_Style_Reset << endl;
+ if (!first)
+ {
+ beginRTFSection();
+ }
+ first=false;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
t << dd->getOutputFileBase();
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
@@ -758,39 +779,27 @@ void RTFGenerator::endIndexSection(IndexSections is)
break;
case isNamespaceDocumentation:
{
- NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict);
- NamespaceDef *nd;
- bool found=FALSE;
- for (nli.toFirst();(nd=nli.current()) && !found;++nli)
- {
- if (nd->isLinkableInProject())
- {
- t << "\\par " << rtf_Style_Reset << endl;
- t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
- t << nd->getOutputFileBase();
- t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
- found=TRUE;
- }
- }
- while ((nd=nli.current()))
+ bool first=true;
+ for (const auto &nd : *Doxygen::namespaceLinkedMap)
{
- if (nd->isLinkableInProject())
+ if (nd->isLinkableInProject() && !nd->isAlias())
{
t << "\\par " << rtf_Style_Reset << endl;
- beginRTFSection();
+ if (!first)
+ {
+ beginRTFSection();
+ }
+ first=false;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
t << nd->getOutputFileBase();
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
}
- ++nli;
}
}
break;
case isClassDocumentation:
{
- ClassSDict::Iterator cli(*Doxygen::classSDict);
- ClassDef *cd=0;
- bool found=FALSE;
+ bool first=true;
if (fortranOpt)
{
t << "{\\tc \\v " << theTranslator->trTypeDocumentation() << "}"<< endl;
@@ -799,29 +808,20 @@ void RTFGenerator::endIndexSection(IndexSections is)
{
t << "{\\tc \\v " << theTranslator->trClassDocumentation() << "}"<< endl;
}
- for (cli.toFirst();(cd=cli.current()) && !found;++cli)
+ for (const auto &cd : *Doxygen::classLinkedMap)
{
- if (cd->isLinkableInProject() &&
+ if (cd->isLinkableInProject() &&
cd->templateMaster()==0 &&
- !cd->isEmbeddedInOuterScope()
+ !cd->isEmbeddedInOuterScope() &&
+ !cd->isAlias()
)
{
t << "\\par " << rtf_Style_Reset << endl;
- t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
- t << cd->getOutputFileBase();
- t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
- found=TRUE;
- }
- }
- for (;(cd=cli.current());++cli)
- {
- if (cd->isLinkableInProject() &&
- cd->templateMaster()==0 &&
- !cd->isEmbeddedInOuterScope()
- )
- {
- t << "\\par " << rtf_Style_Reset << endl;
- beginRTFSection();
+ if (!first)
+ {
+ beginRTFSection();
+ }
+ first=false;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
t << cd->getOutputFileBase();
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
@@ -834,41 +834,25 @@ 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())
{
- if (isFirst)
+ t << "\\par " << rtf_Style_Reset << endl;
+ if (!isFirst)
{
- t << "\\par " << rtf_Style_Reset << endl;
- t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
- t << fd->getOutputFileBase();
- t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
- if (sourceBrowser && m_prettyCode && fd->generateSourceFile())
- {
- t << "\\par " << rtf_Style_Reset << endl;
- t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"" << fd->getSourceFileBase() << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
- }
- isFirst=FALSE;
+ beginRTFSection();
}
- else
+ isFirst=FALSE;
+ t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
+ t << fd->getOutputFileBase();
+ t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
+ if (sourceBrowser && m_prettyCode && fd->generateSourceFile())
{
t << "\\par " << rtf_Style_Reset << endl;
- beginRTFSection();
- t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
- t << fd->getOutputFileBase();
- t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
- if (sourceBrowser && m_prettyCode && fd->generateSourceFile())
- {
- t << "\\par " << rtf_Style_Reset << endl;
- t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"" << fd->getSourceFileBase() << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
- }
+ t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"" << fd->getSourceFileBase() << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
}
}
}
@@ -878,20 +862,16 @@ void RTFGenerator::endIndexSection(IndexSections is)
case isExampleDocumentation:
{
//t << "}\n";
+ bool isFirst=true;
t << "{\\tc \\v " << theTranslator->trExampleDocumentation() << "}"<< endl;
- PageSDict::Iterator pdi(*Doxygen::exampleSDict);
- PageDef *pd=pdi.toFirst();
- if (pd)
- {
- t << "\\par " << rtf_Style_Reset << endl;
- t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
- t << pd->getOutputFileBase();
- t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
- }
- for (++pdi;(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::exampleLinkedMap)
{
t << "\\par " << rtf_Style_Reset << endl;
- beginRTFSection();
+ if (!isFirst)
+ {
+ beginRTFSection();
+ }
+ isFirst=false;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
t << pd->getOutputFileBase();
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
@@ -903,10 +883,8 @@ void RTFGenerator::endIndexSection(IndexSections is)
//#error "fix me in the same way as the latex index..."
//t << "{\\tc \\v " << theTranslator->trPageDocumentation() << "}"<< endl;
//t << "}"<< endl;
- //PageSDict::Iterator pdi(*Doxygen::pageSDict);
- //PageDef *pd=pdi.toFirst();
//bool first=TRUE;
- //for (pdi.toFirst();(pd=pdi.current());++pdi)
+ //for (const auto *pd : Doxygen::pageLinkedMap)
//{
// if (!pd->getGroupDef() && !pd->isReference())
// {
@@ -927,7 +905,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 +931,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 +1189,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 +1204,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 +1222,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 +1246,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 +1262,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 +1270,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 +1412,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 +1457,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 +1491,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 +1504,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 +1663,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 +1671,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
@@ -1862,7 +1839,7 @@ void RTFGenerator::endClassDiagram(const ClassDiagram &d,
newParagraph();
// create a png file
- d.writeImage(t,m_dir,m_relPath,fileName,FALSE);
+ d.writeImage(t,dir(),m_relPath,fileName,FALSE);
// display the file
t << "{" << endl;
@@ -1918,22 +1895,15 @@ void RTFGenerator::writeRTFReference(const char *label)
t << " \\\\*MERGEFORMAT}{\\fldrslt pagenum}}";
}
-void RTFGenerator::startCodeFragment()
+void RTFGenerator::startCodeFragment(const char *)
{
DBG_RTF(t << "{\\comment (startCodeFragment) }" << endl)
t << "{" << endl;
- //newParagraph();
t << rtf_Style_Reset << rtf_Code_DepthStyle();
- //styleStack.push(rtf_Style_CodeExample);
}
-void RTFGenerator::endCodeFragment()
+void RTFGenerator::endCodeFragment(const char *)
{
- //newParagraph();
- //styleStack.pop();
- //printf("RTFGenerator::endCodeFragment() top=%s\n",styleStack.top());
- //t << rtf_Style_Reset << styleStack.top() << endl;
- //endCodeLine checks is there is still an open code line, if so closes it.
endCodeLine();
DBG_RTF(t << "{\\comment (endCodeFragment) }" << endl)
@@ -2012,7 +1982,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 +2070,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 +2113,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 +2433,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';
@@ -2490,7 +2460,7 @@ void RTFGenerator::endDotGraph(DotClassGraph &g)
newParagraph();
QCString fn =
- g.writeGraph(t,GOF_BITMAP,EOF_Rtf,Config_getString(RTF_OUTPUT),m_fileName,m_relPath,TRUE,FALSE);
+ g.writeGraph(t,GOF_BITMAP,EOF_Rtf,dir(),fileName(),m_relPath,TRUE,FALSE);
// display the file
t << "{" << endl;
@@ -2513,8 +2483,7 @@ void RTFGenerator::endInclDepGraph(DotInclDepGraph &g)
{
newParagraph();
- QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_Rtf,Config_getString(RTF_OUTPUT),
- m_fileName,m_relPath,FALSE);
+ QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_Rtf,dir(),fileName(),m_relPath,FALSE);
// display the file
t << "{" << endl;
@@ -2544,8 +2513,7 @@ void RTFGenerator::endCallGraph(DotCallGraph &g)
{
newParagraph();
- QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_Rtf,Config_getString(RTF_OUTPUT),
- m_fileName,m_relPath,FALSE);
+ QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_Rtf,dir(),fileName(),m_relPath,FALSE);
// display the file
t << "{" << endl;
@@ -2567,8 +2535,7 @@ void RTFGenerator::endDirDepGraph(DotDirDeps &g)
{
newParagraph();
- QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_Rtf,Config_getString(RTF_OUTPUT),
- m_fileName,m_relPath,FALSE);
+ QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_Rtf,dir(),fileName(),m_relPath,FALSE);
// display the file
t << "{" << endl;
@@ -2681,7 +2648,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()
@@ -2791,36 +2758,36 @@ void RTFGenerator::exceptionEntry(const char* prefix,bool closeBracket)
t << " ";
}
-void RTFGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *)
+void RTFGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *,int)
{
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 +2800,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 +2825,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 +2893,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 +2913,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,23 +2992,44 @@ 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)
{
- DoxyCodeLineOpen = TRUE;
+ bool rtfHyperlinks = Config_getBool(RTF_HYPERLINKS);
+
+ m_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)
{
- DoxyCodeLineOpen = TRUE;
+ m_doxyCodeLineOpen = true;
m_col=0;
}
void RTFGenerator::endCodeLine()
{
- if (DoxyCodeLineOpen) lineBreak();
- DoxyCodeLineOpen = FALSE;
+ if (m_doxyCodeLineOpen) lineBreak();
+ m_doxyCodeLineOpen = false;
}
void RTFGenerator::startLabels()