42#define DBG_RTF(x) do {} while(0)
46 for (
const auto &attr : cell.
attribs())
48 if (attr.name.lower()==
"align")
50 if (attr.value.lower()==
"center")
return "\\qc ";
51 else if (attr.value.lower()==
"right")
return "\\qr ";
64 baseName=baseName.
mid(i+1);
70 const QCString &langExt,
int hierarchyLevel)
105 err(
"Maximum indent level ({}) exceeded while generating RTF output!\n",
maxIndentLevels-1);
121 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocWord)}\n");
129 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocLinkedWord)}\n");
139 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocWhiteSpace)}\n");
154 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocSymbol)}\n");
170 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocEmoji)}\n");
181 case '&':
case '#':
case 'x':
185 val = 0xd800 + ( ( val1 - 0x10000 ) & 0xffc00 ) / 0x400 - 0x10000;
186 m_t <<
"\\u" << val <<
"?";
187 val = 0xdC00 + ( ( val1 - 0x10000 ) & 0x3ff ) - 0x10000 ;
188 m_t <<
"\\u" << val <<
"?";
191 case '0':
case '1':
case '2':
case '3':
case '4':
192 case '5':
case '6':
case '7':
case '8':
case '9':
193 val = val * 16 + *p -
'0';
195 case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
196 val = val * 16 + *p -
'a' + 10;
212 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocURL)}\n");
242 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocLineBreak)}\n");
250 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocHorRuler)}\n");
251 m_t <<
"{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw5\\brsp20 \\adjustright \\par}\n";
259 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocStyleChange)}\n");
321 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocVerbatim)}\n");
370 static int dotindex = 1;
381 err(
"Could not open file {} for writing\n",
qPrint(fileName));
399 static int mscindex = 1;
410 err(
"Could not open file {} for writing\n",
qPrint(baseName));
444 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocAnchor)}\n");
467 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocInclude)}\n");
555 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocIncOperator)}\n");
575 std::unique_ptr<FileDef> fd =
nullptr;
616 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocFormula)}\n");
622 m_t <<
"\\pard\\plain";
626 m_t <<
"{ \\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"" << f.
relPath() << f.
name() <<
".png\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt Image}}";
637 DBG_RTF(
"{\\comment RTFDocVisitor::visit(DocIndexEntry)}\n");
638 m_t <<
"{\\xe \\v " << i.
entry() <<
"}\n";
649 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocCite &)}\n");
677 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocAutoList &)}\n");
694 static int prevLevel = -1;
696 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocAutoListItem &)}\n");
698 if ((level != prevLevel-1) &&
699 (!(level==prevLevel && level != 0 &&
m_listItemInfo[level].isCheck)) &&
735 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocPara &)}\n");
740 std::get_if<DocParamSect>(p.
parent())
752 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocRoot &)}\n");
754 m_t <<
"{" <<
rtf_Style[
"BodyText"].reference() <<
"\n";
765 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocSimpleSect &)}\n");
769 m_t <<
"{" <<
rtf_Style[
"Heading5"].reference() <<
"\n";
815 m_t <<
"{\\s17 \\sa60 \\sb30\n";
821 std::visit(*
this,*s.
title());
841 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocTitle &)}\n");
849 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocSimpleSect &)}\n");
863 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocSimpleListItem &)}\n");
872 DBG_RTF(
"{\\comment RTFDocVisitor::visitPost(DocSimpleListItem)}\n");
878 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocSection &)}\n");
888 heading.
sprintf(
"Heading%d",level);
894 std::visit(*
this,*s.
title());
896 m_t <<
"\n\\par" <<
"}\n";
897 m_t <<
"{\\tc\\tcl" << level <<
" \\v ";
900 std::visit(*
this,*s.
title());
912 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlList &)}\n");
919 for (
const auto &opt : l.
attribs())
921 if (opt.name==
"type")
925 if (opt.name==
"start")
928 int val = opt.value.toInt(&ok);
934 m_t <<
"\\par" <<
"}\n";
941 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlListItem &)}\n");
947 for (
const auto &opt : l.
attribs())
949 if (opt.name==
"value")
952 int val = opt.value.toInt(&ok);
989 DBG_RTF(
"{\\comment RTFDocVisitor::visitPost(DocHtmlListItem)}\n");
995 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlDescList &)}\n");
1008 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlDescTitle &)}\n");
1011 m_t <<
"{" <<
rtf_Style[
"Heading5"].reference() <<
"\n";
1022 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlDescData &)}\n");
1035 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlTable &)}\n");
1041 m_t <<
"\\pard \\qc \\b";
1047 m_t <<
"{Table \\field\\flddirty{\\*\\fldinst { SEQ Table \\\\*Arabic }}{\\fldrslt {\\noproof 1}} ";
1048 std::visit(*
this,*t.
caption());
1051 m_t <<
"\\pard\\plain\n";
1058 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlCaption &)}\n");
1060 m_t <<
"}\n\\par\n";
1066 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlRow &)}\n");
1068 m_t <<
"\\trowd \\trgaph108\\trleft-108"
1069 "\\trbrdrt\\brdrs\\brdrw10 "
1070 "\\trbrdrl\\brdrs\\brdrw10 "
1071 "\\trbrdrb\\brdrs\\brdrw10 "
1072 "\\trbrdrr\\brdrs\\brdrw10 "
1073 "\\trbrdrh\\brdrs\\brdrw10 "
1074 "\\trbrdrv\\brdrs\\brdrw10 \n";
1075 for (
size_t i=0;i<r.
numCells();i++)
1079 m_t <<
"\\clcbpat16";
1081 m_t <<
"\\clvertalt\\clbrdrt\\brdrs\\brdrw10 "
1082 "\\clbrdrl\\brdrs\\brdrw10 "
1083 "\\clbrdrb\\brdrs\\brdrw10 "
1084 "\\clbrdrr \\brdrs\\brdrw10 "
1086 "\\cellx" << ((i+1)*columnWidth) <<
"\n";
1088 m_t <<
"\\pard \\widctlpar\\intbl\\adjustright\n";
1092 m_t <<
"\\pard \\widctlpar\\intbl\\adjustright\n";
1093 m_t <<
"{\\row }\n";
1100 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlCell &)}\n");
1117 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHRef &)}\n");
1131 "{\\cs37\\ul\\cf2 ";
1137 "{ HYPERLINK \"" << href.
url() <<
"\" "
1141 "{\\cs37\\ul\\cf2 ";
1174 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlDetails &)}\n");
1179 std::visit(*
this,*summary);
1197 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlHeader &)}\n");
1202 heading.
sprintf(
"Heading%d",level);
1206 m_t <<
"{\\tc\\tcl" << level <<
" ";
1225 m_t <<
"\\pard \\qc ";
1227 m_t <<
"{ \\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
1229 m_t <<
"\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt Image}}\n";
1235 m_t <<
"\\pard \\qc \\b";
1236 m_t <<
"{Image \\field\\flddirty{\\*\\fldinst { SEQ Image \\\\*Arabic }}{\\fldrslt {\\noproof 1}} ";
1242 if (hasCaption)
m_t <<
"{\\comment ";
1259 if (hasCaption)
m_t <<
" }";
1282 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocImage &)}\n");
1291 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocDotFile &)}\n");
1299 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocMscFile &)}\n");
1308 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocDiaFile &)}\n");
1317 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocPlantUmlFile &)}\n");
1333 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocLink &)}\n");
1342 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocRef &)}\n");
1362 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocSecRefItem &)}\n");
1369 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocSecRefList &)}\n");
1385 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocParamSect &)}\n");
1389 m_t <<
"{" <<
rtf_Style[
"Heading5"].reference() <<
"\n";
1431 static int columnPos[4][5] =
1432 { { 2, 25, 100, 100, 100 },
1433 { 3, 14, 35, 100, 100 },
1434 { 3, 25, 50, 100, 100 },
1435 { 4, 14, 35, 55, 100 },
1439 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocParamList &)}\n");
1445 parentType = sect->
type();
1455 m_t <<
"\\trowd \\trgaph108\\trleft426\\tblind426"
1456 "\\trbrdrt\\brdrs\\brdrw10\\brdrcf15 "
1457 "\\trbrdrl\\brdrs\\brdrw10\\brdrcf15 "
1458 "\\trbrdrb\\brdrs\\brdrw10\\brdrcf15 "
1459 "\\trbrdrr\\brdrs\\brdrw10\\brdrcf15 "
1460 "\\trbrdrh\\brdrs\\brdrw10\\brdrcf15 "
1461 "\\trbrdrv\\brdrs\\brdrw10\\brdrcf15 "<<
"\n";
1462 for (
int i=0;i<columnPos[config][0];i++)
1464 m_t <<
"\\clvertalt\\clbrdrt\\brdrs\\brdrw10\\brdrcf15 "
1465 "\\clbrdrl\\brdrs\\brdrw10\\brdrcf15 "
1466 "\\clbrdrb\\brdrs\\brdrw10\\brdrcf15 "
1467 "\\clbrdrr \\brdrs\\brdrw10\\brdrcf15 "
1469 "\\cellx" << (
rtf_pageWidth*columnPos[config][i+1]/100) <<
"\n";
1471 m_t <<
"\\pard \\widctlpar\\intbl\\adjustright\n";
1512 std::visit(*
this,type);
1530 if (!first)
m_t <<
",";
else first=
FALSE;
1531 std::visit(*
this,param);
1543 std::visit(*
this,par);
1548 m_t <<
"\\cell }\n";
1550 m_t <<
"{\\row }\n";
1564 bool anonymousEnum = x.
file()==
"@";
1565 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocXRefItem &)}\n");
1573 m_t <<
"{" <<
rtf_Style[
"Heading5"].reference() <<
"\n";
1596 "{\\cs37\\ul\\cf2 ";
1614 DBG_RTF(
"{\\comment RTFDocVisitor::visitPost(DocXRefItem)}\n");
1624 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocInternalRef &)}\n");
1634 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocText &)}\n");
1641 DBG_RTF(
"{\\comment RTFDocVisitor::operator()(const DocHtmlBlockQuote &)}\n");
1675 const char *p=str.
data();
1681 case '{':
m_t <<
"\\{";
break;
1682 case '}':
m_t <<
"\\}";
break;
1683 case '\\':
m_t <<
"\\\\";
break;
1684 case '\n':
if (verbatim)
1717 m_t <<
"{\\field {\\*\\fldinst { HYPERLINK \\\\l \"";
1720 m_t <<
"}{\\fldrslt {\\cs37\\ul\\cf2 ";
1747 const QCString &srcFile,
int srcLine)
1761 const QCString &srcFile,
int srcLine)
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, bool isExampleBlock, const QCString &exampleName=QCString(), const FileDef *fileDef=nullptr, int startLine=-1, int endLine=-1, bool inlineFragment=FALSE, const MemberDef *memberDef=nullptr, bool showLineNumbers=TRUE, const Definition *searchCtx=nullptr, bool collectXRefs=TRUE)=0
Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.
Class representing a directory in the file system.
bool remove(const std::string &path, bool acceptsAbsPath=true) const
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.
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.
QCString 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
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) 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,...)
int findRev(char c, int index=-1, bool cs=TRUE) const
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 writeDotFile(const QCString &fileName, bool hasCaption, const QCString &srcFile, int srcLine)
void includePicturePreRTF(const QCString &name, bool isTypeRTF, bool hasCaption, bool inlineImage=FALSE)
void writeDiaFile(const DocDiaFile &)
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
void writeMscFile(const QCString &fileName, bool hasCaption, const QCString &srcFile, int srcLine)
QCString getListTable(const int id)
void endLink(const QCString &ref)
RTFListItemInfo m_listItemInfo[maxIndentLevels]
void operator()(const DocWord &)
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)
static QCString makeBaseName(const QCString &name)
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)
std::ofstream openOutputStream(const QCString &name, bool append=false)
Portable versions of functions that are platform dependent.
const char * qPrint(const char *s)
static QCString align(const DocHtmlCell &cell)
static QCString makeBaseName(const QCString &name)
QCString rtfFormatBmkStr(const QCString &name)
Rtf_Table_Default rtf_Table_Default[]
const char * reference() const
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()
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.