My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
latexgen.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  *
4  *
5  * Copyright (C) 1997-2015 by 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 LATEXGEN_H
19 #define LATEXGEN_H
20 
21 #include "outputgen.h"
22 
23 class QFile;
24 
25 static const char *latexStyleExtension = ".sty";
26 
28 {
29  public:
30  LatexCodeGenerator(FTextStream &t,const QCString &relPath,const QCString &sourceFile);
32  void setTextStream(FTextStream &t);
33  void setRelativePath(const QCString &path);
34  void setSourceFileName(const QCString &sourceFileName);
35  void codify(const char *text);
36  void writeCodeLink(const char *ref,const char *file,
37  const char *anchor,const char *name,
38  const char *tooltip);
39  void writeTooltip(const char *,
40  const DocLinkInfo &,
41  const char *,
42  const char *,
43  const SourceLinkInfo &,
44  const SourceLinkInfo &
45  ) {}
46  void writeLineNumber(const char *,const char *,const char *,int);
47  void startCodeLine(bool);
48  void endCodeLine();
49  void startFontClass(const char *);
50  void endFontClass();
51  void writeCodeAnchor(const char *) {}
52  void setCurrentDoc(Definition *,const char *,bool) {}
53  void addWord(const char *,bool) {}
54 
55  private:
56  void _writeCodeLink(const char *className,
57  const char *ref,const char *file,
58  const char *anchor,const char *name,
59  const char *tooltip);
60  void docify(const char *str);
63  QCString m_relPath;
64  QCString m_sourceFileName;
65  int m_col;
67 };
68 
71 {
72  public:
75  static void init();
76  static void writeStyleSheetFile(QFile &f);
77  static void writeHeaderFile(QFile &f);
78  static void writeFooterFile(QFile &f);
79 
80  //OutputGenerator *copy();
81  //OutputGenerator *clone() { return new LatexGenerator(*this); }
82  //void append(const OutputGenerator *o);
83  void enable()
84  { if (genStack->top()) active=*genStack->top(); else active=TRUE; }
85  void disable() { active=FALSE; }
86  void enableIf(OutputType o) { if (o==Latex) enable(); }
87  void disableIf(OutputType o) { if (o==Latex) disable(); }
88  void disableIfNot(OutputType o) { if (o!=Latex) disable(); }
89  bool isEnabled(OutputType o) { return (o==Latex && active); }
90  OutputGenerator *get(OutputType o) { return (o==Latex) ? this : 0; }
91 
92  // --- CodeOutputInterface
93  void codify(const char *text)
94  { m_codeGen.codify(text); }
95  void writeCodeLink(const char *ref, const char *file,
96  const char *anchor,const char *name,
97  const char *tooltip)
98  { m_codeGen.writeCodeLink(ref,file,anchor,name,tooltip); }
99  void writeLineNumber(const char *ref,const char *file,const char *anchor,int lineNumber)
100  { m_codeGen.writeLineNumber(ref,file,anchor,lineNumber); }
101  void writeTooltip(const char *id, const DocLinkInfo &docInfo, const char *decl,
102  const char *desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo
103  )
104  { m_codeGen.writeTooltip(id,docInfo,decl,desc,defInfo,declInfo); }
105  void startCodeLine(bool hasLineNumbers)
106  { m_codeGen.startCodeLine(hasLineNumbers); }
107  void endCodeLine()
108  { m_codeGen.endCodeLine(); }
109  void startFontClass(const char *s)
110  { m_codeGen.startFontClass(s); }
112  { m_codeGen.endFontClass(); }
113  void writeCodeAnchor(const char *anchor)
114  { m_codeGen.writeCodeAnchor(anchor); }
115  // ---------------------------
116 
117 
118  void writeDoc(DocNode *,Definition *ctx,MemberDef *);
119 
120  void startFile(const char *name,const char *manName,const char *title);
121  void writeSearchInfo() {}
122  void writeFooter(const char *) {}
123  void endFile();
124  void clearBuffer();
125 
128  void writePageLink(const char *,bool);
129  void startProjectNumber();
131  void writeStyleInfo(int part);
132  void startTitleHead(const char *);
133  void startTitle();
134  void endTitleHead(const char *,const char *name);
135  void endTitle() { t << "}"; }
136 
137  void newParagraph();
138  void startParagraph();
139  void endParagraph();
140  void writeString(const char *text);
143  void startIndexList() { t << "\\begin{DoxyCompactList}" << endl; }
144  void endIndexList() { t << "\\end{DoxyCompactList}" << endl; }
145  void startIndexKey();
146  void endIndexKey();
147  void startIndexValue(bool);
148  void endIndexValue(const char *,bool);
149  void startItemList() { t << "\\begin{DoxyCompactItemize}" << endl; }
150  void endItemList() { t << "\\end{DoxyCompactItemize}" << endl; }
151  void startIndexItem(const char *ref,const char *file);
152  void endIndexItem(const char *ref,const char *file);
153  void docify(const char *text);
154  void writeObjectLink(const char *ref,const char *file,
155  const char *anchor,const char *name);
156 
157  void startTextLink(const char *,const char *);
158  void endTextLink();
159  void startHtmlLink(const char *url);
160  void endHtmlLink();
161  void startTypewriter() { t << "{\\ttfamily "; }
162  void endTypewriter() { t << "}"; }
163  void startGroupHeader(int);
164  void endGroupHeader(int);
165  void startItemListItem() { t << "\\item " << endl; }
166  void endItemListItem() {}
167 
169  void endMemberSections() {}
172  void startMemberHeader(const char *);
173  void endMemberHeader();
178  void startMemberList();
179  void endMemberList();
180  void startInlineHeader();
181  void endInlineHeader();
182  void startAnonTypeScope(int);
183  void endAnonTypeScope(int);
184  void startMemberItem(const char *,int,const char *);
185  void endMemberItem();
187  void endMemberTemplateParams(const char *,const char *);
188 
189  void startMemberGroupHeader(bool);
190  void endMemberGroupHeader();
191  void startMemberGroupDocs();
192  void endMemberGroupDocs();
193  void startMemberGroup();
194  void endMemberGroup(bool);
195 
196  void insertMemberAlign(bool) {}
197 
198  void writeRuler() { t << endl << endl; }
199  void writeAnchor(const char *fileName,const char *name);
200  void startCodeFragment();
201  void endCodeFragment();
202  void startEmphasis() { t << "{\\em "; }
203  void endEmphasis() { t << "}"; }
204  void startBold() { t << "{\\bfseries "; }
205  void endBold() { t << "}"; }
206  void startDescription();
207  void endDescription();
208  void startDescItem();
209  void endDescItem();
210  void lineBreak(const char *style=0);
211  void startMemberDoc(const char *,const char *,const char *,const char *,int,int,bool);
212  void endMemberDoc(bool);
213  void startDoxyAnchor(const char *,const char *,const char *,const char *,const char *);
214  void endDoxyAnchor(const char *,const char *);
215  void writeChar(char c);
216  void writeLatexSpacing() { t << "\\hspace{0.3cm}"; }
217  void writeStartAnnoItem(const char *type,const char *file,
218  const char *path,const char *name);
219  void writeEndAnnoItem(const char *name);
220  void startSubsection() { t << "\\subsection*{"; }
221  void endSubsection() { t << "}" << endl; }
222  void startSubsubsection() { t << "\\subsubsection*{"; }
223  void endSubsubsection() { t << "}" << endl; }
224  void startCenter() { t << "\\begin{center}" << endl; }
225  void endCenter() { t << "\\end{center}" << endl; }
226  void startSmall() { t << "\\footnotesize "; }
227  void endSmall() { t << "\\normalsize "; }
228  void startMemberDescription(const char *,const char *);
229  void endMemberDescription();
231  void endMemberDeclaration(const char *,const char *) {}
232  void writeInheritedSectionTitle(const char *,const char *,const char *,
233  const char *,const char *,const char *) {}
234  void startDescList(SectionTypes) { t << "\\begin{Desc}\n\\item["; }
235  void endDescList() { t << "\\end{Desc}" << endl; }
236  void startSimpleSect(SectionTypes,const char *,const char *,const char *);
237  void endSimpleSect();
238  void startParamList(ParamListTypes,const char *title);
239  void endParamList();
240  void startDescForItem() { t << "\\par" << endl; }
241  void endDescForItem() {}
242  void startSection(const char *,const char *,SectionInfo::SectionType);
243  void endSection(const char *,SectionInfo::SectionType);
244  void addIndexItem(const char *,const char *);
245  void startIndent() {}
246  void endIndent() {}
247  void writeSynopsis() {}
248  void startClassDiagram();
249  void endClassDiagram(const ClassDiagram &,const char *,const char *);
250  void startPageRef();
251  void endPageRef(const char *,const char *);
253  void endQuickIndices() {}
254  void writeSplitBar(const char *) {}
255  void writeNavigationPath(const char *) {}
256  void writeLogo() {}
257  void writeQuickLinks(bool,HighlightedItem,const char*) {}
258  void writeSummaryLink(const char *,const char *,const char *,bool) {}
259  void startContents() {}
260  void endContents() {}
261  void writeNonBreakableSpace(int);
262 
263  void startDescTable(const char *title);
264  void endDescTable();
265  void startDescTableRow();
266  void endDescTableRow();
267  void startDescTableTitle();
268  void endDescTableTitle();
269  void startDescTableData();
270  void endDescTableData();
271  void lastIndexPage();
272 
273  void startDotGraph();
274  void endDotGraph(const DotClassGraph &);
275  void startInclDepGraph();
276  void endInclDepGraph(const DotInclDepGraph &);
277  void startCallGraph();
280  void endCallGraph(const DotCallGraph &);
281  void startDirDepGraph();
282  void endDirDepGraph(const DotDirDeps &g);
284 
285  void startTextBlock(bool) {}
286  void endTextBlock(bool) {}
287 
289  void endMemberDocPrefixItem() { t << "\\\\" << endl; }
290  void startMemberDocName(bool) {}
292  void startParameterType(bool,const char *);
293  void endParameterType();
294  void startParameterName(bool);
295  void endParameterName(bool,bool,bool);
296  void startParameterList(bool);
297  void endParameterList();
298  void exceptionEntry(const char*,bool);
299 
300  void startConstraintList(const char *);
301  void startConstraintParam();
302  void endConstraintParam();
303  void startConstraintType();
304  void endConstraintType();
305  void startConstraintDocs();
306  void endConstraintDocs();
307  void endConstraintList();
308 
309  void startMemberDocSimple(bool);
310  void endMemberDocSimple(bool);
311  void startInlineMemberType();
312  void endInlineMemberType();
313  void startInlineMemberName();
314  void endInlineMemberName();
315  void startInlineMemberDoc();
316  void endInlineMemberDoc();
317 
318  void startLabels();
319  void writeLabel(const char *l,bool isLast);
320  void endLabels();
321 
322  void setCurrentDoc(Definition *,const char *,bool) {}
323  void addWord(const char *,bool) {}
324 
325 
326  private:
332  QCString relPath;
333  int m_indent;
337 };
338 
339 #endif