00001 /****************************************************************************** 00002 * 00003 * $Id: htmlgen.h,v 1.51 2001/03/19 19:27:40 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 HTMLGEN_H 00019 #define HTMLGEN_H 00020 00021 #include "qtbc.h" 00022 #include "outputgen.h" 00023 00024 #define PREFRAG_START "<div class=\"fragment\"><pre class=\"fragment\">" 00025 #define PREFRAG_END "</pre></div>" 00026 00027 class QFile; 00028 00029 class HtmlGenerator : public OutputGenerator 00030 { 00031 public: 00032 HtmlGenerator(); 00033 virtual ~HtmlGenerator(); 00034 static void init(); 00035 static void writeStyleSheetFile(QFile &f); 00036 static void writeHeaderFile(QFile &f); 00037 static void writeFooterFile(QFile &f); 00038 00039 void enable() 00040 { if (genStack->top()) active=*genStack->top(); else active=TRUE; } 00041 void disable() { active=FALSE; } 00042 void enableIf(OutputType o) { if (o==Html) active=TRUE; } 00043 void disableIf(OutputType o) { if (o==Html) active=FALSE; } 00044 void disableIfNot(OutputType o) { if (o!=Html) active=FALSE; } 00045 bool isEnabled(OutputType o) { return (o==Html && active); } 00046 OutputGenerator *get(OutputType o) { return (o==Html) ? this : 0; } 00047 00048 void printDoc(DocNode *,const char *); 00049 00050 void startFile(const char *name,const char *manName,const char *title); 00051 void writeFooter(); 00052 void endFile(); 00053 void clearBuffer(); 00054 00055 void startIndexSection(IndexSections) {} 00056 void endIndexSection(IndexSections) {} 00057 void writePageLink(const char *,bool) {} 00058 void startProjectNumber(); 00059 void endProjectNumber(); 00060 void writeStyleInfo(int part); 00061 void startTitleHead(const char *) { startTitle(); } 00062 void endTitleHead(const char *,const char *) { endTitle(); } 00063 void startTitle() { t << "<h1>"; } 00064 void endTitle() { t << "</h1>"; } 00065 00066 void newParagraph(); 00067 void startParagraph(); 00068 void endParagraph(); 00069 void writeString(const char *text); 00070 void startIndexList(); 00071 void endIndexList(); 00072 void startIndexKey(); 00073 void endIndexKey(); 00074 void startIndexValue(bool); 00075 void endIndexValue(const char *,bool); 00076 void startItemList() { t << "<ul>" << endl; } 00077 void endItemList() { t << "</ul>" << endl; } 00078 void startIndexItem(const char *ref,const char *file); 00079 void endIndexItem(const char *ref,const char *file); 00080 void docify(const char *text); 00081 void codify(const char *text); 00082 void writeObjectLink(const char *ref,const char *file, 00083 const char *anchor,const char *name); 00084 void writeCodeLink(const char *ref,const char *file, 00085 const char *anchor,const char *name, 00086 const char *tooltip); 00087 void startTextLink(const char *file,const char *anchor); 00088 void endTextLink(); 00089 void startHtmlLink(const char *url); 00090 void endHtmlLink(); 00091 void startTypewriter() { t << "<code>"; } 00092 void endTypewriter() { t << "</code>"; } 00093 void startGroupHeader(); 00094 void endGroupHeader(); 00095 void writeListItem() { t << "<li>"; } 00096 00097 void startMemberSections(); 00098 void endMemberSections(); 00099 void startMemberHeader(); 00100 void endMemberHeader(); 00101 void startMemberSubtitle(); 00102 void endMemberSubtitle(); 00103 void startMemberDocList(); 00104 void endMemberDocList(); 00105 void startMemberList(); 00106 void endMemberList(); 00107 void startAnonTypeScope(int) {} 00108 void endAnonTypeScope(int) {} 00109 void startMemberItem(int); 00110 void endMemberItem(); 00111 void startMemberTemplateParams(); 00112 void endMemberTemplateParams(); 00113 00114 void startMemberGroupHeader(bool); 00115 void endMemberGroupHeader(); 00116 void startMemberGroupDocs(); 00117 void endMemberGroupDocs(); 00118 void startMemberGroup(); 00119 void endMemberGroup(bool); 00120 00121 void insertMemberAlign(bool); 00122 void startMemberDescription(); 00123 void endMemberDescription(); 00124 00125 void writeRuler() { t << "<hr>"; } 00126 void writeAnchor(const char *,const char *name) 00127 { t << "<a name=\"" << name <<"\"></a>"; } 00128 void startCodeFragment() { t << PREFRAG_START; } 00129 void endCodeFragment() { t << PREFRAG_END; } 00130 void writeLineNumber(const char *,const char *,const char *,int); 00131 void startCodeLine() { col=0; } 00132 void endCodeLine() { codify("\n"); } 00133 void startEmphasis() { t << "<em>"; } 00134 void endEmphasis() { t << "</em>"; } 00135 void startBold() { t << "<b>"; } 00136 void endBold() { t << "</b>"; } 00137 void startDescription() { t << endl << "<dl compact>" << endl; } 00138 void endDescription() { t << endl << "</dl>" << endl; } 00139 void startDescItem() { t << "<dt>"; } 00140 void endDescItem() { t << "<dd>"; } 00141 void lineBreak() { t << "<br>" << endl; } 00142 void writeChar(char c); 00143 void startMemberDoc(const char *,const char *,const char *,const char *); 00144 void endMemberDoc(bool); 00145 void startDoxyAnchor(const char *fName,const char *manName, 00146 const char *anchor,const char *name, 00147 const char *args); 00148 void endDoxyAnchor(const char *fName,const char *anchor); 00149 void startCodeAnchor(const char *label) { t << "<a name=\"" << label << "\"></a>"; } 00150 void endCodeAnchor() { } 00151 void writeLatexSpacing() {} 00152 void writeStartAnnoItem(const char *type,const char *file, 00153 const char *path,const char *name); 00154 void writeEndAnnoItem(const char *) { t << endl; } 00155 void startSubsection() { t << "<h2>"; } 00156 void endSubsection() { t << "</h2>" << endl; } 00157 void startSubsubsection() { t << "<h3>"; } 00158 void endSubsubsection() { t << "</h3>" << endl; } 00159 void startCenter() { t << "<center>" << endl; } 00160 void endCenter() { t << "</center>" << endl; } 00161 void startSmall() { t << "<small>" << endl; } 00162 void endSmall() { t << "</small>" << endl; } 00163 void startDescList(SectionTypes) { t << "<dl compact><dt><b>" << endl; } 00164 void endDescList() { t << "</dl>"; } 00165 void startSimpleSect(SectionTypes,const char *,const char *,const char *); 00166 void endSimpleSect(); 00167 void startParamList(ParamListTypes,const char *); 00168 void endParamList(); 00169 void writeDescItem() { t << "<dd>" << endl; } 00170 void startSection(const char *,const char *,SectionInfo::SectionType); 00171 void endSection(const char *,SectionInfo::SectionType); 00172 void addIndexItem(const char *,const char *); 00173 void startIndent(); 00174 void endIndent(); 00175 void writeSynopsis() {} 00176 void startClassDiagram(); 00177 void endClassDiagram(const ClassDiagram &,const char *,const char *); 00178 void startPageRef() {} 00179 void endPageRef(const char *,const char *) {} 00180 void startQuickIndices(); 00181 void endQuickIndices(); 00182 void writeQuickLinks(bool compact,HighlightedItem hli); 00183 void startContents(); 00184 void endContents(); 00185 void writeNonBreakableSpace(int); 00186 00187 void startDescTable() 00188 { t << "<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\">" << endl; } 00189 void endDescTable() 00190 { t << "</table>" << endl; } 00191 void startDescTableTitle() 00192 { t << "<tr><td valign=\"top\"><em>"; } 00193 void endDescTableTitle() 00194 { t << "</em> </td>"; } 00195 void startDescTableData() 00196 { t << "<td>" << endl; } 00197 void endDescTableData() 00198 { t << "</td></tr>" << endl; } 00199 00200 void startDotGraph(); 00201 void endDotGraph(const DotClassGraph &g); 00202 void startInclDepGraph(); 00203 void endInclDepGraph(const DotInclDepGraph &g); 00204 void startGroupCollaboration(); 00205 void endGroupCollaboration(const DotGroupCollaboration &g); 00206 void startCallGraph(); 00207 void endCallGraph(const DotCallGraph &g); 00208 void startDirDepGraph(); 00209 void endDirDepGraph(const DotDirDeps &g); 00210 void writeGraphicalHierarchy(const DotGfxHierarchyTable &g); 00211 00212 void startTextBlock(bool) {} 00213 void endTextBlock(bool) {} 00214 void lastIndexPage() {} 00215 00216 void startMemberDocPrefixItem(); 00217 void endMemberDocPrefixItem(); 00218 void startMemberDocName(bool); 00219 void endMemberDocName(); 00220 void startParameterType(bool first,const char *key); 00221 void endParameterType(); 00222 void startParameterName(bool); 00223 void endParameterName(bool last,bool emptyList,bool closeBracket); 00224 void startParameterList(bool); 00225 void endParameterList(); 00226 00227 void startConstraintList(const char *); 00228 void startConstraintParam(); 00229 void endConstraintParam(); 00230 void startConstraintType(); 00231 void endConstraintType(); 00232 void startConstraintDocs(); 00233 void endConstraintDocs(); 00234 void endConstraintList(); 00235 00236 void startFontClass(const char *s) { t << "<span class=\"" << s << "\">"; } 00237 void endFontClass() { t << "</span>"; } 00238 00239 void writeCodeAnchor(const char *anchor) 00240 { t << "<a name=\"" << anchor << "\"></a>"; } 00241 void linkableSymbol(int,const char *,Definition *,Definition *) {} 00242 00243 static void writeSearchPage(); 00244 static void generateSectionImages(); 00245 00246 private: 00247 QCString lastTitle; 00248 QCString lastFile; 00249 QCString relPath; 00250 00251 HtmlGenerator &operator=(const HtmlGenerator &g); 00252 HtmlGenerator(const HtmlGenerator &g); 00253 00254 int col; 00255 }; 00256 00257 #endif