static void writeDefaultHeaderFile(QTextStream &t, const char *title, const char *relPath,bool usePathCmd) { QString relPathStr; if (usePathCmd) relPathStr="$relpath$"; else relPathStr=relPath; t << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n" "<html><head>" "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=" << theTranslator->idLanguageCharset() << "\">\n" "<title>"; t << convertToHtml(title); t << "</title>\n"; t << "<link "; t << "href=\""; if (Config_getString("HTML_STYLESHEET").isEmpty()) { t << relPathStr << "doxygen.css"; } else { QCString cssname=Config_getString("HTML_STYLESHEET"); QFileInfo cssfi(cssname); if (!cssfi.exists()) { err("Error: user specified HTML style sheet file does not exist!\n"); } t << relPathStr << cssfi.fileName(); } t << "\" rel=\"stylesheet\" type=\"text/css\">\n" "</head><body>\n"; }
void HtmlGenerator::writeStyleInfo(int part) { //printf("writeStyleInfo(%d)\n",part); if (part==0) { if (Config_getString("HTML_STYLESHEET").isEmpty()) // write default style sheet { //printf("write doxygen.css\n"); 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 << defaultStyleSheet; endPlainFile(); } else // write user defined style sheet { QCString cssname=Config_getString("HTML_STYLESHEET"); QFileInfo cssfi(cssname); if (!cssfi.exists() || !cssfi.isFile() || !cssfi.isReadable()) { err("Error: style sheet %s does not exist or is not readable!", Config_getString("HTML_STYLESHEET").data()); } else { // convert style sheet to string QCString fileStr = fileToString(cssname); // write the string into the output dir startPlainFile(cssfi.fileName()); t << fileStr; endPlainFile(); } } } }
void FTVHelp::generateTreeView(QString* OutString) { QCString fileName; QFile f; static bool searchEngine = Config_getBool("SEARCHENGINE"); generateTreeViewImages(); // If top level index, generate alternative index.html as a frame if (m_topLevelIndex) { fileName=Config_getString("HTML_OUTPUT")+"/index"+Doxygen::htmlFileExtension; f.setName(fileName); if (!f.open(IO_WriteOnly)) { err("Cannot open file %s for writing!\n",fileName.data()); return; } else { QTextStream t(&f); #if QT_VERSION >= 200 t.setEncoding(QTextStream::UnicodeUTF8); #endif //t << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\">\n"; t << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n"; t << "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n"; t << "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\"/>\n"; t << "<title>"; if (Config_getString("PROJECT_NAME").isEmpty()) { t << "Doxygen Documentation"; } else { t << Config_getString("PROJECT_NAME"); } t << "</title>\n</head>" << endl; t << "<frameset cols=\"" << Config_getInt("TREEVIEW_WIDTH") << ",*\">" << endl; t << " <frame src=\"tree" << Doxygen::htmlFileExtension << "\" name=\"treefrm\"/>" << endl; t << " <frame src=\"main" << Doxygen::htmlFileExtension << "\" name=\"basefrm\"/>" << endl; t << " <noframes>" << endl; t << " <body>" << endl; t << " <a href=\"main" << Doxygen::htmlFileExtension << "\">Frames are disabled. Click here to go to the main page.</a>" << endl; t << " </body>" << endl; t << " </noframes>" << endl; t << "</frameset>" << endl; t << "</html>" << endl; f.close(); } } // Generate tree view if (!OutString) OutString = new QString; QTextOStream t(OutString); t.setEncoding(QTextStream::UnicodeUTF8); if (m_topLevelIndex) { if (searchEngine) { t << "<!-- This comment will put IE 6, 7 and 8 in quirks mode -->" << endl; } t << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; t << "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n"; t << " <head>\n"; t << " <meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>\n"; t << " <meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />\n"; t << " <meta http-equiv=\"Content-Language\" content=\"en\" />\n"; if (searchEngine) { t << " <link href=\"search/search.css\" rel=\"stylesheet\" type=\"text/css\"/>" << endl; t << " <script type=\"text/javaScript\" src=\"search/search.js\"></script>" << endl; } t << " <link rel=\"stylesheet\" href=\""; QCString cssname=Config_getString("HTML_STYLESHEET"); if (cssname.isEmpty()) { t << "doxygen.css"; } else { QFileInfo cssfi(cssname); if (!cssfi.exists()) { err("Error: user specified HTML style sheet file does not exist!\n"); } t << cssfi.fileName(); } t << "\"/>" << endl; t << " <title>TreeView</title>\n"; } t << " <script type=\"text/javascript\">\n"; t << " <!-- // Hide script from old browsers\n"; t << " \n"; /* User has clicked on a node (folder or +/-) in the tree */ t << " function toggleFolder(id, imageNode) \n"; t << " {\n"; t << " var folder = document.getElementById(id);\n"; t << " var l = imageNode.src.length;\n"; /* If the user clicks on the book icon, we move left one image so * the code (below) will also adjust the '+' icon. */ t << " if (imageNode.src.substring(l-20,l)==\"" FTV_ICON_FILE(folderclosed) "\" || \n"; t << " imageNode.src.substring(l-18,l)==\"" FTV_ICON_FILE(folderopen) "\")\n"; t << " {\n"; t << " imageNode = imageNode.previousSibling;\n"; t << " l = imageNode.src.length;\n"; t << " }\n"; t << " if (folder == null) \n"; t << " {\n"; t << " } \n"; /* Node controls a open section, we need to close it */ t << " else if (folder.style.display == \"block\") \n"; t << " {\n"; t << " if (imageNode != null) \n"; t << " {\n"; t << " imageNode.nextSibling.src = \"" FTV_ICON_FILE(folderclosed) "\";\n"; t << " if (imageNode.src.substring(l-13,l) == \"" FTV_ICON_FILE(mnode) "\")\n"; t << " {\n"; t << " imageNode.src = \"" FTV_ICON_FILE(pnode) "\";\n"; t << " }\n"; t << " else if (imageNode.src.substring(l-17,l) == \"" FTV_ICON_FILE(mlastnode) "\")\n"; t << " {\n"; t << " imageNode.src = \"" FTV_ICON_FILE(plastnode) "\";\n"; t << " }\n"; t << " }\n"; t << " folder.style.display = \"none\";\n"; t << " } \n"; t << " else \n"; /* section is closed, we need to open it */ t << " {\n"; t << " if (imageNode != null) \n"; t << " {\n"; t << " imageNode.nextSibling.src = \"" FTV_ICON_FILE(folderopen) "\";\n"; t << " if (imageNode.src.substring(l-13,l) == \"" FTV_ICON_FILE(pnode) "\")\n"; t << " {\n"; t << " imageNode.src = \"" FTV_ICON_FILE(mnode) "\";\n"; t << " }\n"; t << " else if (imageNode.src.substring(l-17,l) == \"" FTV_ICON_FILE(plastnode) "\")\n"; t << " {\n"; t << " imageNode.src = \"" FTV_ICON_FILE(mlastnode) "\";\n"; t << " }\n"; t << " }\n"; t << " folder.style.display = \"block\";\n"; t << " }\n"; t << " }\n"; t << "\n"; t << " // End script hiding --> \n"; t << " </script>\n"; if (m_topLevelIndex) { t << " </head>\n"; t << "\n"; t << " <body class=\"ftvtree\""; if (searchEngine) { t << " onload='searchBox.OnSelectItem(0);'"; } t << ">\n"; if (searchEngine) { t << " <script type=\"text/javascript\"><!--\n"; t << " var searchBox = new SearchBox(\"searchBox\", \"search\", true);\n"; t << " --></script>\n"; t << " <div id=\"MSearchBox\" class=\"MSearchBoxInactive\">\n"; t << " <div class=\"MSearchBoxRow\"><span class=\"MSearchBoxLeft\">\n"; t << " <input type=\"text\" id=\"MSearchField\" value=\"Search\" \n"; t << " onfocus=\"searchBox.OnSearchFieldFocus(true)\" \n"; t << " onblur=\"searchBox.OnSearchFieldFocus(false)\" \n"; t << " onkeyup=\"searchBox.OnSearchFieldChange()\"/>\n"; t << " </span><span class=\"MSearchBoxRight\">\n"; t << " <img id=\"MSearchSelect\" src=\"search/search.png\"\n"; t << " onmouseover=\"return searchBox.OnSearchSelectShow()\"\n"; t << " onmouseout=\"return searchBox.OnSearchSelectHide()\"\n"; t << " alt=\"\"/>\n"; t << " </span></div><div class=\"MSearchBoxSpacer\"> </div>\n"; t << " </div>\n"; HtmlGenerator::writeSearchFooter(t,QCString()); } t << " <div class=\"directory\">\n"; t << " <h3 class=\"swap\"><span>"; QCString &projName = Config_getString("PROJECT_NAME"); if (projName.isEmpty()) { t << "Root"; } else { t << projName; } t << "</span></h3>\n"; } else { t << " <div class=\"directory-alt\">\n"; t << " <br/>\n"; } t << " <div style=\"display: block;\">\n"; generateTree(t,m_indentNodes[0],0); t << " </div>\n"; t << " </div>\n"; if (m_topLevelIndex) { t << " </body>\n"; t << "</html>\n"; } if (m_topLevelIndex) { fileName=Config_getString("HTML_OUTPUT")+"/tree"+Doxygen::htmlFileExtension; f.setName(fileName); if (!f.open(IO_WriteOnly)) { err("Cannot open file %s for writing!\n",fileName.data()); return; } else { QTextStream t(&f); t.setEncoding(QTextStream::UnicodeUTF8); t << *OutString << endl; f.close(); } } }
void FTVHelp::generateTreeView() { QCString fileName; QFile f; static bool searchEngine = Config_getBool("SEARCHENGINE"); static bool serverBasedSearch = Config_getBool("SERVER_BASED_SEARCH"); generateTreeViewImages(); fileName=Config_getString("HTML_OUTPUT")+"/index"+Doxygen::htmlFileExtension; f.setName(fileName); if (!f.open(IO_WriteOnly)) { err("Cannot open file %s for writing!\n",fileName.data()); return; } else { FTextStream t(&f); //t << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\">\n"; t << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n"; t << "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n"; t << "<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>\n"; t << "<title>"; if (Config_getString("PROJECT_NAME").isEmpty()) { t << "Doxygen Documentation"; } else { t << Config_getString("PROJECT_NAME"); } t << "</title>\n</head>" << endl; t << "<frameset cols=\"" << Config_getInt("TREEVIEW_WIDTH") << ",*\">" << endl; t << " <frame src=\"tree" << Doxygen::htmlFileExtension << "\" name=\"treefrm\"/>" << endl; t << " <frame src=\"main" << Doxygen::htmlFileExtension << "\" name=\"basefrm\"/>" << endl; t << " <noframes>" << endl; t << " <body>" << endl; t << " <a href=\"main" << Doxygen::htmlFileExtension << "\">Frames are disabled. Click here to go to the main page.</a>" << endl; t << " </body>" << endl; t << " </noframes>" << endl; t << "</frameset>" << endl; t << "</html>" << endl; f.close(); } // Generate tree view fileName=Config_getString("HTML_OUTPUT")+"/tree"+Doxygen::htmlFileExtension; f.setName(fileName); if (!f.open(IO_WriteOnly)) { err("Cannot open file %s for writing!\n",fileName.data()); return; } else { FTextStream t(&f); //if (searchEngine) //{ // t << "<!-- This comment will put IE 6, 7 and 8 in quirks mode -->" << endl; //} t << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; t << "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n"; t << " <head>\n"; t << " <meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>\n"; t << " <meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />\n"; t << " <meta http-equiv=\"Content-Language\" content=\"en\" />\n"; if (searchEngine) { t << " <link href=\"search/search.css\" rel=\"stylesheet\" type=\"text/css\"/>" << endl; t << " <script type=\"text/javaScript\" src=\"search/search.js\"></script>" << endl; } t << " <link rel=\"stylesheet\" href=\""; QCString cssname=Config_getString("HTML_STYLESHEET"); if (cssname.isEmpty()) { t << "doxygen.css"; } else { QFileInfo cssfi(cssname); if (!cssfi.exists()) { err("Error: user specified HTML style sheet file does not exist!\n"); } t << cssfi.fileName(); } t << "\"/>" << endl; t << " <title>TreeView</title>\n"; generateScript(t); t << " </head>\n"; t << "\n"; t << " <body class=\"ftvtree\""; if (searchEngine && !serverBasedSearch) { t << " onload='searchBox.OnSelectItem(0);'"; } t << ">\n"; if (searchEngine) { t << " <script type=\"text/javascript\"><!--\n"; t << " var searchBox = new SearchBox(\"searchBox\", \"search\", true, '" << theTranslator->trSearch() << "');\n"; t << " --></script>\n"; if (!serverBasedSearch) { t << " <div class=\"tabsearch\">\n"; t << " <div id=\"MSearchBox\" class=\"MSearchBoxInactive\">\n"; t << " <span class=\"left\">\n"; t << " <a id=\"MSearchClose\" href=\"javascript:searchBox.CloseResultsWindow()\">" << "<img id=\"MSearchCloseImg\" border=\"0\" src=\"search/close.png\" alt=\"\"/></a>\n"; t << " <input type=\"text\" id=\"MSearchField\" value=\"" << theTranslator->trSearch() << "\" accesskey=\"S\"\n"; t << " onfocus=\"searchBox.OnSearchFieldFocus(true)\" \n"; t << " onblur=\"searchBox.OnSearchFieldFocus(false)\" \n"; t << " onkeyup=\"searchBox.OnSearchFieldChange(event)\"/>\n"; t << " </span><span class=\"right\">\n"; t << " <img id=\"MSearchSelect\" src=\"search/mag_sel.png\"\n"; t << " onmouseover=\"return searchBox.OnSearchSelectShow()\"\n"; t << " onmouseout=\"return searchBox.OnSearchSelectHide()\"\n"; t << " alt=\"\"/>\n"; t << " </span>\n"; t << " </div>\n"; t << " </div>\n"; HtmlGenerator::writeSearchFooter(t,QCString()); } else { t << " <div class=\"tabsearch\">\n"; t << " <div id=\"MSearchBox\" class=\"MSearchBoxInactive\">\n"; t << " <span class=\"left\">\n"; t << " <form id=\"FSearchBox\" action=\"search.php\" method=\"get\" target=\"basefrm\">\n"; t << " <img id=\"MSearchSelect\" src=\"search/mag.png\" alt=\"\"/>\n"; t << " <input type=\"text\" id=\"MSearchField\" name=\"query\" value=\"" << theTranslator->trSearch() << "\" size=\"20\" accesskey=\"S\" \n"; t << " onfocus=\"searchBox.OnSearchFieldFocus(true)\" \n"; t << " onblur=\"searchBox.OnSearchFieldFocus(false)\"/>\n"; t << " </form>\n"; t << " </span><span class=\"right\"></span>\n"; t << " </div>\n"; t << " </div>\n"; } } t << " <div class=\"directory\">\n"; t << " <h3 class=\"swap\"><span>"; QCString &projName = Config_getString("PROJECT_NAME"); if (projName.isEmpty()) { t << "Root"; } else { t << projName; } t << "</span></h3>\n"; t << " <div style=\"display: block;\">\n"; generateTree(t,m_indentNodes[0],0); t << " </div>\n"; t << " </div>\n"; t << " </body>\n"; t << "</html>\n"; f.close(); } }