diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-15 10:52:06 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-15 10:52:06 +0900 |
commit | b3e03c958bd4534210bdb8d87ab0b56ada4562fb (patch) | |
tree | f3aacdae9418762e601ca1d3cb430065b2d5c312 /src/rtfgen.cpp | |
parent | a65b883ee4bf1831f586218430470f0a493bbe5a (diff) | |
download | doxygen-b3e03c958bd4534210bdb8d87ab0b56ada4562fb.tar.gz doxygen-b3e03c958bd4534210bdb8d87ab0b56ada4562fb.tar.bz2 doxygen-b3e03c958bd4534210bdb8d87ab0b56ada4562fb.zip |
Imported Upstream version 1.8.9upstream/1.8.9
Diffstat (limited to 'src/rtfgen.cpp')
-rw-r--r-- | src/rtfgen.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index ccdadcf..354469b 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -66,6 +66,7 @@ RTFGenerator::RTFGenerator() : OutputGenerator() m_bstartedBody = FALSE; m_omitParagraph = FALSE; m_numCols = 0; + m_prettyCode=Config_getBool("RTF_SOURCE_CODE"); } RTFGenerator::~RTFGenerator() @@ -539,6 +540,8 @@ 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"); + switch (is) { case isTitlePageStart: @@ -810,6 +813,11 @@ void RTFGenerator::endIndexSection(IndexSections is) 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; } else @@ -819,6 +827,11 @@ void RTFGenerator::endIndexSection(IndexSections is) 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"; + } } } } @@ -2268,11 +2281,12 @@ bool isLeadBytes(int c) // note: function is not reentrant! -static void encodeForOutput(FTextStream &t,const QCString &s) +static void encodeForOutput(FTextStream &t,const char *s) { + if (s==0) return; QCString encoding; bool converted=FALSE; - int l = s.length(); + int l = qstrlen(s); static QByteArray enc; if (l*4>(int)enc.size()) enc.resize(l*4); // worst case encoding.sprintf("CP%s",theTranslator->trRTFansicp().data()); @@ -2284,7 +2298,7 @@ static void encodeForOutput(FTextStream &t,const QCString &s) { size_t iLeft=l; size_t oLeft=enc.size(); - char *inputPtr = s.data(); + char *inputPtr = (char*)s; char *outputPtr = enc.data(); if (!portable_iconv(cd, &inputPtr, &iLeft, &outputPtr, &oLeft)) { @@ -2296,7 +2310,7 @@ static void encodeForOutput(FTextStream &t,const QCString &s) } if (!converted) // if we did not convert anything, copy as is. { - memcpy(enc.data(),s.data(),l); + memcpy(enc.data(),s,l); enc.resize(l); } uint i; @@ -2355,7 +2369,7 @@ static bool preProcessFile(QDir &d,QCString &infName, FTextStream &t, bool bIncl err("read error in %s before end of RTF header!\n",infName.data()); return FALSE; } - if (bIncludeHeader) encodeForOutput(t,lineBuf); + if (bIncludeHeader) encodeForOutput(t,lineBuf.data()); } while (lineBuf.find("\\comment begin body")==-1); |