doxygen
rtfgen.h
1 /******************************************************************************
2  *
3  *
4  *
5  * Copyright (C) 1997-2015 by Parker Waechter & Dimitri van Heesch.
6  *
7  * Permission to use, copy, modify, and distribute this software and its
8  * documentation under the terms of the GNU General Public License is hereby
9  * granted. No representations are made about the suitability of this software
10  * for any purpose. It is provided "as is" without express or implied warranty.
11  * See the GNU General Public License for more details.
12  *
13  * Documents produced by Doxygen are derivative works derived from the
14  * input used in their production; they are not affected by this license.
15  *
16  */
17 
18 #ifndef RTFGEN_H
19 #define RTFGEN_H
20 
21 #include <array>
22 
23 #include "config.h"
24 #include "outputgen.h"
25 
26 class OutputCodeList;
27 
30 {
31  public:
33  void setTextStream(TextStream *t) { m_t = t; }
34 
35  OutputType type() const { return OutputType::RTF; }
36  void codify(const QCString &text);
37  void writeCodeLink(CodeSymbolType type,
38  const QCString &ref,const QCString &file,
39  const QCString &anchor,const QCString &name,
40  const QCString &tooltip);
41  void writeTooltip(const QCString &,
42  const DocLinkInfo &,
43  const QCString &,
44  const QCString &,
45  const SourceLinkInfo &,
46  const SourceLinkInfo &
47  ) {}
48  void writeLineNumber(const QCString &,const QCString &,const QCString &,int l, bool);
49  void startCodeLine(bool);
50  void endCodeLine();
51  void startFontClass(const QCString &);
52  void endFontClass();
53  void writeCodeAnchor(const QCString &) {}
54  void startCodeFragment(const QCString &style);
55  void endCodeFragment(const QCString &);
56 
57  private:
58  friend class RTFGenerator;
59  void setSourceFileName(const QCString &name);
60  void setIndentLevel(int level) { m_indentLevel=level; }
61  QCString rtf_Code_DepthStyle();
62  int m_col = 0;
63  TextStream *m_t;
64  bool m_doxyCodeLineOpen = false;
65  QCString m_sourceFileName;
66  int m_indentLevel = 0;
67 };
68 
69 
72 {
73  public:
74  RTFGenerator();
75  RTFGenerator(const RTFGenerator &);
76  RTFGenerator &operator=(const RTFGenerator &);
78  RTFGenerator &operator=(RTFGenerator &&) = delete;
79  ~RTFGenerator();
80 
81  static void init();
82  void cleanup();
83  static void writeStyleSheetFile(TextStream &t);
84  static void writeExtensionsFile(TextStream &t);
85  OutputType type() const { return OutputType::RTF; }
86 
87  void setRelativePath(const QCString &path);
88  void setSourceFileName(const QCString &sourceFileName);
89 
90  void writeDoc(const IDocNodeAST *ast,const Definition *,const MemberDef *,int);
91 
92  void startFile(const QCString &name,const QCString &manName,const QCString &title,int id,int hierarchyLevel);
93  void writeSearchInfo() {}
94  void writeFooter(const QCString &) {}
95  void endFile();
96  void clearBuffer();
97 
98  void startPageDoc(const QCString &) {}
99  void endPageDoc() {}
100  void startIndexSection(IndexSection);
101  void endIndexSection(IndexSection);
102  void writePageLink(const QCString &,bool);
103  void startProjectNumber();
104  void endProjectNumber();
105  void writeStyleInfo(int part);
106  void startTitleHead(const QCString &);
107  void endTitleHead(const QCString &,const QCString &name);
108 
109  void startParagraph(const QCString &classDef);
110  void endParagraph();
111  void writeString(const QCString &text);
112  void startIndexListItem();
113  void endIndexListItem();
114  void startIndexList();
115  void endIndexList();
116  void startIndexKey();
117  void endIndexKey();
118  void startIndexValue(bool);
119  void endIndexValue(const QCString &,bool);
120  void startItemList();
121  void endItemList();
122  void startIndexItem(const QCString &ref,const QCString &file);
123  void endIndexItem(const QCString &ref,const QCString &file);
124  void docify(const QCString &text);
125  void writeObjectLink(const QCString &ref,const QCString &file,
126  const QCString &anchor,const QCString &name);
127  void startTextLink(const QCString &f,const QCString &anchor);
128  void endTextLink();
129  void startTypewriter() { m_t << "{\\f2 "; }
130  void endTypewriter() { m_t << "}"; }
131  void startGroupHeader(int);
132  void endGroupHeader(int);
133  void startItemListItem();
134  void endItemListItem();
135 
136  void startMemberSections() {}
137  void endMemberSections() {}
138  void startHeaderSection() {}
139  void endHeaderSection() {}
140  void startMemberHeader(const QCString &,int) { startGroupHeader(0); }
141  void endMemberHeader() { endGroupHeader(FALSE); }
142  void startMemberSubtitle();
143  void endMemberSubtitle();
144  void startMemberDocList() {}
145  void endMemberDocList() {}
146  void startMemberList();
147  void endMemberList();
148  void startInlineHeader();
149  void endInlineHeader();
150  void startAnonTypeScope(int) {}
151  void endAnonTypeScope(int) {}
152  void startMemberItem(const QCString &,MemberItemType,const QCString &);
153  void endMemberItem(MemberItemType);
154  void startMemberTemplateParams() {}
155  void endMemberTemplateParams(const QCString &,const QCString &) {}
156  void startCompoundTemplateParams();
157  void endCompoundTemplateParams();
158  void insertMemberAlign(bool) {}
159  void insertMemberAlignLeft(MemberItemType,bool){}
160 
161  void writeRuler() { rtfwriteRuler_thin(); }
162 
163  void writeAnchor(const QCString &fileName,const QCString &name);
164  void startEmphasis() { m_t << "{\\i "; }
165  void endEmphasis() { m_t << "}"; }
166  void startBold() { m_t << "{\\b "; }
167  void endBold() { m_t << "}"; }
168  void lineBreak(const QCString &style=QCString());
169  void startMemberDoc(const QCString &,const QCString &,const QCString &,const QCString &,int,int,bool);
170  void endMemberDoc(bool);
171  void startDoxyAnchor(const QCString &,const QCString &,const QCString &,const QCString &,const QCString &);
172  void endDoxyAnchor(const QCString &,const QCString &);
173  void writeChar(char c);
174  void writeLatexSpacing() {};//{ m_t << "\\hspace{0.3cm}"; }
175  void writeStartAnnoItem(const QCString &type,const QCString &file,
176  const QCString &path,const QCString &name);
177  void startCenter() { m_t << "{\\qc\n"; }
178  void endCenter() { m_t << "}"; }
179  void startSmall() { m_t << "{\\sub "; }
180  void endSmall() { m_t << "}"; }
181 
182  void startMemberDescription(const QCString &,const QCString &,bool);
183  void endMemberDescription();
184  void startMemberDeclaration() {}
185  void endMemberDeclaration(const QCString &,const QCString &) {}
186  void writeInheritedSectionTitle(const QCString &,const QCString &,const QCString &,
187  const QCString &,const QCString &,const QCString &);
188  void startExamples();
189  void endExamples();
190  void startDescForItem();
191  void endDescForItem();
192  void startSection(const QCString &,const QCString &,SectionType);
193  void endSection(const QCString &,SectionType);
194  void addIndexItem(const QCString &,const QCString &);
195  void startIndent();
196  void endIndent();
197  void writeSynopsis() {}
198  void startClassDiagram();
199  void endClassDiagram(const ClassDiagram &,const QCString &filename,const QCString &name);
200  void startPageRef();
201  void endPageRef(const QCString &,const QCString &);
202  void startQuickIndices() {}
203  void endQuickIndices() {}
204  void writeSplitBar(const QCString &) {}
205  void writeNavigationPath(const QCString &) {}
206  void writeLogo() {}
207  void writeQuickLinks(bool,HighlightedItem,const QCString &) {}
208  void writeSummaryLink(const QCString &,const QCString &,const QCString &,bool) {}
209  void startContents() {}
210  void endContents() {}
211  void writeNonBreakableSpace(int);
212 
213  void startDescTable(const QCString &title);
214  void endDescTable();
215  void startDescTableRow();
216  void endDescTableRow();
217  void startDescTableTitle();
218  void endDescTableTitle();
219  void startDescTableData();
220  void endDescTableData();
221 
222  void startDotGraph();
223  void endDotGraph(DotClassGraph &);
224  void startInclDepGraph();
225  void endInclDepGraph(DotInclDepGraph &);
226  void startGroupCollaboration();
227  void endGroupCollaboration(DotGroupCollaboration &g);
228  void startCallGraph();
229  void endCallGraph(DotCallGraph &);
230  void startDirDepGraph();
231  void endDirDepGraph(DotDirDeps &g);
232  void writeGraphicalHierarchy(DotGfxHierarchyTable &) {}
233 
234  void startMemberGroupHeader(bool);
235  void endMemberGroupHeader();
236  void startMemberGroupDocs();
237  void endMemberGroupDocs();
238  void startMemberGroup();
239  void endMemberGroup(bool);
240 
241  void startTextBlock(bool dense);
242  void endTextBlock(bool);
243  void lastIndexPage();
244 
245  void startMemberDocPrefixItem() {}
246  void endMemberDocPrefixItem() {}
247  void startMemberDocName(bool) {}
248  void endMemberDocName() {}
249  void startParameterType(bool,const QCString &);
250  void endParameterType();
251  void startParameterName(bool) {}
252  void endParameterName(bool,bool,bool) {}
253  void startParameterList(bool) {}
254  void endParameterList() {}
255  void exceptionEntry(const QCString &,bool);
256 
257  void startConstraintList(const QCString &);
258  void startConstraintParam();
259  void endConstraintParam();
260  void startConstraintType();
261  void endConstraintType();
262  void startConstraintDocs();
263  void endConstraintDocs();
264  void endConstraintList();
265 
266  void startMemberDocSimple(bool);
267  void endMemberDocSimple(bool);
268  void startInlineMemberType();
269  void endInlineMemberType();
270  void startInlineMemberName();
271  void endInlineMemberName();
272  void startInlineMemberDoc();
273  void endInlineMemberDoc();
274 
275  void startLabels();
276  void writeLabel(const QCString &l,bool isLast);
277  void endLabels();
278 
279  void writeLocalToc(const SectionRefs &,const LocalToc &) {}
280 
281  static bool preProcessFileInplace(const QCString &path,const QCString &name);
282 
283  void addCodeGen(OutputCodeList &list);
284 
285  private:
286  QCString rtf_BList_DepthStyle();
287  QCString rtf_CList_DepthStyle();
288  QCString rtf_EList_DepthStyle();
289  QCString rtf_LCList_DepthStyle();
290  QCString rtf_DList_DepthStyle();
291  void beginRTFDocument();
292  void beginRTFChapter();
293  void beginRTFSection();
294  void rtfwriteRuler_doubleline();
295  void rtfwriteRuler_emboss();
296  void rtfwriteRuler_thick();
297  void rtfwriteRuler_thin();
298  void writeRTFReference(const QCString &label);
299  void newParagraph();
300 
301  int indentLevel() const;
302  void incIndentLevel();
303  void decIndentLevel();
304 
305  bool m_bstartedBody = false; // has startbody been called yet?
306  bool m_omitParagraph = false; // should a the next paragraph command be ignored?
307  int m_numCols = 0; // number of columns in a table
308  QCString m_relPath;
309  int m_hierarchyLevel = 0;
310 
311  // RTF does not really have a additive indent...manually set list level.
312  static const int maxIndentLevels = 13;
313  int m_indentLevel = 0;
314  struct RTFListItemInfo
315  {
316  bool isEnum = false;
317  int number = 1;
318  char type = '1';
319  };
320  std::array<RTFListItemInfo,maxIndentLevels> m_listItemInfo;
321  std::unique_ptr<OutputCodeList> m_codeList;
322  RTFCodeGenerator *m_codeGen;
323 };
324 
325 QCString rtfFormatBmkStr(const QCString &name);
326 
327 
328 #endif
The common base class of all entity definitions found in the sources.
Definition: definition.h:74
A model of a class/file/namespace member symbol.
Definition: memberdef.h:45
Text streaming class that buffers data.
Definition: textstream.h:34
Generator for RTF code fragments.
Definition: rtfgen.h:29
class that represents a list of constant references to sections.
Definition: section.h:98
Generator for RTF output.
Definition: rtfgen.h:71
Represents a graphical class hierarchy.
Definition: dotgfxhierarchytable.h:31
Definition: types.h:304
Representation of a group collaboration graph.
Definition: dotgroupcollaboration.h:28
opaque representation of the abstract syntax tree (AST)
Definition: docparser.h:46
Class representing a list of different code generators.
Definition: outputlist.h:144
Class representing a built-in class diagram.
Definition: diagram.h:29
Representation of an call graph.
Definition: dotcallgraph.h:26
Representation of a class inheritance or dependency graph.
Definition: dotclassgraph.h:28
Base class for specific output generators.
Definition: outputgen.h:64
Representation of an include dependency graph.
Definition: dotincldepgraph.h:30
Representation of an directory dependency graph.
Definition: dotdirdeps.h:25
This is an alternative implementation of QCString.
Definition: qcstring.h:92
Definition: outputgen.h:49
Definition: outputgen.h:41