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 DocLink &);
91  void operator()(const DocRef &ref);
92  void operator()(const DocSecRefItem &);
93  void operator()(const DocSecRefList &);
94  void operator()(const DocParamSect &);
95  void operator()(const DocParamList &);
96  void operator()(const DocXRefItem &);
97  void operator()(const DocInternalRef &);
98  void operator()(const DocText &);
99  void operator()(const DocHtmlBlockQuote &);
100  void operator()(const DocVhdlFlow &);
101  void operator()(const DocParBlock &);
102 
103  private:
104  template<class T>
105  void visitChildren(const T &t)
106  {
107  for (const auto &child : t.children())
108  {
109  std::visit(*this, child);
110  }
111  }
112 
113  //--------------------------------------
114  // helper functions
115  //--------------------------------------
116 
117  void filter(const QCString &str,bool verbatim=FALSE);
118  void startLink(const QCString &ref,const QCString &file,
119  const QCString &anchor);
120  void endLink(const QCString &ref);
121  QCString getStyle(const QCString &name);
122  QCString getListTable(const int id);
123 
124  int indentLevel() const;
125  void incIndentLevel();
126  void decIndentLevel();
127 
128  void includePicturePreRTF(const QCString &name, bool isTypeRTF, bool hasCaption, bool inlineImage = FALSE);
129  void includePicturePostRTF(bool isTypeRTF, bool hasCaption, bool inlineImage = FALSE);
130  void writeDotFile(const QCString &fileName, bool hasCaption,const QCString &srcFile,int srcLine);
131  void writeDotFile(const DocDotFile &);
132  void writeMscFile(const QCString &fileName, bool hasCaption,const QCString &srcFile,int srcLine);
133  void writeMscFile(const DocMscFile &);
134  void writeDiaFile(const DocDiaFile &);
135  void writePlantUMLFile(const QCString &fileName, bool hasCaption);
136 
137  //--------------------------------------
138  // state variables
139  //--------------------------------------
140 
141  TextStream &m_t;
142  OutputCodeList &m_ci;
143  bool m_insidePre = false;
144  bool m_hide = false;
145  bool m_lastIsPara = false;
146  QCString m_langExt;
147 
148  static const int maxIndentLevels = 13;
149  int m_indentLevel = 0;
150  int m_hierarchyLevel = 0;
151  struct RTFListItemInfo
152  {
153  bool isEnum = false;
154  bool isCheck = false;
155  int number = 1;
156  char type = '1';
157  };
158  RTFListItemInfo m_listItemInfo[maxIndentLevels];
159 };
160 
161 #endif
Node representing a separator.
Definition: docnode.h:343
Node representing an HTML blockquote.
Definition: docnode.h:1252
Node representing a URL (or email address)
Definition: docnode.h:185
Node representing a word.
Definition: docnode.h:150
Node representing some amount of white space.
Definition: docnode.h:332
Node representing a Hypertext reference.
Definition: docnode.h:784
Root node of a text fragment.
Definition: docnode.h:1265
Node representing a horizontal ruler.
Definition: docnode.h:213
Node representing a simple section title.
Definition: docnode.h:579
Node representing a reference to some item.
Definition: docnode.h:739
Node representing a style change.
Definition: docnode.h:262
Node representing an auto List.
Definition: docnode.h:542
Node representing an emoji.
Definition: docnode.h:319
Node representing a citation of some bibliographic reference.
Definition: docnode.h:242
Text streaming class that buffers data.
Definition: textstream.h:35
Node representing a HTML table caption.
Definition: docnode.h:1189
Root node of documentation tree.
Definition: docnode.h:1274
Node representing a HTML table cell.
Definition: docnode.h:1154
Node representing an entry in the index.
Definition: docnode.h:523
Node representing a simple section.
Definition: docnode.h:978
Node representing a paragraph in the documentation tree.
Definition: docnode.h:1041
Node representing a special symbol.
Definition: docnode.h:306
Helper base class for functionality shared by all visitors.
Definition: docvisitor.h:28
Node Html details.
Definition: docnode.h:818
Node representing a VHDL flow chart.
Definition: docnode.h:710
Node representing a Html description list.
Definition: docnode.h:862
Node representing a HTML list item.
Definition: docnode.h:1126
Node representing a msc file.
Definition: docnode.h:692
Node representing a verbatim, unparsed text fragment.
Definition: docnode.h:354
Node representing a Html description item.
Definition: docnode.h:849
Node Html heading.
Definition: docnode.h:834
Node representing a HTML table.
Definition: docnode.h:1230
Node representing a dia file.
Definition: docnode.h:701
Node representing a HTML table row.
Definition: docnode.h:1207
Concrete visitor implementation for RTF output.
Definition: rtfdocvisitor.h:31
Node representing a line break.
Definition: docnode.h:199
Node representing a list of section references.
Definition: docnode.h:920
Class representing a list of different code generators.
Definition: outputlist.h:199
Node representing a reference to a section.
Definition: docnode.h:896
Node representing an item of a cross-referenced list.
Definition: docnode.h:500
Node representing a parameter section.
Definition: docnode.h:1014
Node representing an image.
Definition: docnode.h:612
Node representing a parameter list.
Definition: docnode.h:1086
Node representing a normal section.
Definition: docnode.h:875
Node representing a Html list.
Definition: docnode.h:961
Node representing an internal reference to some item.
Definition: docnode.h:768
Node representing an included text block from file.
Definition: docnode.h:413
Node representing an block of paragraphs.
Definition: docnode.h:940
Node representing an anchor.
Definition: docnode.h:226
Node representing a separator between two simple sections of the same type.
Definition: docnode.h:1005
Node representing a simple list item.
Definition: docnode.h:1114
Node representing a HTML description data.
Definition: docnode.h:1142
This is an alternative implementation of QCString.
Definition: qcstring.h:93
Node representing a word that can be linked to something.
Definition: docnode.h:162
Node representing a simple list.
Definition: docnode.h:951
Node representing a dot file.
Definition: docnode.h:683
Node representing an item of a auto list.
Definition: docnode.h:566
Node representing an internal section of documentation.
Definition: docnode.h:930
Node representing an item of a cross-referenced list.
Definition: docnode.h:591
Node representing a include/dontinclude operator block.
Definition: docnode.h:450
Node Html summary.
Definition: docnode.h:805