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 *,int) { 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) {}
123 void insertMemberAlignLeft(int,bool){}
125 void writeRuler() { rtfwriteRuler_thin(); }
127 void writeAnchor(const char *fileName,const char *name);
128 void startCodeFragment();
129 void endCodeFragment();
130 void writeLineNumber(const char *,const char *,const char *,int l) { t << QString("%1").arg(l,5) << " "; }
131 void startCodeLine(bool) { col=0; }
132 void endCodeLine() { lineBreak(); }
133 void startEmphasis() { t << "{\\i "; }
134 void endEmphasis() { t << "}"; }
135 void startBold() { t << "{\\b "; }
136 void endBold() { t << "}"; }
137 void startDescription();
138 void endDescription();
139 void startDescItem();
141 void lineBreak(const char *style=0);
142 void startMemberDoc(const char *,const char *,const char *,const char *,int,int,bool);
143 void endMemberDoc(bool);
144 void startDoxyAnchor(const char *,const char *,const char *,const char *,const char *);
145 void endDoxyAnchor(const char *,const char *);
146 void writeChar(char c);
147 void writeLatexSpacing() {};//{ t << "\\hspace{0.3cm}"; }
148 void writeStartAnnoItem(const char *type,const char *file,
149 const char *path,const char *name);
150 void writeEndAnnoItem(const char *name);
151 void startSubsection();
152 void endSubsection();
153 void startSubsubsection();
154 void endSubsubsection();
155 void startCenter() { t << "{\\qc" << endl; }
156 void endCenter() { t << "}"; }
157 void startSmall() { t << "{\\sub "; }
158 void endSmall() { t << "}"; }
160 void startMemberDescription(const char *,const char *,bool);
161 void endMemberDescription();
162 void startMemberDeclaration() {}
163 void endMemberDeclaration(const char *,const char *) {}
164 void writeInheritedSectionTitle(const char *,const char *,const char *,
165 const char *,const char *,const char *) {}
166 void startDescList(SectionTypes);
167 void startExamples();
169 void startParamList(ParamListTypes,const char *);
171 //void writeDescItem();
172 void startDescForItem();
173 void endDescForItem();
174 void startSection(const char *,const char *,SectionInfo::SectionType);
175 void endSection(const char *,SectionInfo::SectionType);
176 void addIndexItem(const char *,const char *);
179 void writeSynopsis() {}
180 void startClassDiagram();
181 void endClassDiagram(const ClassDiagram &,const char *filename,const char *name);
183 void endPageRef(const char *,const char *);
184 void startQuickIndices() {}
185 void endQuickIndices() {}
186 void writeSplitBar(const char *) {}
187 void writeNavigationPath(const char *) {}
189 void writeQuickLinks(bool,HighlightedItem,const char *) {}
190 void writeSummaryLink(const char *,const char *,const char *,bool) {}
191 void startContents() {}
192 void endContents() {}
193 void writeNonBreakableSpace(int);
195 void startDescTable(const char *title);
197 void startDescTableRow();
198 void endDescTableRow();
199 void startDescTableTitle();
200 void endDescTableTitle();
201 void startDescTableData();
202 void endDescTableData();
204 void startDotGraph();
205 void endDotGraph(const DotClassGraph &);
206 void startInclDepGraph();
207 void endInclDepGraph(const DotInclDepGraph &);
208 void startGroupCollaboration();
209 void endGroupCollaboration(const DotGroupCollaboration &g);
210 void startCallGraph();
211 void endCallGraph(const DotCallGraph &);
212 void startDirDepGraph();
213 void endDirDepGraph(const DotDirDeps &g);
214 void writeGraphicalHierarchy(const DotGfxHierarchyTable &) {}
216 void startMemberGroupHeader(bool);
217 void endMemberGroupHeader();
218 void startMemberGroupDocs();
219 void endMemberGroupDocs();
220 void startMemberGroup();
221 void endMemberGroup(bool);
223 void startTextBlock(bool dense);
224 void endTextBlock(bool);
225 void lastIndexPage();
227 void startMemberDocPrefixItem() {}
228 void endMemberDocPrefixItem() {}
229 void startMemberDocName(bool) {}
230 void endMemberDocName() {}
231 void startParameterType(bool,const char *);
232 void endParameterType();
233 void startParameterName(bool) {}
234 void endParameterName(bool,bool,bool) {}
235 void startParameterList(bool) {}
236 void endParameterList() {}
237 void exceptionEntry(const char*,bool);
239 void startConstraintList(const char *);
240 void startConstraintParam();
241 void endConstraintParam();
242 void startConstraintType();
243 void endConstraintType();
244 void startConstraintDocs();
245 void endConstraintDocs();
246 void endConstraintList();
248 void startMemberDocSimple(bool);
249 void endMemberDocSimple(bool);
250 void startInlineMemberType();
251 void endInlineMemberType();
252 void startInlineMemberName();
253 void endInlineMemberName();
254 void startInlineMemberDoc();
255 void endInlineMemberDoc();
258 void writeLabel(const char *l,bool isLast);
261 void startFontClass(const char *);
264 void writeCodeAnchor(const char *) {}
265 void setCurrentDoc(Definition *,const char *,bool) {}
266 void addWord(const char *,bool) {}
268 static bool preProcessFileInplace(const char *path,const char *name);
271 RTFGenerator(const RTFGenerator &);
272 RTFGenerator &operator=(const RTFGenerator &);
274 const char *rtf_BList_DepthStyle();
275 const char *rtf_CList_DepthStyle();
276 const char *rtf_EList_DepthStyle();
277 const char *rtf_LCList_DepthStyle();
278 const char *rtf_DList_DepthStyle();
279 const char *rtf_Code_DepthStyle();
280 void incrementIndentLevel();
281 void decrementIndentLevel();
285 bool m_bstartedBody; // has startbody been called yet?
286 int m_listLevel; // // RTF does not really have a addative indent...manually set list level.
287 bool m_omitParagraph; // should a the next paragraph command be ignored?
288 int m_numCols; // number of columns in a table
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 char *label);
299 //char *getMultiByte(int c);