/****************************************************************************** * * * * Copyright (C) 1997-2000 by Dimitri van Heesch. * * 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. * * Documents produced by Doxygen are derivative works derived from the * input used in their production; they are not affected by this license. * */ #include #include "qtbc.h" #include #include "message.h" #include "htmlgen.h" #include "config.h" #include "util.h" #include "doxygen.h" #include "logos.h" #include "diagram.h" #include "version.h" #include "dot.h" #define GROUP_COLOR "#ff8080" //#define DBG_HTML(x) x; #define DBG_HTML(x) HtmlHelp *HtmlGenerator::htmlHelp = 0; HtmlGenerator::HtmlGenerator() : OutputGenerator() { if (!Config::headerFile.isEmpty()) header=fileToString(Config::headerFile); if (!Config::footerFile.isEmpty()) footer=fileToString(Config::footerFile); dir=Config::htmlOutputDir; col=0; } HtmlGenerator::~HtmlGenerator() { } void HtmlGenerator::append(const OutputGenerator *g) { t << g->getContents(); col+=((HtmlGenerator *)g)->col; } void HtmlGenerator::init() { QDir d(Config::htmlOutputDir); if (!d.exists() && !d.mkdir(Config::htmlOutputDir)) { err("Could not create output directory %s\n",Config::htmlOutputDir.data()); exit(1); } writeLogo(Config::htmlOutputDir); writeNullImage(Config::htmlOutputDir); } void HtmlGenerator::startFile(const char *name,const char *title,bool external) { QCString fileName=name; lastTitle=title; if (fileName.right(5)!=".html") fileName+=".html"; startPlainFile(fileName); lastFile = fileName; if (header.isEmpty()) { t << "\n" "\n" "" << title << "\n"; t << "\n" "\n"; } else { t << substituteKeywords(header,lastTitle); } t << "" << endl; } void HtmlGenerator::startQuickIndexItem(const char *s,const char *l) { QCString *dest; if (s) { t << ""; } void HtmlGenerator::endQuickIndexItem() { t << "   "; } void HtmlGenerator::writeFooter(int part,bool external) { switch (part) { case 0: if (footer.isEmpty()) t << "
"; else t << substituteKeywords(footer,lastTitle); break; case 1: if (footer.isEmpty()) { t << endl << ""; t << endl << "\"doxygen\" " << versionString <<" "; } break; default: if (footer.isEmpty()) t << " Dimitri van Heesch,\n © " "1997-2000
\n\n\n"; break; } } void HtmlGenerator::endFile() { endPlainFile(); } void HtmlGenerator::startProjectNumber() { t << "

"; } void HtmlGenerator::endProjectNumber() { t << "

"; } void HtmlGenerator::writeStyleInfo(int part) { if (part==0) { if (Config::htmlStyleSheet.isEmpty()) // write default style sheet { startPlainFile("doxygen.css"); // alternative, cooler looking titles //t << "H1 { text-align: center; border-width: thin none thin none;" << endl; //t << " border-style : double; border-color : blue; padding-left : 1em; padding-right : 1em }" << endl; t << "H1 { text-align: center; }" << endl; t << "A.qindex {}" << endl; t << "A.qindexRef {}" << endl; t << "A.el { text-decoration: none; font-weight: bold }" << endl; t << "A.elRef { font-weight: bold }" << endl; t << "A.code { text-decoration: none; font-weight: normal; color: #4444ee }" << endl; t << "A.codeRef { font-weight: normal; color: #4444ee }" << endl; t << "DL.el { margin-left: -1cm }" << endl; t << "DIV.fragment { width: 100%; border: none; background-color: #eeeeee }" << endl; t << "DIV.in { margin-left: 16 }" << endl; t << "DIV.ah { background-color: black; margin-bottom: 3; margin-top: 3 }" << endl; t << "TD.md { background-color: #f2f2ff }" << endl; t << "DIV.groupHeader { margin-left: 16; margin-top: 12; margin-bottom: 6; font-weight: bold }" << endl; t << "DIV.groupText { margin-left: 16; font-style: italic; font-size: smaller }" << endl; //t << "TD.groupLine { background-color: #3080ff }" << endl; t << endl; endPlainFile(); } else // write user defined style sheet { startPlainFile(Config::htmlStyleSheet); t << fileToString(Config::htmlStyleSheet); endPlainFile(); } } } void HtmlGenerator::startDoxyAnchor(const char *,const char *, const char *anchor, const char *name) { t << ""; } void HtmlGenerator::endDoxyAnchor() { t << "" << endl; } void HtmlGenerator::newParagraph() { t << endl << "

" << endl; } void HtmlGenerator::writeString(const char *text) { t << text; } void HtmlGenerator::writeIndexItem(const char *ref,const char *f, const char *name) { QCString *dest; t << "

  • "; if (ref || f) { if (ref) { t << ""; } else { t << ""; } docify(name); if (ref || f) { t << "" << endl; } else { t << ""; } //if (Config::htmlHelpFlag && f) //{ // htmlHelp->addItem(name,((QCString)f)+".html"); //} } void HtmlGenerator::writeStartAnnoItem(const char *,const char *f, const char *path,const char *name) { t << "
  • "; if (path) docify(path); t << ""; docify(name); t << " "; //if (Config::htmlHelpFlag && f) //{ // htmlHelp->addItem(name, ((QCString)f)+".html"); //} } void HtmlGenerator::writeObjectLink(const char *ref,const char *f, const char *anchor, const char *name) { QCString *dest; if (ref) { t << ""; docify(name); t << ""; } void HtmlGenerator::writeCodeLink(const char *ref,const char *f, const char *anchor, const char *name) { QCString *dest; if (ref) { t << ""; docify(name); t << ""; col+=strlen(name); } void HtmlGenerator::startTextLink(const char *f,const char *anchor) { t << ""; } void HtmlGenerator::endTextLink() { t << ""; } void HtmlGenerator::writeHtmlLink(const char *url,const char *text) { t << ""; docify(text); t << ""; } void HtmlGenerator::writeMailLink(const char *url) { t << ""; docify(url); t << ""; } void HtmlGenerator::startGroupHeader() { t << "

    "; } void HtmlGenerator::endGroupHeader() { t << "

    " << endl; } void HtmlGenerator::writeSection(const char *lab,const char *title,bool sub) { t << ""; if (sub) t << "

    "; else t << "

    "; docify(title); if (sub) t << "

    "; else t << ""; t << "
    " << endl; } void HtmlGenerator::writeSectionRef(const char *name,const char *lab, const char *title) { QCString refName=name; if (refName.right(5)!=".html") refName+=".html"; t << ""; docify(title); t << ""; } void HtmlGenerator::writeSectionRefItem(const char *name,const char *lab, const char *title) { QCString refName=name; if (refName.right(5)!=".html") refName+=".html"; t << ""; docify(title); t << ""; } void HtmlGenerator::writeSectionRefAnchor(const char *name,const char *lab, const char *title) { writeSectionRef(name,lab,title); } void HtmlGenerator::docify(const char *str) { if (str) { const char *p=str; char c; while (*p) { c=*p++; switch(c) { case '<': t << "<"; break; case '>': t << ">"; break; case '&': t << "&"; break; case '\\': if (*p=='<') { t << "<"; p++; } else if (*p=='>') { t << ">"; p++; } else t << "\\"; break; default: t << c; } } } } void HtmlGenerator::codify(const char *str) { //docify(str); //static char spaces[]=" "; if (str) { const char *p=str; char c; int spacesToNextTabStop; while (*p) { c=*p++; switch(c) { case '\t': spacesToNextTabStop = Config::tabSize - (col%Config::tabSize); t << spaces.left(spacesToNextTabStop); col+=spacesToNextTabStop; break; case '\n': t << '\n'; col=0; break; case '<': t << "<"; col++; break; case '>': t << ">"; col++; break; case '&': t << "&"; col++; break; case '\\': if (*p=='<') { t << "<"; p++; } else if (*p=='>') { t << ">"; p++; } else t << "\\"; col++; break; default: t << c; col++; break; } } } } void HtmlGenerator::writeChar(char c) { char cs[2]; cs[0]=c; cs[1]=0; docify(cs); } void HtmlGenerator::startClassDiagram() { t << "

    "; } void HtmlGenerator::endClassDiagram(ClassDiagram &d, const char *fileName,const char *name) { t << ":\n

    " << endl << "

    " << endl; d.writeImageMap(t,dir,fileName); } void HtmlGenerator::startColorFont(uchar red,uchar green,uchar blue) { QCString colorString; colorString.sprintf("%02x%02x%02x",red,green,blue); t << ""; } void HtmlGenerator::endColorFont() { t << ""; } void HtmlGenerator::writeFormula(const char *n,const char *text) { if (text && text[0]=='\\') t << "

    " << endl; t << "" << endl; if (text && text[0]=='\\') t << "

    " << endl; } void HtmlGenerator::startMemberList() { DBG_HTML(t << "" << endl) if (Config::htmlAlignMemberFlag) { } else { t << "

      " << endl; } } void HtmlGenerator::endMemberList() { DBG_HTML(t << "" << endl) if (Config::htmlAlignMemberFlag) { } else { t << "
    " << endl; } } // annonymous type: // 0 = single column right aligned // 1 = double column left aligned // 2 = single column left aligned void HtmlGenerator::startMemberItem(int annoType) { DBG_HTML(t << "" << endl) if (Config::htmlAlignMemberFlag) { t << ""; switch(annoType) { case 0: t << ""; break; case 1: t << ""; break; default: t << ""; break; } } else { t << "
  • "; } } void HtmlGenerator::endMemberItem(bool) { //DBG_HTML(t << "" << endl) if (Config::htmlAlignMemberFlag) { t << ""; } t << endl; } void HtmlGenerator::startParameter(bool first) { if (first) { t << endl << "" << endl; t << "" << endl; } else { t << "" << endl; } } void HtmlGenerator::endParameter(bool) { t << "" << endl; } void HtmlGenerator::insertMemberAlign() { DBG_HTML(t << "" << endl) if (Config::htmlAlignMemberFlag) { t << " "; } } void HtmlGenerator::startMemberDescription() { DBG_HTML(t << "" << endl) if (Config::htmlAlignMemberFlag) { //t << "" // ""; t << " "; } else { t << "
    "; } } void HtmlGenerator::endMemberDescription() { DBG_HTML(t << "" << endl) if (Config::htmlAlignMemberFlag) { t << "

    " << endl; } else { t << "
    "; } } void HtmlGenerator::startMemberSections() { DBG_HTML(t << "" << endl) if (Config::htmlAlignMemberFlag) { t << "" << endl; } } void HtmlGenerator::endMemberSections() { DBG_HTML(t << "" << endl) if (Config::htmlAlignMemberFlag) { t << "
    " << endl; } } void HtmlGenerator::startMemberHeader() { DBG_HTML(t << "" << endl) if (Config::htmlAlignMemberFlag) { t << "

    "; } else { startGroupHeader(); } } void HtmlGenerator::endMemberHeader() { DBG_HTML(t << "" << endl) if (Config::htmlAlignMemberFlag) { t << "

    " << endl; } else { endGroupHeader(); } } void HtmlGenerator::startMemberSubtitle() { DBG_HTML(t << "" << endl) if (Config::htmlAlignMemberFlag) t << ""; } void HtmlGenerator::endMemberSubtitle() { DBG_HTML(t << "" << endl) if (Config::htmlAlignMemberFlag) t << "

    " << endl; } void HtmlGenerator::startIndexList() { t << "
      " << endl; //if (Config::htmlHelpFlag) //{ // if (htmlHelp->depth()==0) htmlHelp->addItem(lastTitle,lastFile); // htmlHelp->incDepth(); //} } void HtmlGenerator::endIndexList() { t << "
    " << endl; //if (Config::htmlHelpFlag) //{ // htmlHelp->decDepth(); //} } void HtmlGenerator::startAlphabeticalIndexList() { t << "" << endl; } void HtmlGenerator::endAlphabeticalIndexList() { t << "
    " << endl; } void HtmlGenerator::writeIndexHeading(const char *s) { //t << "
    " << s << "
    " << endl; t << "
      " << s << "  
    "; } void HtmlGenerator::writeImage(const char *name,const char *,const char *) { QCString baseName=name; int i; if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1) { baseName=baseName.right(baseName.length()-i-1); } t << "\""" << endl; } void HtmlGenerator::startMemberDoc(const char *,const char *,const char *,const char *) { t << "

    " << endl; t << "" << endl; t << " " << endl; t << " " << endl; t << " " << endl; t << "
    " << endl; t << " " << endl; t << " " << endl; t << " " << endl; t << " " << endl; t << "
    " << endl; } void HtmlGenerator::endMemberDoc() { t << endl; t << "
    " << endl; t << "
    " << endl; } void HtmlGenerator::startCollaborationDiagram() { } void HtmlGenerator::endCollaborationDiagram(DotGfxUsageGraph &g) { g.writeGraph(t,Config::htmlOutputDir); } void HtmlGenerator::startInclDepGraph() { } void HtmlGenerator::endInclDepGraph(DotInclDepGraph &g) { g.writeGraph(t,Config::htmlOutputDir); } void HtmlGenerator::writeGraphicalHierarchy(DotGfxHierarchyTable &g) { g.writeGraph(t,Config::htmlOutputDir); } void HtmlGenerator::startMemberGroupHeader() { //t << "" << endl; //t << "" << endl; //t << "

    " << endl; //t << " " << endl; //t << " " << endl; //t << " " << endl; //t << " " << endl; //t << " " << endl; //t << " " << endl; //t << " " << endl; //t << " " << endl; //t << "
      "; t << "
    "; } void HtmlGenerator::endMemberGroupHeader() { //t << "  
    " << endl; //t << "
    " << endl; //t << "" << endl; //t << "" << endl; t << "" << endl; } void HtmlGenerator::startMemberGroupDocs() { //t << "" << endl; t << "
    "; } void HtmlGenerator::endMemberGroupDocs() { t << "

    " << endl; } void HtmlGenerator::startMemberGroup() { } void HtmlGenerator::endMemberGroup(bool) { }