latexgen.cpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * $Id: latexgen.cpp,v 1.58 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 #include <stdlib.h>
00019 
00020 #include "qtbc.h"
00021 #include <qdir.h>
00022 #include "latexgen.h"
00023 #include "config.h"
00024 #include "message.h"
00025 #include "doxygen.h"
00026 #include "util.h"
00027 #include "diagram.h"
00028 #include "language.h"
00029 #include "version.h"
00030 #include "dot.h"
00031 #include "pagedef.h"
00032 #include "docparser.h"
00033 #include "latexdocvisitor.h"
00034 #include "dirdef.h"
00035 
00036 //static QCString filterTitle(const char *s)
00037 //{
00038 //  QCString tmp=s,result;
00039 //  uint i;for (i=0;i<tmp.length();i++)
00040 //  {
00041 //    char c=tmp.at(i);
00042 //    switch(c)
00043 //    {
00044 //      case '#': result+="\\#";  break;
00045 //      case '"': result+="\\\""; break;
00046 //      case '%': result+="\\%";  break;
00047 //      case '[': result+="{";    break;
00048 //      case ']': result+="}";    break;
00049 //      default:  result+=c;      break;
00050 //    }
00051 //  }
00052 //  return result;  
00053 //}
00054 
00055 
00056 
00057 LatexGenerator::LatexGenerator() : OutputGenerator()
00058 {
00059   dir=Config_getString("LATEX_OUTPUT");
00060   col=0;
00061   //printf("LatexGenerator::LatexGenerator() insideTabbing=FALSE\n");
00062   insideTabbing=FALSE;
00063   firstDescItem=TRUE;
00064   disableLinks=FALSE;
00065   m_indent=0;
00066   templateMemberItem = FALSE;
00067 }
00068 
00069 LatexGenerator::~LatexGenerator()
00070 {
00071 }
00072 
00073 void LatexGenerator::init()
00074 {
00075   QCString dir=Config_getString("LATEX_OUTPUT");
00076   QDir d(dir);
00077   if (!d.exists() && !d.mkdir(dir))
00078   {
00079     err("Could not create output directory %s\n",dir.data());
00080     exit(1);
00081   }
00082   
00083   QCString fileName=dir+"/Makefile";
00084   QFile file(fileName);
00085   if (!file.open(IO_WriteOnly))
00086   {
00087     err("Could not open file %s for writing\n",fileName.data());
00088     exit(1);
00089   }
00090   // inserted by KONNO Akihisa <konno@researchers.jp> 2002-03-05
00091   QCString latex_command = Config_getString("LATEX_CMD_NAME");
00092   QCString mkidx_command = Config_getString("MAKEINDEX_CMD_NAME");
00093   // end insertion by KONNO Akihisa <konno@researchers.jp> 2002-03-05
00094   QTextStream t(&file);
00095   if (!Config_getBool("USE_PDFLATEX")) // use plain old latex
00096   {
00097     t << "all: clean refman.dvi" << endl
00098       << endl
00099       << "ps: refman.ps" << endl
00100       << endl
00101       << "pdf: refman.pdf" << endl
00102       << endl
00103       << "ps_2on1: refman_2on1.ps" << endl
00104       << endl
00105       << "pdf_2on1: refman_2on1.pdf" << endl
00106       << endl
00107       << "refman.ps: refman.dvi" << endl
00108       << "\tdvips -o refman.ps refman.dvi" << endl
00109       << endl;
00110     t << "refman.pdf: refman.ps" << endl;
00111 #if defined(_MSC_VER)
00112     // ps2pdf.bat does not work properly from a makefile using GNU make!
00113     t << "\tgswin32c -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite "
00114       "-sOutputFile=refman.pdf -c save pop -f refman.ps" << endl << endl;
00115 #else
00116     t << "\tps2pdf refman.ps refman.pdf" << endl << endl;
00117 #endif
00118     t << "refman.dvi: refman.tex doxygen.sty" << endl
00119       << "\techo \"Running latex...\"" << endl
00120       << "\t" << latex_command << " refman.tex" << endl
00121       << "\techo \"Running makeindex...\"" << endl
00122       << "\t" << mkidx_command << " refman.idx" << endl
00123       << "\techo \"Rerunning latex....\"" << endl
00124       << "\t" << latex_command << " refman.tex" << endl
00125       << "\tlatex_count=5 ; \\" << endl
00126       << "\twhile egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\\" << endl
00127       << "\t    do \\" << endl
00128       << "\t      echo \"Rerunning latex....\" ;\\" << endl
00129       << "\t      " << latex_command << " refman.tex ;\\" << endl
00130       << "\t      latex_count=`expr $$latex_count - 1` ;\\" << endl
00131       << "\t    done" << endl << endl
00132       << "refman_2on1.ps: refman.ps" << endl
00133       << "\tpsnup -2 refman.ps >refman_2on1.ps" << endl
00134       << endl
00135       << "refman_2on1.pdf: refman_2on1.ps" << endl
00136 #if defined(_MSC_VER)
00137       // ps2pdf.bat does not work properly from a makefile using GNU make!
00138       << "\tgswin32c -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite "
00139          "-sOutputFile=refman_2on1.pdf -c save pop -f refman_2on1.ps" << endl;
00140 #else
00141       << "\tps2pdf refman_2on1.ps refman_2on1.pdf" << endl;
00142 #endif
00143   }
00144   else // use pdflatex for higher quality output
00145   {
00146     t << "all: clean refman.pdf" << endl << endl
00147       << "pdf: refman.pdf" << endl << endl;
00148     t << "refman.pdf: refman.tex" << endl;
00149     t << "\tpdflatex refman.tex" << endl;
00150     t << "\tmakeindex refman.idx" << endl;
00151     t << "\tpdflatex refman.tex" << endl
00152       << "\tlatex_count=5 ; \\" << endl
00153       << "\twhile egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\\" << endl
00154       << "\t    do \\" << endl
00155       << "\t      echo \"Rerunning latex....\" ;\\" << endl
00156       << "\t      pdflatex refman.tex ;\\" << endl
00157       << "\t      latex_count=`expr $$latex_count - 1` ;\\" << endl
00158       << "\t    done" << endl << endl;
00159   }
00160 
00161   t << endl
00162     << "clean:" << endl
00163     << "\trm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out refman.pdf" << endl;
00164 
00165   createSubDirs(d);
00166 }
00167 
00168 static void writeDefaultHeaderPart1(QTextStream &t)
00169 {
00170   // part 1
00171 
00172   QCString paperName;
00173   if (Config_getBool("LATEX_BATCHMODE")) t << "\\batchmode" << endl;
00174   QCString &paperType=Config_getEnum("PAPER_TYPE");
00175   if (paperType=="a4wide") 
00176     paperName="a4"; 
00177   else 
00178     paperName=paperType;
00179   t << "\\documentclass[" << paperName << "paper";
00180   //if (Config_getBool("PDF_HYPERLINKS")) t << ",ps2pdf";
00181   t << "]{";
00182   if (Config_getBool("COMPACT_LATEX")) t << "article"; else t << "book";
00183   t << "}\n";
00184   if (paperType=="a4wide") t << "\\usepackage{a4wide}\n";
00185   t << "\\usepackage{makeidx}\n"
00186     "\\usepackage{fancyhdr}\n"
00187     "\\usepackage{graphicx}\n"
00188     "\\usepackage{multicol}\n"
00189     "\\usepackage{float}\n"
00190     "\\usepackage{textcomp}\n"
00191     "\\usepackage{alltt}\n"
00192     //"\\usepackage{ae,aecompl,aeguill}\n"
00193     ;
00194   if (Config_getBool("USE_PDFLATEX"))
00195   {
00196     t << "\\usepackage{times}" << endl;
00197   }
00198   if (Config_getBool("PDF_HYPERLINKS")) 
00199   {
00200     t << "\\usepackage{ifpdf}" << endl
00201       << "\\ifpdf" << endl
00202       << "\\usepackage[pdftex," << endl
00203       << "            pagebackref=true," << endl
00204       << "            colorlinks=true," << endl
00205       << "            linkcolor=blue," << endl
00206       << "            unicode" << endl
00207       << "           ]{hyperref}" << endl
00208       << "\\else" << endl
00209       << "\\usepackage[ps2pdf," << endl
00210       << "            pagebackref=true," << endl
00211       << "            colorlinks=true," << endl
00212       << "            linkcolor=blue," << endl
00213       << "            unicode" << endl
00214       << "           ]{hyperref}" << endl
00215       << "\\usepackage{pspicture}" << endl
00216       << "\\fi" << endl;
00217   }
00218   // Try to get the command for switching on the language
00219   // support
00220   t << "\\usepackage[utf8]{inputenc}" << endl;
00221   QCString sLanguageSupportCommand(
00222       theTranslator->latexLanguageSupportCommand());
00223 
00224   if (!sLanguageSupportCommand.isEmpty())
00225   {
00226     // The command is not empty.  Put it to the output.
00227     // if the command is empty, no output is needed.
00228     t << sLanguageSupportCommand << endl;
00229   }
00230   t << "\\usepackage{doxygen}\n";
00231   QStrList &extraPackages = Config_getList("EXTRA_PACKAGES");
00232   const char *s=extraPackages.first();
00233   while (s)
00234   {
00235     t << "\\usepackage{" << s << "}\n";
00236     s=extraPackages.next();
00237   }
00238   t << "\\makeindex\n"
00239     "\\setcounter{tocdepth}{1}\n"
00240     "\\renewcommand{\\footrulewidth}{0.4pt}\n"
00241     "\\begin{document}\n";
00242   if (theTranslator->idLanguage()=="greek") t << "\\selectlanguage{greek}\n";
00243   t << "\\begin{titlepage}\n"
00244     "\\vspace*{7cm}\n"
00245     "\\begin{center}\n"
00246     "{\\Large ";
00247 }
00248 
00249 static void writeDefaultHeaderPart2(QTextStream &t)
00250 {
00251   // part 2
00252   t << "}\\\\" << endl
00253     << "\\vspace*{1cm}" << endl
00254     << "{\\large ";
00255 }
00256 
00257 static void writeDefaultHeaderPart3(QTextStream &t)
00258 {
00259   // part 3
00260   t << " Doxygen " << versionString << "}\\\\" << endl
00261     << "\\vspace*{0.5cm}" << endl
00262     << "{\\small " << dateToString(TRUE) << "}\\\\" << endl
00263     << "\\end{center}" << endl
00264     << "\\end{titlepage}" << endl;
00265   if (!Config_getBool("COMPACT_LATEX")) t << "\\clearemptydoublepage\n";
00266   t << "\\pagenumbering{roman}\n";
00267   t << "\\tableofcontents\n";
00268   if (!Config_getBool("COMPACT_LATEX")) t << "\\clearemptydoublepage\n";
00269   t << "\\pagenumbering{arabic}\n";
00270 }
00271 
00272 static void writeDefaultStyleSheetPart1(QTextStream &t)
00273 {
00274   // part 1
00275   t << "\\NeedsTeXFormat{LaTeX2e}\n";
00276   t << "\\ProvidesPackage{doxygen}\n";
00277   t << "\\RequirePackage{calc}\n";
00278   t << "\\RequirePackage{array}\n";
00279   t << "\\pagestyle{fancyplain}\n";
00280   //t << "\\addtolength{\\headwidth}{\\marginparsep}\n";
00281   //t << "\\addtolength{\\headwidth}{\\marginparwidth}\n";
00282   t << "\\newcommand{\\clearemptydoublepage}{\\newpage{\\pagestyle{empty}";
00283   t << "\\cleardoublepage}}\n";
00284   if (!Config_getBool("COMPACT_LATEX")) 
00285     t << "\\renewcommand{\\chaptermark}[1]{\\markboth{#1}{}}\n";
00286   t << "\\renewcommand{\\sectionmark}[1]{\\markright{\\thesection\\ #1}}\n";
00287   t << "\\lhead[\\fancyplain{}{\\bfseries\\thepage}]\n";
00288   t << "        {\\fancyplain{}{\\bfseries\\rightmark}}\n";
00289   t << "\\rhead[\\fancyplain{}{\\bfseries\\leftmark}]\n";
00290   t << "        {\\fancyplain{}{\\bfseries\\thepage}}\n";
00291   t << "\\rfoot[\\fancyplain{}{\\bfseries\\scriptsize ";
00292 }
00293 
00294 static void writeDefaultStyleSheetPart2(QTextStream &t)
00295 {
00296   t << "\\lfoot[]{\\fancyplain{}{\\bfseries\\scriptsize ";
00297 }
00298 
00299 static void writeDefaultStyleSheetPart3(QTextStream &t)
00300 {
00301   t << "}}\n";
00302   t << "\\cfoot{}\n";
00303   t << "\\newenvironment{Code}\n";
00304   t << "{\\footnotesize}\n";
00305   t << "{\\normalsize}\n";
00306   t << "\\newcommand{\\doxyref}[3]{\\textbf{#1} (\\textnormal{#2}\\,\\pageref{#3})}\n";
00307   t << "\\newenvironment{DocInclude}\n";
00308   t << "{\\footnotesize}\n";
00309   t << "{\\normalsize}\n";
00310   t << "\\newenvironment{VerbInclude}\n";
00311   t << "{\\footnotesize}\n";
00312   t << "{\\normalsize}\n";
00313   t << "\\newenvironment{Image}\n";
00314   t << "{\\begin{figure}[H]}\n";
00315   t << "{\\end{figure}}\n";
00316   t << "\\newenvironment{ImageNoCaption}{}{}\n";
00317   t << "\\newenvironment{CompactList}\n";
00318   t << "{\\begin{list}{}{\n";
00319   t << "  \\setlength{\\leftmargin}{0.5cm}\n";
00320   t << "  \\setlength{\\itemsep}{0pt}\n";
00321   t << "  \\setlength{\\parsep}{0pt}\n";
00322   t << "  \\setlength{\\topsep}{0pt}\n";
00323   t << "  \\renewcommand{\\makelabel}{\\hfill}}}\n";
00324   t << "{\\end{list}}\n";
00325   t << "\\newenvironment{CompactItemize}\n";
00326   t << "{\n";
00327   t << "  \\begin{itemize}\n";
00328   t << "  \\setlength{\\itemsep}{-3pt}\n";
00329   t << "  \\setlength{\\parsep}{0pt}\n";
00330   t << "  \\setlength{\\topsep}{0pt}\n";
00331   t << "  \\setlength{\\partopsep}{0pt}\n";
00332   t << "}\n";
00333   t << "{\\end{itemize}}\n";
00334   t << "\\newcommand{\\PBS}[1]{\\let\\temp=\\\\#1\\let\\\\=\\temp}\n";
00335   t << "\\newlength{\\tmplength}\n";
00336   t << "\\newenvironment{TabularC}[1]\n";
00337   t << "{\n";
00338   t << "\\setlength{\\tmplength}\n";
00339   t << "     {\\linewidth/(#1)-\\tabcolsep*2-\\arrayrulewidth*(#1+1)/(#1)}\n";
00340   t << "      \\par\\begin{tabular*}{\\linewidth}\n";
00341   t << "             {*{#1}{|>{\\PBS\\raggedright\\hspace{0pt}}p{\\the\\tmplength}}|}\n";
00342   t << "}\n";
00343   t << "{\\end{tabular*}\\par}\n";
00344   t << "\\newcommand{\\entrylabel}[1]{\n";
00345   t << "   {\\parbox[b]{\\labelwidth-4pt}{\\makebox[0pt][l]{\\textbf{#1}}\\vspace{1.5\\baselineskip}}}}\n";
00346   t << "\\newenvironment{Desc}\n";
00347   t << "{\\begin{list}{}\n";
00348   t << "  {\n";
00349   t << "    \\settowidth{\\labelwidth}{40pt}\n";
00350   t << "    \\setlength{\\leftmargin}{\\labelwidth}\n";
00351   t << "    \\setlength{\\parsep}{0pt}\n";
00352   t << "    \\setlength{\\itemsep}{-4pt}\n";
00353   t << "    \\renewcommand{\\makelabel}{\\entrylabel}\n";
00354   t << "  }\n";
00355   t << "}\n";
00356   t << "{\\end{list}}\n";
00357 
00358   t << "\\newenvironment{Indent}\n";
00359   t << "  {\\begin{list}{}{\\setlength{\\leftmargin}{0.5cm}}\n";
00360   t << "      \\item[]\\ignorespaces}\n";
00361   t << "  {\\unskip\\end{list}}\n";
00362 
00363   t << "\\setlength{\\parindent}{0cm}\n";
00364   t << "\\setlength{\\parskip}{0.2cm}\n";
00365   t << "\\addtocounter{secnumdepth}{1}\n";
00366   t << "\\sloppy\n";
00367   t << "\\usepackage[T1]{fontenc}\n";
00368 }
00369 
00370 void LatexGenerator::writeHeaderFile(QFile &f)
00371 {
00372   QTextStream t(&f);
00373   writeDefaultHeaderPart1(t);
00374   t << "Your title here";
00375   writeDefaultHeaderPart2(t);
00376   t << "Generated by";
00377   writeDefaultHeaderPart3(t);
00378 }
00379 
00380 void LatexGenerator::writeStyleSheetFile(QFile &f)
00381 {
00382   QTextStream t(&f);
00383   t.setEncoding(QTextStream::UnicodeUTF8);
00384 
00385   writeDefaultStyleSheetPart1(t);
00386   QCString &projectName = Config_getString("PROJECT_NAME");
00387 
00388   t << theTranslator->trGeneratedAt( dateToString(TRUE), projectName );
00389   t << " doxygen";
00390   //t << " " << theTranslator->trWrittenBy() << " ";
00391   //t << "Dimitri van Heesch \\copyright~1997-2008";
00392   writeDefaultStyleSheetPart2(t);
00393   t << theTranslator->trGeneratedAt( dateToString(TRUE), projectName );
00394   t << " doxygen";
00395   //t << " << theTranslator->trWrittenBy() << " ";
00396   //t << "Dimitri van Heesch \\copyright~1997-2008";
00397   writeDefaultStyleSheetPart3(t);
00398 }
00399 
00400 void LatexGenerator::startFile(const char *name,const char *,const char *)
00401 {
00402 #if 0
00403   setEncoding(Config_getString("LATEX_OUTPUT_ENCODING"));
00404 #endif
00405   QCString fileName=name;
00406   relPath = relativePathToRoot(fileName);
00407   if (fileName.right(4)!=".tex" && fileName.right(4)!=".sty") fileName+=".tex";
00408   startPlainFile(fileName);
00409 }
00410 
00411 void LatexGenerator::endFile()
00412 {
00413   endPlainFile();
00414 }
00415 
00416 //void LatexGenerator::writeIndex()
00417 //{
00418 //  startFile("refman.tex");
00419 //} 
00420   
00421 void LatexGenerator::startProjectNumber()
00422 {
00423   t << "\\\\[1ex]\\large "; 
00424 }
00425 
00426 void LatexGenerator::startIndexSection(IndexSections is)
00427 {
00428   bool &compactLatex = Config_getBool("COMPACT_LATEX");
00429   QCString &latexHeader = Config_getString("LATEX_HEADER");
00430   switch (is)
00431   {
00432     case isTitlePageStart:
00433       {
00434         if (latexHeader.isEmpty())
00435         {
00436           writeDefaultHeaderPart1(t);
00437         }
00438         else
00439         {
00440           QCString header = fileToString(latexHeader);
00441           t << substituteKeywords(header,0);
00442         }
00443       }
00444       break;
00445     case isTitlePageAuthor:
00446       if (latexHeader.isEmpty())
00447       {
00448         writeDefaultHeaderPart2(t);
00449       }
00450       break;
00451     case isMainPage:
00452       if (compactLatex) t << "\\section"; else t << "\\chapter";
00453       t << "{"; //Introduction}\n"
00454       break;
00455     //case isPackageIndex:
00456     //  if (compactLatex) t << "\\section"; else t << "\\chapter";
00457     //  t << "{"; //Package Index}\n"
00458     //  break;
00459     case isModuleIndex:
00460       if (compactLatex) t << "\\section"; else t << "\\chapter";
00461       t << "{"; //Module Index}\n"
00462       break;
00463     case isDirIndex:
00464       if (compactLatex) t << "\\section"; else t << "\\chapter";
00465       t << "{"; //Directory Index}\n"
00466       break;
00467     case isNamespaceIndex:
00468       if (compactLatex) t << "\\section"; else t << "\\chapter";
00469       t << "{"; //Namespace Index}\"
00470       break;
00471     case isClassHierarchyIndex:
00472       if (compactLatex) t << "\\section"; else t << "\\chapter";
00473       t << "{"; //Hierarchical Index}\n"
00474       break;
00475     case isCompoundIndex:
00476       if (compactLatex) t << "\\section"; else t << "\\chapter";
00477       t << "{"; //Annotated Compound Index}\n"
00478       break;
00479     case isFileIndex:
00480       if (compactLatex) t << "\\section"; else t << "\\chapter";
00481       t << "{"; //Annotated File Index}\n"
00482       break;
00483     case isPageIndex:
00484       if (compactLatex) t << "\\section"; else t << "\\chapter";
00485       t << "{"; //Annotated Page Index}\n"
00486       break;
00487     case isModuleDocumentation:
00488       {
00489         GroupSDict::Iterator gli(*Doxygen::groupSDict);
00490         GroupDef *gd;
00491         bool found=FALSE;
00492         for (gli.toFirst();(gd=gli.current()) && !found;++gli)
00493         {
00494           if (!gd->isReference())
00495           {
00496             if (compactLatex) t << "\\section"; else t << "\\chapter";
00497             t << "{"; //Module Documentation}\n";
00498             found=TRUE;
00499           }
00500         }
00501       }
00502       break;
00503     case isDirDocumentation:
00504       {
00505         SDict<DirDef>::Iterator dli(*Doxygen::directories);
00506         DirDef *dd;
00507         bool found=FALSE;
00508         for (dli.toFirst();(dd=dli.current()) && !found;++dli)
00509         {
00510           if (dd->isLinkableInProject())
00511           {
00512             if (compactLatex) t << "\\section"; else t << "\\chapter";
00513             t << "{"; //Module Documentation}\n";
00514             found=TRUE;
00515           }
00516         }
00517       }
00518       break;
00519     case isNamespaceDocumentation:
00520       {
00521         NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict);
00522         NamespaceDef *nd;
00523         bool found=FALSE;
00524         for (nli.toFirst();(nd=nli.current()) && !found;++nli)
00525         {
00526           if (nd->isLinkableInProject())
00527           {
00528             if (compactLatex) t << "\\section"; else t << "\\chapter";
00529             t << "{"; // Namespace Documentation}\n":
00530             found=TRUE;
00531           }
00532         } 
00533       }
00534       break;
00535     case isClassDocumentation:
00536       {
00537         ClassSDict::Iterator cli(*Doxygen::classSDict);
00538         ClassDef *cd=0;
00539         bool found=FALSE;
00540         for (cli.toFirst();(cd=cli.current()) && !found;++cli)
00541         {
00542           if (cd->isLinkableInProject() && cd->templateMaster()==0)
00543           {
00544             if (compactLatex) t << "\\section"; else t << "\\chapter";
00545             t << "{"; //Compound Documentation}\n";
00546             found=TRUE;
00547           }
00548         }
00549       }
00550       break;
00551     case isFileDocumentation:
00552       {
00553         bool isFirst=TRUE;
00554         FileName *fn=Doxygen::inputNameList->first();
00555         while (fn)
00556         {
00557           FileDef *fd=fn->first();
00558           while (fd)
00559           {
00560             if (fd->isLinkableInProject())
00561             {
00562               if (isFirst)
00563               {
00564                 if (compactLatex) t << "\\section"; else t << "\\chapter";
00565                 t << "{"; //File Documentation}\n";
00566                 isFirst=FALSE;
00567                 break;
00568               }
00569             }
00570             fd=fn->next();
00571           }
00572           fn=Doxygen::inputNameList->next();
00573         }
00574       }
00575       break;
00576     case isExampleDocumentation:
00577       {
00578         if (compactLatex) t << "\\section"; else t << "\\chapter";
00579         t << "{"; //Example Documentation}\n";
00580       }
00581       break;
00582     case isPageDocumentation:
00583       {
00584         if (compactLatex) t << "\\section"; else t << "\\chapter";
00585         t << "{"; //Page Documentation}\n";
00586       }
00587       break;
00588     case isEndIndex:
00589       break;
00590   }
00591 }
00592 
00593 void LatexGenerator::endIndexSection(IndexSections is)
00594 {
00595   bool &compactLatex = Config_getBool("COMPACT_LATEX");
00596   QCString &latexHeader = Config_getString("LATEX_HEADER");
00597   switch (is)
00598   {
00599     case isTitlePageStart:
00600       break;
00601     case isTitlePageAuthor:
00602       if (latexHeader.isEmpty())
00603       {
00604         writeDefaultHeaderPart3(t);
00605       }
00606       break;
00607     case isMainPage:
00608       {
00609         QCString indexName="index";
00610         if (Config_getBool("GENERATE_TREEVIEW")) indexName="main";
00611         t << "}\n\\label{index}";
00612         if (Config_getBool("PDF_HYPERLINKS")) t << "\\hypertarget{index}{}";
00613         t << "\\input{" << indexName << "}\n";
00614       }
00615       break;
00616     case isModuleIndex:
00617       t << "}\n\\input{modules}\n";
00618       break;
00619     case isDirIndex:
00620       t << "}\n\\input{dirs}\n";
00621       break;
00622     case isNamespaceIndex:
00623       t << "}\n\\input{namespaces}\n";
00624       break;
00625     case isClassHierarchyIndex:
00626       t << "}\n\\input{hierarchy}\n";
00627       break;
00628     case isCompoundIndex:
00629       t << "}\n\\input{annotated}\n";
00630       break;
00631     case isFileIndex:
00632       t << "}\n\\input{files}\n";
00633       break;
00634     case isPageIndex:
00635       t << "}\n\\input{pages}\n";
00636       break;
00637     case isModuleDocumentation:
00638       {
00639         GroupSDict::Iterator gli(*Doxygen::groupSDict);
00640         GroupDef *gd;
00641         bool found=FALSE;
00642         for (gli.toFirst();(gd=gli.current()) && !found;++gli)
00643         {
00644           if (!gd->isReference())
00645           {
00646             t << "}\n\\input{" << gd->getOutputFileBase() << "}\n";
00647             found=TRUE;
00648           }
00649         }
00650         for (;(gd=gli.current());++gli)
00651         {
00652           if (!gd->isReference())
00653           {
00654             if (compactLatex) t << "\\input"; else t << "\\include";
00655             t << "{" << gd->getOutputFileBase() << "}\n";
00656           }
00657         }
00658       }
00659       break;
00660     case isDirDocumentation:
00661       {
00662         SDict<DirDef>::Iterator dli(*Doxygen::directories);
00663         DirDef *dd;
00664         bool found=FALSE;
00665         for (dli.toFirst();(dd=dli.current()) && !found;++dli)
00666         {
00667           if (dd->isLinkableInProject())
00668           {
00669             t << "}\n\\input{" << dd->getOutputFileBase() << "}\n";
00670             found=TRUE;
00671           }
00672         }
00673         for (;(dd=dli.current());++dli)
00674         {
00675           if (dd->isLinkableInProject())
00676           {
00677             if (compactLatex) t << "\\input"; else t << "\\include";
00678             t << "{" << dd->getOutputFileBase() << "}\n";
00679           }
00680         }
00681       }
00682       break;
00683     case isNamespaceDocumentation:
00684       {
00685         NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict);
00686         NamespaceDef *nd;
00687         bool found=FALSE;
00688         for (nli.toFirst();(nd=nli.current()) && !found;++nli)
00689         {
00690           if (nd->isLinkableInProject())
00691           {
00692             t << "}\n\\input{" << nd->getOutputFileBase() << "}\n";
00693             found=TRUE;
00694           }
00695         }
00696         while ((nd=nli.current()))
00697         {
00698           if (nd->isLinkableInProject())
00699           {
00700             if (compactLatex) t << "\\input"; else t << "\\include";
00701             t << "{" << nd->getOutputFileBase() << "}\n";
00702           }
00703           ++nli;
00704         }
00705       }
00706       break;
00707     case isClassDocumentation:
00708       {
00709         ClassSDict::Iterator cli(*Doxygen::classSDict);
00710         ClassDef *cd=0;
00711         bool found=FALSE;
00712         for (cli.toFirst();(cd=cli.current()) && !found;++cli)
00713         {
00714           if (cd->isLinkableInProject() && cd->templateMaster()==0)
00715           {
00716             t << "}\n\\input{" << cd->getOutputFileBase() << "}\n";
00717             found=TRUE;
00718           }
00719         }
00720         for (;(cd=cli.current());++cli)
00721         {
00722           if (cd->isLinkableInProject() && cd->templateMaster()==0)
00723           {
00724             if (compactLatex) t << "\\input"; else t << "\\include";
00725             t << "{" << cd->getOutputFileBase() << "}\n";
00726           } 
00727         }
00728       }
00729       break;
00730     case isFileDocumentation:
00731       {
00732         bool isFirst=TRUE;
00733         FileName *fn=Doxygen::inputNameList->first();
00734         while (fn)
00735         {
00736           FileDef *fd=fn->first();
00737           while (fd)
00738           {
00739             if (fd->isLinkableInProject())
00740             {
00741               if (isFirst)
00742               {
00743                 t << "}\n\\input{" << fd->getOutputFileBase() << "}\n";
00744                 isFirst=FALSE;
00745               }
00746               else
00747               {
00748                 if (compactLatex) t << "\\input" ; else t << "\\include";
00749                 t << "{" << fd->getOutputFileBase() << "}\n";
00750               }
00751             }
00752             fd=fn->next();
00753           }
00754           fn=Doxygen::inputNameList->next();
00755         }
00756       }
00757       break;
00758     case isExampleDocumentation:
00759       {
00760         t << "}\n";
00761         PageSDict::Iterator pdi(*Doxygen::exampleSDict);
00762         PageDef *pd=pdi.toFirst();
00763         if (pd)
00764         {
00765           t << "\\input{" << pd->getOutputFileBase() << "}\n";
00766         }
00767         for (++pdi;(pd=pdi.current());++pdi)
00768         {
00769           if (compactLatex) t << "\\input" ; else t << "\\include";
00770           t << "{" << pd->getOutputFileBase() << "}\n";
00771         }
00772       }
00773       break;
00774     case isPageDocumentation:
00775       {
00776         t << "}\n";
00777 #if 0
00778         PageSDict::Iterator pdi(*Doxygen::pageSDict);
00779         PageDef *pd=pdi.toFirst();
00780         bool first=TRUE;
00781         for (pdi.toFirst();(pd=pdi.current());++pdi)
00782         {
00783           if (!pd->getGroupDef() && !pd->isReference())
00784           {
00785              if (compactLatex) t << "\\section"; else t << "\\chapter";
00786              t << "{" << pd->title();
00787              t << "}\n";
00788             
00789             if (compactLatex || first) t << "\\input" ; else t << "\\include";
00790             t << "{" << pd->getOutputFileBase() << "}\n";
00791             first=FALSE;
00792           }
00793         }
00794 #endif
00795       }
00796       break;
00797     case isEndIndex:
00798       t << "\\printindex\n";
00799       t << "\\end{document}\n";
00800       break;
00801   }
00802 }
00803 
00804 void LatexGenerator::writePageLink(const char *name, bool first)
00805 {
00806   bool &compactLatex = Config_getBool("COMPACT_LATEX");
00807   if (compactLatex || first) t << "\\input" ; else t << "\\include";
00808   t << "{" << name << "}\n";
00809 }
00810 
00811 
00812 void LatexGenerator::writeStyleInfo(int part)
00813 {
00814   switch(part)
00815   {
00816     case 0:
00817       {
00818         //QCString pname=Config_getString("PROJECT_NAME").stripWhiteSpace();
00819         startPlainFile("doxygen.sty");
00820         writeDefaultStyleSheetPart1(t);
00821       }
00822       break;
00823     case 1:
00824     case 3:
00825       t << " Doxygen ";
00826       break;
00827     case 2:
00828       {
00829         //t << " Dimitri van Heesch \\copyright~1997-2008";
00830         t << "}]{}\n";
00831         writeDefaultStyleSheetPart2(t);
00832       }
00833       break;
00834     case 4:
00835       {
00836         //t << " Dimitri van Heesch \\copyright~1997-2008";
00837         writeDefaultStyleSheetPart3(t);
00838         endPlainFile();
00839       }
00840       break;
00841   }
00842 }
00843 
00844 void LatexGenerator::newParagraph()
00845 {
00846   t << endl << endl;
00847 }
00848 
00849 void LatexGenerator::startParagraph()
00850 {
00851   t << endl << endl;
00852 }
00853 
00854 void LatexGenerator::endParagraph()
00855 {
00856 }
00857 
00858 void LatexGenerator::writeString(const char *text)
00859 {
00860   t << text;
00861 }
00862 
00863 void LatexGenerator::startIndexItem(const char *ref,const char *fn)
00864 {
00865   t << "\\item ";
00866   if (!ref && fn)
00867   {
00868     t << "\\contentsline{section}{";
00869   }
00870 }
00871 
00872 void LatexGenerator::endIndexItem(const char *ref,const char *fn)
00873 {
00874   if (!ref && fn)
00875   {
00876     t << "}{\\pageref{" << fn << "}}{}" << endl;
00877   }
00878 }
00879 
00880 //void LatexGenerator::writeIndexFileItem(const char *,const char *text)
00881 //{
00882 //  t << "\\item\\contentsline{section}{";
00883 //  docify(text);
00884 //  t << "}{\\pageref{" << text << "}}" << endl;
00885 //}
00886 
00887 
00888 void LatexGenerator::startHtmlLink(const char *url)
00889 {
00890   if (Config_getBool("PDF_HYPERLINKS"))
00891   {
00892     t << "\\href{";
00893     t << url;
00894     t << "}";
00895   }
00896   t << "{\\tt ";
00897 }
00898 
00899 void LatexGenerator::endHtmlLink()
00900 {
00901   t << "}";
00902 }
00903 
00904 //void LatexGenerator::writeMailLink(const char *url)
00905 //{
00906 //  if (Config_getBool("PDF_HYPERLINKS"))
00907 //  {
00908 //    t << "\\href{mailto:";
00909 //    t << url;
00910 //    t << "}";
00911 //  }
00912 //  t << "{\\tt "; 
00913 //  docify(url);
00914 //  t << "}";
00915 //}
00916 
00917 void LatexGenerator::writeStartAnnoItem(const char *,const char *,
00918                                         const char *path,const char *name)
00919 {
00920   t << "\\item\\contentsline{section}{\\bf ";
00921   if (path) docify(path);
00922   docify(name); 
00923   t << "} ";
00924 }
00925 
00926 void LatexGenerator::writeEndAnnoItem(const char *name)
00927 {
00928   t << "}{\\pageref{" << name << "}}{}" << endl;
00929 }
00930 
00931 void LatexGenerator::startIndexKey()
00932 {
00933   t << "\\item\\contentsline{section}{";
00934 }
00935 
00936 void LatexGenerator::endIndexKey()
00937 {
00938 }
00939 
00940 void LatexGenerator::startIndexValue(bool hasBrief)
00941 {
00942   t << " ";
00943   if (hasBrief) t << "(";
00944 }
00945 
00946 void LatexGenerator::endIndexValue(const char *name,bool hasBrief)
00947 {
00948   if (hasBrief) t << ")";
00949   t << "}{\\pageref{" << name << "}}{}" << endl;
00950 }
00951 
00952 //void LatexGenerator::writeClassLink(const char *,const char *,
00953 //                                    const char *,const char *name)
00954 //{
00955 //  t << "{\\bf ";
00956 //  docify(name);
00957 //  t << "}"; 
00958 //}
00959 
00960 void LatexGenerator::startTextLink(const char *f,const char *anchor)
00961 {
00962   if (!disableLinks && Config_getBool("PDF_HYPERLINKS"))
00963   {
00964     t << "\\hyperlink{";
00965     if (f) t << stripPath(f);
00966     if (anchor) t << "_" << anchor; 
00967     t << "}{";
00968   }
00969   else
00970   {
00971     t << "{\\bf ";
00972   }
00973 }
00974 
00975 void LatexGenerator::endTextLink()
00976 {
00977   t << "}";
00978 }
00979 
00980 void LatexGenerator::writeObjectLink(const char *ref, const char *f,
00981                                      const char *anchor, const char *text)
00982 {
00983   if (!disableLinks && !ref && Config_getBool("PDF_HYPERLINKS"))
00984   {
00985     t << "\\hyperlink{";
00986     if (f) t << stripPath(f);
00987     if (f && anchor) t << "_"; 
00988     if (anchor) t << anchor; 
00989     t << "}{";
00990     docify(text);
00991     t << "}";
00992   }
00993   else
00994   {
00995     t << "{\\bf ";
00996     docify(text);
00997     t << "}";
00998   } 
00999 }
01000 
01001 void LatexGenerator::startPageRef()
01002 {
01003   t << " \\doxyref{}{";
01004 }
01005 
01006 void LatexGenerator::endPageRef(const char *clname, const char *anchor)
01007 {
01008   t << "}{";
01009   if (clname) t << clname; 
01010   if (anchor) t << "_" << anchor;
01011   t << "}";
01012 }
01013 
01014 void LatexGenerator::writeCodeLink(const char *,const char *,
01015                                    const char *,const char *name,
01016                                    const char *)
01017 {
01018   t << name;
01019   col+=strlen(name);
01020 }
01021 
01022 void LatexGenerator::startTitleHead(const char *fileName)
01023 {
01024   if (Config_getBool("PDF_HYPERLINKS") && fileName)
01025   {
01026     t << "\\hypertarget{" << stripPath(fileName) << "}{" << endl;
01027   }
01028   if (Config_getBool("COMPACT_LATEX")) 
01029   {
01030     t << "\\subsection{"; 
01031   }
01032   else 
01033   {
01034     t << "\\section{"; 
01035   }
01036 }
01037 
01038 void LatexGenerator::endTitleHead(const char *fileName,const char *name)
01039 {
01040   t << "}" << endl;
01041   if (name)
01042   {
01043     t << "\\label{" << fileName << "}\\index{";
01044     escapeLabelName(name);
01045     t << "@{";
01046     escapeMakeIndexChars(name);
01047     t << "}}" << endl;
01048   }
01049   if (Config_getBool("PDF_HYPERLINKS") && fileName)
01050   {
01051     t << "}" << endl;
01052   }
01053 }
01054 
01055 void LatexGenerator::startTitle()
01056 {
01057   if (Config_getBool("COMPACT_LATEX")) 
01058   {
01059     t << "\\subsection{"; 
01060   }
01061   else 
01062   {
01063     t << "\\section{"; 
01064   }
01065 }
01066 
01067 void LatexGenerator::startGroupHeader()
01068 {
01069   if (Config_getBool("COMPACT_LATEX")) 
01070   {
01071     t << "\\subsubsection{"; 
01072   }
01073   else 
01074   {
01075     t << "\\subsection{";
01076   }
01077   disableLinks=TRUE;
01078 }
01079 
01080 void LatexGenerator::endGroupHeader()
01081 {
01082   disableLinks=FALSE;
01083   t << "}" << endl;
01084 }
01085 
01086 void LatexGenerator::startMemberHeader()
01087 {
01088   if (Config_getBool("COMPACT_LATEX")) 
01089   {
01090     t << "\\subsubsection*{"; 
01091   }
01092   else 
01093   {
01094     t << "\\subsection*{";
01095   }
01096   disableLinks=TRUE;
01097 }
01098 
01099 void LatexGenerator::endMemberHeader()
01100 {
01101   disableLinks=FALSE;
01102   t << "}" << endl;
01103 }
01104 
01105 void LatexGenerator::startMemberDoc(const char *clname,
01106                                     const char *memname,
01107                                     const char *,
01108                                     const char *)
01109 { 
01110   if (memname && memname[0]!='@')
01111   {
01112     t << "\\index{";
01113     if (clname)
01114     {
01115       escapeLabelName(clname);
01116       t << "@{";
01117       escapeMakeIndexChars(clname);
01118       t << "}!";
01119     }
01120     escapeLabelName(memname);
01121     t << "@{";
01122     escapeMakeIndexChars(memname);
01123     t << "}}" << endl;
01124 
01125     t << "\\index{";
01126     escapeLabelName(memname);
01127     t << "@{";
01128     escapeMakeIndexChars(memname);
01129     t << "}";
01130     if (clname)
01131     {
01132       t << "!" << clname << "@{";
01133       docify(clname);
01134       t << "}"; 
01135     }
01136     t << "}" << endl;
01137   }
01138   if (Config_getBool("COMPACT_LATEX")) t << "\\paragraph"; else t << "\\subsubsection";
01139   //if (Config_getBool("PDF_HYPERLINKS") && memname) 
01140   //{
01141   //  t << "["; 
01142   //  escapeMakeIndexChars(this,t,memname);
01143   //  t << "]";
01144   //}
01145   t << "{\\setlength{\\rightskip}{0pt plus 5cm}";
01146   disableLinks=TRUE;
01147 }
01148 
01149 void LatexGenerator::endMemberDoc(bool) 
01150 { 
01151   disableLinks=FALSE;
01152   t << "}";
01153   if (Config_getBool("COMPACT_LATEX")) t << "\\hfill";
01154 }
01155 
01156 void LatexGenerator::startDoxyAnchor(const char *fName,const char *,
01157                                      const char *anchor, const char *,
01158                                      const char *)
01159 {
01160   if (Config_getBool("PDF_HYPERLINKS"))
01161   {
01162     t << "\\hypertarget{";
01163     if (fName) t << stripPath(fName);
01164     if (anchor) t << "_" << anchor;
01165     t << "}{" << endl;
01166   }
01167 }
01168 
01169 void LatexGenerator::endDoxyAnchor(const char *fName,const char *anchor)
01170 {
01171   if (Config_getBool("PDF_HYPERLINKS"))
01172   {
01173     t << "}" << endl;
01174   }
01175   t << "\\label{";
01176   if (fName) t << fName;
01177   if (anchor) t << "_" << anchor;
01178   t << "}" << endl;
01179 }
01180 
01181 void LatexGenerator::writeAnchor(const char *fName,const char *name)
01182 { 
01183   //printf("LatexGenerator::writeAnchor(%s,%s)\n",fName,name);
01184   t << "\\label{" << name << "}" << endl; 
01185   if (fName && Config_getBool("PDF_HYPERLINKS"))
01186   {
01187     t << "\\hypertarget{" << stripPath(fName) << "_" << name << "}{}" << endl;
01188   }
01189 }
01190 
01191 
01192 //void LatexGenerator::writeLatexLabel(const char *clName,const char *anchor)
01193 //{
01194 //  writeDoxyAnchor(0,clName,anchor,0);
01195 //}
01196 
01197 void LatexGenerator::addIndexItem(const char *s1,const char *s2)
01198 {
01199   if (s1)
01200   {
01201     t << "\\index{";
01202     escapeLabelName(s1);
01203     t << "@{";
01204     escapeMakeIndexChars(s1);
01205     t << "}";
01206     if (s2)
01207     {
01208       t << "!";
01209       escapeLabelName(s2);
01210       t << "@{";
01211       escapeMakeIndexChars(s2);
01212       t << "}";
01213     }
01214     t << "}";
01215   }
01216 }
01217 
01218 
01219 void LatexGenerator::startSection(const char *lab,const char *,SectionInfo::SectionType type)
01220 {
01221   if (Config_getBool("PDF_HYPERLINKS"))
01222   {
01223     t << "\\hypertarget{" << stripPath(lab) << "}{}";
01224   }
01225   t << "\\";
01226   if (Config_getBool("COMPACT_LATEX"))
01227   {
01228     switch(type)
01229     {
01230       case SectionInfo::Page:          t << "subsection"; break;
01231       case SectionInfo::Section:       t << "subsubsection"; break;
01232       case SectionInfo::Subsection:    t << "paragraph"; break;
01233       case SectionInfo::Subsubsection: t << "subparagraph"; break;
01234       case SectionInfo::Paragraph:     t << "subparagraph"; break;
01235       default: ASSERT(0); break;
01236     }
01237     t << "{";
01238   }
01239   else
01240   {
01241     switch(type)
01242     {
01243       case SectionInfo::Page:          t << "section"; break;
01244       case SectionInfo::Section:       t << "subsection"; break;
01245       case SectionInfo::Subsection:    t << "subsubsection"; break;
01246       case SectionInfo::Subsubsection: t << "paragraph"; break;
01247       case SectionInfo::Paragraph:     t << "subparagraph"; break;
01248       default: ASSERT(0); break;
01249     }
01250     t << "{";
01251   }
01252 }
01253 
01254 void LatexGenerator::endSection(const char *lab,SectionInfo::SectionType)
01255 {
01256   t << "}\\label{" << lab << "}" << endl;
01257 }
01258 
01259 
01260 //void LatexGenerator::docifyStatic(QTextStream &t,const char *str)
01261 void LatexGenerator::docify(const char *str)
01262 {
01263   filterLatexString(t,str,insideTabbing,FALSE);
01264 }
01265 
01266 void LatexGenerator::codify(const char *str)
01267 {
01268   static bool isJapanese  = theTranslator->idLanguage()=="japanese" || 
01269                             theTranslator->idLanguage()=="japanese-en";
01270 
01271   if (str)
01272   { 
01273     const char *p=str;
01274     char c;
01275     int spacesToNextTabStop;
01276     int &tabSize = Config_getInt("TAB_SIZE");
01277     while (*p)
01278     {
01279       static bool MultiByte = FALSE;
01280       c=*p++;
01281 
01282       if( isJapanese )
01283       {
01284         if ( MultiByte )
01285         {
01286           t << (char)c;
01287           MultiByte = FALSE;
01288           continue;
01289         }
01290         if ((uchar)c>=0x80) // char in range [0x80..0xff]
01291         {
01292           t << (char)c;
01293           MultiByte = TRUE;
01294           continue;
01295         }
01296       }
01297 
01298       switch(c)
01299       {
01300         case 0x0c: break; // remove ^L
01301         case '\t': spacesToNextTabStop =
01302                          tabSize - (col%tabSize);
01303                    t << spaces.left(spacesToNextTabStop); 
01304                    col+=spacesToNextTabStop;
01305                    break; 
01306         case '\n': t << '\n'; col=0;                    break;
01307         default:   t << c;    col++;                    break;
01308       }
01309     }
01310   }
01311 }
01312 
01313 void LatexGenerator::writeChar(char c)
01314 {
01315   char cs[2];
01316   cs[0]=c;
01317   cs[1]=0;
01318   docify(cs);
01319 }
01320 
01321 void LatexGenerator::startClassDiagram()
01322 {
01323   //if (Config_getBool("COMPACT_LATEX")) t << "\\subsubsection"; else t << "\\subsection";
01324   //t << "{";
01325 }
01326 
01327 void LatexGenerator::endClassDiagram(const ClassDiagram &d,
01328                                        const char *fileName,const char *)
01329 {
01330   d.writeFigure(t,dir,fileName);
01331 }
01332 
01333 
01334 void LatexGenerator::startAnonTypeScope(int indent)
01335 {
01336   if (indent==0)
01337   {
01338     t << "\\begin{tabbing}" << endl;
01339     t << "xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=\\kill" << endl;
01340     insideTabbing=TRUE;
01341   }
01342   m_indent=indent;
01343 }
01344 
01345 void LatexGenerator::endAnonTypeScope(int indent)
01346 {
01347   if (indent==0)
01348   {
01349     t << endl << "\\end{tabbing}";
01350     insideTabbing=FALSE;
01351   }
01352   m_indent=indent;
01353 }
01354 
01355 void LatexGenerator::startMemberTemplateParams()
01356 {
01357   if (templateMemberItem)
01358   {
01359     t << "{\\footnotesize ";
01360   }
01361 }
01362 
01363 void LatexGenerator::endMemberTemplateParams()
01364 {
01365   if (templateMemberItem)
01366   {
01367     t << "}\\\\";
01368   }
01369 }
01370 
01371 void LatexGenerator::startMemberItem(int annoType) 
01372 { 
01373   //printf("LatexGenerator::startMemberItem(%d)\n",annType);
01374   if (!insideTabbing)
01375   {
01376     t << "\\item " << endl; 
01377     templateMemberItem = (annoType == 3);
01378   }
01379 }
01380 
01381 void LatexGenerator::endMemberItem() 
01382 {
01383   if (insideTabbing)
01384   {
01385     t << "\\\\";
01386   } 
01387   templateMemberItem = FALSE;
01388   t << endl; 
01389 }
01390 
01391 void LatexGenerator::startMemberDescription() 
01392 {
01393   if (!insideTabbing)
01394   { 
01395     t << "\\begin{CompactList}\\small\\item\\em "; 
01396   }
01397   else
01398   {
01399     for (int i=0;i<m_indent+2;i++) t << "\\>";
01400     t << "{\\em ";
01401   }
01402 }
01403 
01404 void LatexGenerator::endMemberDescription() 
01405 { 
01406   if (!insideTabbing)
01407   {
01408     t << "\\item\\end{CompactList}"; 
01409   }
01410   else
01411   {
01412     t << "}\\\\\n";
01413   }
01414 }
01415 
01416 
01417 void LatexGenerator::writeNonBreakableSpace(int) 
01418 {
01419   //printf("writeNonBreakbleSpace()\n");
01420   if (insideTabbing)
01421   {
01422     t << "\\>";
01423   }
01424   else
01425     t << "~"; 
01426 }
01427 
01428 void LatexGenerator::startMemberList()  
01429 { 
01430   if (!insideTabbing)
01431   {
01432     t << "\\begin{CompactItemize}" << endl; 
01433   }
01434 }
01435 
01436 void LatexGenerator::endMemberList()    
01437 {
01438   //printf("LatexGenerator::endMemberList(%d)\n",insideTabbing);
01439   if (!insideTabbing)
01440   {
01441     t << "\\end{CompactItemize}"   << endl; 
01442   }
01443 }
01444 
01445 
01446 void LatexGenerator::startMemberGroupHeader(bool hasHeader)
01447 {
01448   if (hasHeader) t << "\\begin{Indent}";
01449   t << "{\\bf ";
01450 }
01451 
01452 void LatexGenerator::endMemberGroupHeader()
01453 {
01454   t << "}\\par" << endl;
01455 }
01456 
01457 void LatexGenerator::startMemberGroupDocs()
01458 {
01459   t << "{\\em ";
01460 }
01461 
01462 void LatexGenerator::endMemberGroupDocs()
01463 {
01464   t << "}";
01465 }
01466 
01467 void LatexGenerator::startMemberGroup()
01468 {
01469 }
01470 
01471 void LatexGenerator::endMemberGroup(bool hasHeader)
01472 {
01473   if (hasHeader)t << "\\end{Indent}"; 
01474   t << endl;
01475 }
01476 
01477 void LatexGenerator::startDotGraph() 
01478 {
01479 }
01480 
01481 void LatexGenerator::endDotGraph(const DotClassGraph &g) 
01482 {
01483   g.writeGraph(t,EPS,Config_getString("LATEX_OUTPUT"),relPath);
01484 }
01485 
01486 void LatexGenerator::startInclDepGraph() 
01487 {
01488 }
01489 
01490 void LatexGenerator::endInclDepGraph(const DotInclDepGraph &g) 
01491 {
01492   g.writeGraph(t,EPS,Config_getString("LATEX_OUTPUT"),relPath);
01493 }
01494 
01495 void LatexGenerator::startGroupCollaboration() 
01496 {
01497 }
01498 
01499 void LatexGenerator::endGroupCollaboration(const DotGroupCollaboration &g) 
01500 {
01501   g.writeGraph(t,EPS,Config_getString("LATEX_OUTPUT"),relPath);
01502 }
01503 
01504 void LatexGenerator::startCallGraph() 
01505 {
01506 }
01507 
01508 void LatexGenerator::endCallGraph(const DotCallGraph &g) 
01509 {
01510   g.writeGraph(t,EPS,Config_getString("LATEX_OUTPUT"),relPath);
01511 }
01512 
01513 void LatexGenerator::startDirDepGraph() 
01514 {
01515 }
01516 
01517 void LatexGenerator::endDirDepGraph(const DotDirDeps &g) 
01518 {
01519   g.writeGraph(t,EPS,Config_getString("LATEX_OUTPUT"),relPath);
01520 }
01521 
01522 void LatexGenerator::startDescription() 
01523 { 
01524   t << "\\begin{description}" << endl; 
01525 }
01526 
01527 void LatexGenerator::endDescription()   
01528 { 
01529   t << "\\end{description}" << endl; 
01530   firstDescItem=TRUE;
01531 }
01532 
01533 void LatexGenerator::startDescItem()    
01534 { 
01535   firstDescItem=TRUE;
01536   t << "\\item["; 
01537 }
01538 
01539 void LatexGenerator::endDescItem()      
01540 { 
01541   if (firstDescItem) 
01542   {
01543     t << "]" << endl;
01544     firstDescItem=FALSE;
01545   } 
01546   else
01547   {
01548     lineBreak();
01549   }
01550 }
01551 
01552 void LatexGenerator::startSimpleSect(SectionTypes,const char *file,
01553                                      const char *anchor,const char *title)
01554 {
01555   t << "\\begin{Desc}\n\\item[";
01556   if (file)
01557   {
01558     writeObjectLink(0,file,anchor,title);
01559   }
01560   else
01561   {
01562     docify(title);
01563   }
01564   t << "]";
01565 }
01566 
01567 void LatexGenerator::endSimpleSect()
01568 {
01569   t << "\\end{Desc}" << endl;
01570 }
01571 
01572 void LatexGenerator::startParamList(ParamListTypes,const char *title)
01573 {
01574   t << "\\begin{Desc}\n\\item[";
01575   docify(title);
01576   t << "]";
01577 }
01578 
01579 void LatexGenerator::endParamList()
01580 {
01581   t << "\\end{Desc}" << endl;
01582 }
01583 
01584 void LatexGenerator::startParameterType(bool first,const char *key)
01585 {
01586   if (!first)
01587   {
01588     t << "\\/ " << key << " ";
01589   }
01590 }
01591 
01592 void LatexGenerator::printDoc(DocNode *n,const char *langExt)
01593 {
01594   LatexDocVisitor *visitor = new LatexDocVisitor(t,*this,langExt,insideTabbing);
01595   n->accept(visitor);
01596   delete visitor; 
01597 }
01598 
01599 void LatexGenerator::startConstraintList(const char *header)
01600 {
01601   t << "\\begin{Desc}\n\\item[";
01602   docify(header);
01603   t << "]";
01604   t << "\\begin{description}" << endl;
01605 }
01606 
01607 void LatexGenerator::startConstraintParam()
01608 {
01609   t << "\\item[{\\em ";
01610 }
01611 
01612 void LatexGenerator::endConstraintParam()
01613 {
01614 }
01615 
01616 void LatexGenerator::startConstraintType()
01617 {
01618   t << "} : {\\em ";
01619 }
01620 
01621 void LatexGenerator::endConstraintType()
01622 {
01623   t << "}]";
01624 }
01625 
01626 void LatexGenerator::startConstraintDocs()
01627 {
01628 }
01629 
01630 void LatexGenerator::endConstraintDocs()
01631 {
01632 }
01633 
01634 void LatexGenerator::endConstraintList()
01635 {
01636   t << "\\end{description}" << endl;
01637   t << "\\end{Desc}" << endl;
01638 }
01639 
01640 void LatexGenerator::escapeLabelName(const char *s)
01641 {
01642   const char *p=s;
01643   char str[2];
01644   str[1]=0;
01645   char c;
01646   while ((c=*p++))
01647   {
01648     switch (c)
01649     {
01650       case '%': t << "\\%";       break;
01651       case '|': t << "\\tt{\"|}"; break;
01652       case '!': t << "\"!";       break;
01653       default:  str[0]=c; docify(str); break;
01654     }
01655   }
01656 }
01657 
01658 void LatexGenerator::escapeMakeIndexChars(const char *s)
01659 {
01660   const char *p=s;
01661   char str[2];
01662   str[1]=0;
01663   char c;
01664   while ((c=*p++))
01665   {
01666     switch (c)
01667     {
01668       case '!': t << "\"!"; break;
01669       case '"': t << "\"\""; break;
01670       case '@': t << "\"@"; break;
01671       case '|': t << "\\tt{\"|}"; break;
01672       case '[': t << "["; break;
01673       case ']': t << "]"; break;
01674       default:  str[0]=c; docify(str); break;
01675     }
01676   }
01677 }
01678 
01679 



Generated on Mon Mar 31 10:58:39 2008 by  doxygen 1.5.1