Fix for UBSan build
[platform/upstream/doxygen.git] / src / rtfgen.h
1 /******************************************************************************
2  *
3  * $Id: rtfgen.h,v 1.13 2001/03/19 19:27:41 root Exp $
4  *
5  * Copyright (C) 1997-2012 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 "outputgen.h"
22
23 class QFile;
24
25 /** Generator for RTF output. */
26 class RTFGenerator : public OutputGenerator
27 {
28   public:
29     RTFGenerator();
30    ~RTFGenerator();
31     static void init();
32     static void writeStyleSheetFile(QFile &f);
33     static void writeExtensionsFile(QFile &file);
34
35     void enable() 
36     { if (genStack->top()) active=*genStack->top(); else active=TRUE; }
37     void disable() { active=FALSE; }
38     void enableIf(OutputType o)  { if (o==RTF) enable();  }
39     void disableIf(OutputType o) { if (o==RTF) disable(); }
40     void disableIfNot(OutputType o) { if (o!=RTF) disable(); }
41     bool isEnabled(OutputType o) { return (o==RTF && active); } 
42     OutputGenerator *get(OutputType o) { return (o==RTF) ? this : 0; }
43
44     void writeDoc(DocNode *,Definition *,MemberDef *);
45
46     void startFile(const char *name,const char *manName,const char *title);
47     void writeSearchInfo() {}
48     void writeFooter(const char *) {}
49     void endFile();
50     void clearBuffer();
51     //void postProcess(QByteArray &);
52     
53     void startIndexSection(IndexSections);
54     void endIndexSection(IndexSections);
55     void writePageLink(const char *,bool);
56     void startProjectNumber();
57     void endProjectNumber();
58     void writeStyleInfo(int part);
59     void startTitleHead(const char *);
60     void startTitle();
61     void endTitleHead(const char *,const char *name);
62     void endTitle() {} 
63
64     void newParagraph();
65     void startParagraph();
66     void endParagraph();
67     void writeString(const char *text);
68     void startIndexListItem();
69     void endIndexListItem();
70     void startIndexList();
71     void endIndexList();
72     void startIndexKey();
73     void endIndexKey();
74     void startIndexValue(bool);
75     void endIndexValue(const char *,bool);
76     void startItemList();
77     void endItemList();
78     void startIndexItem(const char *ref,const char *file);
79     void endIndexItem(const char *ref,const char *file);
80     void docify(const char *text);
81     void codify(const char *text);
82     void writeObjectLink(const char *ref,const char *file,
83                          const char *anchor,const char *name);
84     void writeCodeLink(const char *ref, const char *file,
85                        const char *anchor,const char *name,
86                        const char *tooltip);
87     void startTextLink(const char *f,const char *anchor);
88     void endTextLink();
89     void startHtmlLink(const char *url);
90     void endHtmlLink();
91     void startTypewriter() { t << "{\\f2 "; }
92     void endTypewriter()   { t << "}";      }
93     void startGroupHeader(int);
94     void endGroupHeader(int);
95     //void writeListItem();
96     void startItemListItem();
97     void endItemListItem();
98
99     void startMemberSections() {}
100     void endMemberSections() {} 
101     void startHeaderSection() {}
102     void endHeaderSection() {}
103     void startMemberHeader(const char *) { startGroupHeader(FALSE); }
104     void endMemberHeader() { endGroupHeader(FALSE); }
105     void startMemberSubtitle(); 
106     void endMemberSubtitle(); 
107     void startMemberDocList() {}
108     void endMemberDocList() {}
109     void startMemberList();
110     void endMemberList();
111     void startInlineHeader();
112     void endInlineHeader();
113     void startAnonTypeScope(int) {}
114     void endAnonTypeScope(int) {}
115     void startMemberItem(const char *,int,const char *);
116     void endMemberItem();
117     void startMemberTemplateParams() {}
118     void endMemberTemplateParams(const char *,const char *) {}
119     void insertMemberAlign(bool) {}
120
121     void writeRuler() { rtfwriteRuler_thin(); }
122         
123     void writeAnchor(const char *fileName,const char *name);
124     void startCodeFragment();
125     void endCodeFragment();
126     void writeLineNumber(const char *,const char *,const char *,int l) { t << l << " "; }
127     void startCodeLine(bool) { col=0; }
128     void endCodeLine() { lineBreak(); }
129     void startEmphasis() { t << "{\\i ";  }
130     void endEmphasis()   { t << "}"; }
131     void startBold()     { t << "{\\b "; }
132     void endBold()       { t << "}"; }
133     void startDescription();
134     void endDescription();
135     void startDescItem();
136     void endDescItem();
137     void lineBreak(const char *style=0);
138     void startMemberDoc(const char *,const char *,const char *,const char *,bool);
139     void endMemberDoc(bool);
140     void startDoxyAnchor(const char *,const char *,const char *,const char *,const char *);
141     void endDoxyAnchor(const char *,const char *);
142     void startCodeAnchor(const char *) {};
143     void endCodeAnchor() {};
144     void writeChar(char c);
145     void writeLatexSpacing() {};//{ t << "\\hspace{0.3cm}"; }
146     void writeStartAnnoItem(const char *type,const char *file, 
147                             const char *path,const char *name);
148     void writeEndAnnoItem(const char *name);
149     void startSubsection();
150     void endSubsection();
151     void startSubsubsection();
152     void endSubsubsection();
153     void startCenter()      { t << "{\\qc" << endl; }
154     void endCenter()        { t << "}"; }
155     void startSmall()       { t << "{\\sub "; }
156     void endSmall()         { t << "}"; }
157
158     void startMemberDescription(const char *,const char *);
159     void endMemberDescription();
160     void startMemberDeclaration() {} 
161     void endMemberDeclaration(const char *,const char *) {}
162     void writeInheritedSectionTitle(const char *,const char *,const char *,
163                       const char *,const char *,const char *) {}
164     void startDescList(SectionTypes);
165     void startSimpleSect(SectionTypes,const char *,const char *,const char *);
166     void endSimpleSect();
167     void startParamList(ParamListTypes,const char *);
168     void endParamList();
169     //void writeDescItem();
170     void startDescForItem();
171     void endDescForItem();
172     void startSection(const char *,const char *,SectionInfo::SectionType);
173     void endSection(const char *,SectionInfo::SectionType);
174     void addIndexItem(const char *,const char *);
175     void startIndent();
176     void endIndent();
177     void writeSynopsis()     {}
178     void startClassDiagram();
179     void endClassDiagram(const ClassDiagram &,const char *filename,const char *name);
180     void startPageRef();
181     void endPageRef(const char *,const char *);
182     void startQuickIndices() {}
183     void endQuickIndices() {}
184     void writeSplitBar(const char *) {}
185     void writeNavigationPath(const char *) {}
186     void writeLogo() {}
187     void writeQuickLinks(bool,HighlightedItem,const char *) {}
188     void writeSummaryLink(const char *,const char *,const char *,bool) {}
189     void startContents() {}
190     void endContents() {}
191     void writeNonBreakableSpace(int);
192         
193     void startDescTable();
194     void endDescTable();
195     void startDescTableTitle();
196     void endDescTableTitle();
197     void startDescTableData();
198     void endDescTableData();
199     
200     void startDotGraph();
201     void endDotGraph(const DotClassGraph &);
202     void startInclDepGraph();
203     void endInclDepGraph(const DotInclDepGraph &);
204     void startGroupCollaboration();
205     void endGroupCollaboration(const DotGroupCollaboration &g);
206     void startCallGraph();
207     void endCallGraph(const DotCallGraph &);
208     void startDirDepGraph();
209     void endDirDepGraph(const DotDirDeps &g);
210     void writeGraphicalHierarchy(const DotGfxHierarchyTable &) {}
211
212     void startMemberGroupHeader(bool);
213     void endMemberGroupHeader();
214     void startMemberGroupDocs();
215     void endMemberGroupDocs();
216     void startMemberGroup();
217     void endMemberGroup(bool);
218     
219     void startTextBlock(bool dense);
220     void endTextBlock(bool);
221     void lastIndexPage();
222
223     void startMemberDocPrefixItem() {}
224     void endMemberDocPrefixItem() {}
225     void startMemberDocName(bool) {}
226     void endMemberDocName() {}
227     void startParameterType(bool,const char *);
228     void endParameterType();
229     void startParameterName(bool) {}
230     void endParameterName(bool,bool,bool) {}
231     void startParameterList(bool) {}
232     void endParameterList() {}
233
234     void startConstraintList(const char  *);
235     void startConstraintParam();
236     void endConstraintParam();
237     void startConstraintType();
238     void endConstraintType();
239     void startConstraintDocs();
240     void endConstraintDocs();
241     void endConstraintList();
242
243     void startMemberDocSimple();
244     void endMemberDocSimple();
245     void startInlineMemberType();
246     void endInlineMemberType();
247     void startInlineMemberName();
248     void endInlineMemberName();
249     void startInlineMemberDoc();
250     void endInlineMemberDoc();
251
252     void startLabels();
253     void writeLabel(const char *l,bool isLast);
254     void endLabels();
255
256     void startFontClass(const char *) {}
257     void endFontClass() {}
258
259     void writeCodeAnchor(const char *) {}
260     void linkableSymbol(int,const char *,Definition *,Definition *) {}
261
262     static bool preProcessFileInplace(const char *path,const char *name);
263     
264   private:
265     RTFGenerator(const RTFGenerator &);
266     RTFGenerator &operator=(const RTFGenerator &);
267
268     const char *rtf_BList_DepthStyle();
269     const char *rtf_CList_DepthStyle();
270     const char *rtf_EList_DepthStyle();
271     const char *rtf_LCList_DepthStyle();
272     const char *rtf_DList_DepthStyle();
273     const char *rtf_Code_DepthStyle();
274     void incrementIndentLevel();
275     void decrementIndentLevel();
276     int  col;
277
278     bool m_bstartedBody;  // has startbody been called yet?
279     int  m_listLevel; // // RTF does not really have a addative indent...manually set list level.
280     bool m_omitParagraph; // should a the next paragraph command be ignored?
281     int  m_numCols; // number of columns in a table
282     QCString relPath;
283
284     void beginRTFDocument();
285     void beginRTFChapter();
286     void beginRTFSection();
287     void rtfwriteRuler_doubleline();
288     void rtfwriteRuler_emboss();
289     void rtfwriteRuler_thick();
290     void rtfwriteRuler_thin();
291     void writeRTFReference(const char *label);
292     //char *getMultiByte(int c);
293 };
294
295 #endif