Imported Upstream version 1.8.15
[platform/upstream/doxygen.git] / src / docbookvisitor.cpp
1 /******************************************************************************
2  *
3  * 
4  *
5  *
6  * Copyright (C) 1997-2015 by Dimitri van Heesch.
7  *
8  * Permission to use, copy, modify, and distribute this software and its
9  * documentation under the terms of the GNU General Public License is hereby
10  * granted. No representations are made about the suitability of this software
11  * for any purpose. It is provided "as is" without express or implied warranty.
12  * See the GNU General Public License for more details.
13  *
14  * Documents produced by Doxygen are derivative works derived from the
15  * input used in their production; they are not affected by this license.
16  *
17  */
18
19 #include <qfileinfo.h>
20
21 #include "docbookvisitor.h"
22 #include "docparser.h"
23 #include "language.h"
24 #include "doxygen.h"
25 #include "outputgen.h"
26 #include "docbookgen.h"
27 #include "dot.h"
28 #include "message.h"
29 #include "util.h"
30 #include "parserintf.h"
31 #include "filename.h"
32 #include "config.h"
33 #include "filedef.h"
34 #include "msc.h"
35 #include "dia.h"
36 #include "htmlentity.h"
37 #include "emoji.h"
38 #include "plantuml.h"
39
40 #if 0
41 #define DB_VIS_C DB_VIS_C1(m_t)
42 #define DB_VIS_C1(x) x << "<!-- DB_VIS_C " << __LINE__ << " -->\n";
43 #define DB_VIS_C2(y) DB_VIS_C2a(m_t,y)
44 #define DB_VIS_C2a(x,y) x << "<!-- DB_VIS_C " << __LINE__ << " " << y << " -->\n";
45 #else
46 #define DB_VIS_C
47 #define DB_VIS_C1(x)
48 #define DB_VIS_C2(y)
49 #define DB_VIS_C2a(x,y)
50 #endif
51
52 void DocbookDocVisitor::visitCaption(const QList<DocNode> &children)
53 {
54   QListIterator<DocNode> cli(children);
55   DocNode *n;
56   for (cli.toFirst();(n=cli.current());++cli) n->accept(this);
57 }
58
59 void DocbookDocVisitor::visitPreStart(FTextStream &t,
60                    const QList<DocNode> &children,
61                    bool hasCaption,
62                    const QCString &name,
63                    const QCString &width,
64                    const QCString &height,
65                    bool inlineImage)
66 {
67   if (hasCaption && !inlineImage)
68   {
69     t << "    <figure>" << endl;
70     t << "        <title>" << endl;
71     visitCaption(children);
72     t << "        </title>" << endl;
73   }
74   else
75   {
76     t << "    <informalfigure>" << endl;
77   }
78   t << "        <mediaobject>" << endl;
79   t << "            <imageobject>" << endl;
80   t << "                <imagedata";
81   if (!width.isEmpty())
82   {
83     t << " width=\"" << convertToDocBook(width) << "\"";
84   }
85   else
86   {
87     if (!height.isEmpty() && !inlineImage) t << " width=\"50%\"";
88   }
89   if (!height.isEmpty())
90   {
91     t << " depth=\"" << convertToDocBook(height) << "\"";
92   }
93   t << " align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" << name << "\">";
94   t << "</imagedata>" << endl;
95   t << "            </imageobject>" << endl;
96   if (hasCaption && !inlineImage)
97   {
98     t << "        <!--" << endl; // Needed for general formatting with title for other formats
99   }
100 }
101
102 void DocbookDocVisitor::visitPostEnd(FTextStream &t, bool hasCaption, bool inlineImage)
103 {
104   t << endl;
105   if (hasCaption && !inlineImage)
106   {
107     t << "        -->" << endl; // Needed for general formatting with title for other formats
108   }
109   t << "        </mediaobject>" << endl;
110   if (hasCaption && !inlineImage)
111   {
112     t << "    </figure>" << endl;
113   }
114   else
115   {
116     t << "    </informalfigure>" << endl;
117   }
118 }
119
120 DocbookDocVisitor::DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci)
121   : DocVisitor(DocVisitor_Docbook), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE)
122 {
123 DB_VIS_C
124   // m_t << "<section>" << endl;
125 }
126 DocbookDocVisitor::~DocbookDocVisitor()
127 {
128 DB_VIS_C
129   // m_t << "</section>" << endl;
130 }
131
132 //--------------------------------------
133 // visitor functions for leaf nodes
134 //--------------------------------------
135
136 void DocbookDocVisitor::visit(DocWord *w)
137 {
138 DB_VIS_C
139   if (m_hide) return;
140   filter(w->word());
141 }
142
143 void DocbookDocVisitor::visit(DocLinkedWord *w)
144 {
145 DB_VIS_C
146   if (m_hide) return;
147   startLink(w->file(),w->anchor());
148   filter(w->word());
149   endLink();
150 }
151
152 void DocbookDocVisitor::visit(DocWhiteSpace *w)
153 {
154 DB_VIS_C
155   if (m_hide) return;
156   if (m_insidePre)
157   {
158     m_t << w->chars();
159   }
160   else
161   {
162     m_t << " ";
163   }
164 }
165
166 void DocbookDocVisitor::visit(DocSymbol *s)
167 {
168 DB_VIS_C
169   if (m_hide) return;
170   const char *res = HtmlEntityMapper::instance()->docbook(s->symbol());
171   if (res)
172   {
173     m_t << res;
174   }
175   else
176   {
177     err("DocBook: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE));
178   }
179 }
180
181 void DocbookDocVisitor::visit(DocEmoji *s)
182 {
183 DB_VIS_C
184   if (m_hide) return;
185   const char *res = EmojiEntityMapper::instance()->unicode(s->index());
186   if (res)
187   {
188     m_t << res;
189   }
190   else
191   {
192     m_t << s->name();
193   }
194 }
195
196 void DocbookDocVisitor::visit(DocURL *u)
197 {
198 DB_VIS_C
199   if (m_hide) return;
200   m_t << "<link xlink:href=\"";
201   if (u->isEmail()) m_t << "mailto:";
202   filter(u->url());
203   m_t << "\">";
204   filter(u->url());
205   m_t << "</link>";
206 }
207
208 void DocbookDocVisitor::visit(DocLineBreak *)
209 {
210 DB_VIS_C
211   if (m_hide) return;
212   m_t << endl << "<literallayout>&#160;&#xa;</literallayout>" << endl;
213   // gives nicer results but gives problems as it is not allowed in <pare> and also problems with dblatex
214   // m_t << endl << "<sbr/>" << endl;
215 }
216
217 void DocbookDocVisitor::visit(DocHorRuler *)
218 {
219 DB_VIS_C
220   if (m_hide) return;
221   m_t << "<informaltable frame='bottom'><tgroup cols='1'><colspec align='center'/><tbody><row><entry align='center'>\n";
222   m_t << "</entry></row></tbody></tgroup></informaltable>\n";
223 }
224
225 void DocbookDocVisitor::visit(DocStyleChange *s)
226 {
227 DB_VIS_C
228   if (m_hide) return;
229   switch (s->style())
230   {
231     case DocStyleChange::Bold:
232       if (s->enable()) m_t << "<emphasis role=\"bold\">";      else m_t << "</emphasis>";
233       break;
234     case DocStyleChange::Italic:
235       if (s->enable()) m_t << "<emphasis>";     else m_t << "</emphasis>";
236       break;
237     case DocStyleChange::Code:
238       if (s->enable()) m_t << "<computeroutput>";   else m_t << "</computeroutput>";
239       break;
240     case DocStyleChange::Subscript:
241       if (s->enable()) m_t << "<subscript>";    else m_t << "</subscript>";
242       break;
243     case DocStyleChange::Superscript:
244       if (s->enable()) m_t << "<superscript>";    else m_t << "</superscript>";
245       break;
246     case DocStyleChange::Center:
247       if (s->enable()) m_t << "<informaltable frame='none'><tgroup cols='1'><colspec align='center'/><tbody><row><entry align='center'>";
248       else m_t << "</entry></row></tbody></tgroup></informaltable>";
249       break;
250     case DocStyleChange::Preformatted:
251       if (s->enable())
252       {
253         m_t << "<literallayout>";
254         m_insidePre=TRUE;
255       }
256       else
257       {
258         m_t << "</literallayout>";
259         m_insidePre=FALSE;
260       }
261       break;
262       /* There is no equivalent Docbook tag for rendering Small text */
263     case DocStyleChange::Small: /* XSLT Stylesheets can be used */ break;
264                                                                    /* HTML only */
265     case DocStyleChange::Strike:  break;
266     case DocStyleChange::Underline:  break;
267     case DocStyleChange::Div:  /* HTML only */ break;
268     case DocStyleChange::Span: /* HTML only */ break;
269   }
270 }
271
272 void DocbookDocVisitor::visit(DocVerbatim *s)
273 {
274 DB_VIS_C
275   if (m_hide) return;
276   SrcLangExt langExt = getLanguageFromFileName(m_langExt);
277   switch(s->type())
278   {
279     case DocVerbatim::Code: // fall though
280       m_t << "<literallayout><computeroutput>";
281       Doxygen::parserManager->getParser(m_langExt)
282         ->parseCode(m_ci,s->context(),s->text(),langExt,
283             s->isExample(),s->exampleFile());
284       m_t << "</computeroutput></literallayout>";
285       break;
286     case DocVerbatim::Verbatim:
287       m_t << "<literallayout><computeroutput>";
288       filter(s->text());
289       m_t << "</computeroutput></literallayout>";
290       break;
291     case DocVerbatim::HtmlOnly:    
292       break;
293     case DocVerbatim::RtfOnly:     
294       break;
295     case DocVerbatim::ManOnly:     
296       break;
297     case DocVerbatim::LatexOnly:   
298       break;
299     case DocVerbatim::XmlOnly:     
300       break;
301     case DocVerbatim::DocbookOnly: 
302       m_t << s->text();
303       break;
304     case DocVerbatim::Dot:
305       {
306         static int dotindex = 1;
307         QCString baseName(4096);
308         QCString name;
309         QCString stext = s->text();
310         m_t << "<para>" << endl;
311         name.sprintf("%s%d", "dot_inline_dotgraph_", dotindex);
312         baseName.sprintf("%s%d",
313             (Config_getString(DOCBOOK_OUTPUT)+"/inline_dotgraph_").data(),
314             dotindex++
315             );
316         QFile file(baseName+".dot");
317         if (!file.open(IO_WriteOnly))
318         {
319           err("Could not open file %s.msc for writing\n",baseName.data());
320         }
321         file.writeBlock( stext, stext.length() );
322         file.close();
323         writeDotFile(baseName, s);
324         m_t << "</para>" << endl;
325       }
326       break;
327     case DocVerbatim::Msc:
328       {
329         static int mscindex = 1;
330         QCString baseName(4096);
331         QCString name;
332         QCString stext = s->text();
333         m_t << "<para>" << endl;
334         name.sprintf("%s%d", "msc_inline_mscgraph_", mscindex);
335         baseName.sprintf("%s%d",
336             (Config_getString(DOCBOOK_OUTPUT)+"/inline_mscgraph_").data(),
337             mscindex++
338             );
339         QFile file(baseName+".msc");
340         if (!file.open(IO_WriteOnly))
341         {
342           err("Could not open file %s.msc for writing\n",baseName.data());
343         }
344         QCString text = "msc {";
345         text+=stext;
346         text+="}";
347         file.writeBlock( text, text.length() );
348         file.close();
349         writeMscFile(baseName,s);
350         m_t << "</para>" << endl;
351       }
352       break;
353     case DocVerbatim::PlantUML:
354       {
355         static QCString docbookOutput = Config_getString(DOCBOOK_OUTPUT);
356         QCString baseName = writePlantUMLSource(docbookOutput,s->exampleFile(),s->text());
357         QCString shortName = baseName;
358         int i;
359         if ((i=shortName.findRev('/'))!=-1)
360         {
361           shortName=shortName.right(shortName.length()-i-1);
362         }
363         m_t << "<para>" << endl;
364         writePlantUMLFile(baseName,s);
365         m_t << "</para>" << endl;
366       }
367       break;
368   }
369 }
370
371 void DocbookDocVisitor::visit(DocAnchor *anc)
372 {
373 DB_VIS_C
374   if (m_hide) return;
375   m_t << "<anchor xml:id=\"_" <<  stripPath(anc->file()) << "_1" << anc->anchor() << "\"/>";
376 }
377
378 void DocbookDocVisitor::visit(DocInclude *inc)
379 {
380 DB_VIS_C
381   if (m_hide) return;
382   SrcLangExt langExt = getLanguageFromFileName(inc->extension());
383   switch(inc->type())
384   {
385     case DocInclude::IncWithLines:
386       {
387         m_t << "<literallayout><computeroutput>";
388         QFileInfo cfi( inc->file() );
389         FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() );
390         Doxygen::parserManager->getParser(inc->extension())
391           ->parseCode(m_ci,inc->context(),
392               inc->text(),
393               langExt,
394               inc->isExample(),
395               inc->exampleFile(), &fd);
396         m_t << "</computeroutput></literallayout>";
397       }
398       break;
399     case DocInclude::Include:
400       m_t << "<literallayout><computeroutput>";
401       Doxygen::parserManager->getParser(inc->extension())
402         ->parseCode(m_ci,inc->context(),
403             inc->text(),
404             langExt,
405             inc->isExample(),
406             inc->exampleFile());
407       m_t << "</computeroutput></literallayout>";
408       break;
409     case DocInclude::DontInclude:
410       break;
411     case DocInclude::HtmlInclude:
412       break;
413     case DocInclude::LatexInclude:
414       break;
415     case DocInclude::VerbInclude:
416       m_t << "<literallayout>";
417       filter(inc->text());
418       m_t << "</literallayout>";
419       break;
420     case DocInclude::Snippet:
421       m_t << "<literallayout><computeroutput>";
422       Doxygen::parserManager->getParser(inc->extension())
423         ->parseCode(m_ci,
424             inc->context(),
425             extractBlock(inc->text(),inc->blockId()),
426             langExt,
427             inc->isExample(),
428             inc->exampleFile()
429             );
430       m_t << "</computeroutput></literallayout>";
431       break;
432     case DocInclude::SnipWithLines:
433       {
434          QFileInfo cfi( inc->file() );
435          FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() );
436          m_t << "<literallayout><computeroutput>";
437          Doxygen::parserManager->getParser(inc->extension())
438                                ->parseCode(m_ci,
439                                            inc->context(),
440                                            extractBlock(inc->text(),inc->blockId()),
441                                            langExt,
442                                            inc->isExample(),
443                                            inc->exampleFile(), 
444                                            &fd,
445                                            lineBlock(inc->text(),inc->blockId()),
446                                            -1,    // endLine
447                                            FALSE, // inlineFragment
448                                            0,     // memberDef
449                                            TRUE   // show line number
450                                           );
451          m_t << "</computeroutput></literallayout>";
452       }
453       break;
454     case DocInclude::SnippetDoc: 
455     case DocInclude::IncludeDoc: 
456       err("Internal inconsistency: found switch SnippetDoc / IncludeDoc in file: %s"
457           "Please create a bug report\n",__FILE__);
458       break;
459   }
460 }
461
462 void DocbookDocVisitor::visit(DocIncOperator *op)
463 {
464 DB_VIS_C
465   if (op->isFirst())
466   {
467     if (!m_hide)
468     {
469       m_t << "<programlisting>";
470     }
471     pushEnabled();
472     m_hide = TRUE;
473   }
474   SrcLangExt langExt = getLanguageFromFileName(m_langExt);
475   if (op->type()!=DocIncOperator::Skip)
476   {
477     popEnabled();
478     if (!m_hide)
479     {
480       Doxygen::parserManager->getParser(m_langExt)
481         ->parseCode(m_ci,op->context(),
482             op->text(),langExt,op->isExample(),
483             op->exampleFile());
484     }
485     pushEnabled();
486     m_hide=TRUE;
487   }
488   if (op->isLast())
489   {
490     popEnabled();
491     if (!m_hide) m_t << "</programlisting>";
492   }
493   else
494   {
495     if (!m_hide) m_t << endl;
496   }
497 }
498
499 void DocbookDocVisitor::visit(DocFormula *f)
500 {
501 DB_VIS_C
502   if (m_hide) return;
503
504   if (f->isInline()) m_t  << "<inlinemediaobject>" << endl;
505   else m_t << "        <mediaobject>" << endl;
506   m_t << "            <imageobject>" << endl;
507   m_t << "                <imagedata ";
508   m_t << "align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" << f->relPath() << f->name() << ".png\"/>" << endl;
509   m_t << "            </imageobject>" << endl;
510   if (f->isInline()) m_t  << "</inlinemediaobject>" << endl;
511   else m_t << "        </mediaobject>" << endl;
512 }
513
514 void DocbookDocVisitor::visit(DocIndexEntry *ie)
515 {
516 DB_VIS_C
517   if (m_hide) return;
518   m_t << "<indexterm><primary>";
519   filter(ie->entry());
520   m_t << "</primary></indexterm>" << endl;
521 }
522
523 void DocbookDocVisitor::visit(DocSimpleSectSep *)
524 {
525 DB_VIS_C
526   // m_t << "<simplesect/>";
527 }
528
529 void DocbookDocVisitor::visit(DocCite *cite)
530 {
531 DB_VIS_C
532   if (m_hide) return;
533   if (!cite->file().isEmpty()) startLink(cite->file(),cite->anchor());
534   filter(cite->text());
535   if (!cite->file().isEmpty()) endLink();
536 }
537
538 //--------------------------------------
539 // visitor functions for compound nodes
540 //--------------------------------------
541
542 void DocbookDocVisitor::visitPre(DocAutoList *l)
543 {
544 DB_VIS_C
545   if (m_hide) return;
546   if (l->isEnumList())
547   {
548     m_t << "<orderedlist>\n";
549   }
550   else
551   {
552     m_t << "<itemizedlist>\n";
553   }
554 }
555
556 void DocbookDocVisitor::visitPost(DocAutoList *l)
557 {
558 DB_VIS_C
559   if (m_hide) return;
560   if (l->isEnumList())
561   {
562     m_t << "</orderedlist>\n";
563   }
564   else
565   {
566     m_t << "</itemizedlist>\n";
567   }
568 }
569
570 void DocbookDocVisitor::visitPre(DocAutoListItem *)
571 {
572 DB_VIS_C
573   if (m_hide) return;
574   m_t << "<listitem>";
575 }
576
577 void DocbookDocVisitor::visitPost(DocAutoListItem *)
578 {
579 DB_VIS_C
580   if (m_hide) return;
581   m_t << "</listitem>";
582 }
583
584 void DocbookDocVisitor::visitPre(DocPara *)
585 {
586 DB_VIS_C
587   if (m_hide) return;
588   m_t << endl;
589   m_t << "<para>";
590 }
591
592 void DocbookDocVisitor::visitPost(DocPara *)
593 {
594 DB_VIS_C
595   if (m_hide) return;
596   m_t << "</para>";
597   m_t << endl;
598 }
599
600 void DocbookDocVisitor::visitPre(DocRoot *)
601 {
602 DB_VIS_C
603   //m_t << "<hr><h4><font color=\"red\">New parser:</font></h4>\n";
604 }
605
606 void DocbookDocVisitor::visitPost(DocRoot *)
607 {
608 DB_VIS_C
609   //m_t << "<hr><h4><font color=\"red\">Old parser:</font></h4>\n";
610 }
611
612 void DocbookDocVisitor::visitPre(DocSimpleSect *s)
613 {
614 DB_VIS_C
615   if (m_hide) return;
616   switch(s->type())
617   {
618     case DocSimpleSect::See:
619       if (m_insidePre) 
620       {
621         m_t << "<formalpara><title>" << theTranslator->trSeeAlso() << ": </title>" << endl;
622       } 
623       else 
624       {
625         m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trSeeAlso()) << ": </title>" << endl;
626       }
627       break;
628     case DocSimpleSect::Return:
629       if (m_insidePre) 
630       {
631         m_t << "<formalpara><title>" << theTranslator->trReturns()<< ": </title>" << endl;
632       } 
633       else 
634       {
635         m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trReturns()) << ": </title>" << endl;
636       }
637       break;
638     case DocSimpleSect::Author:
639       if (m_insidePre) 
640       {
641         m_t << "<formalpara><title>" << theTranslator->trAuthor(TRUE, TRUE) << ": </title>" << endl;
642       } 
643       else 
644       {
645         m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trAuthor(TRUE, TRUE)) << ": </title>" << endl;
646       }
647       break;
648     case DocSimpleSect::Authors:
649       if (m_insidePre) 
650       {
651         m_t << "<formalpara><title>" << theTranslator->trAuthor(TRUE, FALSE) << ": </title>" << endl;
652       } 
653       else 
654       {
655         m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trAuthor(TRUE, FALSE)) << ": </title>" << endl;
656       }
657       break;
658     case DocSimpleSect::Version:
659       if (m_insidePre) 
660       {
661         m_t << "<formalpara><title>" << theTranslator->trVersion() << ": </title>" << endl;
662       } 
663       else 
664       {
665         m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trVersion()) << ": </title>" << endl;
666       }
667       break;
668     case DocSimpleSect::Since:
669       if (m_insidePre) 
670       {
671         m_t << "<formalpara><title>" << theTranslator->trSince() << ": </title>" << endl;
672       } 
673       else 
674       {
675         m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trSince()) << ": </title>" << endl;
676       }
677       break;
678     case DocSimpleSect::Date:
679       if (m_insidePre) 
680       {
681         m_t << "<formalpara><title>" << theTranslator->trDate() << ": </title>" << endl;
682       } 
683       else 
684       {
685         m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trDate()) << ": </title>" << endl;
686       }
687       break;
688     case DocSimpleSect::Note:
689       if (m_insidePre) 
690       {
691         m_t << "<note><title>" << theTranslator->trNote() << ": </title>" << endl;
692       } 
693       else 
694       {
695         m_t << "<note><title>" << convertToDocBook(theTranslator->trNote()) << ": </title>" << endl;
696       }
697       break;
698     case DocSimpleSect::Warning:
699       if (m_insidePre) 
700       {
701         m_t << "<warning><title>" << theTranslator->trWarning() << ": </title>" << endl;
702       } 
703       else 
704       {
705         m_t << "<warning><title>" << convertToDocBook(theTranslator->trWarning()) << ": </title>" << endl;
706       }
707       break;
708     case DocSimpleSect::Pre:
709       if (m_insidePre) 
710       {
711         m_t << "<formalpara><title>" << theTranslator->trPrecondition() << ": </title>" << endl;
712       } 
713       else 
714       {
715         m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trPrecondition()) << ": </title>" << endl;
716       }
717       break;
718     case DocSimpleSect::Post:
719       if (m_insidePre) 
720       {
721         m_t << "<formalpara><title>" << theTranslator->trPostcondition() << ": </title>" << endl;
722       } 
723       else 
724       {
725         m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trPostcondition()) << ": </title>" << endl;
726       }
727       break;
728     case DocSimpleSect::Copyright:
729       if (m_insidePre) 
730       {
731         m_t << "<formalpara><title>" << theTranslator->trCopyright() << ": </title>" << endl;
732       } 
733       else 
734       {
735         m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trCopyright()) << ": </title>" << endl;
736       }
737       break;
738     case DocSimpleSect::Invar:
739       if (m_insidePre) 
740       {
741         m_t << "<formalpara><title>" << theTranslator->trInvariant() << ": </title>" << endl;
742       } 
743       else 
744       {
745         m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trInvariant()) << ": </title>" << endl;
746       }
747       break;
748     case DocSimpleSect::Remark:
749       // <remark> is miising the <title> possibility
750       if (m_insidePre) 
751       {
752         m_t << "<formalpara><title>" << theTranslator->trRemarks() << ": </title>" << endl;
753       } 
754       else 
755       {
756         m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trRemarks()) << ": </title>" << endl;
757       }
758       break;
759     case DocSimpleSect::Attention:
760       if (m_insidePre) 
761       {
762         m_t << "<caution><title>" << theTranslator->trAttention() << ": </title>" << endl;
763       } 
764       else 
765       {
766         m_t << "<caution><title>" << convertToDocBook(theTranslator->trAttention()) << ": </title>" << endl;
767       }
768       break;
769     case DocSimpleSect::User:
770       if (s->hasTitle())
771         m_t << "<formalpara>" << endl;
772       else
773         m_t << "<para>" << endl;
774       break;
775     case DocSimpleSect::Rcs:
776     case DocSimpleSect::Unknown:
777       m_t << "<para>" << endl;
778       break;
779   }
780 }
781
782 void DocbookDocVisitor::visitPost(DocSimpleSect *s)
783 {
784 DB_VIS_C
785   if (m_hide) return;
786   switch(s->type())
787   {
788     case DocSimpleSect::Rcs:
789     case DocSimpleSect::Unknown:
790       m_t << "</para>" << endl;
791       break;
792     case DocSimpleSect::User:
793       if (s->hasTitle())
794         m_t << "</formalpara>" << endl;
795       else
796         m_t << "</para>" << endl;
797       break;
798     case DocSimpleSect::Note:
799       m_t << "</note>" << endl;
800       break;
801     case DocSimpleSect::Attention:
802       m_t << "</caution>" << endl;
803       break;
804     case DocSimpleSect::Warning:
805       m_t << "</warning>" << endl;
806       break;
807     default:
808       m_t << "</formalpara>" << endl;
809       break;
810   }
811 }
812
813 void DocbookDocVisitor::visitPre(DocTitle *t)
814 {
815 DB_VIS_C
816   if (m_hide) return;
817   if (t->hasTitle()) m_t << "<title>";
818 }
819
820 void DocbookDocVisitor::visitPost(DocTitle *t)
821 {
822 DB_VIS_C
823   if (m_hide) return;
824   if (t->hasTitle()) m_t << "</title>";
825 }
826
827 void DocbookDocVisitor::visitPre(DocSimpleList *)
828 {
829 DB_VIS_C
830   if (m_hide) return;
831   m_t << "<itemizedlist>\n";
832 }
833
834 void DocbookDocVisitor::visitPost(DocSimpleList *)
835 {
836 DB_VIS_C
837   if (m_hide) return;
838   m_t << "</itemizedlist>\n";
839 }
840
841 void DocbookDocVisitor::visitPre(DocSimpleListItem *)
842 {
843 DB_VIS_C
844   if (m_hide) return;
845   m_t << "<listitem>";
846 }
847
848 void DocbookDocVisitor::visitPost(DocSimpleListItem *)
849 {
850 DB_VIS_C
851   if (m_hide) return;
852   m_t << "</listitem>\n";
853 }
854
855 void DocbookDocVisitor::visitPre(DocSection *s)
856 {
857 DB_VIS_C
858   if (m_hide) return;
859   m_t << "<section xml:id=\"_" <<  stripPath(s->file());
860   if (!s->anchor().isEmpty()) m_t << "_1" << s->anchor();
861   m_t << "\">" << endl;
862   m_t << "<title>";
863   filter(s->title());
864   m_t << "</title>" << endl;
865 }
866
867 void DocbookDocVisitor::visitPost(DocSection *)
868 {
869 DB_VIS_C
870   m_t << "</section>\n";
871 }
872
873 void DocbookDocVisitor::visitPre(DocHtmlList *s)
874 {
875 DB_VIS_C
876   if (m_hide) return;
877   if (s->type()==DocHtmlList::Ordered)
878     m_t << "<orderedlist>\n";
879   else
880     m_t << "<itemizedlist>\n";
881 }
882
883 void DocbookDocVisitor::visitPost(DocHtmlList *s)
884 {
885 DB_VIS_C
886   if (m_hide) return;
887   if (s->type()==DocHtmlList::Ordered)
888     m_t << "</orderedlist>\n";
889   else
890     m_t << "</itemizedlist>\n";
891 }
892
893 void DocbookDocVisitor::visitPre(DocHtmlListItem *)
894 {
895 DB_VIS_C
896   if (m_hide) return;
897   m_t << "<listitem>\n";
898 }
899
900 void DocbookDocVisitor::visitPost(DocHtmlListItem *)
901 {
902 DB_VIS_C
903   if (m_hide) return;
904   m_t << "</listitem>\n";
905 }
906
907 void DocbookDocVisitor::visitPre(DocHtmlDescList *)
908 {
909 DB_VIS_C
910   if (m_hide) return;
911   m_t << "<variablelist>\n";
912 }
913
914 void DocbookDocVisitor::visitPost(DocHtmlDescList *)
915 {
916 DB_VIS_C
917   if (m_hide) return;
918   m_t << "</variablelist>\n";
919 }
920
921 void DocbookDocVisitor::visitPre(DocHtmlDescTitle *)
922 {
923 DB_VIS_C
924   if (m_hide) return;
925   m_t << "<varlistentry><term>";
926 }
927
928 void DocbookDocVisitor::visitPost(DocHtmlDescTitle *)
929 {
930 DB_VIS_C
931   if (m_hide) return;
932   m_t << "</term>\n";
933 }
934
935 void DocbookDocVisitor::visitPre(DocHtmlDescData *)
936 {
937 DB_VIS_C
938   if (m_hide) return;
939   m_t << "<listitem>";
940 }
941
942 void DocbookDocVisitor::visitPost(DocHtmlDescData *)
943 {
944 DB_VIS_C
945   if (m_hide) return;
946   m_t << "</listitem></varlistentry>\n";
947 }
948
949 static int colCnt = 0;
950 static bool bodySet = FALSE; // it is possible to have tables without a header
951 void DocbookDocVisitor::visitPre(DocHtmlTable *t)
952 {
953 DB_VIS_C
954   bodySet = FALSE;
955   if (m_hide) return;
956   m_t << "<informaltable frame=\"all\">" << endl;
957   m_t << "    <tgroup cols=\"" << t->numColumns() << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">" << endl;
958   for (int i = 0; i <t->numColumns(); i++)
959   {
960     // do something with colwidth based of cell width specification (be aware of possible colspan in the header)?
961     m_t << "      <colspec colname='c" << i+1 << "'/>\n";
962   }
963 }
964
965 void DocbookDocVisitor::visitPost(DocHtmlTable *)
966 {
967 DB_VIS_C
968   if (m_hide) return;
969   if (bodySet) m_t << "    </tbody>" << endl;
970   bodySet = FALSE;
971   m_t << "    </tgroup>" << endl;
972   m_t << "</informaltable>" << endl;
973 }
974
975 void DocbookDocVisitor::visitPre(DocHtmlRow *tr)
976 {
977 DB_VIS_C
978   colCnt = 0;
979   if (m_hide) return;
980
981   if (tr->isHeading()) m_t << "<thead>\n";
982   else if (!bodySet)
983   {
984     bodySet = TRUE;
985     m_t << "<tbody>\n";
986   }
987
988   m_t << "      <row ";
989
990   HtmlAttribListIterator li(tr->attribs());
991   HtmlAttrib *opt;
992   for (li.toFirst();(opt=li.current());++li)
993   {
994     if (opt->name=="class")
995     {
996       // just skip it
997     }
998     else if (opt->name=="style")
999     {
1000       // just skip it
1001     }
1002     else if (opt->name=="height")
1003     {
1004       // just skip it
1005     }
1006     else if (opt->name=="filter")
1007     {
1008       // just skip it
1009     }
1010     else
1011     {
1012       m_t << " " << opt->name << "='" << opt->value << "'";
1013     }
1014   }
1015   m_t << ">\n";
1016 }
1017
1018 void DocbookDocVisitor::visitPost(DocHtmlRow *tr)
1019 {
1020 DB_VIS_C
1021   if (m_hide) return;
1022   m_t << "</row>\n";
1023   if (tr->isHeading())
1024   {
1025     bodySet = TRUE;
1026     m_t << "</thead><tbody>\n";
1027   }
1028 }
1029
1030 void DocbookDocVisitor::visitPre(DocHtmlCell *c)
1031 {
1032 DB_VIS_C
1033   colCnt++;
1034   if (m_hide) return;
1035   m_t << "<entry";
1036
1037   HtmlAttribListIterator li(c->attribs());
1038   HtmlAttrib *opt;
1039   for (li.toFirst();(opt=li.current());++li)
1040   {
1041     if (opt->name=="colspan")
1042     {
1043       m_t << " namest='c" << colCnt << "'";
1044       int cols = opt->value.toInt();
1045       colCnt += (cols - 1);
1046       m_t << " nameend='c" << colCnt << "'";
1047     }
1048     else if (opt->name=="rowspan")
1049     {
1050       int extraRows = opt->value.toInt() - 1;
1051       m_t << " morerows='" << extraRows << "'";
1052     }
1053     else if (opt->name=="class")
1054     {
1055       if (opt->value == "markdownTableBodyRight")
1056       {
1057         m_t << " align='right'";
1058       }
1059       else if (opt->value == "markdownTableBodyLeftt")
1060       {
1061         m_t << " align='left'";
1062       }
1063       else if (opt->value == "markdownTableBodyCenter")
1064       {
1065         m_t << " align='center'";
1066       }
1067       else if (opt->value == "markdownTableHeadRight")
1068       {
1069         m_t << " align='right'";
1070       }
1071       else if (opt->value == "markdownTableHeadLeftt")
1072       {
1073         m_t << " align='left'";
1074       }
1075       else if (opt->value == "markdownTableHeadCenter")
1076       {
1077         m_t << " align='center'";
1078       }
1079     }
1080     else if (opt->name=="style")
1081     {
1082       // just skip it
1083     }
1084     else if (opt->name=="width")
1085     {
1086       // just skip it
1087     }
1088     else if (opt->name=="height")
1089     {
1090       // just skip it
1091     }
1092     else
1093     {
1094       m_t << " " << opt->name << "='" << opt->value << "'";
1095     }
1096   }
1097   m_t << ">";
1098 }
1099
1100 void DocbookDocVisitor::visitPost(DocHtmlCell *c)
1101 {
1102 DB_VIS_C
1103   if (m_hide) return;
1104   m_t << "</entry>";
1105 }
1106
1107 void DocbookDocVisitor::visitPre(DocHtmlCaption *c)
1108 {
1109 DB_VIS_C
1110   if (m_hide) return;
1111    m_t << "<caption>";
1112 }
1113
1114 void DocbookDocVisitor::visitPost(DocHtmlCaption *)
1115 {
1116 DB_VIS_C
1117   if (m_hide) return;
1118   m_t << "</caption>\n";
1119 }
1120
1121 void DocbookDocVisitor::visitPre(DocInternal *)
1122 {
1123 DB_VIS_C
1124   if (m_hide) return;
1125   // TODO: to be implemented
1126 }
1127
1128 void DocbookDocVisitor::visitPost(DocInternal *)
1129 {
1130 DB_VIS_C
1131   if (m_hide) return;
1132   // TODO: to be implemented
1133 }
1134
1135 void DocbookDocVisitor::visitPre(DocHRef *href)
1136 {
1137 DB_VIS_C
1138   if (m_hide) return;
1139   m_t << "<link xlink:href=\"" << convertToDocBook(href->url()) << "\">";
1140 }
1141
1142 void DocbookDocVisitor::visitPost(DocHRef *)
1143 {
1144 DB_VIS_C
1145   if (m_hide) return;
1146   m_t << "</link>";
1147 }
1148
1149 void DocbookDocVisitor::visitPre(DocHtmlHeader *)
1150 {
1151 DB_VIS_C
1152   if (m_hide) return;
1153   m_t << "<formalpara><title>";
1154 }
1155
1156 void DocbookDocVisitor::visitPost(DocHtmlHeader *)
1157 {
1158 DB_VIS_C
1159   if (m_hide) return;
1160   m_t << "</title></formalpara>\n";
1161 }
1162
1163 void DocbookDocVisitor::visitPre(DocImage *img)
1164 {
1165 DB_VIS_C
1166   if (img->type()==DocImage::DocBook)
1167   {
1168     if (m_hide) return;
1169     m_t << endl;
1170     QCString baseName=img->name();
1171     int i;
1172     if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1)
1173     {
1174       baseName=baseName.right(baseName.length()-i-1);
1175     }
1176     visitPreStart(m_t, img->children(), img->hasCaption(), img->relPath() + baseName, img->width(), img->height(), img->isInlineImage());
1177   }
1178   else
1179   {
1180     pushEnabled();
1181     m_hide=TRUE;
1182   }
1183 }
1184
1185 void DocbookDocVisitor::visitPost(DocImage *img)
1186 {
1187 DB_VIS_C
1188   if (img->type()==DocImage::DocBook)
1189   {
1190     if (m_hide) return;
1191     visitPostEnd(m_t, img -> hasCaption(),img -> isInlineImage());
1192     // copy the image to the output dir
1193     QCString baseName=img->name();
1194     int i;
1195     if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1)
1196     {
1197       baseName=baseName.right(baseName.length()-i-1);
1198     }
1199     QCString m_file;
1200     bool ambig;
1201     FileDef *fd=findFileDef(Doxygen::imageNameDict, baseName, ambig);
1202     if (fd) 
1203     {
1204       m_file=fd->absFilePath();
1205     }
1206     QFile inImage(m_file);
1207     QFile outImage(Config_getString(DOCBOOK_OUTPUT)+"/"+baseName.data());
1208     if (inImage.open(IO_ReadOnly))
1209     {
1210       if (outImage.open(IO_WriteOnly))
1211       {
1212         char *buffer = new char[inImage.size()];
1213         inImage.readBlock(buffer,inImage.size());
1214         outImage.writeBlock(buffer,inImage.size());
1215         outImage.flush();
1216         delete[] buffer;
1217       }
1218     }
1219   } 
1220   else 
1221   {
1222     popEnabled();
1223   }
1224 }
1225
1226 void DocbookDocVisitor::visitPre(DocDotFile *df)
1227 {
1228 DB_VIS_C
1229   if (m_hide) return;
1230   startDotFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children());
1231 }
1232
1233 void DocbookDocVisitor::visitPost(DocDotFile *df)
1234 {
1235 DB_VIS_C
1236   if (m_hide) return;
1237   endDotFile(df->hasCaption());
1238 }
1239
1240 void DocbookDocVisitor::visitPre(DocMscFile *df)
1241 {
1242 DB_VIS_C
1243   if (m_hide) return;
1244   startMscFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children());
1245 }
1246
1247 void DocbookDocVisitor::visitPost(DocMscFile *df)
1248 {
1249 DB_VIS_C
1250   if (m_hide) return;
1251   endMscFile(df->hasCaption());
1252 }
1253 void DocbookDocVisitor::visitPre(DocDiaFile *df)
1254 {
1255 DB_VIS_C
1256   if (m_hide) return;
1257   startDiaFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children());
1258 }
1259
1260 void DocbookDocVisitor::visitPost(DocDiaFile *df)
1261 {
1262 DB_VIS_C
1263   if (m_hide) return;
1264   endDiaFile(df->hasCaption());
1265 }
1266
1267 void DocbookDocVisitor::visitPre(DocLink *lnk)
1268 {
1269 DB_VIS_C
1270   if (m_hide) return;
1271   startLink(lnk->file(),lnk->anchor());
1272 }
1273
1274 void DocbookDocVisitor::visitPost(DocLink *)
1275 {
1276 DB_VIS_C
1277   if (m_hide) return;
1278   endLink();
1279 }
1280
1281 void DocbookDocVisitor::visitPre(DocRef *ref)
1282 {
1283 DB_VIS_C
1284   if (m_hide) return;
1285   if (ref->isSubPage())
1286   {
1287     startLink(0,ref->anchor());
1288   }
1289   else
1290   {
1291     if (!ref->file().isEmpty()) startLink(ref->file(),ref->anchor());
1292   }
1293
1294   if (!ref->hasLinkText()) filter(ref->targetTitle());
1295 }
1296
1297 void DocbookDocVisitor::visitPost(DocRef *ref)
1298 {
1299 DB_VIS_C
1300   if (m_hide) return;
1301   if (!ref->file().isEmpty()) endLink();
1302 }
1303
1304 void DocbookDocVisitor::visitPre(DocSecRefItem *ref)
1305 {
1306 DB_VIS_C
1307   if (m_hide) return;
1308   //m_t << "<tocentry xml:idref=\"_" <<  stripPath(ref->file()) << "_1" << ref->anchor() << "\">";
1309   m_t << "<tocentry>";
1310 }
1311
1312 void DocbookDocVisitor::visitPost(DocSecRefItem *)
1313 {
1314 DB_VIS_C
1315   if (m_hide) return;
1316   m_t << "</tocentry>" << endl;
1317 }
1318
1319 void DocbookDocVisitor::visitPre(DocSecRefList *)
1320 {
1321 DB_VIS_C
1322   if (m_hide) return;
1323   m_t << "<toc>" << endl;
1324 }
1325
1326 void DocbookDocVisitor::visitPost(DocSecRefList *)
1327 {
1328 DB_VIS_C
1329   if (m_hide) return;
1330   m_t << "</toc>" << endl;
1331 }
1332
1333 void DocbookDocVisitor::visitPre(DocParamSect *s)
1334 {
1335 DB_VIS_C
1336   if (m_hide) return;
1337   m_t <<  endl;
1338   m_t << "                <formalpara>" << endl;
1339   m_t << "                    <title>" << endl;
1340   switch(s->type())
1341   {
1342     case DocParamSect::Param:         m_t << theTranslator->trParameters();         break;
1343     case DocParamSect::RetVal:        m_t << theTranslator->trReturnValues();       break;
1344     case DocParamSect::Exception:     m_t << theTranslator->trExceptions();         break;
1345     case DocParamSect::TemplateParam: m_t << theTranslator->trTemplateParameters(); break;
1346     default:
1347       ASSERT(0);
1348   }
1349   m_t << "                    </title>" << endl;
1350   m_t << "                    <para>" << endl;
1351   m_t << "                    <table frame=\"all\">" << endl;
1352   int ncols = 2;
1353   if (s->type() == DocParamSect::Param)
1354   {
1355     bool hasInOutSpecs = s->hasInOutSpecifier();
1356     bool hasTypeSpecs  = s->hasTypeSpecifier();
1357     if      (hasInOutSpecs && hasTypeSpecs) ncols += 2;
1358     else if (hasInOutSpecs || hasTypeSpecs) ncols += 1;
1359   }
1360   m_t << "                        <tgroup cols=\"" << ncols << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">" << endl;
1361   for (int i = 1; i <= ncols; i++)
1362   {
1363     if (i == ncols) m_t << "                        <colspec colwidth=\"4*\"/>" << endl;
1364     else            m_t << "                        <colspec colwidth=\"1*\"/>" << endl;
1365   }
1366   m_t << "                        <tbody>" << endl;
1367 }
1368
1369 void DocbookDocVisitor::visitPost(DocParamSect *)
1370 {
1371 DB_VIS_C
1372   if (m_hide) return;
1373   m_t << "                        </tbody>" << endl;
1374   m_t << "                        </tgroup>" << endl;
1375   m_t << "                    </table>" << endl;
1376   m_t << "                    </para>" << endl;
1377   m_t << "                </formalpara>" << endl;
1378   m_t << "                ";
1379 }
1380
1381 void DocbookDocVisitor::visitPre(DocParamList *pl)
1382 {
1383 DB_VIS_C
1384   if (m_hide) return;
1385   m_t << "                            <row>" << endl;
1386
1387   DocParamSect::Type parentType = DocParamSect::Unknown;
1388   DocParamSect *sect = 0;
1389   if (pl->parent() && pl->parent()->kind()==DocNode::Kind_ParamSect)
1390   {
1391     parentType = ((DocParamSect*)pl->parent())->type();
1392     sect=(DocParamSect*)pl->parent();
1393   }
1394
1395   if (sect && sect->hasInOutSpecifier())
1396   {
1397     m_t << "                                <entry>";
1398     if (pl->direction()!=DocParamSect::Unspecified)
1399     {
1400       if (pl->direction()==DocParamSect::In)
1401       {
1402         m_t << "in";
1403       }
1404       else if (pl->direction()==DocParamSect::Out)
1405       {
1406         m_t << "out";
1407       }
1408       else if (pl->direction()==DocParamSect::InOut)
1409       {
1410         m_t << "in,out";
1411       }
1412     }
1413     m_t << "                                </entry>";
1414   }
1415
1416   if (sect && sect->hasTypeSpecifier())
1417   {
1418     QListIterator<DocNode> li(pl->paramTypes());
1419     DocNode *type;
1420     bool first=TRUE;
1421     m_t << "                                <entry>";
1422     for (li.toFirst();(type=li.current());++li)
1423     {
1424       if (!first) m_t << " | "; else first=FALSE;
1425       if (type->kind()==DocNode::Kind_Word)
1426       {
1427         visit((DocWord*)type);
1428       }
1429       else if (type->kind()==DocNode::Kind_LinkedWord)
1430       {
1431         visit((DocLinkedWord*)type);
1432       }
1433     }
1434     m_t << "                                </entry>";
1435   }
1436
1437   QListIterator<DocNode> li(pl->parameters());
1438   DocNode *param;
1439   if (!li.toFirst())
1440   {
1441     m_t << "                                <entry></entry>" << endl;
1442   }
1443   else
1444   {
1445     m_t << "                                <entry>";
1446     int cnt = 0;
1447     for (li.toFirst();(param=li.current());++li)
1448     {
1449       if (cnt)
1450       {
1451         m_t << ", ";
1452       }
1453       if (param->kind()==DocNode::Kind_Word)
1454       {
1455         visit((DocWord*)param);
1456       }
1457       else if (param->kind()==DocNode::Kind_LinkedWord)
1458       {
1459         visit((DocLinkedWord*)param);
1460       }
1461       cnt++;
1462     }
1463     m_t << "</entry>" << endl;
1464   }
1465   m_t << "                                <entry>";
1466 }
1467
1468 void DocbookDocVisitor::visitPost(DocParamList *)
1469 {
1470 DB_VIS_C
1471   if (m_hide) return;
1472   m_t << "</entry>" << endl;
1473   m_t << "                            </row>" << endl;
1474 }
1475
1476 void DocbookDocVisitor::visitPre(DocXRefItem *x)
1477 {
1478 DB_VIS_C
1479   if (m_hide) return;
1480   if (x->title().isEmpty()) return;
1481   m_t << "<para><link linkend=\"_";
1482   m_t << stripPath(x->file()) << "_1" << x->anchor();
1483   m_t << "\">";
1484   filter(x->title());
1485   m_t << "</link>";
1486   m_t << " ";
1487 }
1488
1489 void DocbookDocVisitor::visitPost(DocXRefItem *x)
1490 {
1491 DB_VIS_C
1492   if (m_hide) return;
1493   if (x->title().isEmpty()) return;
1494   m_t << "</para>";
1495 }
1496
1497 void DocbookDocVisitor::visitPre(DocInternalRef *ref)
1498 {
1499 DB_VIS_C
1500   if (m_hide) return;
1501   startLink(ref->file(),ref->anchor());
1502 }
1503
1504 void DocbookDocVisitor::visitPost(DocInternalRef *)
1505 {
1506 DB_VIS_C
1507   if (m_hide) return;
1508   endLink();
1509   m_t << " ";
1510 }
1511
1512 void DocbookDocVisitor::visitPre(DocCopy *)
1513 {
1514 DB_VIS_C
1515   if (m_hide) return;
1516   // TODO: to be implemented
1517 }
1518
1519
1520 void DocbookDocVisitor::visitPost(DocCopy *)
1521 {
1522 DB_VIS_C
1523   if (m_hide) return;
1524   // TODO: to be implemented
1525 }
1526
1527
1528 void DocbookDocVisitor::visitPre(DocText *)
1529 {
1530 DB_VIS_C
1531   // TODO: to be implemented
1532 }
1533
1534
1535 void DocbookDocVisitor::visitPost(DocText *)
1536 {
1537 DB_VIS_C
1538   // TODO: to be implemented
1539 }
1540
1541
1542 void DocbookDocVisitor::visitPre(DocHtmlBlockQuote *)
1543 {
1544 DB_VIS_C
1545   if (m_hide) return;
1546   m_t << "<blockquote>";
1547 }
1548
1549 void DocbookDocVisitor::visitPost(DocHtmlBlockQuote *)
1550 {
1551 DB_VIS_C
1552   if (m_hide) return;
1553   m_t << "</blockquote>";
1554 }
1555
1556 void DocbookDocVisitor::visitPre(DocVhdlFlow *)
1557 {
1558 DB_VIS_C
1559   // TODO: to be implemented
1560 }
1561
1562
1563 void DocbookDocVisitor::visitPost(DocVhdlFlow *)
1564 {
1565 DB_VIS_C
1566   // TODO: to be implemented
1567 }
1568
1569 void DocbookDocVisitor::visitPre(DocParBlock *)
1570 {
1571 DB_VIS_C
1572 }
1573
1574 void DocbookDocVisitor::visitPost(DocParBlock *)
1575 {
1576 DB_VIS_C
1577 }
1578
1579
1580 void DocbookDocVisitor::filter(const char *str)
1581 {
1582 DB_VIS_C
1583   m_t << convertToDocBook(str);
1584 }
1585
1586 void DocbookDocVisitor::startLink(const QCString &file,const QCString &anchor)
1587 {
1588 DB_VIS_C
1589   m_t << "<link linkend=\"_" << stripPath(file);
1590   if (!anchor.isEmpty())
1591   {
1592     if (file) m_t << "_1";
1593     m_t << anchor;
1594   }
1595   m_t << "\">";
1596 }
1597
1598 void DocbookDocVisitor::endLink()
1599 {
1600 DB_VIS_C
1601   m_t << "</link>";
1602 }
1603
1604 void DocbookDocVisitor::pushEnabled()
1605 {
1606 DB_VIS_C
1607   m_enabled.push(new bool(m_hide));
1608 }
1609
1610 void DocbookDocVisitor::popEnabled()
1611 {
1612 DB_VIS_C
1613   bool *v=m_enabled.pop();
1614   ASSERT(v!=0);
1615   m_hide = *v;
1616   delete v;
1617 }
1618
1619 void DocbookDocVisitor::writeMscFile(const QCString &baseName, DocVerbatim *s)
1620 {
1621 DB_VIS_C
1622   QCString shortName = baseName;
1623   int i;
1624   if ((i=shortName.findRev('/'))!=-1)
1625   {
1626     shortName=shortName.right(shortName.length()-i-1);
1627   }
1628   QCString outDir = Config_getString(DOCBOOK_OUTPUT);
1629   writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_BITMAP);
1630   visitPreStart(m_t, s->children(), s->hasCaption(), s->relPath() + shortName + ".png", s->width(), s->height());
1631   visitCaption(s->children());
1632   visitPostEnd(m_t, s->hasCaption());
1633 }
1634
1635 void DocbookDocVisitor::writePlantUMLFile(const QCString &baseName, DocVerbatim *s)
1636 {
1637 DB_VIS_C
1638   QCString shortName = baseName;
1639   int i;
1640   if ((i=shortName.findRev('/'))!=-1)
1641   {
1642     shortName=shortName.right(shortName.length()-i-1);
1643   }
1644   QCString outDir = Config_getString(DOCBOOK_OUTPUT);
1645   generatePlantUMLOutput(baseName,outDir,PUML_BITMAP);
1646   visitPreStart(m_t, s->children(), s->hasCaption(), s->relPath() + shortName + ".png", s->width(),s->height());
1647   visitCaption(s->children());
1648   visitPostEnd(m_t, s->hasCaption());
1649 }
1650
1651 void DocbookDocVisitor::startMscFile(const QCString &fileName,
1652     const QCString &width,
1653     const QCString &height,
1654     bool hasCaption,
1655     const QList<DocNode> &children
1656     )
1657 {
1658 DB_VIS_C
1659   QCString baseName=fileName;
1660   int i;
1661   if ((i=baseName.findRev('/'))!=-1)
1662   {
1663     baseName=baseName.right(baseName.length()-i-1);
1664   }
1665   if ((i=baseName.find('.'))!=-1)
1666   {
1667     baseName=baseName.left(i);
1668   }
1669   baseName.prepend("msc_");
1670   QCString outDir = Config_getString(DOCBOOK_OUTPUT);
1671   writeMscGraphFromFile(fileName,outDir,baseName,MSC_BITMAP);
1672   m_t << "<para>" << endl;
1673   visitPreStart(m_t, children, hasCaption, baseName + ".png",  width,  height);
1674 }
1675
1676 void DocbookDocVisitor::endMscFile(bool hasCaption)
1677 {
1678 DB_VIS_C
1679   if (m_hide) return;
1680   visitPostEnd(m_t, hasCaption);
1681   m_t << "</para>" << endl;
1682 }
1683
1684 void DocbookDocVisitor::writeDiaFile(const QCString &baseName, DocVerbatim *s)
1685 {
1686 DB_VIS_C
1687   QCString shortName = baseName;
1688   int i;
1689   if ((i=shortName.findRev('/'))!=-1)
1690   {
1691     shortName=shortName.right(shortName.length()-i-1);
1692   }
1693   QCString outDir = Config_getString(DOCBOOK_OUTPUT);
1694   writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_BITMAP);
1695   visitPreStart(m_t, s->children(), s->hasCaption(), shortName, s->width(),s->height());
1696   visitCaption(s->children());
1697   visitPostEnd(m_t, s->hasCaption());
1698 }
1699
1700 void DocbookDocVisitor::startDiaFile(const QCString &fileName,
1701     const QCString &width,
1702     const QCString &height,
1703     bool hasCaption,
1704     const QList<DocNode> &children
1705     )
1706 {
1707 DB_VIS_C
1708   QCString baseName=fileName;
1709   int i;
1710   if ((i=baseName.findRev('/'))!=-1)
1711   {
1712     baseName=baseName.right(baseName.length()-i-1);
1713   }
1714   if ((i=baseName.find('.'))!=-1)
1715   {
1716     baseName=baseName.left(i);
1717   }
1718   baseName.prepend("dia_");
1719   QCString outDir = Config_getString(DOCBOOK_OUTPUT);
1720   writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP);
1721   m_t << "<para>" << endl;
1722   visitPreStart(m_t, children, hasCaption, baseName + ".png",  width,  height);
1723 }
1724
1725 void DocbookDocVisitor::endDiaFile(bool hasCaption)
1726 {
1727 DB_VIS_C
1728   if (m_hide) return;
1729   visitPostEnd(m_t, hasCaption);
1730   m_t << "</para>" << endl;
1731 }
1732
1733 void DocbookDocVisitor::writeDotFile(const QCString &baseName, DocVerbatim *s)
1734 {
1735 DB_VIS_C
1736   QCString shortName = baseName;
1737   int i;
1738   if ((i=shortName.findRev('/'))!=-1)
1739   {
1740     shortName=shortName.right(shortName.length()-i-1);
1741   }
1742   QCString outDir = Config_getString(DOCBOOK_OUTPUT);
1743   writeDotGraphFromFile(baseName+".dot",outDir,shortName,GOF_BITMAP);
1744   visitPreStart(m_t, s->children(), s->hasCaption(), s->relPath() + shortName + "." + getDotImageExtension(), s->width(),s->height());
1745   visitCaption(s->children());
1746   visitPostEnd(m_t, s->hasCaption());
1747 }
1748
1749 void DocbookDocVisitor::startDotFile(const QCString &fileName,
1750     const QCString &width,
1751     const QCString &height,
1752     bool hasCaption,
1753     const QList<DocNode> &children
1754     )
1755 {
1756 DB_VIS_C
1757   QCString baseName=fileName;
1758   int i;
1759   if ((i=baseName.findRev('/'))!=-1)
1760   {
1761     baseName=baseName.right(baseName.length()-i-1);
1762   }
1763   if ((i=baseName.find('.'))!=-1)
1764   {
1765     baseName=baseName.left(i);
1766   }
1767   baseName.prepend("dot_");
1768   QCString outDir = Config_getString(DOCBOOK_OUTPUT);
1769   QCString imgExt = getDotImageExtension();
1770   writeDotGraphFromFile(fileName,outDir,baseName,GOF_BITMAP);
1771   m_t << "<para>" << endl;
1772   visitPreStart(m_t, children, hasCaption, baseName + "." + imgExt,  width,  height);
1773 }
1774
1775 void DocbookDocVisitor::endDotFile(bool hasCaption)
1776 {
1777 DB_VIS_C
1778   if (m_hide) return;
1779   m_t << endl;
1780   visitPostEnd(m_t, hasCaption);
1781   m_t << "</para>" << endl;
1782 }
1783