1 /******************************************************************************
5 * Copyright (C) 1997-2015 by Parker Waechter & Dimitri van Heesch.
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.
13 * Documents produced by Doxygen are derivative works derived from the
14 * input used in their production; they are not affected by this license.
21 #include "outputgen.h"
25 /** Generator for RTF output. */
26 class RTFGenerator : public OutputGenerator
32 static void writeStyleSheetFile(QFile &f);
33 static void writeExtensionsFile(QFile &file);
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; }
44 void writeDoc(DocNode *,Definition *,MemberDef *);
46 void startFile(const char *name,const char *manName,const char *title);
47 void writeSearchInfo() {}
48 void writeFooter(const char *) {}
51 //void postProcess(QByteArray &);
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 *);
61 void endTitleHead(const char *,const char *name);
65 void startParagraph(const char *classDef);
67 void writeString(const char *text);
68 void startIndexListItem();
69 void endIndexListItem();
70 void startIndexList();
74 void startIndexValue(bool);
75 void endIndexValue(const char *,bool);
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,
87 void writeTooltip(const char *, const DocLinkInfo &, const char *,
88 const char *, const SourceLinkInfo &, const SourceLinkInfo &
90 void startTextLink(const char *f,const char *anchor);
92 void startHtmlLink(const char *url);
94 void startTypewriter() { t << "{\\f2 "; }
95 void endTypewriter() { t << "}"; }
96 void startGroupHeader(int);
97 void endGroupHeader(int);
98 //void writeListItem();
99 void startItemListItem();
100 void endItemListItem();
102 void startMemberSections() {}
103 void endMemberSections() {}
104 void startHeaderSection() {}
105 void endHeaderSection() {}
106 void startMemberHeader(const char *) { startGroupHeader(FALSE); }
107 void endMemberHeader() { endGroupHeader(FALSE); }
108 void startMemberSubtitle();
109 void endMemberSubtitle();
110 void startMemberDocList() {}
111 void endMemberDocList() {}
112 void startMemberList();
113 void endMemberList();
114 void startInlineHeader();
115 void endInlineHeader();
116 void startAnonTypeScope(int) {}
117 void endAnonTypeScope(int) {}
118 void startMemberItem(const char *,int,const char *);
119 void endMemberItem();
120 void startMemberTemplateParams() {}
121 void endMemberTemplateParams(const char *,const char *) {}
122 void insertMemberAlign(bool) {}
124 void writeRuler() { rtfwriteRuler_thin(); }
126 void writeAnchor(const char *fileName,const char *name);
127 void startCodeFragment();
128 void endCodeFragment();
129 void writeLineNumber(const char *,const char *,const char *,int l) { t << QString("%1").arg(l,5) << " "; }
130 void startCodeLine(bool) { col=0; }
131 void endCodeLine() { lineBreak(); }
132 void startEmphasis() { t << "{\\i "; }
133 void endEmphasis() { t << "}"; }
134 void startBold() { t << "{\\b "; }
135 void endBold() { t << "}"; }
136 void startDescription();
137 void endDescription();
138 void startDescItem();
140 void lineBreak(const char *style=0);
141 void startMemberDoc(const char *,const char *,const char *,const char *,int,int,bool);
142 void endMemberDoc(bool);
143 void startDoxyAnchor(const char *,const char *,const char *,const char *,const char *);
144 void endDoxyAnchor(const char *,const char *);
145 void writeChar(char c);
146 void writeLatexSpacing() {};//{ t << "\\hspace{0.3cm}"; }
147 void writeStartAnnoItem(const char *type,const char *file,
148 const char *path,const char *name);
149 void writeEndAnnoItem(const char *name);
150 void startSubsection();
151 void endSubsection();
152 void startSubsubsection();
153 void endSubsubsection();
154 void startCenter() { t << "{\\qc" << endl; }
155 void endCenter() { t << "}"; }
156 void startSmall() { t << "{\\sub "; }
157 void endSmall() { t << "}"; }
159 void startMemberDescription(const char *,const char *);
160 void endMemberDescription();
161 void startMemberDeclaration() {}
162 void endMemberDeclaration(const char *,const char *) {}
163 void writeInheritedSectionTitle(const char *,const char *,const char *,
164 const char *,const char *,const char *) {}
165 void startDescList(SectionTypes);
166 void startSimpleSect(SectionTypes,const char *,const char *,const char *);
167 void endSimpleSect();
168 void startParamList(ParamListTypes,const char *);
170 //void writeDescItem();
171 void startDescForItem();
172 void endDescForItem();
173 void startSection(const char *,const char *,SectionInfo::SectionType);
174 void endSection(const char *,SectionInfo::SectionType);
175 void addIndexItem(const char *,const char *);
178 void writeSynopsis() {}
179 void startClassDiagram();
180 void endClassDiagram(const ClassDiagram &,const char *filename,const char *name);
182 void endPageRef(const char *,const char *);
183 void startQuickIndices() {}
184 void endQuickIndices() {}
185 void writeSplitBar(const char *) {}
186 void writeNavigationPath(const char *) {}
188 void writeQuickLinks(bool,HighlightedItem,const char *) {}
189 void writeSummaryLink(const char *,const char *,const char *,bool) {}
190 void startContents() {}
191 void endContents() {}
192 void writeNonBreakableSpace(int);
194 void startDescTable(const char *title);
196 void startDescTableRow();
197 void endDescTableRow();
198 void startDescTableTitle();
199 void endDescTableTitle();
200 void startDescTableData();
201 void endDescTableData();
203 void startDotGraph();
204 void endDotGraph(const DotClassGraph &);
205 void startInclDepGraph();
206 void endInclDepGraph(const DotInclDepGraph &);
207 void startGroupCollaboration();
208 void endGroupCollaboration(const DotGroupCollaboration &g);
209 void startCallGraph();
210 void endCallGraph(const DotCallGraph &);
211 void startDirDepGraph();
212 void endDirDepGraph(const DotDirDeps &g);
213 void writeGraphicalHierarchy(const DotGfxHierarchyTable &) {}
215 void startMemberGroupHeader(bool);
216 void endMemberGroupHeader();
217 void startMemberGroupDocs();
218 void endMemberGroupDocs();
219 void startMemberGroup();
220 void endMemberGroup(bool);
222 void startTextBlock(bool dense);
223 void endTextBlock(bool);
224 void lastIndexPage();
226 void startMemberDocPrefixItem() {}
227 void endMemberDocPrefixItem() {}
228 void startMemberDocName(bool) {}
229 void endMemberDocName() {}
230 void startParameterType(bool,const char *);
231 void endParameterType();
232 void startParameterName(bool) {}
233 void endParameterName(bool,bool,bool) {}
234 void startParameterList(bool) {}
235 void endParameterList() {}
236 void exceptionEntry(const char*,bool);
238 void startConstraintList(const char *);
239 void startConstraintParam();
240 void endConstraintParam();
241 void startConstraintType();
242 void endConstraintType();
243 void startConstraintDocs();
244 void endConstraintDocs();
245 void endConstraintList();
247 void startMemberDocSimple(bool);
248 void endMemberDocSimple(bool);
249 void startInlineMemberType();
250 void endInlineMemberType();
251 void startInlineMemberName();
252 void endInlineMemberName();
253 void startInlineMemberDoc();
254 void endInlineMemberDoc();
257 void writeLabel(const char *l,bool isLast);
260 void startFontClass(const char *) {}
261 void endFontClass() {}
263 void writeCodeAnchor(const char *) {}
264 void setCurrentDoc(Definition *,const char *,bool) {}
265 void addWord(const char *,bool) {}
267 static bool preProcessFileInplace(const char *path,const char *name);
270 RTFGenerator(const RTFGenerator &);
271 RTFGenerator &operator=(const RTFGenerator &);
273 const char *rtf_BList_DepthStyle();
274 const char *rtf_CList_DepthStyle();
275 const char *rtf_EList_DepthStyle();
276 const char *rtf_LCList_DepthStyle();
277 const char *rtf_DList_DepthStyle();
278 const char *rtf_Code_DepthStyle();
279 void incrementIndentLevel();
280 void decrementIndentLevel();
284 bool m_bstartedBody; // has startbody been called yet?
285 int m_listLevel; // // RTF does not really have a addative indent...manually set list level.
286 bool m_omitParagraph; // should a the next paragraph command be ignored?
287 int m_numCols; // number of columns in a table
290 void beginRTFDocument();
291 void beginRTFChapter();
292 void beginRTFSection();
293 void rtfwriteRuler_doubleline();
294 void rtfwriteRuler_emboss();
295 void rtfwriteRuler_thick();
296 void rtfwriteRuler_thin();
297 void writeRTFReference(const char *label);
298 //char *getMultiByte(int c);