doxygen
rtfdocvisitor.h
1 /******************************************************************************
2  *
3  *
4  *
5  *
6  * Copyright (C) 1997-2015 by Dimitri van Heesch.
7  *
8  * Permission to use, copy, modify, and distribute this software and its
9  * documentation under the terms of the GNU General Public License is hereby
10  * granted. No representations are made about the suitability of this software
11  * for any purpose. It is provided "as is" without express or implied warranty.
12  * See the GNU General Public License for more details.
13  *
14  * Documents produced by Doxygen are derivative works derived from the
15  * input used in their production; they are not affected by this license.
16  *
17  */
18 
19 #ifndef RTFDOCVISITOR_H
20 #define RTFDOCVISITOR_H
21 
22 #include <iostream>
23 
24 #include "docvisitor.h"
25 #include "docnode.h"
26 
27 class OutputCodeList;
28 class TextStream;
29 
31 class RTFDocVisitor : public DocVisitor
32 {
33  public:
34  RTFDocVisitor(TextStream &t,OutputCodeList &ci,const QCString &langExt, int hierarchyLevel = 0);
35 
36  //--------------------------------------
37  // visitor functions for leaf nodes
38  //--------------------------------------
39 
40  void operator()(const DocWord &);
41  void operator()(const DocLinkedWord &);
42  void operator()(const DocWhiteSpace &);
43  void operator()(const DocSymbol &);
44  void operator()(const DocEmoji &);
45  void operator()(const DocURL &);
46  void operator()(const DocLineBreak &);
47  void operator()(const DocHorRuler &);
48  void operator()(const DocStyleChange &);
49  void operator()(const DocVerbatim &);
50  void operator()(const DocAnchor &);
51  void operator()(const DocInclude &);
52  void operator()(const DocIncOperator &);
53  void operator()(const DocFormula &);
54  void operator()(const DocIndexEntry &);
55  void operator()(const DocSimpleSectSep &);
56  void operator()(const DocCite &);
57  void operator()(const DocSeparator &);
58 
59  //--------------------------------------
60  // visitor functions for compound nodes
61  //--------------------------------------
62 
63  void operator()(const DocAutoList &);
64  void operator()(const DocAutoListItem &);
65  void operator()(const DocPara &);
66  void operator()(const DocRoot &);
67  void operator()(const DocSimpleSect &);
68  void operator()(const DocTitle &);
69  void operator()(const DocSimpleList &);
70  void operator()(const DocSimpleListItem &);
71  void operator()(const DocSection &s);
72  void operator()(const DocHtmlList &s);
73  void operator()(const DocHtmlListItem &);
74  void operator()(const DocHtmlDescList &);
75  void operator()(const DocHtmlDescTitle &);
76  void operator()(const DocHtmlDescData &);
77  void operator()(const DocHtmlTable &t);
78  void operator()(const DocHtmlCaption &);
79  void operator()(const DocHtmlRow &);
80  void operator()(const DocHtmlCell &);
81  void operator()(const DocInternal &);
82  void operator()(const DocHRef &);
83  void operator()(const DocHtmlSummary &);
84  void operator()(const DocHtmlDetails &);
85  void operator()(const DocHtmlHeader &);
86  void operator()(const DocImage &);
87  void operator()(const DocDotFile &);
88  void operator()(const DocMscFile &);
89  void operator()(const DocDiaFile &);
90  void operator()(const DocPlantUmlFile &);
91  void operator()(const DocLink &);
92  void operator()(const DocRef &ref);
93  void operator()(const DocSecRefItem &);
94  void operator()(const DocSecRefList &);
95  void operator()(const DocParamSect &);
96  void operator()(const DocParamList &);
97  void operator()(const DocXRefItem &);
98  void operator()(const DocInternalRef &);
99  void operator()(const DocText &);
100  void operator()(const DocHtmlBlockQuote &);
101  void operator()(const DocVhdlFlow &);
102  void operator()(const DocParBlock &);
103 
104  private:
105  template<class T>
106  void visitChildren(const T &t)
107  {
108  for (const auto &child : t.children())
109  {
110  std::visit(*this, child);
111  }
112  }
113 
114  //--------------------------------------
115  // helper functions
116  //--------------------------------------
117 
118  void filter(const QCString &str,bool verbatim=FALSE);
119  void startLink(const QCString &ref,const QCString &file,
120  const QCString &anchor);
121  void endLink(const QCString &ref);
122  QCString getStyle(const QCString &name);
123  QCString getListTable(const int id);
124 
125  int indentLevel() const;
126  void incIndentLevel();
127  void decIndentLevel();
128 
129  void includePicturePreRTF(const QCString &name, bool isTypeRTF, bool hasCaption, bool inlineImage = FALSE);
130  void includePicturePostRTF(bool isTypeRTF, bool hasCaption, bool inlineImage = FALSE);
131  void writeDotFile(const QCString &fileName, bool hasCaption,const QCString &srcFile,int srcLine);
132  void writeDotFile(const DocDotFile &);
133  void writeMscFile(const QCString &fileName, bool hasCaption,const QCString &srcFile,int srcLine);
134  void writeMscFile(const DocMscFile &);
135  void writeDiaFile(const DocDiaFile &);
136  void writePlantUMLFile(const QCString &fileName, bool hasCaption);
137 
138  //--------------------------------------
139  // state variables
140  //--------------------------------------
141 
142  TextStream &m_t;
143  OutputCodeList &m_ci;
144  bool m_insidePre = false;
145  bool m_hide = false;
146  bool m_lastIsPara = false;
147  QCString m_langExt;
148 
149  static const int maxIndentLevels = 13;
150  int m_indentLevel = 0;
151  int m_hierarchyLevel = 0;
152  struct RTFListItemInfo
153  {
154  bool isEnum = false;
155  bool isCheck = false;
156  int number = 1;
157  char type = '1';
158  };
159  RTFListItemInfo m_listItemInfo[maxIndentLevels];
160 };
161 
162 #endif
Node representing a separator.
Definition: docnode.h:364
Node representing an HTML blockquote.
Definition: docnode.h:1290
Node representing a URL (or email address)
Definition: docnode.h:187
Node representing a word.
Definition: docnode.h:152
Node representing some amount of white space.
Definition: docnode.h:353
Node representing a Hypertext reference.
Definition: docnode.h:822
Root node of a text fragment.
Definition: docnode.h:1303
Node representing a horizontal ruler.
Definition: docnode.h:215
Node representing a simple section title.
Definition: docnode.h:607
Node representing a reference to some item.
Definition: docnode.h:777
Node representing a style change.
Definition: docnode.h:267
Node representing an auto List.
Definition: docnode.h:570
Node representing an emoji.
Definition: docnode.h:340
Node representing a citation of some bibliographic reference.
Definition: docnode.h:244
Text streaming class that buffers data.
Definition: textstream.h:35
Node representing a HTML table caption.
Definition: docnode.h:1227
Root node of documentation tree.
Definition: docnode.h:1312
Node representing a HTML table cell.
Definition: docnode.h:1192
Node representing an entry in the index.
Definition: docnode.h:551
Node representing a simple section.
Definition: docnode.h:1016
Node representing a paragraph in the documentation tree.
Definition: docnode.h:1079
Node representing a special symbol.
Definition: docnode.h:327
Helper base class for functionality shared by all visitors.
Definition: docvisitor.h:28
Node Html details.
Definition: docnode.h:856
Node representing a VHDL flow chart.
Definition: docnode.h:748
Node representing a Html description list.
Definition: docnode.h:900
Node representing a HTML list item.
Definition: docnode.h:1164
Node representing a msc file.
Definition: docnode.h:721
Node representing a verbatim, unparsed text fragment.
Definition: docnode.h:375
Node representing a Html description item.
Definition: docnode.h:887
Node Html heading.
Definition: docnode.h:872
Node representing a HTML table.
Definition: docnode.h:1268
Node representing a dia file.
Definition: docnode.h:730
Node representing a HTML table row.
Definition: docnode.h:1245
Concrete visitor implementation for RTF output.
Definition: rtfdocvisitor.h:31
Node representing a line break.
Definition: docnode.h:201
Node representing a list of section references.
Definition: docnode.h:958
Class representing a list of different code generators.
Definition: outputlist.h:163
Node representing a reference to a section.
Definition: docnode.h:934
Node representing an item of a cross-referenced list.
Definition: docnode.h:528
Node representing a parameter section.
Definition: docnode.h:1052
Node representing an image.
Definition: docnode.h:641
Node representing a parameter list.
Definition: docnode.h:1124
Node representing a normal section.
Definition: docnode.h:913
Node representing a Html list.
Definition: docnode.h:999
Node representing a uml file.
Definition: docnode.h:739
Node representing an internal reference to some item.
Definition: docnode.h:806
Node representing an included text block from file.
Definition: docnode.h:434
Node representing an block of paragraphs.
Definition: docnode.h:978
Node representing an anchor.
Definition: docnode.h:228
Node representing a separator between two simple sections of the same type.
Definition: docnode.h:1043
Node representing a simple list item.
Definition: docnode.h:1152
Node representing a HTML description data.
Definition: docnode.h:1180
This is an alternative implementation of QCString.
Definition: qcstring.h:100
Node representing a word that can be linked to something.
Definition: docnode.h:164
Node representing a simple list.
Definition: docnode.h:989
Node representing a dot file.
Definition: docnode.h:712
Node representing an item of a auto list.
Definition: docnode.h:594
Node representing an internal section of documentation.
Definition: docnode.h:968
Node representing an item of a cross-referenced list.
Definition: docnode.h:620
Node representing a include/dontinclude operator block.
Definition: docnode.h:476
Node Html summary.
Definition: docnode.h:843