latexgen.h 10.4 KB
Newer Older
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1 2
/******************************************************************************
 *
3
 * 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
4
 *
Dimitri van Heesch's avatar
Dimitri van Heesch committed
5
 * Copyright (C) 1997-2013 by Dimitri van Heesch.
Dimitri van Heesch's avatar
Dimitri van Heesch committed
6 7 8 9 10 11 12
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation under the terms of the GNU General Public License is hereby 
 * granted. No representations are made about the suitability of this software 
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
Dimitri van Heesch's avatar
Dimitri van Heesch committed
13 14
 * Documents produced by Doxygen are derivative works derived from the
 * input used in their production; they are not affected by this license.
Dimitri van Heesch's avatar
Dimitri van Heesch committed
15 16 17
 *
 */

18 19
#ifndef LATEXGEN_H
#define LATEXGEN_H
Dimitri van Heesch's avatar
Dimitri van Heesch committed
20 21 22 23 24

#include "outputgen.h"

class QFile;

Dimitri van Heesch's avatar
Dimitri van Heesch committed
25
/** Generator for LaTeX output. */
Dimitri van Heesch's avatar
Dimitri van Heesch committed
26 27 28 29 30
class LatexGenerator : public OutputGenerator
{
  public:
    LatexGenerator();
   ~LatexGenerator();
31 32
    static void init();
    static void writeStyleSheetFile(QFile &f);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
33
    static void writeHeaderFile(QFile &f);
34
    static void writeFooterFile(QFile &f);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
35

36
    //OutputGenerator *copy();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
37
    //OutputGenerator *clone() { return new LatexGenerator(*this); }
38
    //void append(const OutputGenerator *o);
39 40
    void enable() 
    { if (genStack->top()) active=*genStack->top(); else active=TRUE; }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
41
    void disable() { active=FALSE; }
42 43 44
    void enableIf(OutputType o)  { if (o==Latex) enable();  }
    void disableIf(OutputType o) { if (o==Latex) disable(); }
    void disableIfNot(OutputType o) { if (o!=Latex) disable(); }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
45 46 47
    bool isEnabled(OutputType o) { return (o==Latex && active); } 
    OutputGenerator *get(OutputType o) { return (o==Latex) ? this : 0; }

Dimitri van Heesch's avatar
Dimitri van Heesch committed
48
    void writeDoc(DocNode *,Definition *ctx,MemberDef *);
49

50
    void startFile(const char *name,const char *manName,const char *title);
51
    void writeSearchInfo() {}
52
    void writeFooter(const char *) {}
Dimitri van Heesch's avatar
Dimitri van Heesch committed
53 54 55 56 57
    void endFile();
    void clearBuffer();
    
    void startIndexSection(IndexSections);
    void endIndexSection(IndexSections);
58
    void writePageLink(const char *,bool);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
59 60 61
    void startProjectNumber();
    void endProjectNumber() {}
    void writeStyleInfo(int part);
62
    void startTitleHead(const char *);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
63
    void startTitle();
64
    void endTitleHead(const char *,const char *name);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
65 66 67
    void endTitle()   { t << "}"; }

    void newParagraph();
68 69
    void startParagraph();
    void endParagraph();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
70
    void writeString(const char *text);
71 72
    void startIndexListItem() {}
    void endIndexListItem() {}
73 74
    void startIndexList() { t << "\\begin{DoxyCompactList}"    << endl; }
    void endIndexList()   { t << "\\end{DoxyCompactList}"      << endl; }
75 76
    void startIndexKey();
    void endIndexKey();
77 78
    void startIndexValue(bool);
    void endIndexValue(const char *,bool);
79 80
    void startItemList()  { t << "\\begin{DoxyCompactItemize}" << endl; }
    void endItemList()    { t << "\\end{DoxyCompactItemize}"   << endl; }
81 82
    void startIndexItem(const char *ref,const char *file);
    void endIndexItem(const char *ref,const char *file);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
83 84 85
    void docify(const char *text);
    void codify(const char *text);
    void writeObjectLink(const char *ref,const char *file,
86
                         const char *anchor,const char *name);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
87
    void writeCodeLink(const char *ref, const char *file,
88 89
                       const char *anchor,const char *name,
                       const char *tooltip);
90 91
    void startTextLink(const char *,const char *);
    void endTextLink();
92
    void startHtmlLink(const char *url);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
93
    void endHtmlLink();
94
    void startTypewriter() { t << "{\\ttfamily "; }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
95
    void endTypewriter()   { t << "}";      }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
96 97
    void startGroupHeader(int);
    void endGroupHeader(int);
98 99
    void startItemListItem() { t << "\\item " << endl; }
    void endItemListItem()   {}
Dimitri van Heesch's avatar
Dimitri van Heesch committed
100

101 102
    void startMemberSections() {}
    void endMemberSections() {} 
103 104 105
    void startHeaderSection() {}
    void endHeaderSection() {}
    void startMemberHeader(const char *);
106
    void endMemberHeader();
107 108
    void startMemberSubtitle() {}
    void endMemberSubtitle() {}
109 110
    void startMemberDocList() {}
    void endMemberDocList() {}
111 112
    void startMemberList();
    void endMemberList();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
113 114
    void startInlineHeader();
    void endInlineHeader();
115 116
    void startAnonTypeScope(int);
    void endAnonTypeScope(int);
117
    void startMemberItem(const char *,int,const char *);
118
    void endMemberItem();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
119
    void startMemberTemplateParams();
120
    void endMemberTemplateParams(const char *,const char *);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
121

Dimitri van Heesch's avatar
Dimitri van Heesch committed
122
    void startMemberGroupHeader(bool);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
123 124 125 126 127 128
    void endMemberGroupHeader();
    void startMemberGroupDocs();
    void endMemberGroupDocs();
    void startMemberGroup();
    void endMemberGroup(bool);
    
Dimitri van Heesch's avatar
Dimitri van Heesch committed
129
    void insertMemberAlign(bool) {}
Dimitri van Heesch's avatar
Dimitri van Heesch committed
130

131
    void writeRuler() { t << endl << endl; }
132
    void writeAnchor(const char *fileName,const char *name);
133 134 135
    void startCodeFragment();
    void endCodeFragment();
    void writeLineNumber(const char *,const char *,const char *,int l);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
136
    void startCodeLine(bool hasLineNumbers);
137
    void endCodeLine();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
138 139
    void startEmphasis() { t << "{\\em ";  }
    void endEmphasis()   { t << "}"; }
140
    void startBold()     { t << "{\\bfseries "; }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
141
    void endBold()       { t << "}"; }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
142 143 144 145
    void startDescription();
    void endDescription();
    void startDescItem();
    void endDescItem();
146
    void lineBreak(const char *style=0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
147
    void startMemberDoc(const char *,const char *,const char *,const char *,bool);
148
    void endMemberDoc(bool);
149
    void startDoxyAnchor(const char *,const char *,const char *,const char *,const char *);
150
    void endDoxyAnchor(const char *,const char *);
151 152
    void startCodeAnchor(const char *);
    void endCodeAnchor();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
153 154 155 156 157 158 159 160 161 162 163 164 165
    void writeChar(char c);
    void writeLatexSpacing() { t << "\\hspace{0.3cm}"; }
    void writeStartAnnoItem(const char *type,const char *file, 
                            const char *path,const char *name);
    void writeEndAnnoItem(const char *name);
    void startSubsection() { t << "\\subsection*{"; }
    void endSubsection() { t << "}" << endl; }
    void startSubsubsection() { t << "\\subsubsection*{"; }
    void endSubsubsection() { t << "}" << endl; }
    void startCenter()      { t << "\\begin{center}" << endl; }
    void endCenter()        { t << "\\end{center}" << endl; }
    void startSmall()       { t << "\\footnotesize "; }
    void endSmall()         { t << "\\normalsize "; }
166
    void startMemberDescription(const char *,const char *);
167
    void endMemberDescription();
168 169
    void startMemberDeclaration() {} 
    void endMemberDeclaration(const char *,const char *) {}
Dimitri van Heesch's avatar
Dimitri van Heesch committed
170
    void writeInheritedSectionTitle(const char *,const char *,const char *,
171
                      const char *,const char *,const char *) {}
172
    void startDescList(SectionTypes)     { t << "\\begin{Desc}\n\\item["; }
173
    void endDescList()       { t << "\\end{Desc}" << endl; }
174 175 176 177
    void startSimpleSect(SectionTypes,const char *,const char *,const char *);
    void endSimpleSect();
    void startParamList(ParamListTypes,const char *title);
    void endParamList();
178 179
    void startDescForItem()     { t << "\\par" << endl; }
    void endDescForItem()       {}
180 181
    void startSection(const char *,const char *,SectionInfo::SectionType);
    void endSection(const char *,SectionInfo::SectionType);
182
    void addIndexItem(const char *,const char *);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
183 184 185 186
    void startIndent()       {}
    void endIndent()         {}
    void writeSynopsis()     {}
    void startClassDiagram();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
187
    void endClassDiagram(const ClassDiagram &,const char *,const char *);
188 189
    void startPageRef();
    void endPageRef(const char *,const char *);
190 191
    void startQuickIndices() {}
    void endQuickIndices() {}
192
    void writeSplitBar(const char *) {}
Dimitri van Heesch's avatar
Dimitri van Heesch committed
193
    void writeNavigationPath(const char *) {}
194
    void writeLogo() {}
195
    void writeQuickLinks(bool,HighlightedItem,const char*) {}
Dimitri van Heesch's avatar
Dimitri van Heesch committed
196
    void writeSummaryLink(const char *,const char *,const char *,bool) {}
197 198
    void startContents() {}
    void endContents() {}
199
    void writeNonBreakableSpace(int);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
200
    
201 202 203 204
    void startDescTable(const char *title)
    { startSimpleSect(EnumValues,0,0,title);
      startDescForItem();
      t << "\\begin{description}" << endl; }
205
    void endDescTable()
206 207 208 209
    { t << "\\end{description}" << endl; 
      endDescForItem();
      endSimpleSect();
    }
210
    void startDescTableTitle()
Dimitri van Heesch's avatar
Dimitri van Heesch committed
211
    { t << "\\item[{\\em " << endl; }
212
    void endDescTableTitle()
Dimitri van Heesch's avatar
Dimitri van Heesch committed
213
    { t << "}]"; }
214 215
    void startDescTableData() {}
    void endDescTableData() {}
Dimitri van Heesch's avatar
Dimitri van Heesch committed
216
    void lastIndexPage() {}
217

218
    void startDotGraph();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
219
    void endDotGraph(const DotClassGraph &);
220
    void startInclDepGraph();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
221
    void endInclDepGraph(const DotInclDepGraph &);
222
    void startCallGraph();
223
    void startGroupCollaboration();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
224 225
    void endGroupCollaboration(const DotGroupCollaboration &g);
    void endCallGraph(const DotCallGraph &);
226
    void startDirDepGraph();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
227 228
    void endDirDepGraph(const DotDirDeps &g);
    void writeGraphicalHierarchy(const DotGfxHierarchyTable &) {}
Dimitri van Heesch's avatar
Dimitri van Heesch committed
229 230

    void startTextBlock(bool) {}
231
    void endTextBlock(bool) {}
232 233 234

    void startMemberDocPrefixItem() {}
    void endMemberDocPrefixItem() {}
Dimitri van Heesch's avatar
Dimitri van Heesch committed
235
    void startMemberDocName(bool) {}
236
    void endMemberDocName() {}
237
    void startParameterType(bool,const char *);
238 239 240 241
    void endParameterType();
    void startParameterName(bool);
    void endParameterName(bool,bool,bool);
    void startParameterList(bool);
242
    void endParameterList();
243
    void exceptionEntry(const char*,bool);
244

245 246 247 248 249 250 251 252 253
    void startConstraintList(const char *);
    void startConstraintParam();
    void endConstraintParam();
    void startConstraintType();
    void endConstraintType();
    void startConstraintDocs();
    void endConstraintDocs();
    void endConstraintList();

254 255 256 257 258 259 260 261 262
    void startMemberDocSimple();
    void endMemberDocSimple();
    void startInlineMemberType();
    void endInlineMemberType();
    void startInlineMemberName();
    void endInlineMemberName();
    void startInlineMemberDoc();
    void endInlineMemberDoc();

263 264 265 266
    void startLabels();
    void writeLabel(const char *l,bool isLast);
    void endLabels();

267 268
    void startFontClass(const char *); // {}
    void endFontClass(); // {}
Dimitri van Heesch's avatar
Dimitri van Heesch committed
269

270
    void writeCodeAnchor(const char *) {}
Dimitri van Heesch's avatar
Dimitri van Heesch committed
271 272 273
    void setCurrentDoc(Definition *,const char *,bool) {}
    void addWord(const char *,bool) {}

274

Dimitri van Heesch's avatar
Dimitri van Heesch committed
275 276 277
  private:
    LatexGenerator(const LatexGenerator &);
    LatexGenerator &operator=(const LatexGenerator &);
278 279
    void escapeLabelName(const char *s);
    void escapeMakeIndexChars(const char *s);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
280
    int col;
281
    bool insideTabbing;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
282
    bool firstDescItem;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
283
    bool disableLinks;
284
    QCString relPath;
285
    QCString sourceFileName;
286
    int m_indent;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
287
    bool templateMemberItem;
288
    bool m_prettyCode;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
289 290 291
};

#endif