43#define DBG_RTF(x) do {} while(0)
47 for (
const auto &attr : cell.
attribs())
49 if (attr.name.lower()==
"align")
51 if (attr.value.lower()==
"center")
return "\\qc ";
52 else if (attr.value.lower()==
"right")
return "\\qr ";
60 const QCString &langExt,
int hierarchyLevel)
95 err(
"Maximum indent level ({}) exceeded while generating RTF output!\n",
maxIndentLevels-1);
111 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocWord)}\n");
119 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocLinkedWord)}\n");
129 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocWhiteSpace)}\n");
144 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocSymbol)}\n");
160 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocEmoji)}\n");
171 case '&':
case '#':
case 'x':
175 val = 0xd800 + ( ( val1 - 0x10000 ) & 0xffc00 ) / 0x400 - 0x10000;
176 m_t <<
"\\u" << val <<
"?";
177 val = 0xdC00 + ( ( val1 - 0x10000 ) & 0x3ff ) - 0x10000 ;
178 m_t <<
"\\u" << val <<
"?";
181 case '0':
case '1':
case '2':
case '3':
case '4':
182 case '5':
case '6':
case '7':
case '8':
case '9':
183 val = val * 16 + *p -
'0';
185 case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
186 val = val * 16 + *p -
'a' + 10;
202 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocURL)}\n");
232 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocLineBreak)}\n");
240 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocHorRuler)}\n");
241 m_t <<
"{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw5\\brsp20 \\adjustright \\par}\n";
249 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocStyleChange)}\n");
311 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocVerbatim)}\n");
365 if (!fileName.isEmpty())
378 "msc {"+s.
text()+
"}",
380 if (!fileName.isEmpty())
395 for (
const auto &baseName: baseNameVector)
410 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocAnchor)}\n");
433 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocInclude)}\n");
513 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocIncOperator)}\n");
533 std::unique_ptr<FileDef> fd =
nullptr;
572 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocFormula)}\n");
578 m_t <<
"\\pard\\plain";
582 m_t <<
"{ \\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"" << f.
relPath() << f.
name() <<
".png\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt Image}}";
593 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocIndexEntry)}\n");
594 m_t <<
"{\\xe \\v " << i.
entry() <<
"}\n";
605 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocCite &)}\n");
618 if (!opt.noPar())
filter(
"[");
620 if (!opt.noPar())
filter(
"]");
633 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocAutoList &)}\n");
650 static int prevLevel = -1;
652 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocAutoListItem &)}\n");
654 if ((level != prevLevel-1) &&
655 (!(level==prevLevel && level != 0 &&
m_listItemInfo[level].isCheck)) &&
691 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocPara &)}\n");
696 std::get_if<DocParamSect>(p.
parent())
708 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocRoot &)}\n");
710 m_t <<
"{" <<
rtf_Style[
"BodyText"].reference() <<
"\n";
721 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocSimpleSect &)}\n");
725 m_t <<
"{" <<
rtf_Style[
"Heading5"].reference() <<
"\n";
771 m_t <<
"{\\s17 \\sa60 \\sb30\n";
777 std::visit(*
this,*s.
title());
797 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocTitle &)}\n");
805 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocSimpleSect &)}\n");
819 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocSimpleListItem &)}\n");
828 DBG_RTF(
"{\\comment RTFDocVisitor::visitPost(DocSimpleListItem)}\n");
834 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocSection &)}\n");
844 heading.
sprintf(
"Heading%d",level);
850 std::visit(*
this,*s.
title());
852 m_t <<
"\n\\par" <<
"}\n";
853 m_t <<
"{\\tc\\tcl" << level <<
" \\v ";
856 std::visit(*
this,*s.
title());
868 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlList &)}\n");
875 for (
const auto &opt : l.
attribs())
877 if (opt.name==
"type")
881 if (opt.name==
"start")
884 int val = opt.value.toInt(&ok);
890 m_t <<
"\\par" <<
"}\n";
897 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlListItem &)}\n");
903 for (
const auto &opt : l.
attribs())
905 if (opt.name==
"value")
908 int val = opt.value.toInt(&ok);
945 DBG_RTF(
"{\\comment RTFDocVisitor::visitPost(DocHtmlListItem)}\n");
951 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlDescList &)}\n");
964 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlDescTitle &)}\n");
967 m_t <<
"{" <<
rtf_Style[
"Heading5"].reference() <<
"\n";
978 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlDescData &)}\n");
991 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlTable &)}\n");
997 m_t <<
"\\pard \\qc \\b";
1003 m_t <<
"{Table \\field\\flddirty{\\*\\fldinst { SEQ Table \\\\*Arabic }}{\\fldrslt {\\noproof 1}} ";
1004 std::visit(*
this,*t.
caption());
1007 m_t <<
"\\pard\\plain\n";
1014 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlCaption &)}\n");
1016 m_t <<
"}\n\\par\n";
1022 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlRow &)}\n");
1024 m_t <<
"\\trowd \\trgaph108\\trleft-108"
1025 "\\trbrdrt\\brdrs\\brdrw10 "
1026 "\\trbrdrl\\brdrs\\brdrw10 "
1027 "\\trbrdrb\\brdrs\\brdrw10 "
1028 "\\trbrdrr\\brdrs\\brdrw10 "
1029 "\\trbrdrh\\brdrs\\brdrw10 "
1030 "\\trbrdrv\\brdrs\\brdrw10 \n";
1031 for (
size_t i=0;i<r.
numCells();i++)
1035 m_t <<
"\\clcbpat16";
1037 m_t <<
"\\clvertalt\\clbrdrt\\brdrs\\brdrw10 "
1038 "\\clbrdrl\\brdrs\\brdrw10 "
1039 "\\clbrdrb\\brdrs\\brdrw10 "
1040 "\\clbrdrr \\brdrs\\brdrw10 "
1042 "\\cellx" << ((i+1)*columnWidth) <<
"\n";
1044 m_t <<
"\\pard \\widctlpar\\intbl\\adjustright\n";
1048 m_t <<
"\\pard \\widctlpar\\intbl\\adjustright\n";
1049 m_t <<
"{\\row }\n";
1056 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlCell &)}\n");
1073 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHRef &)}\n");
1087 "{\\cs37\\ul\\cf2 ";
1093 "{ HYPERLINK \"" << href.
url() <<
"\" "
1097 "{\\cs37\\ul\\cf2 ";
1130 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlDetails &)}\n");
1135 std::visit(*
this,*summary);
1153 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlHeader &)}\n");
1158 heading.
sprintf(
"Heading%d",level);
1162 m_t <<
"{\\tc\\tcl" << level <<
" ";
1181 m_t <<
"\\pard \\qc ";
1183 m_t <<
"{ \\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
1185 m_t <<
"\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt Image}}\n";
1191 m_t <<
"\\pard \\qc \\b";
1192 m_t <<
"{Image \\field\\flddirty{\\*\\fldinst { SEQ Image \\\\*Arabic }}{\\fldrslt {\\noproof 1}} ";
1198 if (hasCaption)
m_t <<
"{\\comment ";
1215 if (hasCaption)
m_t <<
" }";
1238 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocImage &)}\n");
1247 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocDotFile &)}\n");
1248 bool exists =
false;
1256 if (!fileName.isEmpty())
1266 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocMscFile &)}\n");
1267 bool exists =
false;
1275 if (!fileName.isEmpty())
1286 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocDiaFile &)}\n");
1287 bool exists =
false;
1295 if (!fileName.isEmpty())
1306 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocPlantUmlFile &)}\n");
1314 for(
const auto &baseName: baseNameVector)
1325 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocLink &)}\n");
1334 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocRef &)}\n");
1354 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocSecRefItem &)}\n");
1361 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocSecRefList &)}\n");
1377 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocParamSect &)}\n");
1381 m_t <<
"{" <<
rtf_Style[
"Heading5"].reference() <<
"\n";
1423 static int columnPos[4][5] =
1424 { { 2, 25, 100, 100, 100 },
1425 { 3, 14, 35, 100, 100 },
1426 { 3, 25, 50, 100, 100 },
1427 { 4, 14, 35, 55, 100 },
1431 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocParamList &)}\n");
1437 parentType = sect->
type();
1447 m_t <<
"\\trowd \\trgaph108\\trleft426\\tblind426"
1448 "\\trbrdrt\\brdrs\\brdrw10\\brdrcf15 "
1449 "\\trbrdrl\\brdrs\\brdrw10\\brdrcf15 "
1450 "\\trbrdrb\\brdrs\\brdrw10\\brdrcf15 "
1451 "\\trbrdrr\\brdrs\\brdrw10\\brdrcf15 "
1452 "\\trbrdrh\\brdrs\\brdrw10\\brdrcf15 "
1453 "\\trbrdrv\\brdrs\\brdrw10\\brdrcf15 "<<
"\n";
1454 for (
int i=0;i<columnPos[config][0];i++)
1456 m_t <<
"\\clvertalt\\clbrdrt\\brdrs\\brdrw10\\brdrcf15 "
1457 "\\clbrdrl\\brdrs\\brdrw10\\brdrcf15 "
1458 "\\clbrdrb\\brdrs\\brdrw10\\brdrcf15 "
1459 "\\clbrdrr \\brdrs\\brdrw10\\brdrcf15 "
1461 "\\cellx" << (
rtf_pageWidth*columnPos[config][i+1]/100) <<
"\n";
1463 m_t <<
"\\pard \\widctlpar\\intbl\\adjustright\n";
1504 std::visit(*
this,type);
1522 if (!first)
m_t <<
",";
else first=
FALSE;
1523 std::visit(*
this,param);
1535 std::visit(*
this,par);
1540 m_t <<
"\\cell }\n";
1542 m_t <<
"{\\row }\n";
1556 bool anonymousEnum = x.
file()==
"@";
1557 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocXRefItem &)}\n");
1565 m_t <<
"{" <<
rtf_Style[
"Heading5"].reference() <<
"\n";
1588 "{\\cs37\\ul\\cf2 ";
1606 DBG_RTF(
"{\\comment RTFDocVisitor::visitPost(DocXRefItem)}\n");
1616 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocInternalRef &)}\n");
1626 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocText &)}\n");
1633 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlBlockQuote &)}\n");
1667 const char *p=str.
data();
1673 case '{':
m_t <<
"\\{";
break;
1674 case '}':
m_t <<
"\\}";
break;
1675 case '\\':
m_t <<
"\\\\";
break;
1676 case '\n':
if (verbatim)
1709 m_t <<
"{\\field {\\*\\fldinst { HYPERLINK \\\\l \"";
1712 m_t <<
"}{\\fldrslt {\\cs37\\ul\\cf2 ";
1735 const QCString &srcFile,
int srcLine,
bool newFile)
1745 const QCString &srcFile,
int srcLine,
bool newFile)
1754 const QCString &srcFile,
int srcLine,
bool newFile)
void parseCodeFragment(OutputCodeList &codeOutList, const QCString &fileName, const QCString &blockId, const QCString &scopeName, bool showLineNumbers, bool trimLeft, bool stripCodeComments)
static CodeFragmentManager & instance()
virtual void parseCode(OutputCodeList &codeOutList, const QCString &scopeName, const QCString &input, SrcLangExt lang, bool stripCodeComments, const CodeParserOptions &options)=0
Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.
Node representing an anchor.
Node representing an auto List.
bool isCheckedList() const
Node representing an item of a auto list.
Node representing a citation of some bibliographic reference.
CiteInfoOption option() const
Node representing a dia file.
Node representing a dot file.
Node representing an emoji.
Node representing a Hypertext reference.
Node representing a horizontal ruler.
Node representing an HTML blockquote.
Node representing a HTML table caption.
Node representing a HTML table cell.
const HtmlAttribList & attribs() const
Node representing a HTML description data.
Node representing a Html description list.
Node representing a Html description item.
const DocNodeVariant * summary() const
Node representing a Html list.
const HtmlAttribList & attribs() const
Node representing a HTML list item.
const HtmlAttribList & attribs() const
Node representing a HTML table row.
Node representing a HTML table.
const DocNodeVariant * caption() const
Node representing an image.
bool isInlineImage() const
Node representing a include/dontinclude operator block.
bool stripCodeComments() const
QCString includeFileName() const
QCString exampleFile() const
Node representing an included text block from file.
QCString extension() const
bool stripCodeComments() const
QCString exampleFile() const
Node representing an entry in the index.
Node representing an internal section of documentation.
Node representing an internal reference to some item.
Node representing a line break.
Node representing a link to some item.
Node representing a word that can be linked to something.
Node representing a msc file.
DocNodeVariant * parent()
Node representing an block of paragraphs.
Node representing a paragraph in the documentation tree.
Node representing a parameter list.
const DocNodeList & parameters() const
const DocNodeList & paramTypes() const
DocParamSect::Direction direction() const
const DocNodeList & paragraphs() const
Node representing a parameter section.
bool hasInOutSpecifier() const
bool hasTypeSpecifier() const
Node representing a uml file.
Node representing a reference to some item.
QCString targetTitle() const
Root node of documentation tree.
Node representing a reference to a section.
Node representing a list of section references.
Node representing a normal section.
const DocNodeVariant * title() const
Node representing a separator.
Node representing a simple list.
Node representing a simple list item.
const DocNodeVariant * paragraph() const
Node representing a simple section.
const DocNodeVariant * title() const
Node representing a separator between two simple sections of the same type.
Node representing a style change.
Node representing a special symbol.
HtmlEntityMapper::SymType symbol() const
Root node of a text fragment.
Node representing a simple section title.
Node representing a URL (or email address).
Node representing a verbatim, unparsed text fragment.
QCString language() const
QCString exampleFile() const
Node representing a VHDL flow chart.
CodeParserInterface & getCodeParser(const QCString &langExt)
void pushHidden(bool hide)
Node representing some amount of white space.
Node representing a word.
Node representing an item of a cross-referenced list.
const char * unicode(int index) const
Access routine to the unicode sequence for the Emoji entity.
static EmojiEntityMapper & instance()
Returns the one and only instance of the Emoji entity mapper.
Minimal replacement for QFileInfo.
std::string fileName() const
std::string dirPath(bool absPath=true) const
static HtmlEntityMapper & instance()
Returns the one and only instance of the HTML entity mapper.
const char * rtf(SymType symb) const
Access routine to the RTF code of the HTML entity.
Class representing a list of different code generators.
StringVector writePlantUMLSource(const QCString &outDirArg, const QCString &fileName, const QCString &content, OutputFormat format, const QCString &engine, const QCString &srcFile, int srcLine, bool inlineCode)
Write a PlantUML compatible file.
static PlantumlManager & instance()
void generatePlantUMLOutput(const QCString &baseName, const QCString &outDir, OutputFormat format)
Convert a PlantUML file to an image.
This is an alternative implementation of QCString.
size_t length() const
Returns the length of the string, not counting the 0-terminator.
bool startsWith(const char *s) const
bool isEmpty() const
Returns TRUE iff the string is empty.
const std::string & str() const
QCString & setNum(short n)
QCString right(size_t len) const
QCString & sprintf(const char *format,...)
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
void startLink(const QCString &ref, const QCString &file, const QCString &anchor)
void filter(const QCString &str, bool verbatim=FALSE)
void visitChildren(const T &t)
void includePicturePreRTF(const QCString &name, bool isTypeRTF, bool hasCaption, bool inlineImage=FALSE)
void writeDotFile(const QCString &fileName, bool hasCaption, const QCString &srcFile, int srcLine, bool newFile=true)
void includePicturePostRTF(bool isTypeRTF, bool hasCaption, bool inlineImage=FALSE)
RTFDocVisitor(TextStream &t, OutputCodeList &ci, const QCString &langExt, int hierarchyLevel=0)
QCString getStyle(const QCString &name)
void writePlantUMLFile(const QCString &fileName, bool hasCaption)
static const int maxIndentLevels
QCString getListTable(const int id)
void writeMscFile(const QCString &fileName, bool hasCaption, const QCString &srcFile, int srcLine, bool newFile=true)
void endLink(const QCString &ref)
RTFListItemInfo m_listItemInfo[maxIndentLevels]
void operator()(const DocWord &)
void writeDiaFile(const QCString &fileName, bool hasCaption, const QCString &srcFile, int srcLine, bool newFile=true)
static constexpr int MaxLevel
static constexpr int MinLevel
Text streaming class that buffers data.
#define Config_getBool(name)
#define Config_getString(name)
void writeDiaGraphFromFile(const QCString &inFile, const QCString &outDir, const QCString &outFile, DiaOutputFormat format, const QCString &srcFile, int srcLine)
void writeDotGraphFromFile(const QCString &inFile, const QCString &outDir, const QCString &outFile, GraphOutputFormat format, const QCString &srcFile, int srcLine)
std::unique_ptr< FileDef > createFileDef(const QCString &p, const QCString &n, const QCString &ref, const QCString &dn)
Translator * theTranslator
void writeMscGraphFromFile(const QCString &inFile, const QCString &outDir, const QCString &outFile, MscOutputFormat format, const QCString &srcFile, int srcLine)
Portable versions of functions that are platform dependent.
static QCString align(const DocHtmlCell &cell)
QCString rtfFormatBmkStr(const QCString &name)
Rtf_Table_Default rtf_Table_Default[]
Options to configure the code parser.
CodeParserOptions & setStartLine(int lineNr)
CodeParserOptions & setInlineFragment(bool enable)
CodeParserOptions & setShowLineNumbers(bool enable)
CodeParserOptions & setFileDef(const FileDef *fd)
QCString reference() const
QCString writeFileContents(const QCString &baseName, const QCString &extension, const QCString &content, bool &exists)
Thread-safe function to write a string to a file.
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
QCString integerToRoman(int n, bool upper)
QCString stripPath(const QCString &s)
bool readInputFile(const QCString &fileName, std::string &contents, bool filter, bool isSourceCode)
read a file name fileName and optionally filter and transcode it
SrcLangExt getLanguageFromCodeLang(QCString &fileName)
Routine to handle the language attribute of the \code command.
QCString integerToAlpha(int n, bool upper)
QCString getDotImageExtension()
QCString makeBaseName(const QCString &name, const QCString &ext)
bool copyFile(const QCString &src, const QCString &dest)
Copies the contents of file with name src to the newly created file with name dest.
QCString getFileNameExtension(const QCString &fn)
A bunch of utility functions.