Chameleon

Chameleon Svn Source Tree

Root/branches/xZenu/src/util/doxygen/src/latexgen.cpp

Source at commit 1322 created 12 years 8 months ago.
By meklort, Add doxygen to utils folder
1/******************************************************************************
2 *
3 * $Id: latexgen.cpp,v 1.58 2001/03/19 19:27:40 root Exp $
4 *
5 * Copyright (C) 1997-2011 by Dimitri van Heesch.
6 *
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation under the terms of the GNU General Public License is hereby
9 * granted. No representations are made about the suitability of this software
10 * for any purpose. It is provided "as is" without express or implied warranty.
11 * See the GNU General Public License for more details.
12 *
13 * Documents produced by Doxygen are derivative works derived from the
14 * input used in their production; they are not affected by this license.
15 *
16 */
17
18#include <stdlib.h>
19
20#include "qtbc.h"
21#include <qdir.h>
22#include "latexgen.h"
23#include "config.h"
24#include "message.h"
25#include "doxygen.h"
26#include "util.h"
27#include "diagram.h"
28#include "language.h"
29#include "version.h"
30#include "dot.h"
31#include "pagedef.h"
32#include "docparser.h"
33#include "latexdocvisitor.h"
34#include "dirdef.h"
35
36//static QCString filterTitle(const char *s)
37//{
38// QCString tmp=s,result;
39// uint i;for (i=0;i<tmp.length();i++)
40// {
41// char c=tmp.at(i);
42// switch(c)
43// {
44// case '#': result+="\\#"; break;
45// case '"': result+="\\\""; break;
46// case '%': result+="\\%"; break;
47// case '[': result+="{"; break;
48// case ']': result+="}"; break;
49// default: result+=c; break;
50// }
51// }
52// return result;
53//}
54
55
56
57LatexGenerator::LatexGenerator() : OutputGenerator()
58{
59 dir=Config_getString("LATEX_OUTPUT");
60 col=0;
61 //printf("LatexGenerator::LatexGenerator() insideTabbing=FALSE\n");
62 insideTabbing=FALSE;
63 firstDescItem=TRUE;
64 disableLinks=FALSE;
65 m_indent=0;
66 templateMemberItem = FALSE;
67 m_prettyCode=Config_getBool("LATEX_SOURCE_CODE");
68}
69
70LatexGenerator::~LatexGenerator()
71{
72}
73
74void LatexGenerator::init()
75{
76 QCString dir=Config_getString("LATEX_OUTPUT");
77 QDir d(dir);
78 if (!d.exists() && !d.mkdir(dir))
79 {
80 err("Could not create output directory %s\n",dir.data());
81 exit(1);
82 }
83
84 QCString fileName=dir+"/Makefile";
85 QFile file(fileName);
86 if (!file.open(IO_WriteOnly))
87 {
88 err("Could not open file %s for writing\n",fileName.data());
89 exit(1);
90 }
91 // inserted by KONNO Akihisa <konno@researchers.jp> 2002-03-05
92 QCString latex_command = Config_getString("LATEX_CMD_NAME");
93 QCString mkidx_command = Config_getString("MAKEINDEX_CMD_NAME");
94 // end insertion by KONNO Akihisa <konno@researchers.jp> 2002-03-05
95 FTextStream t(&file);
96 if (!Config_getBool("USE_PDFLATEX")) // use plain old latex
97 {
98 t << "all: refman.dvi" << endl
99 << endl
100 << "ps: refman.ps" << endl
101 << endl
102 << "pdf: refman.pdf" << endl
103 << endl
104 << "ps_2on1: refman_2on1.ps" << endl
105 << endl
106 << "pdf_2on1: refman_2on1.pdf" << endl
107 << endl
108 << "refman.ps: refman.dvi" << endl
109 << "\tdvips -o refman.ps refman.dvi" << endl
110 << endl;
111 t << "refman.pdf: refman.ps" << endl;
112#if defined(_MSC_VER)
113 // ps2pdf.bat does not work properly from a makefile using GNU make!
114 t << "\tgswin32c -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite "
115 "-sOutputFile=refman.pdf -c save pop -f refman.ps" << endl << endl;
116#else
117 t << "\tps2pdf refman.ps refman.pdf" << endl << endl;
118#endif
119 t << "refman.dvi: clean refman.tex doxygen.sty" << endl
120 << "\techo \"Running latex...\"" << endl
121 << "\t" << latex_command << " refman.tex" << endl
122 << "\techo \"Running makeindex...\"" << endl
123 << "\t" << mkidx_command << " refman.idx" << endl
124 << "\techo \"Rerunning latex....\"" << endl
125 << "\t" << latex_command << " refman.tex" << endl
126 << "\tlatex_count=5 ; \\" << endl
127 << "\twhile egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\\" << endl
128 << "\t do \\" << endl
129 << "\t echo \"Rerunning latex....\" ;\\" << endl
130 << "\t " << latex_command << " refman.tex ;\\" << endl
131 << "\t latex_count=`expr $$latex_count - 1` ;\\" << endl
132 << "\t done" << endl << endl
133 << "refman_2on1.ps: refman.ps" << endl
134 << "\tpsnup -2 refman.ps >refman_2on1.ps" << endl
135 << endl
136 << "refman_2on1.pdf: refman_2on1.ps" << endl
137#if defined(_MSC_VER)
138 // ps2pdf.bat does not work properly from a makefile using GNU make!
139 << "\tgswin32c -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite "
140 "-sOutputFile=refman_2on1.pdf -c save pop -f refman_2on1.ps" << endl;
141#else
142 << "\tps2pdf refman_2on1.ps refman_2on1.pdf" << endl;
143#endif
144 }
145 else // use pdflatex for higher quality output
146 {
147 t << "all: refman.pdf" << endl << endl
148 << "pdf: refman.pdf" << endl << endl;
149 t << "refman.pdf: clean refman.tex" << endl;
150 t << "\tpdflatex refman.tex" << endl;
151 t << "\tmakeindex refman.idx" << endl;
152 t << "\tpdflatex refman.tex" << endl
153 << "\tlatex_count=5 ; \\" << endl
154 << "\twhile egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\\" << endl
155 << "\t do \\" << endl
156 << "\t echo \"Rerunning latex....\" ;\\" << endl
157 << "\t pdflatex refman.tex ;\\" << endl
158 << "\t latex_count=`expr $$latex_count - 1` ;\\" << endl
159 << "\t done" << endl << endl;
160 }
161
162 t << endl
163 << "clean:" << endl
164#if defined(_MSC_VER)
165 << "\tdel /s/y "
166#else
167 << "\trm -f "
168#endif
169 << "*.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out refman.pdf" << endl;
170
171 createSubDirs(d);
172}
173
174static void writeDefaultHeaderPart1(FTextStream &t)
175{
176 // part 1
177
178 QCString paperName;
179 if (Config_getBool("LATEX_BATCHMODE")) t << "\\batchmode" << endl;
180 QCString &paperType=Config_getEnum("PAPER_TYPE");
181 if (paperType=="a4wide")
182 paperName="a4";
183 else
184 paperName=paperType;
185 t << "\\documentclass[" << paperName << "paper";
186 //if (Config_getBool("PDF_HYPERLINKS")) t << ",ps2pdf";
187 t << "]{";
188 if (Config_getBool("COMPACT_LATEX")) t << "article"; else t << "book";
189 t << "}\n";
190 // the next package is obsolete (see bug 563698)
191 //if (paperType=="a4wide") t << "\\usepackage{a4wide}\n";
192 t << "\\usepackage{makeidx}\n"
193 "\\usepackage{graphicx}\n"
194 "\\usepackage{multicol}\n"
195 "\\usepackage{float}\n"
196 "\\usepackage{listings}\n"
197 "\\usepackage{color}\n"
198 "\\usepackage{ifthen}\n"
199 "\\usepackage[table]{xcolor}\n"
200 "\\usepackage{textcomp}\n"
201 "\\usepackage{alltt}\n"
202 //"\\usepackage{ae,aecompl,aeguill}\n"
203 ;
204 //if (Config_getBool("USE_PDFLATEX"))
205 //{
206 // t << "\\usepackage{times}" << endl;
207 //}
208 if (Config_getBool("PDF_HYPERLINKS"))
209 {
210 t << "\\usepackage{ifpdf}" << endl
211 << "\\ifpdf" << endl
212 << "\\usepackage[pdftex," << endl
213 << " pagebackref=true," << endl
214 << " colorlinks=true," << endl
215 << " linkcolor=blue," << endl
216 << " unicode" << endl
217 << " ]{hyperref}" << endl
218 << "\\else" << endl
219 << "\\usepackage[ps2pdf," << endl
220 << " pagebackref=true," << endl
221 << " colorlinks=true," << endl
222 << " linkcolor=blue," << endl
223 << " unicode" << endl
224 << " ]{hyperref}" << endl
225 << "\\usepackage{pspicture}" << endl
226 << "\\fi" << endl;
227 }
228 // Try to get the command for switching on the language
229 // support
230 t << "\\usepackage[utf8]{inputenc}" << endl;
231 QCString sLanguageSupportCommand(
232 theTranslator->latexLanguageSupportCommand());
233
234 if (!sLanguageSupportCommand.isEmpty())
235 {
236 // The command is not empty. Put it to the output.
237 // if the command is empty, no output is needed.
238 t << sLanguageSupportCommand << endl;
239 }
240 t << "\\usepackage{mathptmx}\n";
241 t << "\\usepackage[scaled=.90]{helvet}\n";
242 t << "\\usepackage{courier}\n";
243 t << "\\usepackage{sectsty}\n";
244 t << "\\usepackage[titles]{tocloft}\n";
245 t << "\\usepackage{doxygen}\n";
246
247 // define option for listings
248 t << "\\lstset{language=C++,"
249 "inputencoding=utf8,"
250 "basicstyle=\\footnotesize,"
251 "breaklines=true,"
252 "breakatwhitespace=true,"
253 "tabsize=" << Config_getInt("TAB_SIZE") <<","
254 "numbers=left }" << endl;
255
256 QStrList &extraPackages = Config_getList("EXTRA_PACKAGES");
257 const char *s=extraPackages.first();
258 while (s)
259 {
260 t << "\\usepackage{" << s << "}\n";
261 s=extraPackages.next();
262 }
263 t << "\\makeindex\n"
264 "\\setcounter{tocdepth}{3}\n"
265 "\\renewcommand{\\footrulewidth}{0.4pt}\n"
266 "\\renewcommand{\\familydefault}{\\sfdefault}\n"
267 "\\begin{document}\n";
268 static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS");
269 static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
270 if (pdfHyperlinks && usePDFLatex)
271 {
272 // to avoid duplicate page anchors due to reuse of same numbers for
273 // the index (be it as roman numbers)
274 t << "\\hypersetup{pageanchor=false}" << endl;
275 }
276 if (theTranslator->idLanguage()=="greek") t << "\\selectlanguage{greek}\n";
277 t << "\\begin{titlepage}\n"
278 "\\vspace*{7cm}\n"
279 "\\begin{center}\n"
280 "{\\Large ";
281
282}
283
284static void writeDefaultHeaderPart2(FTextStream &t)
285{
286 // part 2
287 t << "}\\\\" << endl
288 << "\\vspace*{1cm}" << endl
289 << "{\\large ";
290}
291
292static void writeDefaultHeaderPart3(FTextStream &t)
293{
294 // part 3
295 t << " Doxygen " << versionString << "}\\\\" << endl
296 << "\\vspace*{0.5cm}" << endl
297 << "{\\small " << dateToString(TRUE) << "}\\\\" << endl
298 << "\\end{center}" << endl
299 << "\\end{titlepage}" << endl;
300 if (!Config_getBool("COMPACT_LATEX")) t << "\\clearemptydoublepage\n";
301 t << "\\pagenumbering{roman}\n";
302 t << "\\tableofcontents\n";
303 if (!Config_getBool("COMPACT_LATEX")) t << "\\clearemptydoublepage\n";
304 t << "\\pagenumbering{arabic}\n";
305 static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS");
306 static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
307 if (pdfHyperlinks && usePDFLatex)
308 {
309 t << "\\hypersetup{pageanchor=true}" << endl;
310 }
311}
312
313static void writeDefaultStyleSheetPart1(FTextStream &t)
314{
315 // part 1
316 t << "\\NeedsTeXFormat{LaTeX2e}\n"
317 "\\ProvidesPackage{doxygen}\n\n";
318 t << "% Packages used by this style file\n"
319 "\\RequirePackage{alltt}\n"
320 "\\RequirePackage{array}\n"
321 "\\RequirePackage{calc}\n"
322 "\\RequirePackage{color}\n"
323 "\\RequirePackage{fancyhdr}\n"
324 "\\RequirePackage{longtable}\n"
325 "\\RequirePackage{verbatim}\n"
326 "\\RequirePackage{ifthen}\n"
327 "\\RequirePackage[table]{xcolor}\n\n";
328
329 t << "% Use helvetica font instead of times roman\n"
330 "\\RequirePackage{helvet}\n"
331 "\\RequirePackage{sectsty}\n"
332 "\\RequirePackage{tocloft}\n"
333// "\\allsectionsfont{\\usefont{OT1}{phv}{bc}{n}\\selectfont}\n"
334// "\\providecommand{\\cftchapfont}{%\n"
335// " \\fontsize{11}{13}\\usefont{OT1}{phv}{bc}{n}\\selectfont\n"
336// "}\n"
337// "\\providecommand{\\cftchappagefont}{%\n"
338// " \\fontsize{11}{13}\\usefont{OT1}{phv}{c}{n}\\selectfont\n"
339// "}\n"
340// "\\providecommand{\\cftsecfont}{%\n"
341// " \\fontsize{10}{12}\\usefont{OT1}{phv}{c}{n}\\selectfont\n"
342// "}\n"
343// "\\providecommand{\\cftsecpagefont}{%\n"
344// " \\fontsize{10}{12}\\usefont{OT1}{phv}{c}{n}\\selectfont\n"
345// "}\n"
346// "\\providecommand{\\cftsubsecfont}{%\n"
347// " \\fontsize{10}{12}\\usefont{OT1}{phv}{c}{n}\\selectfont\n"
348// "}\n"
349// "\\providecommand{\\cftsubsecpagefont}{%\n"
350// " \\fontsize{10}{12}\\usefont{OT1}{phv}{c}{n}\\selectfont\n"
351// "}\n"
352// "\\providecommand{\\cftsubsubsecfont}{%\n"
353// " \\fontsize{9}{11}\\usefont{OT1}{phv}{c}{n}\\selectfont\n"
354// "}\n"
355// "\\providecommand{\\cftsubsubsecpagefont}{%\n"
356// " \\fontsize{9}{11}\\usefont{OT1}{phv}{c}{n}\\selectfont\n"
357// "}\n"
358// "\\providecommand{\\cftparafont}{%\n"
359// " \\fontsize{9}{11}\\usefont{OT1}{phv}{c}{n}\\selectfont\n"
360// "}\n"
361// "\\providecommand{\\cftparapagefont}{%\n"
362// " \\fontsize{9}{11}\\usefont{OT1}{phv}{c}{n}\\selectfont\n"
363// "}\n"
364// "\\providecommand{\\cfttoctitlefont}{%\n"
365// " \\fontsize{20}{22}\\usefont{OT1}{phv}{b}{n}\\selectfont\n"
366// "}\n"
367 "\\providecommand{\\rmdefault}{phv}\n"
368 "\\providecommand{\\bfdefault}{bc}\n"
369 "\n\n";
370
371 t << "% Setup fancy headings\n"
372 "\\pagestyle{fancyplain}\n"
373 "\\newcommand{\\clearemptydoublepage}{%\n"
374 " \\newpage{\\pagestyle{empty}\\cleardoublepage}%\n"
375 "}\n";
376 if (!Config_getBool("COMPACT_LATEX"))
377 t << "\\renewcommand{\\chaptermark}[1]{%\n"
378 " \\markboth{#1}{}%\n"
379 "}\n";
380 t << "\\renewcommand{\\sectionmark}[1]{%\n"
381 " \\markright{\\thesection\\ #1}%\n"
382 "}\n";
383
384 //t << "\\lhead[\\fancyplain{}{\\bfseries\\thepage}]{%\n"
385 // " \\fancyplain{}{\\bfseries\\rightmark}%\n"
386 // "}\n";
387 //t << "\\rhead[\\fancyplain{}{\\bfseries\\leftmark}]{%\n"
388 // " \\fancyplain{}{\\bfseries\\thepage}%\n"
389 // "}\n";
390 //t << "\\rfoot[\\fancyplain{}{\\bfseries\\scriptsize%\n ";
391 t << "\\fancyhead[LE]{\\fancyplain{}{\\bfseries\\thepage}}\n";
392 t << "\\fancyhead[CE]{\\fancyplain{}{}}\n";
393 t << "\\fancyhead[RE]{\\fancyplain{}{\\bfseries\\leftmark}}\n";
394 t << "\\fancyhead[LO]{\\fancyplain{}{\\bfseries\\rightmark}}\n";
395 t << "\\fancyhead[CO]{\\fancyplain{}{}}\n";
396 t << "\\fancyhead[RO]{\\fancyplain{}{\\bfseries\\thepage}}\n";
397
398 t << "\\fancyfoot[LE]{\\fancyplain{}{}}\n";
399 t << "\\fancyfoot[CE]{\\fancyplain{}{}}\n";
400 t << "\\fancyfoot[RE]{\\fancyplain{}{\\bfseries\\scriptsize ";
401}
402
403static void writeDefaultStyleSheetPart2(FTextStream &t)
404{
405 t << "}}\n";
406 t << "\\fancyfoot[LO]{\\fancyplain{}{\\bfseries\\scriptsize ";
407 //t << "\\lfoot[]{\\fancyplain{}{\\bfseries\\scriptsize%\n ";
408
409}
410
411static void writeDefaultStyleSheetPart3(FTextStream &t)
412{
413 static bool latexSourceCode = Config_getBool("LATEX_SOURCE_CODE");
414 t << "}}\n";
415 //t << "\\cfoot{}\n\n";
416 t << "\\fancyfoot[CO]{\\fancyplain{}{}}\n";
417 t << "\\fancyfoot[RO]{\\fancyplain{}{}}\n";
418
419 t << "%---------- Internal commands used in this style file ----------------\n\n";
420 t << "% Generic environment used by all paragraph-based environments defined\n"
421 "% below. Note that the command \\title{...} needs to be defined inside\n"
422 "% those environments!\n"
423 "\\newenvironment{DoxyDesc}[1]{%\n"
424 " \\begin{list}{}%\n"
425 " {%\n"
426 " \\settowidth{\\labelwidth}{40pt}%\n"
427 " \\setlength{\\leftmargin}{\\labelwidth}%\n"
428 " \\setlength{\\parsep}{0pt}%\n"
429 " \\setlength{\\itemsep}{-4pt}%\n"
430 " \\renewcommand{\\makelabel}{\\entrylabel}%\n"
431 " }%\n"
432 " \\item[#1]%\n"
433 "}{%\n"
434 " \\end{list}%\n"
435 "}\n\n";
436 t << "%---------- Commands used by doxygen LaTeX output generator ----------\n\n";
437 t << "% Used by <pre> ... </pre>\n"
438 "\\newenvironment{DoxyPre}{%\n"
439 " \\small%\n"
440 " \\begin{alltt}%\n"
441 "}{%\n"
442 " \\end{alltt}%\n"
443 " \\normalsize%\n"
444 "}\n\n";
445 t << "% Used by @code ... @endcode\n"
446 "\\newenvironment{DoxyCode}{%\n";
447 if (latexSourceCode)
448 {
449 t << "\n\n\\begin{footnotesize}\\begin{alltt}%" << endl;
450 }
451 else
452 {
453 t << " \\footnotesize%\n"
454 " \\verbatim%\n";
455 }
456 t << "}{%\n";
457 if (latexSourceCode)
458 {
459 t << "\\end{alltt}\\end{footnotesize}%" << endl;
460 }
461 else
462 {
463 t << " \\endverbatim%\n"
464 " \\normalsize%\n";
465 }
466 t << "}\n\n";
467 t << "% Used by @example, @include, @includelineno and @dontinclude\n"
468 "\\newenvironment{DoxyCodeInclude}{%\n"
469 " \\DoxyCode%\n"
470 "}{%\n"
471 " \\endDoxyCode%\n"
472 "}\n\n";
473 t << "% Used by @verbatim ... @endverbatim\n"
474 "\\newenvironment{DoxyVerb}{%\n"
475 " \\footnotesize%\n"
476 " \\verbatim%\n"
477 "}{%\n"
478 " \\endverbatim%\n"
479 " \\normalsize%\n"
480 "}\n\n";
481 t << "% Used by @verbinclude\n"
482 "\\newenvironment{DoxyVerbInclude}{%\n"
483 " \\DoxyVerb%\n"
484 "}{%\n"
485 " \\endDoxyVerb%\n"
486 "}\n\n";
487 t << "% Used by numbered lists (using '-#' or <ol> ... </ol>)\n"
488 "\\newenvironment{DoxyEnumerate}{%\n"
489 " \\enumerate%\n"
490 "}{%\n"
491 " \\endenumerate%\n"
492 "}\n\n";
493 t << "% Used by bullet lists (using '-', @li, @arg, or <ul> ... </ul>)\n"
494 "\\newenvironment{DoxyItemize}{%\n"
495 " \\itemize%\n"
496 "}{%\n"
497 " \\enditemize%\n"
498 "}\n\n";
499 t << "% Used by description lists (using <dl> ... </dl>)\n"
500 "\\newenvironment{DoxyDescription}{%\n"
501 " \\description%\n"
502 "}{%\n"
503 " \\enddescription%\n"
504 "}\n\n";
505 t << "% Used by @image, @dotfile, and @dot ... @enddot\n"
506 "% (only if caption is specified)\n"
507 "\\newenvironment{DoxyImage}{%\n"
508 " \\begin{figure}[H]%\n"
509 " \\begin{center}%\n"
510 "}{%\n"
511 " \\end{center}%\n"
512 " \\end{figure}%\n"
513 "}\n\n";
514 t << "% Used by @image, @dotfile, @dot ... @enddot, and @msc ... @endmsc\n"
515 "% (only if no caption is specified)\n"
516 "\\newenvironment{DoxyImageNoCaption}{%\n"
517 "}{%\n"
518 "}\n\n";
519 t << "% Used by @attention\n"
520 "\\newenvironment{DoxyAttention}[1]{%\n"
521 " \\begin{DoxyDesc}{#1}%\n"
522 "}{%\n"
523 " \\end{DoxyDesc}%\n"
524 "}\n\n";
525 t << "% Used by @author and @authors\n"
526 "\\newenvironment{DoxyAuthor}[1]{%\n"
527 " \\begin{DoxyDesc}{#1}%\n"
528 "}{%\n"
529 " \\end{DoxyDesc}%\n"
530 "}\n\n";
531 t << "% Used by @date\n"
532 "\\newenvironment{DoxyDate}[1]{%\n"
533 " \\begin{DoxyDesc}{#1}%\n"
534 "}{%\n"
535 " \\end{DoxyDesc}%\n"
536 "}\n\n";
537 t << "% Used by @invariant\n"
538 "\\newenvironment{DoxyInvariant}[1]{%\n"
539 " \\begin{DoxyDesc}{#1}%\n"
540 "}{%\n"
541 " \\end{DoxyDesc}%\n"
542 "}\n\n";
543 t << "% Used by @note\n"
544 "\\newenvironment{DoxyNote}[1]{%\n"
545 " \\begin{DoxyDesc}{#1}%\n"
546 "}{%\n"
547 " \\end{DoxyDesc}%\n"
548 "}\n\n";
549 t << "% Used by @post\n"
550 "\\newenvironment{DoxyPostcond}[1]{%\n"
551 " \\begin{DoxyDesc}{#1}%\n"
552 "}{%\n"
553 " \\end{DoxyDesc}%\n"
554 "}\n\n";
555 t << "% Used by @pre\n"
556 "\\newenvironment{DoxyPrecond}[1]{%\n"
557 " \\begin{DoxyDesc}{#1}%\n"
558 "}{%\n"
559 " \\end{DoxyDesc}%\n"
560 "}\n\n";
561 t << "% Used by @remark\n"
562 "\\newenvironment{DoxyRemark}[1]{%\n"
563 " \\begin{DoxyDesc}{#1}%\n"
564 "}{%\n"
565 " \\end{DoxyDesc}%\n"
566 "}\n\n";
567 t << "% Used by @return\n"
568 "\\newenvironment{DoxyReturn}[1]{%\n"
569 " \\begin{DoxyDesc}{#1}%\n"
570 "}{%\n"
571 " \\end{DoxyDesc}%\n"
572 "}\n\n";
573 t << "% Used by @since\n"
574 "\\newenvironment{DoxySince}[1]{%\n"
575 " \\begin{DoxyDesc}{#1}%\n"
576 "}{%\n"
577 " \\end{DoxyDesc}%\n"
578 "}\n\n";
579 t << "% Used by @see\n"
580 "\\newenvironment{DoxySeeAlso}[1]{%\n"
581 " \\begin{DoxyDesc}{#1}%\n"
582 "}{%\n"
583 " \\end{DoxyDesc}%\n"
584 "}\n\n";
585 t << "% Used by @version\n"
586 "\\newenvironment{DoxyVersion}[1]{%\n"
587 " \\begin{DoxyDesc}{#1}%\n"
588 "}{%\n"
589 " \\end{DoxyDesc}%\n"
590 "}\n\n";
591 t << "% Used by @warning\n"
592 "\\newenvironment{DoxyWarning}[1]{%\n"
593 " \\begin{DoxyDesc}{#1}%\n"
594 "}{%\n"
595 " \\end{DoxyDesc}%\n"
596 "}\n\n";
597 t << "% Used by @internal\n"
598 "\\newenvironment{DoxyInternal}[1]{%\n"
599 " \\paragraph*{#1}%\n"
600 "}{%\n"
601 "}\n\n";
602 t << "% Used by @par and @paragraph\n"
603 "\\newenvironment{DoxyParagraph}[1]{%\n"
604 " \\begin{list}{}%\n"
605 " {%\n"
606 " \\settowidth{\\labelwidth}{40pt}%\n"
607 " \\setlength{\\leftmargin}{\\labelwidth}%\n"
608 " \\setlength{\\parsep}{0pt}%\n"
609 " \\setlength{\\itemsep}{-4pt}%\n"
610 " \\renewcommand{\\makelabel}{\\entrylabel}%\n"
611 " }%\n"
612 " \\item[#1]%\n"
613 "}{%\n"
614 " \\end{list}%\n"
615 "}\n\n";
616 t << "% Used by parameter lists\n"
617 "\\newenvironment{DoxyParams}[2][]{%\n"
618 " \\begin{DoxyDesc}{#2}%\n"
619 " \\begin{description}%\n"
620 " \\item[] \\hspace{\\fill} \\vspace{-25pt}%\n"
621 " \\definecolor{tableShade}{HTML}{F8F8F8}%\n"
622 " \\rowcolors{1}{white}{tableShade}%\n"
623 " \\arrayrulecolor{gray}%\n"
624 " \\setlength{\\tabcolsep}{0.01\\textwidth}%\n"
625 " \\ifthenelse{\\equal{#1}{}}\n" // default: name, docs columns
626 " {\\begin{longtable}{|>{\\raggedleft\\hspace{0pt}}p{0.15\\textwidth}|%\n"
627 " p{0.87\\textwidth}|}}%\n"
628 " {\\ifthenelse{\\equal{#1}{1}}%\n" // inout, name, docs columns, or type, name, docs columns
629 " {\\begin{longtable}{|>{\\centering}p{0.10\\textwidth}|%\n"
630 " >{\\raggedleft\\hspace{0pt}}p{0.15\\textwidth}|%\n"
631 " p{0.75\\textwidth}|}}%\n"
632 " {\\begin{longtable}{|>{\\centering}p{0.10\\textwidth}|%\n" // inout, type, name, docs columns
633 " >{\\centering\\hspace{0pt}}p{0.15\\textwidth}|%\n"
634 " >{\\raggedleft\\hspace{0pt}}p{0.15\\textwidth}|%\n"
635 " p{0.58\\textwidth}|}}%\n"
636 " }\\hline%\n"
637 "}{%\n"
638 " \\end{longtable}%\n"
639 " \\end{description}%\n"
640 " \\end{DoxyDesc}%\n"
641 "}\n\n";
642 t << "% is used for parameters within a detailed function description\n"
643 "\\newenvironment{DoxyParamCaption}{%\n"
644 " \\renewcommand{\\item}[2][]{##1 {\\em ##2}}%\n"
645 " }{%\n"
646 "}\n\n";
647 t << "% Used by return value lists\n"
648 "\\newenvironment{DoxyRetVals}[1]{%\n"
649 " \\begin{DoxyDesc}{#1}%\n"
650 " \\begin{description}%\n"
651 " \\item[] \\hspace{\\fill} \\vspace{-25pt}%\n"
652 " \\definecolor{tableShade}{HTML}{F8F8F8}%\n"
653 " \\rowcolors{1}{white}{tableShade}%\n"
654 " \\arrayrulecolor{gray}%\n"
655 " \\setlength{\\tabcolsep}{0.01\\textwidth}%\n"
656 " \\begin{longtable}{|>{\\raggedleft\\hspace{0pt}}p{0.25\\textwidth}|%\n"
657 " p{0.77\\textwidth}|}%\n"
658 " \\hline%\n"
659 "}{%\n"
660 " \\end{longtable}%\n"
661 " \\end{description}%\n"
662 " \\end{DoxyDesc}%\n"
663 "}\n\n";
664 t << "% Used by exception lists\n"
665 "\\newenvironment{DoxyExceptions}[1]{%\n"
666 " \\begin{DoxyDesc}{#1}%\n"
667 " \\begin{description}%\n"
668 " \\item[] \\hspace{\\fill} \\vspace{-25pt}%\n"
669 " \\definecolor{tableShade}{HTML}{F8F8F8}%\n"
670 " \\rowcolors{1}{white}{tableShade}%\n"
671 " \\arrayrulecolor{gray}%\n"
672 " \\setlength{\\tabcolsep}{0.01\\textwidth}%\n"
673 " \\begin{longtable}{|>{\\raggedleft\\hspace{0pt}}p{0.25\\textwidth}|%\n"
674 " p{0.77\\textwidth}|}%\n"
675 " \\hline%\n"
676 "}{%\n"
677 " \\end{longtable}%\n"
678 " \\end{description}%\n"
679 " \\end{DoxyDesc}%\n"
680 "}\n\n";
681 t << "% Used by template parameter lists\n"
682 "\\newenvironment{DoxyTemplParams}[1]{%\n"
683 " \\begin{DoxyDesc}{#1}%\n"
684 " \\begin{description}%\n"
685 " \\item[] \\hspace{\\fill} \\vspace{-25pt}%\n"
686 " \\definecolor{tableShade}{HTML}{F8F8F8}%\n"
687 " \\rowcolors{1}{white}{tableShade}%\n"
688 " \\arrayrulecolor{gray}%\n"
689 " \\setlength{\\tabcolsep}{0.01\\textwidth}%\n"
690 " \\begin{longtable}{|>{\\raggedleft\\hspace{0pt}}p{0.25\\textwidth}|%\n"
691 " p{0.77\\textwidth}|}%\n"
692 " \\hline%\n"
693 "}{%\n"
694 " \\end{longtable}%\n"
695 " \\end{description}%\n"
696 " \\end{DoxyDesc}%\n"
697 "}\n\n";
698 t << "\\newcommand{\\doxyref}[3]{\\textbf{#1} (\\textnormal{#2}\\,\\pageref{#3})}\n";
699 t << "\\newenvironment{DoxyCompactList}\n";
700 t << "{\\begin{list}{}{\n";
701 t << " \\setlength{\\leftmargin}{0.5cm}\n";
702 t << " \\setlength{\\itemsep}{0pt}\n";
703 t << " \\setlength{\\parsep}{0pt}\n";
704 t << " \\setlength{\\topsep}{0pt}\n";
705 t << " \\renewcommand{\\makelabel}{\\hfill}}}\n";
706 t << "{\\end{list}}\n";
707 t << "\\newenvironment{DoxyCompactItemize}\n";
708 t << "{\n";
709 t << " \\begin{itemize}\n";
710 t << " \\setlength{\\itemsep}{-3pt}\n";
711 t << " \\setlength{\\parsep}{0pt}\n";
712 t << " \\setlength{\\topsep}{0pt}\n";
713 t << " \\setlength{\\partopsep}{0pt}\n";
714 t << "}\n";
715 t << "{\\end{itemize}}\n";
716 t << "\\newcommand{\\PBS}[1]{\\let\\temp=\\\\#1\\let\\\\=\\temp}\n";
717 t << "\\newlength{\\tmplength}\n";
718 t << "\\newenvironment{TabularC}[1]\n";
719 t << "{\n";
720 t << "\\setlength{\\tmplength}\n";
721 t << " {\\linewidth/(#1)-\\tabcolsep*2-\\arrayrulewidth*(#1+1)/(#1)}\n";
722 t << " \\par\\begin{tabular*}{\\linewidth}\n";
723 t << " {*{#1}{|>{\\PBS\\raggedright\\hspace{0pt}}p{\\the\\tmplength}}|}\n";
724 t << "}\n";
725 t << "{\\end{tabular*}\\par}\n";
726 t << "\\newcommand{\\entrylabel}[1]{\n";
727 t << " {\\parbox[b]{\\labelwidth-4pt}{\\makebox[0pt][l]{\\textbf{#1}}\\vspace{1.5\\baselineskip}}}}\n";
728 t << "\\newenvironment{Desc}\n";
729 t << "{\\begin{list}{}\n";
730 t << " {\n";
731 t << " \\settowidth{\\labelwidth}{40pt}\n";
732 t << " \\setlength{\\leftmargin}{\\labelwidth}\n";
733 t << " \\setlength{\\parsep}{0pt}\n";
734 t << " \\setlength{\\itemsep}{-4pt}\n";
735 t << " \\renewcommand{\\makelabel}{\\entrylabel}\n";
736 t << " }\n";
737 t << "}\n";
738 t << "{\\end{list}}\n";
739
740 t << "\\newenvironment{Indent}\n";
741 t << " {\\begin{list}{}{\\setlength{\\leftmargin}{0.5cm}}\n";
742 t << " \\item[]\\ignorespaces}\n";
743 t << " {\\unskip\\end{list}}\n";
744
745 t << "\\setlength{\\parindent}{0cm}\n";
746 t << "\\setlength{\\parskip}{0.2cm}\n";
747 t << "\\addtocounter{secnumdepth}{2}\n";
748 // \sloppy should not be used, see bug 563698
749 //t << "\\sloppy\n";
750 t << "\\usepackage[T1]{fontenc}\n";
751 t << "\\makeatletter\n";
752 t << "\\renewcommand{\\paragraph}{\\@startsection{paragraph}{4}{0ex}%\n";
753 t << " {-1.0ex}%\n";
754 t << " {1.0ex}%\n";
755 t << " {\\usefont{OT1}{phv}{bc}{n}\\color{darkgray}}}\n";
756 t << "\\renewcommand{\\subparagraph}{\\@startsection{subparagraph}{5}{0ex}%\n";
757 t << " {-1.0ex}%\n";
758 t << " {1.0ex}%\n";
759 t << " {\\usefont{OT1}{phv}{bc}{n}\\color{darkgray}}}\n";
760 t << "\\makeatother\n";
761 t << "\\allsectionsfont{\\usefont{OT1}{phv}{bc}{n}\\selectfont\\color{darkgray}}\n";
762 t << "\\stepcounter{secnumdepth}\n";
763 t << "\\stepcounter{tocdepth}\n";
764 t << "\\definecolor{comment}{rgb}{0.5,0.0,0.0}\n";
765 t << "\\definecolor{keyword}{rgb}{0.0,0.5,0.0}\n";
766 t << "\\definecolor{keywordtype}{rgb}{0.38,0.25,0.125}\n";
767 t << "\\definecolor{keywordflow}{rgb}{0.88,0.5,0.0}\n";
768 t << "\\definecolor{preprocessor}{rgb}{0.5,0.38,0.125}\n";
769 t << "\\definecolor{stringliteral}{rgb}{0.0,0.125,0.25}\n";
770 t << "\\definecolor{charliteral}{rgb}{0.0,0.5,0.5}\n";
771 t << "\\definecolor{vhdldigit}{rgb}{1.0,0.0,1.0}\n";
772 t << "\\definecolor{vhdlkeyword}{rgb}{0.43,0.0,0.43}\n";
773 t << "\\definecolor{vhdllogic}{rgb}{1.0,0.0,0.0}\n";
774 t << "\\definecolor{vhdlchar}{rgb}{0.0,0.0,0.0}\n";
775}
776
777static void writeDefaultFooter(FTextStream &t)
778{
779 t << "\\printindex\n";
780 t << "\\end{document}\n";
781}
782
783void LatexGenerator::writeHeaderFile(QFile &f)
784{
785 FTextStream t(&f);
786 writeDefaultHeaderPart1(t);
787 t << "Your title here";
788 writeDefaultHeaderPart2(t);
789 t << "Generated by";
790 writeDefaultHeaderPart3(t);
791}
792
793void LatexGenerator::writeFooterFile(QFile &f)
794{
795 FTextStream t(&f);
796 writeDefaultFooter(t);
797}
798
799void LatexGenerator::writeStyleSheetFile(QFile &f)
800{
801 FTextStream t(&f);
802
803 writeDefaultStyleSheetPart1(t);
804 QCString &projectName = Config_getString("PROJECT_NAME");
805
806 t << theTranslator->trGeneratedAt( dateToString(TRUE), projectName );
807 t << " doxygen";
808 //t << " " << theTranslator->trWrittenBy() << " ";
809 //t << "Dimitri van Heesch \\copyright~1997-2011";
810 writeDefaultStyleSheetPart2(t);
811 t << theTranslator->trGeneratedAt( dateToString(TRUE), projectName );
812 t << " doxygen";
813 //t << " << theTranslator->trWrittenBy() << " ";
814 //t << "Dimitri van Heesch \\copyright~1997-2011";
815 writeDefaultStyleSheetPart3(t);
816}
817
818void LatexGenerator::startFile(const char *name,const char *,const char *)
819{
820#if 0
821 setEncoding(Config_getString("LATEX_OUTPUT_ENCODING"));
822#endif
823 QCString fileName=name;
824 relPath = relativePathToRoot(fileName);
825 sourceFileName = stripPath(fileName);
826 if (fileName.right(4)!=".tex" && fileName.right(4)!=".sty") fileName+=".tex";
827 startPlainFile(fileName);
828}
829
830void LatexGenerator::endFile()
831{
832 endPlainFile();
833 sourceFileName.resize(0);
834}
835
836//void LatexGenerator::writeIndex()
837//{
838// startFile("refman.tex");
839//}
840
841void LatexGenerator::startProjectNumber()
842{
843 t << "\\\\[1ex]\\large ";
844}
845
846void LatexGenerator::startIndexSection(IndexSections is)
847{
848 bool &compactLatex = Config_getBool("COMPACT_LATEX");
849 QCString &latexHeader = Config_getString("LATEX_HEADER");
850 switch (is)
851 {
852 case isTitlePageStart:
853 {
854 if (latexHeader.isEmpty())
855 {
856 writeDefaultHeaderPart1(t);
857 }
858 else
859 {
860 QCString header = fileToString(latexHeader);
861 t << substituteKeywords(header,0);
862 }
863 }
864 break;
865 case isTitlePageAuthor:
866 if (latexHeader.isEmpty())
867 {
868 writeDefaultHeaderPart2(t);
869 }
870 break;
871 case isMainPage:
872 if (compactLatex) t << "\\section"; else t << "\\chapter";
873 t << "{"; //Introduction}\n"
874 break;
875 //case isPackageIndex:
876 // if (compactLatex) t << "\\section"; else t << "\\chapter";
877 // t << "{"; //Package Index}\n"
878 // break;
879 case isModuleIndex:
880 if (compactLatex) t << "\\section"; else t << "\\chapter";
881 t << "{"; //Module Index}\n"
882 break;
883 case isDirIndex:
884 if (compactLatex) t << "\\section"; else t << "\\chapter";
885 t << "{"; //Directory Index}\n"
886 break;
887 case isNamespaceIndex:
888 if (compactLatex) t << "\\section"; else t << "\\chapter";
889 t << "{"; //Namespace Index}\"
890 break;
891 case isClassHierarchyIndex:
892 if (compactLatex) t << "\\section"; else t << "\\chapter";
893 t << "{"; //Hierarchical Index}\n"
894 break;
895 case isCompoundIndex:
896 if (compactLatex) t << "\\section"; else t << "\\chapter";
897 t << "{"; //Annotated Compound Index}\n"
898 break;
899 case isFileIndex:
900 if (compactLatex) t << "\\section"; else t << "\\chapter";
901 t << "{"; //Annotated File Index}\n"
902 break;
903 case isPageIndex:
904 if (compactLatex) t << "\\section"; else t << "\\chapter";
905 t << "{"; //Annotated Page Index}\n"
906 break;
907 case isModuleDocumentation:
908 {
909 GroupSDict::Iterator gli(*Doxygen::groupSDict);
910 GroupDef *gd;
911 bool found=FALSE;
912 for (gli.toFirst();(gd=gli.current()) && !found;++gli)
913 {
914 if (!gd->isReference())
915 {
916 if (compactLatex) t << "\\section"; else t << "\\chapter";
917 t << "{"; //Module Documentation}\n";
918 found=TRUE;
919 }
920 }
921 }
922 break;
923 case isDirDocumentation:
924 {
925 SDict<DirDef>::Iterator dli(*Doxygen::directories);
926 DirDef *dd;
927 bool found=FALSE;
928 for (dli.toFirst();(dd=dli.current()) && !found;++dli)
929 {
930 if (dd->isLinkableInProject())
931 {
932 if (compactLatex) t << "\\section"; else t << "\\chapter";
933 t << "{"; //Module Documentation}\n";
934 found=TRUE;
935 }
936 }
937 }
938 break;
939 case isNamespaceDocumentation:
940 {
941 NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict);
942 NamespaceDef *nd;
943 bool found=FALSE;
944 for (nli.toFirst();(nd=nli.current()) && !found;++nli)
945 {
946 if (nd->isLinkableInProject())
947 {
948 if (compactLatex) t << "\\section"; else t << "\\chapter";
949 t << "{"; // Namespace Documentation}\n":
950 found=TRUE;
951 }
952 }
953 }
954 break;
955 case isClassDocumentation:
956 {
957 ClassSDict::Iterator cli(*Doxygen::classSDict);
958 ClassDef *cd=0;
959 bool found=FALSE;
960 for (cli.toFirst();(cd=cli.current()) && !found;++cli)
961 {
962 if (cd->isLinkableInProject() &&
963 cd->templateMaster()==0 &&
964 !cd->isEmbeddedInGroupDocs()
965 )
966 {
967 if (compactLatex) t << "\\section"; else t << "\\chapter";
968 t << "{"; //Compound Documentation}\n";
969 found=TRUE;
970 }
971 }
972 }
973 break;
974 case isFileDocumentation:
975 {
976 bool isFirst=TRUE;
977 FileName *fn=Doxygen::inputNameList->first();
978 while (fn)
979 {
980 FileDef *fd=fn->first();
981 while (fd)
982 {
983 if (fd->isLinkableInProject())
984 {
985 if (isFirst)
986 {
987 if (compactLatex) t << "\\section"; else t << "\\chapter";
988 t << "{"; //File Documentation}\n";
989 isFirst=FALSE;
990 break;
991 }
992 }
993 fd=fn->next();
994 }
995 fn=Doxygen::inputNameList->next();
996 }
997 }
998 break;
999 case isExampleDocumentation:
1000 {
1001 if (compactLatex) t << "\\section"; else t << "\\chapter";
1002 t << "{"; //Example Documentation}\n";
1003 }
1004 break;
1005 case isPageDocumentation:
1006 {
1007 if (compactLatex) t << "\\section"; else t << "\\chapter";
1008 t << "{"; //Page Documentation}\n";
1009 }
1010 break;
1011 case isPageDocumentation2:
1012 break;
1013 case isEndIndex:
1014 break;
1015 }
1016}
1017
1018void LatexGenerator::endIndexSection(IndexSections is)
1019{
1020 //static bool compactLatex = Config_getBool("COMPACT_LATEX");
1021 static bool sourceBrowser = Config_getBool("SOURCE_BROWSER");
1022 static QCString latexHeader = Config_getString("LATEX_HEADER");
1023 static QCString latexFooter = Config_getString("LATEX_FOOTER");
1024 switch (is)
1025 {
1026 case isTitlePageStart:
1027 break;
1028 case isTitlePageAuthor:
1029 if (latexHeader.isEmpty())
1030 {
1031 writeDefaultHeaderPart3(t);
1032 }
1033 break;
1034 case isMainPage:
1035 {
1036 QCString indexName=Config_getBool("GENERATE_TREEVIEW")?"main":"index";
1037 t << "}\n\\label{index}";
1038 if (Config_getBool("PDF_HYPERLINKS")) t << "\\hypertarget{index}{}";
1039 t << "\\input{" << indexName << "}\n";
1040 }
1041 break;
1042 case isModuleIndex:
1043 t << "}\n\\input{modules}\n";
1044 break;
1045 case isDirIndex:
1046 t << "}\n\\input{dirs}\n";
1047 break;
1048 case isNamespaceIndex:
1049 t << "}\n\\input{namespaces}\n";
1050 break;
1051 case isClassHierarchyIndex:
1052 t << "}\n\\input{hierarchy}\n";
1053 break;
1054 case isCompoundIndex:
1055 t << "}\n\\input{annotated}\n";
1056 break;
1057 case isFileIndex:
1058 t << "}\n\\input{files}\n";
1059 break;
1060 case isPageIndex:
1061 t << "}\n\\input{pages}\n";
1062 break;
1063 case isModuleDocumentation:
1064 {
1065 GroupSDict::Iterator gli(*Doxygen::groupSDict);
1066 GroupDef *gd;
1067 bool found=FALSE;
1068 for (gli.toFirst();(gd=gli.current()) && !found;++gli)
1069 {
1070 if (!gd->isReference())
1071 {
1072 t << "}\n\\input{" << gd->getOutputFileBase() << "}\n";
1073 found=TRUE;
1074 }
1075 }
1076 for (;(gd=gli.current());++gli)
1077 {
1078 if (!gd->isReference())
1079 {
1080 //if (compactLatex) t << "\\input"; else t << "\\include";
1081 t << "\\input";
1082 t << "{" << gd->getOutputFileBase() << "}\n";
1083 }
1084 }
1085 }
1086 break;
1087 case isDirDocumentation:
1088 {
1089 SDict<DirDef>::Iterator dli(*Doxygen::directories);
1090 DirDef *dd;
1091 bool found=FALSE;
1092 for (dli.toFirst();(dd=dli.current()) && !found;++dli)
1093 {
1094 if (dd->isLinkableInProject())
1095 {
1096 t << "}\n\\input{" << dd->getOutputFileBase() << "}\n";
1097 found=TRUE;
1098 }
1099 }
1100 for (;(dd=dli.current());++dli)
1101 {
1102 if (dd->isLinkableInProject())
1103 {
1104 //if (compactLatex) t << "\\input"; else t << "\\include";
1105 t << "\\input";
1106 t << "{" << dd->getOutputFileBase() << "}\n";
1107 }
1108 }
1109 }
1110 break;
1111 case isNamespaceDocumentation:
1112 {
1113 NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict);
1114 NamespaceDef *nd;
1115 bool found=FALSE;
1116 for (nli.toFirst();(nd=nli.current()) && !found;++nli)
1117 {
1118 if (nd->isLinkableInProject())
1119 {
1120 t << "}\n\\input{" << nd->getOutputFileBase() << "}\n";
1121 found=TRUE;
1122 }
1123 }
1124 while ((nd=nli.current()))
1125 {
1126 if (nd->isLinkableInProject())
1127 {
1128 //if (compactLatex) t << "\\input"; else t << "\\include";
1129 t << "\\input";
1130 t << "{" << nd->getOutputFileBase() << "}\n";
1131 }
1132 ++nli;
1133 }
1134 }
1135 break;
1136 case isClassDocumentation:
1137 {
1138 ClassSDict::Iterator cli(*Doxygen::classSDict);
1139 ClassDef *cd=0;
1140 bool found=FALSE;
1141 for (cli.toFirst();(cd=cli.current()) && !found;++cli)
1142 {
1143 if (cd->isLinkableInProject() &&
1144 cd->templateMaster()==0 &&
1145 !cd->isEmbeddedInGroupDocs()
1146 )
1147 {
1148 t << "}\n\\input{" << cd->getOutputFileBase() << "}\n";
1149 found=TRUE;
1150 }
1151 }
1152 for (;(cd=cli.current());++cli)
1153 {
1154 if (cd->isLinkableInProject() &&
1155 cd->templateMaster()==0 &&
1156 !cd->isEmbeddedInGroupDocs()
1157 )
1158 {
1159 //if (compactLatex) t << "\\input"; else t << "\\include";
1160 t << "\\input";
1161 t << "{" << cd->getOutputFileBase() << "}\n";
1162 }
1163 }
1164 }
1165 break;
1166 case isFileDocumentation:
1167 {
1168 bool isFirst=TRUE;
1169 FileName *fn=Doxygen::inputNameList->first();
1170 while (fn)
1171 {
1172 FileDef *fd=fn->first();
1173 while (fd)
1174 {
1175 if (fd->isLinkableInProject())
1176 {
1177 if (isFirst)
1178 {
1179 t << "}\n\\input{" << fd->getOutputFileBase() << "}\n";
1180 if (sourceBrowser && m_prettyCode && fd->generateSourceFile())
1181 {
1182 //t << "\\include{" << fd->getSourceFileBase() << "}\n";
1183 t << "\\input{" << fd->getSourceFileBase() << "}\n";
1184 }
1185 isFirst=FALSE;
1186 }
1187 else
1188 {
1189 //if (compactLatex) t << "\\input" ; else t << "\\include";
1190 t << "\\input" ;
1191 t << "{" << fd->getOutputFileBase() << "}\n";
1192 if (sourceBrowser && m_prettyCode && fd->generateSourceFile())
1193 {
1194 //t << "\\include{" << fd->getSourceFileBase() << "}\n";
1195 t << "\\input{" << fd->getSourceFileBase() << "}\n";
1196 }
1197 }
1198 }
1199 fd=fn->next();
1200 }
1201 fn=Doxygen::inputNameList->next();
1202 }
1203 }
1204 break;
1205 case isExampleDocumentation:
1206 {
1207 t << "}\n";
1208 PageSDict::Iterator pdi(*Doxygen::exampleSDict);
1209 PageDef *pd=pdi.toFirst();
1210 if (pd)
1211 {
1212 t << "\\input{" << pd->getOutputFileBase() << "}\n";
1213 }
1214 for (++pdi;(pd=pdi.current());++pdi)
1215 {
1216 //if (compactLatex) t << "\\input" ; else t << "\\include";
1217 t << "\\input";
1218 t << "{" << pd->getOutputFileBase() << "}\n";
1219 }
1220 }
1221 break;
1222 case isPageDocumentation:
1223 {
1224 t << "}\n";
1225#if 0
1226 PageSDict::Iterator pdi(*Doxygen::pageSDict);
1227 PageDef *pd=pdi.toFirst();
1228 bool first=TRUE;
1229 for (pdi.toFirst();(pd=pdi.current());++pdi)
1230 {
1231 if (!pd->getGroupDef() && !pd->isReference())
1232 {
1233 if (compactLatex) t << "\\section"; else t << "\\chapter";
1234 t << "{" << pd->title();
1235 t << "}\n";
1236
1237 if (compactLatex || first) t << "\\input" ; else t << "\\include";
1238 t << "{" << pd->getOutputFileBase() << "}\n";
1239 first=FALSE;
1240 }
1241 }
1242#endif
1243 }
1244 break;
1245 case isPageDocumentation2:
1246 break;
1247 case isEndIndex:
1248 if (latexFooter.isEmpty())
1249 {
1250 writeDefaultFooter(t);
1251 }
1252 else
1253 {
1254 QCString footer = fileToString(latexFooter);
1255 t << substituteKeywords(footer,0);
1256 }
1257 break;
1258 }
1259}
1260
1261void LatexGenerator::writePageLink(const char *name, bool /*first*/)
1262{
1263 //bool &compactLatex = Config_getBool("COMPACT_LATEX");
1264 // next is remove for bug615957
1265 //if (compactLatex || first) t << "\\input" ; else t << "\\include";
1266 t << "\\input" ;
1267 t << "{" << name << "}\n";
1268}
1269
1270
1271void LatexGenerator::writeStyleInfo(int part)
1272{
1273 switch(part)
1274 {
1275 case 0:
1276 {
1277 //QCString pname=Config_getString("PROJECT_NAME").stripWhiteSpace();
1278 startPlainFile("doxygen.sty");
1279 writeDefaultStyleSheetPart1(t);
1280 }
1281 break;
1282 case 1:
1283 case 3:
1284 t << " Doxygen ";
1285 break;
1286 case 2:
1287 {
1288 writeDefaultStyleSheetPart2(t);
1289 }
1290 break;
1291 case 4:
1292 {
1293 writeDefaultStyleSheetPart3(t);
1294 endPlainFile();
1295 }
1296 break;
1297 }
1298}
1299
1300void LatexGenerator::newParagraph()
1301{
1302 t << endl << endl;
1303}
1304
1305void LatexGenerator::startParagraph()
1306{
1307 t << endl << endl;
1308}
1309
1310void LatexGenerator::endParagraph()
1311{
1312 t << endl << endl;
1313}
1314
1315void LatexGenerator::writeString(const char *text)
1316{
1317 t << text;
1318}
1319
1320void LatexGenerator::startIndexItem(const char *ref,const char *fn)
1321{
1322 t << "\\item ";
1323 if (!ref && fn)
1324 {
1325 t << "\\contentsline{section}{";
1326 }
1327}
1328
1329void LatexGenerator::endIndexItem(const char *ref,const char *fn)
1330{
1331 if (!ref && fn)
1332 {
1333 t << "}{\\pageref{" << fn << "}}{}" << endl;
1334 }
1335}
1336
1337//void LatexGenerator::writeIndexFileItem(const char *,const char *text)
1338//{
1339// t << "\\item\\contentsline{section}{";
1340// docify(text);
1341// t << "}{\\pageref{" << text << "}}" << endl;
1342//}
1343
1344
1345void LatexGenerator::startHtmlLink(const char *url)
1346{
1347 if (Config_getBool("PDF_HYPERLINKS"))
1348 {
1349 t << "\\href{";
1350 t << url;
1351 t << "}";
1352 }
1353 t << "{\\tt ";
1354}
1355
1356void LatexGenerator::endHtmlLink()
1357{
1358 t << "}";
1359}
1360
1361//void LatexGenerator::writeMailLink(const char *url)
1362//{
1363// if (Config_getBool("PDF_HYPERLINKS"))
1364// {
1365// t << "\\href{mailto:";
1366// t << url;
1367// t << "}";
1368// }
1369// t << "{\\tt ";
1370// docify(url);
1371// t << "}";
1372//}
1373
1374void LatexGenerator::writeStartAnnoItem(const char *,const char *,
1375 const char *path,const char *name)
1376{
1377 t << "\\item\\contentsline{section}{\\bf ";
1378 if (path) docify(path);
1379 docify(name);
1380 t << "} ";
1381}
1382
1383void LatexGenerator::writeEndAnnoItem(const char *name)
1384{
1385 t << "}{\\pageref{" << name << "}}{}" << endl;
1386}
1387
1388void LatexGenerator::startIndexKey()
1389{
1390 t << "\\item\\contentsline{section}{";
1391}
1392
1393void LatexGenerator::endIndexKey()
1394{
1395}
1396
1397void LatexGenerator::startIndexValue(bool hasBrief)
1398{
1399 t << " ";
1400 if (hasBrief) t << "(";
1401}
1402
1403void LatexGenerator::endIndexValue(const char *name,bool hasBrief)
1404{
1405 if (hasBrief) t << ")";
1406 t << "}{\\pageref{" << name << "}}{}" << endl;
1407}
1408
1409//void LatexGenerator::writeClassLink(const char *,const char *,
1410// const char *,const char *name)
1411//{
1412// t << "{\\bf ";
1413// docify(name);
1414// t << "}";
1415//}
1416
1417void LatexGenerator::startTextLink(const char *f,const char *anchor)
1418{
1419 if (!disableLinks && Config_getBool("PDF_HYPERLINKS"))
1420 {
1421 t << "\\hyperlink{";
1422 if (f) t << stripPath(f);
1423 if (anchor) t << "_" << anchor;
1424 t << "}{";
1425 }
1426 else
1427 {
1428 t << "{\\bf ";
1429 }
1430}
1431
1432void LatexGenerator::endTextLink()
1433{
1434 t << "}";
1435}
1436
1437void LatexGenerator::writeObjectLink(const char *ref, const char *f,
1438 const char *anchor, const char *text)
1439{
1440 if (!disableLinks && !ref && Config_getBool("PDF_HYPERLINKS"))
1441 {
1442 t << "\\hyperlink{";
1443 if (f) t << stripPath(f);
1444 if (f && anchor) t << "_";
1445 if (anchor) t << anchor;
1446 t << "}{";
1447 docify(text);
1448 t << "}";
1449 }
1450 else
1451 {
1452 t << "{\\bf ";
1453 docify(text);
1454 t << "}";
1455 }
1456}
1457
1458void LatexGenerator::startPageRef()
1459{
1460 t << " \\doxyref{}{";
1461}
1462
1463void LatexGenerator::endPageRef(const char *clname, const char *anchor)
1464{
1465 t << "}{";
1466 if (clname) t << clname;
1467 if (anchor) t << "_" << anchor;
1468 t << "}";
1469}
1470
1471void LatexGenerator::writeCodeLink(const char *ref,const char *f,
1472 const char *anchor,const char *name,
1473 const char *)
1474{
1475 static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS");
1476 static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
1477 int l = strlen(name);
1478 if (col+l>80)
1479 {
1480 t << "\n ";
1481 col=0;
1482 }
1483 if (m_prettyCode && !disableLinks && !ref && usePDFLatex && pdfHyperlinks)
1484 {
1485 t << "\\hyperlink{";
1486 if (f) t << stripPath(f);
1487 if (f && anchor) t << "_";
1488 if (anchor) t << anchor;
1489 t << "}{" << name << "}";
1490 }
1491 else
1492 {
1493 t << name;
1494 }
1495 col+=l;
1496}
1497
1498void LatexGenerator::startTitleHead(const char *fileName)
1499{
1500 static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS");
1501 static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
1502 if (usePDFLatex && pdfHyperlinks && fileName)
1503 {
1504 t << "\\hypertarget{" << stripPath(fileName) << "}{" << endl;
1505 }
1506 if (Config_getBool("COMPACT_LATEX"))
1507 {
1508 t << "\\subsection{";
1509 }
1510 else
1511 {
1512 t << "\\section{";
1513 }
1514}
1515
1516void LatexGenerator::endTitleHead(const char *fileName,const char *name)
1517{
1518 static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS");
1519 static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
1520 t << "}" << endl;
1521 if (name)
1522 {
1523 t << "\\label{" << fileName << "}\\index{";
1524 escapeLabelName(name);
1525 t << "@{";
1526 escapeMakeIndexChars(name);
1527 t << "}}" << endl;
1528 }
1529 if (usePDFLatex && pdfHyperlinks && fileName)
1530 {
1531 t << "}" << endl;
1532 }
1533}
1534
1535void LatexGenerator::startTitle()
1536{
1537 if (Config_getBool("COMPACT_LATEX"))
1538 {
1539 t << "\\subsection{";
1540 }
1541 else
1542 {
1543 t << "\\section{";
1544 }
1545}
1546
1547void LatexGenerator::startGroupHeader(int extraIndentLevel)
1548{
1549 if (Config_getBool("COMPACT_LATEX"))
1550 {
1551 extraIndentLevel++;
1552 }
1553
1554 if (extraIndentLevel==3)
1555 {
1556 t << "\\subparagraph*{";
1557 }
1558 else if (extraIndentLevel==2)
1559 {
1560 t << "\\paragraph{";
1561 }
1562 else if (extraIndentLevel==1)
1563 {
1564 t << "\\subsubsection{";
1565 }
1566 else // extraIndentLevel==0
1567 {
1568 t << "\\subsection{";
1569 }
1570 disableLinks=TRUE;
1571}
1572
1573void LatexGenerator::endGroupHeader(int)
1574{
1575 disableLinks=FALSE;
1576 t << "}" << endl;
1577}
1578
1579void LatexGenerator::startMemberHeader(const char *)
1580{
1581 if (Config_getBool("COMPACT_LATEX"))
1582 {
1583 t << "\\subsubsection*{";
1584 }
1585 else
1586 {
1587 t << "\\subsection*{";
1588 }
1589 disableLinks=TRUE;
1590}
1591
1592void LatexGenerator::endMemberHeader()
1593{
1594 disableLinks=FALSE;
1595 t << "}" << endl;
1596}
1597
1598void LatexGenerator::startMemberDoc(const char *clname,
1599 const char *memname,
1600 const char *,
1601 const char *title,
1602 bool showInline)
1603{
1604 if (memname && memname[0]!='@')
1605 {
1606 t << "\\index{";
1607 if (clname)
1608 {
1609 escapeLabelName(clname);
1610 t << "@{";
1611 escapeMakeIndexChars(clname);
1612 t << "}!";
1613 }
1614 escapeLabelName(memname);
1615 t << "@{";
1616 escapeMakeIndexChars(memname);
1617 t << "}}" << endl;
1618
1619 t << "\\index{";
1620 escapeLabelName(memname);
1621 t << "@{";
1622 escapeMakeIndexChars(memname);
1623 t << "}";
1624 if (clname)
1625 {
1626 t << "!" << clname << "@{";
1627 docify(clname);
1628 t << "}";
1629 }
1630 t << "}" << endl;
1631 }
1632 static const char *levelLab[] = { "subsubsection","paragraph","subparagraph", "subparagraph" };
1633 static bool compactLatex = Config_getBool("COMPACT_LATEX");
1634 int level=0;
1635 if (showInline) level+=2;
1636 if (compactLatex) level++;
1637 t << "\\" << levelLab[level];
1638
1639 //if (Config_getBool("PDF_HYPERLINKS") && memname)
1640 //{
1641 // t << "[";
1642 // escapeMakeIndexChars(this,t,memname);
1643 // t << "]";
1644 //}
1645 t << "[{";
1646 escapeMakeIndexChars(title);
1647 t << "}]";
1648 t << "{\\setlength{\\rightskip}{0pt plus 5cm}";
1649 disableLinks=TRUE;
1650}
1651
1652void LatexGenerator::endMemberDoc(bool)
1653{
1654 disableLinks=FALSE;
1655 t << "}";
1656 //if (Config_getBool("COMPACT_LATEX")) t << "\\hfill";
1657}
1658
1659void LatexGenerator::startDoxyAnchor(const char *fName,const char *,
1660 const char *anchor, const char *,
1661 const char *)
1662{
1663 static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS");
1664 static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
1665 if (usePDFLatex && pdfHyperlinks)
1666 {
1667 t << "\\hypertarget{";
1668 if (fName) t << stripPath(fName);
1669 if (anchor) t << "_" << anchor;
1670 t << "}{" << endl;
1671 }
1672}
1673
1674void LatexGenerator::endDoxyAnchor(const char *fName,const char *anchor)
1675{
1676 static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS");
1677 static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
1678 if (usePDFLatex && pdfHyperlinks)
1679 {
1680 t << "}" << endl;
1681 }
1682 t << "\\label{";
1683 if (fName) t << fName;
1684 if (anchor) t << "_" << anchor;
1685 t << "}" << endl;
1686}
1687
1688void LatexGenerator::writeAnchor(const char *fName,const char *name)
1689{
1690 //printf("LatexGenerator::writeAnchor(%s,%s)\n",fName,name);
1691 t << "\\label{" << name << "}" << endl;
1692 static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS");
1693 static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
1694 if (usePDFLatex && pdfHyperlinks)
1695 {
1696 if (fName)
1697 {
1698 t << "\\hypertarget{" << stripPath(fName) << "_" << name << "}{}" << endl;
1699 }
1700 else
1701 {
1702 t << "\\hypertarget{" << name << "}{}" << endl;
1703 }
1704 }
1705}
1706
1707
1708//void LatexGenerator::writeLatexLabel(const char *clName,const char *anchor)
1709//{
1710// writeDoxyAnchor(0,clName,anchor,0);
1711//}
1712
1713void LatexGenerator::addIndexItem(const char *s1,const char *s2)
1714{
1715 if (s1)
1716 {
1717 t << "\\index{";
1718 escapeLabelName(s1);
1719 t << "@{";
1720 escapeMakeIndexChars(s1);
1721 t << "}";
1722 if (s2)
1723 {
1724 t << "!";
1725 escapeLabelName(s2);
1726 t << "@{";
1727 escapeMakeIndexChars(s2);
1728 t << "}";
1729 }
1730 t << "}";
1731 }
1732}
1733
1734
1735void LatexGenerator::startSection(const char *lab,const char *,SectionInfo::SectionType type)
1736{
1737 static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS");
1738 static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
1739 if (usePDFLatex && pdfHyperlinks)
1740 {
1741 t << "\\hypertarget{" << stripPath(lab) << "}{}";
1742 }
1743 t << "\\";
1744 if (Config_getBool("COMPACT_LATEX"))
1745 {
1746 switch(type)
1747 {
1748 case SectionInfo::Page: t << "subsection"; break;
1749 case SectionInfo::Section: t << "subsubsection"; break;
1750 case SectionInfo::Subsection: t << "paragraph"; break;
1751 case SectionInfo::Subsubsection: t << "subparagraph"; break;
1752 case SectionInfo::Paragraph: t << "subparagraph"; break;
1753 default: ASSERT(0); break;
1754 }
1755 t << "{";
1756 }
1757 else
1758 {
1759 switch(type)
1760 {
1761 case SectionInfo::Page: t << "section"; break;
1762 case SectionInfo::Section: t << "subsection"; break;
1763 case SectionInfo::Subsection: t << "subsubsection"; break;
1764 case SectionInfo::Subsubsection: t << "paragraph"; break;
1765 case SectionInfo::Paragraph: t << "subparagraph"; break;
1766 default: ASSERT(0); break;
1767 }
1768 t << "{";
1769 }
1770}
1771
1772void LatexGenerator::endSection(const char *lab,SectionInfo::SectionType)
1773{
1774 t << "}\\label{" << lab << "}" << endl;
1775}
1776
1777
1778void LatexGenerator::docify(const char *str)
1779{
1780 filterLatexString(t,str,insideTabbing,FALSE);
1781}
1782
1783void LatexGenerator::codify(const char *str)
1784{
1785 if (str)
1786 {
1787 const char *p=str;
1788 char c;
1789 char cs[5];
1790 int spacesToNextTabStop;
1791 static int tabSize = Config_getInt("TAB_SIZE");
1792 while (*p)
1793 {
1794 //static bool MultiByte = FALSE;
1795 c=*p++;
1796
1797 switch(c)
1798 {
1799 case 0x0c: break; // remove ^L
1800 case '\t': spacesToNextTabStop =
1801 tabSize - (col%tabSize);
1802 t << Doxygen::spaces.left(spacesToNextTabStop);
1803 col+=spacesToNextTabStop;
1804 break;
1805 case '\n': t << '\n'; col=0; break;
1806 default: cs[0]=c;
1807 cs[1]=0;
1808 int bytes=1;
1809 if (c<0) // multibyte utf-8 character
1810 {
1811 bytes++; // 1xxx.xxxx: >=2 byte character
1812 cs[1]=*p;
1813 cs[2]=0;
1814 if (((uchar)c&0xE0)==0xE0)
1815 {
1816 bytes++; // 111x.xxxx: >=3 byte character
1817 cs[2]=*(p+1);
1818 cs[3]=0;
1819 }
1820 if (((uchar)c&0xF0)==0xF0)
1821 {
1822 bytes++; // 1111.xxxx: 4 byte character
1823 cs[2]=*(p+2);
1824 cs[4]=0;
1825 }
1826 }
1827 if (m_prettyCode)
1828 {
1829 filterLatexString(t,cs,insideTabbing,TRUE);
1830 }
1831 else
1832 {
1833 t << cs;
1834 }
1835 if (col>=80)
1836 {
1837 t << "\n ";
1838 col=0;
1839 }
1840 else
1841 {
1842 col++;
1843 }
1844 p+=(bytes-1); // skip to next character
1845 break;
1846 }
1847 }
1848 }
1849}
1850
1851void LatexGenerator::writeChar(char c)
1852{
1853 char cs[2];
1854 cs[0]=c;
1855 cs[1]=0;
1856 docify(cs);
1857}
1858
1859void LatexGenerator::startClassDiagram()
1860{
1861 //if (Config_getBool("COMPACT_LATEX")) t << "\\subsubsection"; else t << "\\subsection";
1862 //t << "{";
1863}
1864
1865void LatexGenerator::endClassDiagram(const ClassDiagram &d,
1866 const char *fileName,const char *)
1867{
1868 d.writeFigure(t,dir,fileName);
1869}
1870
1871
1872void LatexGenerator::startAnonTypeScope(int indent)
1873{
1874 if (indent==0)
1875 {
1876 t << "\\begin{tabbing}" << endl;
1877 t << "xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=\\kill" << endl;
1878 insideTabbing=TRUE;
1879 }
1880 m_indent=indent;
1881}
1882
1883void LatexGenerator::endAnonTypeScope(int indent)
1884{
1885 if (indent==0)
1886 {
1887 t << endl << "\\end{tabbing}";
1888 insideTabbing=FALSE;
1889 }
1890 m_indent=indent;
1891}
1892
1893void LatexGenerator::startMemberTemplateParams()
1894{
1895 if (templateMemberItem)
1896 {
1897 t << "{\\footnotesize ";
1898 }
1899}
1900
1901void LatexGenerator::endMemberTemplateParams()
1902{
1903 if (templateMemberItem)
1904 {
1905 t << "}\\\\";
1906 }
1907}
1908
1909void LatexGenerator::startMemberItem(int annoType)
1910{
1911 //printf("LatexGenerator::startMemberItem(%d)\n",annType);
1912 if (!insideTabbing)
1913 {
1914 t << "\\item " << endl;
1915 templateMemberItem = (annoType == 3);
1916 }
1917}
1918
1919void LatexGenerator::endMemberItem()
1920{
1921 if (insideTabbing)
1922 {
1923 t << "\\\\";
1924 }
1925 templateMemberItem = FALSE;
1926 t << endl;
1927}
1928
1929void LatexGenerator::startMemberDescription()
1930{
1931 if (!insideTabbing)
1932 {
1933 t << "\\begin{DoxyCompactList}\\small\\item\\em ";
1934 }
1935 else
1936 {
1937 for (int i=0;i<m_indent+2;i++) t << "\\>";
1938 t << "{\\em ";
1939 }
1940}
1941
1942void LatexGenerator::endMemberDescription()
1943{
1944 if (!insideTabbing)
1945 {
1946 //t << "\\item\\end{DoxyCompactList}";
1947 t << "\\end{DoxyCompactList}";
1948 }
1949 else
1950 {
1951 t << "}\\\\\n";
1952 }
1953}
1954
1955
1956void LatexGenerator::writeNonBreakableSpace(int)
1957{
1958 //printf("writeNonBreakbleSpace()\n");
1959 if (insideTabbing)
1960 {
1961 t << "\\>";
1962 }
1963 else
1964 t << "~";
1965}
1966
1967void LatexGenerator::startMemberList()
1968{
1969 if (!insideTabbing)
1970 {
1971 t << "\\begin{DoxyCompactItemize}" << endl;
1972 }
1973}
1974
1975void LatexGenerator::endMemberList()
1976{
1977 //printf("LatexGenerator::endMemberList(%d)\n",insideTabbing);
1978 if (!insideTabbing)
1979 {
1980 t << "\\end{DoxyCompactItemize}" << endl;
1981 }
1982}
1983
1984
1985void LatexGenerator::startMemberGroupHeader(bool hasHeader)
1986{
1987 if (hasHeader) t << "\\begin{Indent}";
1988 if (Config_getBool("COMPACT_LATEX"))
1989 {
1990 t << "\\subparagraph*{";
1991 }
1992 else
1993 {
1994 t << "\\paragraph*{";
1995 }
1996}
1997
1998void LatexGenerator::endMemberGroupHeader()
1999{
2000 t << "}" << endl;
2001}
2002
2003void LatexGenerator::startMemberGroupDocs()
2004{
2005 t << "{\\em ";
2006}
2007
2008void LatexGenerator::endMemberGroupDocs()
2009{
2010 t << "}";
2011}
2012
2013void LatexGenerator::startMemberGroup()
2014{
2015}
2016
2017void LatexGenerator::endMemberGroup(bool hasHeader)
2018{
2019 if (hasHeader)t << "\\end{Indent}";
2020 t << endl;
2021}
2022
2023void LatexGenerator::startDotGraph()
2024{
2025 newParagraph();
2026}
2027
2028void LatexGenerator::endDotGraph(const DotClassGraph &g)
2029{
2030 g.writeGraph(t,EPS,Config_getString("LATEX_OUTPUT"),fileName,relPath);
2031}
2032
2033void LatexGenerator::startInclDepGraph()
2034{
2035}
2036
2037void LatexGenerator::endInclDepGraph(const DotInclDepGraph &g)
2038{
2039 g.writeGraph(t,EPS,Config_getString("LATEX_OUTPUT"),fileName,relPath);
2040}
2041
2042void LatexGenerator::startGroupCollaboration()
2043{
2044}
2045
2046void LatexGenerator::endGroupCollaboration(const DotGroupCollaboration &g)
2047{
2048 g.writeGraph(t,EPS,Config_getString("LATEX_OUTPUT"),fileName,relPath);
2049}
2050
2051void LatexGenerator::startCallGraph()
2052{
2053}
2054
2055void LatexGenerator::endCallGraph(const DotCallGraph &g)
2056{
2057 g.writeGraph(t,EPS,Config_getString("LATEX_OUTPUT"),fileName,relPath);
2058}
2059
2060void LatexGenerator::startDirDepGraph()
2061{
2062}
2063
2064void LatexGenerator::endDirDepGraph(const DotDirDeps &g)
2065{
2066 g.writeGraph(t,EPS,Config_getString("LATEX_OUTPUT"),fileName,relPath);
2067}
2068
2069void LatexGenerator::startDescription()
2070{
2071 t << "\\begin{description}" << endl;
2072}
2073
2074void LatexGenerator::endDescription()
2075{
2076 t << "\\end{description}" << endl;
2077 firstDescItem=TRUE;
2078}
2079
2080void LatexGenerator::startDescItem()
2081{
2082 firstDescItem=TRUE;
2083 t << "\\item[";
2084}
2085
2086void LatexGenerator::endDescItem()
2087{
2088 if (firstDescItem)
2089 {
2090 t << "]" << endl;
2091 firstDescItem=FALSE;
2092 }
2093 else
2094 {
2095 lineBreak();
2096 }
2097}
2098
2099void LatexGenerator::startSimpleSect(SectionTypes,const char *file,
2100 const char *anchor,const char *title)
2101{
2102 t << "\\begin{Desc}\n\\item[";
2103 if (file)
2104 {
2105 writeObjectLink(0,file,anchor,title);
2106 }
2107 else
2108 {
2109 docify(title);
2110 }
2111 t << "]";
2112}
2113
2114void LatexGenerator::endSimpleSect()
2115{
2116 t << "\\end{Desc}" << endl;
2117}
2118
2119void LatexGenerator::startParamList(ParamListTypes,const char *title)
2120{
2121 t << "\\begin{Desc}\n\\item[";
2122 docify(title);
2123 t << "]";
2124}
2125
2126void LatexGenerator::endParamList()
2127{
2128 t << "\\end{Desc}" << endl;
2129}
2130
2131void LatexGenerator::startParameterList(bool openBracket)
2132{
2133 /* start of ParameterType ParameterName list */
2134 if (openBracket) t << "(";
2135 t << endl << "\\begin{DoxyParamCaption}" << endl;
2136}
2137
2138void LatexGenerator::endParameterList()
2139{
2140}
2141
2142
2143void LatexGenerator::startParameterType(bool /*first*/,const char *key)
2144{
2145 t << "\\item[{";
2146 t << key;
2147// if (!first)
2148// {
2149// t << "\\/ " << key << " ";
2150// }
2151}
2152
2153void LatexGenerator::endParameterType()
2154{
2155 t << "}]";
2156}
2157
2158void LatexGenerator::startParameterName(bool /*oneArgOnly*/)
2159{
2160 t << "{";
2161}
2162
2163void LatexGenerator::endParameterName(bool last,bool /* emptyList */,bool closeBracket)
2164{
2165 t << "}" << endl;
2166
2167 if (last)
2168 {
2169 t << "\\end{DoxyParamCaption}" << endl;
2170 if (closeBracket) t << ")";
2171 }
2172}
2173
2174
2175void LatexGenerator::printDoc(DocNode *n,const char *langExt)
2176{
2177 LatexDocVisitor *visitor = new LatexDocVisitor(t,*this,langExt,insideTabbing);
2178 n->accept(visitor);
2179 delete visitor;
2180}
2181
2182void LatexGenerator::startConstraintList(const char *header)
2183{
2184 t << "\\begin{Desc}\n\\item[";
2185 docify(header);
2186 t << "]";
2187 t << "\\begin{description}" << endl;
2188}
2189
2190void LatexGenerator::startConstraintParam()
2191{
2192 t << "\\item[{\\em ";
2193}
2194
2195void LatexGenerator::endConstraintParam()
2196{
2197}
2198
2199void LatexGenerator::startConstraintType()
2200{
2201 t << "} : {\\em ";
2202}
2203
2204void LatexGenerator::endConstraintType()
2205{
2206 t << "}]";
2207}
2208
2209void LatexGenerator::startConstraintDocs()
2210{
2211}
2212
2213void LatexGenerator::endConstraintDocs()
2214{
2215}
2216
2217void LatexGenerator::endConstraintList()
2218{
2219 t << "\\end{description}" << endl;
2220 t << "\\end{Desc}" << endl;
2221}
2222
2223void LatexGenerator::escapeLabelName(const char *s)
2224{
2225 const char *p=s;
2226 char str[2];
2227 str[1]=0;
2228 char c;
2229 while ((c=*p++))
2230 {
2231 switch (c)
2232 {
2233 case '%': t << "\\%"; break;
2234 //case '|': t << "\\tt{\"|}"; break;
2235 //case '!': t << "\"!"; break;
2236 default: str[0]=c; docify(str); break;
2237 }
2238 }
2239}
2240
2241void LatexGenerator::escapeMakeIndexChars(const char *s)
2242{
2243 const char *p=s;
2244 char str[2];
2245 str[1]=0;
2246 char c;
2247 while ((c=*p++))
2248 {
2249 switch (c)
2250 {
2251 //case '!': t << "\"!"; break;
2252 case '"': t << "\"\""; break;
2253 case '@': t << "\"@"; break;
2254 //case '|': t << "\\tt{\"|}"; break;
2255 case '[': t << "["; break;
2256 case ']': t << "]"; break;
2257 default: str[0]=c; docify(str); break;
2258 }
2259 }
2260}
2261
2262void LatexGenerator::startCodeFragment()
2263{
2264 //if (m_prettyCode)
2265 //{
2266 // t << endl << endl;
2267 // t << "\\begin{footnotesize}\\begin{alltt}\n";
2268 //}
2269 //else
2270 //{
2271 t << "\n\\begin{DoxyCode}\n";
2272 //}
2273}
2274
2275void LatexGenerator::endCodeFragment()
2276{
2277 //if (m_prettyCode)
2278 //{
2279 // t << "\\end{alltt}\\end{footnotesize}" << endl;
2280 //}
2281 //else
2282 //{
2283 t << "\\end{DoxyCode}\n";
2284 //}
2285}
2286
2287void LatexGenerator::writeLineNumber(const char *ref,const char *fileName,const char *anchor,int l)
2288{
2289 if (m_prettyCode)
2290 {
2291 QCString lineNumber;
2292 lineNumber.sprintf("%05d",l);
2293
2294 if (fileName && !sourceFileName.isEmpty())
2295 {
2296 QCString lineAnchor;
2297 lineAnchor.sprintf("_l%05d",l);
2298 lineAnchor.prepend(sourceFileName);
2299 startCodeAnchor(lineAnchor);
2300 writeCodeLink(ref,fileName,anchor,lineNumber,0);
2301 endCodeAnchor();
2302 }
2303 else
2304 {
2305 codify(lineNumber);
2306 }
2307 t << " ";
2308 }
2309 else
2310 {
2311 t << l << " ";
2312 }
2313}
2314
2315void LatexGenerator::startCodeLine()
2316{
2317 col=0;
2318}
2319
2320void LatexGenerator::endCodeLine()
2321{
2322 codify("\n");
2323}
2324
2325void LatexGenerator::startFontClass(const char *name)
2326{
2327 if (!m_prettyCode) return;
2328 t << "\\textcolor{" << name << "}{";
2329}
2330
2331void LatexGenerator::endFontClass()
2332{
2333 if (!m_prettyCode) return;
2334 t << "}";
2335}
2336
2337void LatexGenerator::startCodeAnchor(const char *name)
2338{
2339 static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
2340 static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS");
2341 if (!m_prettyCode) return;
2342 if (usePDFLatex && pdfHyperlinks)
2343 {
2344 t << "\\hypertarget{" << stripPath(name) << "}{}";
2345 }
2346}
2347
2348void LatexGenerator::endCodeAnchor()
2349{
2350}
2351
2352void LatexGenerator::startInlineHeader()
2353{
2354 if (Config_getBool("COMPACT_LATEX"))
2355 {
2356 t << "\\paragraph*{";
2357 }
2358 else
2359 {
2360 t << "\\subsubsection*{";
2361 }
2362}
2363
2364void LatexGenerator::endInlineHeader()
2365{
2366 t << "}" << endl;
2367}
2368
2369

Archive Download this file

Revision: 1322