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