00001 /****************************************************************************** 00002 * 00003 * $Id: latexgen.h,v 1.50 2001/03/19 19:27:41 root Exp $ 00004 * 00005 * Copyright (C) 1997-2008 by Dimitri van Heesch. 00006 * 00007 * Permission to use, copy, modify, and distribute this software and its 00008 * documentation under the terms of the GNU General Public License is hereby 00009 * granted. No representations are made about the suitability of this software 00010 * for any purpose. It is provided "as is" without express or implied warranty. 00011 * See the GNU General Public License for more details. 00012 * 00013 * Documents produced by Doxygen are derivative works derived from the 00014 * input used in their production; they are not affected by this license. 00015 * 00016 */ 00017 00018 #ifndef LATEXGEN_H 00019 #define LATEXGEN_H 00020 00021 #include "outputgen.h" 00022 00023 class QFile; 00024 00025 class LatexGenerator : public OutputGenerator 00026 { 00027 public: 00028 LatexGenerator(); 00029 ~LatexGenerator(); 00030 static void init(); 00031 static void writeStyleSheetFile(QFile &f); 00032 static void writeHeaderFile(QFile &f); 00033 00034 //OutputGenerator *copy(); 00035 //OutputGenerator *clone() { return new LatexGenerator(*this); } 00036 //void append(const OutputGenerator *o); 00037 void enable() 00038 { if (genStack->top()) active=*genStack->top(); else active=TRUE; } 00039 void disable() { active=FALSE; } 00040 void enableIf(OutputType o) { if (o==Latex) active=TRUE; } 00041 void disableIf(OutputType o) { if (o==Latex) active=FALSE; } 00042 void disableIfNot(OutputType o) { if (o!=Latex) active=FALSE; } 00043 bool isEnabled(OutputType o) { return (o==Latex && active); } 00044 OutputGenerator *get(OutputType o) { return (o==Latex) ? this : 0; } 00045 00046 void printDoc(DocNode *,const char *); 00047 00048 void startFile(const char *name,const char *manName,const char *title); 00049 void writeFooter() {} 00050 void endFile(); 00051 void clearBuffer(); 00052 00053 void startIndexSection(IndexSections); 00054 void endIndexSection(IndexSections); 00055 void writePageLink(const char *,bool); 00056 void startProjectNumber(); 00057 void endProjectNumber() {} 00058 void writeStyleInfo(int part); 00059 void startTitleHead(const char *); 00060 void startTitle(); 00061 void endTitleHead(const char *,const char *name); 00062 void endTitle() { t << "}"; } 00063 00064 void newParagraph(); 00065 void startParagraph(); 00066 void endParagraph(); 00067 void writeString(const char *text); 00068 void startIndexList() { t << "\\begin{CompactList}" << endl; } 00069 void endIndexList() { t << "\\end{CompactList}" << endl; } 00070 void startIndexKey(); 00071 void endIndexKey(); 00072 void startIndexValue(bool); 00073 void endIndexValue(const char *,bool); 00074 void startItemList() { t << "\\begin{CompactItemize}" << endl; } 00075 void endItemList() { t << "\\end{CompactItemize}" << endl; } 00076 void startIndexItem(const char *ref,const char *file); 00077 void endIndexItem(const char *ref,const char *file); 00078 void docify(const char *text); 00079 void codify(const char *text); 00080 void writeObjectLink(const char *ref,const char *file, 00081 const char *anchor,const char *name); 00082 void writeCodeLink(const char *ref, const char *file, 00083 const char *anchor,const char *name, 00084 const char *tooltip); 00085 void startTextLink(const char *,const char *); 00086 void endTextLink(); 00087 void startHtmlLink(const char *url); 00088 void endHtmlLink(); 00089 void startTypewriter() { t << "{\\tt "; } 00090 void endTypewriter() { t << "}"; } 00091 void startGroupHeader(); 00092 void endGroupHeader(); 00093 void writeListItem() { t << "\\item " << endl; } 00094 00095 void startMemberSections() {} 00096 void endMemberSections() {} 00097 void startMemberHeader(); 00098 void endMemberHeader(); 00099 void startMemberSubtitle() {} 00100 void endMemberSubtitle() {} 00101 void startMemberDocList() {} 00102 void endMemberDocList() {} 00103 void startMemberList(); 00104 void endMemberList(); 00105 void startAnonTypeScope(int); 00106 void endAnonTypeScope(int); 00107 void startMemberItem(int); 00108 void endMemberItem(); 00109 void startMemberTemplateParams(); 00110 void endMemberTemplateParams(); 00111 00112 void startMemberGroupHeader(bool); 00113 void endMemberGroupHeader(); 00114 void startMemberGroupDocs(); 00115 void endMemberGroupDocs(); 00116 void startMemberGroup(); 00117 void endMemberGroup(bool); 00118 00119 void insertMemberAlign(bool) {} 00120 00121 void writeRuler() { t << endl << endl; /*t << "\\vspace{0.4cm}\\hrule\\vspace{0.2cm}" << endl; */ } 00122 void writeAnchor(const char *fileName,const char *name); 00123 void startCodeFragment() { t << endl << endl << "\\begin{Code}\\begin{verbatim}"; } 00124 void endCodeFragment() { t << "\\end{verbatim}\n\\end{Code}" << endl; } 00125 void writeLineNumber(const char *,const char *,const char *,int l) { t << l << " "; } 00126 void startCodeLine() { col=0; } 00127 void endCodeLine() { codify("\n"); } 00128 void startEmphasis() { t << "{\\em "; } 00129 void endEmphasis() { t << "}"; } 00130 void startBold() { t << "\\textbf{"; } 00131 void endBold() { t << "}"; } 00132 void startDescription(); 00133 void endDescription(); 00134 void startDescItem(); 00135 void endDescItem(); 00136 void lineBreak() { t << "\\par\n"; } 00137 void startMemberDoc(const char *,const char *,const char *,const char *); 00138 void endMemberDoc(bool); 00139 void startDoxyAnchor(const char *,const char *,const char *,const char *,const char *); 00140 void endDoxyAnchor(const char *,const char *); 00141 void startCodeAnchor(const char *) {} 00142 void endCodeAnchor() {} 00143 void writeChar(char c); 00144 void writeLatexSpacing() { t << "\\hspace{0.3cm}"; } 00145 void writeStartAnnoItem(const char *type,const char *file, 00146 const char *path,const char *name); 00147 void writeEndAnnoItem(const char *name); 00148 void startSubsection() { t << "\\subsection*{"; } 00149 void endSubsection() { t << "}" << endl; } 00150 void startSubsubsection() { t << "\\subsubsection*{"; } 00151 void endSubsubsection() { t << "}" << endl; } 00152 void startCenter() { t << "\\begin{center}" << endl; } 00153 void endCenter() { t << "\\end{center}" << endl; } 00154 void startSmall() { t << "\\footnotesize "; } 00155 void endSmall() { t << "\\normalsize "; } 00156 void startMemberDescription(); 00157 void endMemberDescription(); 00158 void startDescList(SectionTypes) { t << "\\begin{Desc}\n\\item["; } 00159 void endDescList() { t << "\\end{Desc}" << endl; } 00160 void startSimpleSect(SectionTypes,const char *,const char *,const char *); 00161 void endSimpleSect(); 00162 void startParamList(ParamListTypes,const char *title); 00163 void endParamList(); 00164 void writeDescItem() { t << "\\par" << endl; } 00165 void startSection(const char *,const char *,SectionInfo::SectionType); 00166 void endSection(const char *,SectionInfo::SectionType); 00167 void addIndexItem(const char *,const char *); 00168 void startIndent() {} 00169 void endIndent() {} 00170 void writeSynopsis() {} 00171 void startClassDiagram(); 00172 void endClassDiagram(const ClassDiagram &,const char *,const char *); 00173 void startPageRef(); 00174 void endPageRef(const char *,const char *); 00175 void startQuickIndices() {} 00176 void endQuickIndices() {} 00177 void writeQuickLinks(bool,HighlightedItem) {} 00178 void startContents() {} 00179 void endContents() {} 00180 void writeNonBreakableSpace(int); 00181 00182 void startDescTable() 00183 { t << "\\begin{description}" << endl; } 00184 void endDescTable() 00185 { t << "\\end{description}" << endl; } 00186 void startDescTableTitle() 00187 { t << "\\item[{\\em " << endl; } 00188 void endDescTableTitle() 00189 { t << "}]"; } 00190 void startDescTableData() {} 00191 void endDescTableData() {} 00192 void lastIndexPage() {} 00193 00194 void startDotGraph(); 00195 void endDotGraph(const DotClassGraph &); 00196 void startInclDepGraph(); 00197 void endInclDepGraph(const DotInclDepGraph &); 00198 void startCallGraph(); 00199 void startGroupCollaboration(); 00200 void endGroupCollaboration(const DotGroupCollaboration &g); 00201 void endCallGraph(const DotCallGraph &); 00202 void startDirDepGraph(); 00203 void endDirDepGraph(const DotDirDeps &g); 00204 void writeGraphicalHierarchy(const DotGfxHierarchyTable &) {} 00205 00206 void startTextBlock(bool) {} 00207 void endTextBlock(bool) {} 00208 00209 void startMemberDocPrefixItem() {} 00210 void endMemberDocPrefixItem() {} 00211 void startMemberDocName(bool) {} 00212 void endMemberDocName() {} 00213 void startParameterType(bool,const char *); 00214 void endParameterType() {} 00215 void startParameterName(bool) {} 00216 void endParameterName(bool,bool,bool) {} 00217 void startParameterList(bool) {} 00218 void endParameterList() {} 00219 00220 void startConstraintList(const char *); 00221 void startConstraintParam(); 00222 void endConstraintParam(); 00223 void startConstraintType(); 00224 void endConstraintType(); 00225 void startConstraintDocs(); 00226 void endConstraintDocs(); 00227 void endConstraintList(); 00228 00229 void startFontClass(const char *) {} 00230 void endFontClass() {} 00231 00232 void writeCodeAnchor(const char *) {} 00233 void linkableSymbol(int,const char *,Definition *,Definition *) {} 00234 00235 private: 00236 LatexGenerator(const LatexGenerator &); 00237 LatexGenerator &operator=(const LatexGenerator &); 00238 void escapeLabelName(const char *s); 00239 void escapeMakeIndexChars(const char *s); 00240 int col; 00241 bool insideTabbing; 00242 bool firstDescItem; 00243 bool disableLinks; 00244 QCString relPath; 00245 int m_indent; 00246 bool templateMemberItem; 00247 }; 00248 00249 #endif