rtfdocvisitor.cpp
Go to the documentation of this file.
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 "rtfdocvisitor.h"
22 #include "docparser.h"
23 #include "language.h"
24 #include "doxygen.h"
25 #include "outputgen.h"
26 #include "dot.h"
27 #include "msc.h"
28 #include "util.h"
29 #include "rtfstyle.h"
30 #include "message.h"
31 #include "parserintf.h"
32 #include "msc.h"
33 #include "dia.h"
34 #include "filedef.h"
35 #include "config.h"
36 #include "htmlentity.h"
37 #include "plantuml.h"
38 
39 //#define DBG_RTF(x) m_t << x
40 #define DBG_RTF(x) do {} while(0)
41 
42 static QCString align(DocHtmlCell *cell)
43 {
44  HtmlAttribList attrs = cell->attribs();
45  uint i;
46  for (i=0; i<attrs.count(); ++i)
47  {
48  if (attrs.at(i)->name.lower()=="align")
49  {
50  if (attrs.at(i)->value.lower()=="center")
51  return "\\qc ";
52  else if (attrs.at(i)->value.lower()=="right")
53  return "\\qr ";
54  else return "";
55  }
56  }
57  return "";
58 }
59 
61  const char *langExt)
62  : DocVisitor(DocVisitor_RTF), m_t(t), m_ci(ci), m_insidePre(FALSE),
63  m_hide(FALSE), m_indentLevel(0), m_lastIsPara(FALSE), m_langExt(langExt)
64 {
65 }
66 
68 {
69  QCString n;
70  n.sprintf("%s%d",name,m_indentLevel);
71  StyleData *sd = rtf_Style[n];
72  ASSERT(sd!=0);
73  return sd->reference;
74 }
75 
77 {
79 }
80 
82 {
84 }
85 
86  //--------------------------------------
87  // visitor functions for leaf nodes
88  //--------------------------------------
89 
91 {
92  if (m_hide) return;
93  DBG_RTF("{\\comment RTFDocVisitor::visit(DocWord)}\n");
94  filter(w->word());
96 }
97 
99 {
100  if (m_hide) return;
101  DBG_RTF("{\\comment RTFDocVisitor::visit(DocLinkedWord)}\n");
102  startLink(w->ref(),w->file(),w->anchor());
103  filter(w->word());
104  endLink(w->ref());
106 }
107 
109 {
110  if (m_hide) return;
111  DBG_RTF("{\\comment RTFDocVisitor::visit(DocWhiteSpace)}\n");
112  if (m_insidePre)
113  {
114  m_t << w->chars();
115  }
116  else
117  {
118  m_t << " ";
119  }
121 }
122 
124 {
125  if (m_hide) return;
126  DBG_RTF("{\\comment RTFDocVisitor::visit(DocSymbol)}\n");
127  const char *res = HtmlEntityMapper::instance()->rtf(s->symbol());
128  if (res)
129  {
130  m_t << res;
131  }
132  else
133  {
134  err("RTF: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE));
135  }
137 }
138 
140 {
141  if (m_hide) return;
142  DBG_RTF("{\\comment RTFDocVisitor::visit(DocURL)}\n");
143  if (Config_getBool("RTF_HYPERLINKS"))
144  {
145  m_t << "{\\field "
146  "{\\*\\fldinst "
147  "{ HYPERLINK \"";
148  if (u->isEmail()) m_t << "mailto:";
149  m_t << u->url();
150  m_t << "\" }"
151  "{}";
152  m_t << "}"
153  "{\\fldrslt "
154  "{\\cs37\\ul\\cf2 ";
155  filter(u->url());
156  m_t << "}"
157  "}"
158  "}" << endl;
159  }
160  else
161  {
162  m_t << "{\\f2 ";
163  filter(u->url());
164  m_t << "}";
165  }
167 }
168 
170 {
171  if (m_hide) return;
172  DBG_RTF("{\\comment RTFDocVisitor::visit(DocLineBreak)}\n");
173  m_t << "\\par" << endl;
175 }
176 
178 {
179  if (m_hide) return;
180  DBG_RTF("{\\comment RTFDocVisitor::visit(DocHorRuler)}\n");
181  m_t << "{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw5\\brsp20 \\adjustright \\par}" << endl;
183 }
184 
186 {
187  if (m_hide) return;
189  DBG_RTF("{\\comment RTFDocVisitor::visit(DocStyleChange)}\n");
190  switch (s->style())
191  {
193  if (s->enable()) m_t << "{\\b "; else m_t << "} ";
194  break;
196  if (s->enable()) m_t << "{\\i "; else m_t << "} ";
197  break;
199  if (s->enable()) m_t << "{\\f2 "; else m_t << "} ";
200  break;
202  if (s->enable()) m_t << "{\\sub "; else m_t << "} ";
203  break;
205  if (s->enable()) m_t << "{\\super "; else m_t << "} ";
206  break;
208  if (s->enable()) m_t << "{\\qc "; else m_t << "} ";
209  break;
211  if (s->enable()) m_t << "{\\sub "; else m_t << "} ";
212  break;
214  if (s->enable())
215  {
216  m_t << "{" << endl;
217  m_t << "\\par" << endl;
218  m_t << rtf_Style_Reset << getStyle("CodeExample");
220  }
221  else
222  {
224  m_t << "\\par";
225  m_t << "}" << endl;
226  }
228  break;
229  case DocStyleChange::Div: /* HTML only */ break;
230  case DocStyleChange::Span: /* HTML only */ break;
231  }
232 }
233 
235 {
236  if (m_hide) return;
237  DBG_RTF("{\\comment RTFDocVisitor::visit(DocVerbatim)}\n");
238  QCString lang = m_langExt;
239  if (!s->language().isEmpty()) // explicit language setting
240  {
241  lang = s->language();
242  }
243  SrcLangExt langExt = getLanguageFromFileName(lang);
244  switch(s->type())
245  {
246  case DocVerbatim::Code: // fall though
247  m_t << "{" << endl;
248  m_t << "\\par" << endl;
249  m_t << rtf_Style_Reset << getStyle("CodeExample");
251  ->parseCode(m_ci,s->context(),s->text(),langExt,
252  s->isExample(),s->exampleFile());
253  //m_t << "\\par" << endl;
254  m_t << "}" << endl;
255  break;
256  case DocVerbatim::Verbatim:
257  m_t << "{" << endl;
258  m_t << "\\par" << endl;
259  m_t << rtf_Style_Reset << getStyle("CodeExample");
260  filter(s->text(),TRUE);
261  //m_t << "\\par" << endl;
262  m_t << "}" << endl;
263  break;
264  case DocVerbatim::RtfOnly:
265  m_t << s->text();
266  break;
267  case DocVerbatim::HtmlOnly:
269  case DocVerbatim::XmlOnly:
272  /* nothing */
273  break;
274  case DocVerbatim::Dot:
275  {
276  static int dotindex = 1;
277  QCString fileName(4096);
278 
279  fileName.sprintf("%s%d%s",
280  (Config_getString("RTF_OUTPUT")+"/inline_dotgraph_").data(),
281  dotindex++,
282  ".dot"
283  );
284  QFile file(fileName);
285  if (!file.open(IO_WriteOnly))
286  {
287  err("Could not open file %s for writing\n",fileName.data());
288  }
289  file.writeBlock( s->text(), s->text().length() );
290  file.close();
291  m_t << "\\par{\\qc "; // center picture
292  writeDotFile(fileName);
293  m_t << "} ";
294  if (Config_getBool("DOT_CLEANUP")) file.remove();
295  }
296  break;
297  case DocVerbatim::Msc:
298  {
299  static int mscindex = 1;
300  QCString baseName(4096);
301 
302  baseName.sprintf("%s%d%s",
303  (Config_getString("RTF_OUTPUT")+"/inline_mscgraph_").data(),
304  mscindex++,
305  ".msc"
306  );
307  QFile file(baseName);
308  if (!file.open(IO_WriteOnly))
309  {
310  err("Could not open file %s for writing\n",baseName.data());
311  }
312  QCString text = "msc {";
313  text+=s->text();
314  text+="}";
315  file.writeBlock( text, text.length() );
316  file.close();
317  m_t << "\\par{\\qc "; // center picture
318  writeMscFile(baseName);
319  m_t << "} ";
320  if (Config_getBool("DOT_CLEANUP")) file.remove();
321  }
322  break;
324  {
325  static QCString rtfOutput = Config_getString("RTF_OUTPUT");
326  QCString baseName = writePlantUMLSource(rtfOutput,s->exampleFile(),s->text());
327 
328  m_t << "\\par{\\qc "; // center picture
329  writePlantUMLFile(baseName);
330  m_t << "} ";
331  }
332  break;
333  }
335 }
336 
338 {
339  if (m_hide) return;
340  DBG_RTF("{\\comment RTFDocVisitor::visit(DocAnchor)}\n");
341  QCString anchor;
342  if (!anc->file().isEmpty())
343  {
344  anchor+=anc->file();
345  }
346  if (!anc->file().isEmpty() && !anc->anchor().isEmpty())
347  {
348  anchor+="_";
349  }
350  if (!anc->anchor().isEmpty())
351  {
352  anchor+=anc->anchor();
353  }
354  m_t << "{\\bkmkstart " << rtfFormatBmkStr(anchor) << "}" << endl;
355  m_t << "{\\bkmkend " << rtfFormatBmkStr(anchor) << "}" << endl;
357 }
358 
360 {
361  if (m_hide) return;
362  SrcLangExt langExt = getLanguageFromFileName(inc->extension());
363  DBG_RTF("{\\comment RTFDocVisitor::visit(DocInclude)}\n");
364  switch(inc->type())
365  {
367  {
368  m_t << "{" << endl;
369  m_t << "\\par" << endl;
370  m_t << rtf_Style_Reset << getStyle("CodeExample");
371  QFileInfo cfi( inc->file() );
372  FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() );
374  ->parseCode(m_ci,inc->context(),
375  inc->text(),
376  langExt,
377  inc->isExample(),
378  inc->exampleFile(), &fd);
379  m_t << "\\par";
380  m_t << "}" << endl;
381  }
382  break;
383  case DocInclude::Include:
384  m_t << "{" << endl;
385  m_t << "\\par" << endl;
386  m_t << rtf_Style_Reset << getStyle("CodeExample");
388  ->parseCode(m_ci,inc->context(),
389  inc->text(),langExt,inc->isExample(),
390  inc->exampleFile());
391  m_t << "\\par";
392  m_t << "}" << endl;
393  break;
395  break;
397  break;
399  break;
401  m_t << "{" << endl;
402  m_t << "\\par" << endl;
403  m_t << rtf_Style_Reset << getStyle("CodeExample");
404  filter(inc->text());
405  m_t << "\\par";
406  m_t << "}" << endl;
407  break;
408  case DocInclude::Snippet:
409  m_t << "{" << endl;
410  if (!m_lastIsPara) m_t << "\\par" << endl;
411  m_t << rtf_Style_Reset << getStyle("CodeExample");
413  ->parseCode(m_ci,
414  inc->context(),
415  extractBlock(inc->text(),inc->blockId()),
416  langExt,
417  inc->isExample(),
418  inc->exampleFile()
419  );
420  m_t << "}";
421  break;
422  }
424 }
425 
427 {
428  //printf("DocIncOperator: type=%d first=%d, last=%d text=`%s'\n",
429  // op->type(),op->isFirst(),op->isLast(),op->text().data());
430  DBG_RTF("{\\comment RTFDocVisitor::visit(DocIncOperator)}\n");
432  if (op->isFirst())
433  {
434  if (!m_hide)
435  {
436  m_t << "{" << endl;
437  m_t << "\\par" << endl;
438  m_t << rtf_Style_Reset << getStyle("CodeExample");
439  }
440  pushEnabled();
441  m_hide = TRUE;
442  }
443  if (op->type()!=DocIncOperator::Skip)
444  {
445  popEnabled();
446  if (!m_hide)
447  {
449  ->parseCode(m_ci,op->context(),op->text(),langExt,
450  op->isExample(),op->exampleFile());
451  }
452  pushEnabled();
453  m_hide=TRUE;
454  }
455  if (op->isLast())
456  {
457  popEnabled();
458  if (!m_hide)
459  {
460  m_t << "\\par";
461  m_t << "}" << endl;
462  }
464  }
465  else
466  {
467  if (!m_hide) m_t << endl;
469  }
470 }
471 
473 {
474  if (m_hide) return;
475  // TODO: do something sensible here, like including a bitmap
476  DBG_RTF("{\\comment RTFDocVisitor::visit(DocFormula)}\n");
477  m_t << f->text();
479 }
480 
482 {
483  if (m_hide) return;
484  DBG_RTF("{\\comment RTFDocVisitor::visit(DocIndexEntry)}\n");
485  m_t << "{\\xe \\v " << i->entry() << "}" << endl;
487 }
488 
490 {
491 }
492 
494 {
495  if (m_hide) return;
496  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocCite)}\n");
497  if (!cite->file().isEmpty())
498  {
499  startLink(cite->ref(),cite->file(),cite->anchor());
500  }
501  else
502  {
503  m_t << "{\\b ";
504  }
505  filter(cite->text());
506  if (!cite->file().isEmpty())
507  {
508  endLink(cite->ref());
509  }
510  else
511  {
512  m_t << "}";
513  }
514 }
515 
516 
517 //--------------------------------------
518 // visitor functions for compound nodes
519 //--------------------------------------
520 
522 {
523  if (m_hide) return;
524  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocAutoList)}\n");
525  m_t << "{" << endl;
529 }
530 
532 {
533  if (m_hide) return;
534  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocAutoList)}\n");
535  m_t << "\\par";
536  m_t << "}" << endl;
538 }
539 
541 {
542  if (m_hide) return;
543  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocAutoListItem)}\n");
544  if (!m_lastIsPara) m_t << "\\par" << endl;
545  m_t << rtf_Style_Reset;
546  if (rtf_listItemInfo[m_indentLevel].isEnum)
547  {
548  m_t << getStyle("ListEnum") << endl;
549  m_t << rtf_listItemInfo[m_indentLevel].number << ".\\tab ";
551  }
552  else
553  {
554  m_t << getStyle("ListBullet") << endl;
555  }
556  incIndentLevel();
558 }
559 
561 {
562  decIndentLevel();
563  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocAutoListItem)}\n");
564 }
565 
567 {
568  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocPara)}\n");
569 }
570 
572 {
573  if (m_hide) return;
574  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocPara)}\n");
575  if (!m_lastIsPara &&
576  !p->isLast() && // omit <p> for last paragraph
577  !(p->parent() && // and for parameters & sections
579  )
580  )
581  {
582  m_t << "\\par" << endl;
584  }
585 }
586 
588 {
589  if (m_hide) return;
590  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocRoot)}\n");
591  if (r->indent()) incIndentLevel();
592  m_t << "{" << rtf_Style["BodyText"]->reference << endl;
593 }
594 
596 {
597  if (m_hide) return;
598  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocRoot)}\n");
599  if (!m_lastIsPara && !r->singleLine()) m_t << "\\par" << endl;
600  m_t << "}";
602  if (r->indent()) decIndentLevel();
603 }
604 
606 {
607  if (m_hide) return;
608  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSimpleSect)}\n");
609  if (!m_lastIsPara) m_t << "\\par" << endl;
610  m_t << "{"; // start desc
611  //m_t << "{\\b "; // start bold
612  m_t << "{" << rtf_Style["Heading5"]->reference << endl;
613  switch(s->type())
614  {
615  case DocSimpleSect::See:
616  m_t << theTranslator->trSeeAlso(); break;
617  case DocSimpleSect::Return:
618  m_t << theTranslator->trReturns(); break;
619  case DocSimpleSect::Author:
620  m_t << theTranslator->trAuthor(TRUE,TRUE); break;
622  m_t << theTranslator->trAuthor(TRUE,FALSE); break;
624  m_t << theTranslator->trVersion(); break;
625  case DocSimpleSect::Since:
626  m_t << theTranslator->trSince(); break;
627  case DocSimpleSect::Date:
628  m_t << theTranslator->trDate(); break;
629  case DocSimpleSect::Note:
630  m_t << theTranslator->trNote(); break;
632  m_t << theTranslator->trWarning(); break;
633  case DocSimpleSect::Pre:
634  m_t << theTranslator->trPrecondition(); break;
635  case DocSimpleSect::Post:
636  m_t << theTranslator->trPostcondition(); break;
638  m_t << theTranslator->trCopyright(); break;
640  m_t << theTranslator->trInvariant(); break;
642  m_t << theTranslator->trRemarks(); break;
644  m_t << theTranslator->trAttention(); break;
645  case DocSimpleSect::User: break;
646  case DocSimpleSect::Rcs: break;
647  case DocSimpleSect::Unknown: break;
648  }
649 
650  // special case 1: user defined title
651  if (s->type()!=DocSimpleSect::User && s->type()!=DocSimpleSect::Rcs)
652  {
653  m_t << ":";
654  m_t << "\\par";
655  m_t << "}"; // end bold
656  incIndentLevel();
657  m_t << rtf_Style_Reset << getStyle("DescContinue");
658  }
660 }
661 
663 {
664  if (m_hide) return;
665  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSimpleSect)}\n");
666  if (!m_lastIsPara) m_t << "\\par" << endl;
667  decIndentLevel();
668  m_t << "}"; // end desc
670 }
671 
673 {
674  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocTitle)}\n");
675 }
676 
678 {
679  if (m_hide) return;
680  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocTitle)}\n");
681  m_t << "\\par" << endl;
682  m_t << "}"; // end bold
683  incIndentLevel();
684  m_t << rtf_Style_Reset << getStyle("DescContinue");
686 }
687 
689 {
690  if (m_hide) return;
691  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSimpleSect)}\n");
692  m_t << "{" << endl;
695 }
696 
698 {
699  if (m_hide) return;
700  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSimpleSect)}\n");
701  if (!m_lastIsPara) m_t << "\\par" << endl;
702  m_t << "}" << endl;
704 }
705 
707 {
708  if (m_hide) return;
709  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSimpleListItem)}\n");
710  m_t << "\\par" << rtf_Style_Reset << getStyle("ListBullet") << endl;
712  incIndentLevel();
713 }
714 
716 {
717  decIndentLevel();
718  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSimpleListItem)}\n");
719 }
720 
722 {
723  if (m_hide) return;
724  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSection)}\n");
725  if (!m_lastIsPara) m_t << "\\par" << endl;
726  m_t << "{\\bkmkstart " << rtfFormatBmkStr(s->file()+"_"+s->anchor()) << "}" << endl;
727  m_t << "{\\bkmkend " << rtfFormatBmkStr(s->file()+"_"+s->anchor()) << "}" << endl;
728  m_t << "{{" // start section
729  << rtf_Style_Reset;
730  QCString heading;
731  int level = QMIN(s->level()+1,4);
732  heading.sprintf("Heading%d",level);
733  // set style
734  m_t << rtf_Style[heading]->reference << endl;
735  // make table of contents entry
736  filter(s->title());
737  m_t << endl << "\\par" << "}" << endl;
738  m_t << "{\\tc\\tcl" << level << " \\v ";
739  filter(s->title());
740  m_t << "}" << endl;
742 }
743 
745 {
746  if (m_hide) return;
747  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSection)}\n");
748  m_t << "\\par}" << endl; // end section
750 }
751 
753 {
754  if (m_hide) return;
755  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlList)}\n");
756  m_t << "{" << endl;
760 }
761 
763 {
764  if (m_hide) return;
765  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlList)}\n");
766  m_t << "\\par" << "}" << endl;
768 }
769 
771 {
772  if (m_hide) return;
773  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlListItem)}\n");
774  m_t << "\\par" << endl;
775  m_t << rtf_Style_Reset;
776  if (rtf_listItemInfo[m_indentLevel].isEnum)
777  {
778  m_t << getStyle("ListEnum") << endl;
779  m_t << rtf_listItemInfo[m_indentLevel].number << ".\\tab ";
781  }
782  else
783  {
784  m_t << getStyle("ListBullet") << endl;
785  }
786  incIndentLevel();
788 }
789 
791 {
792  decIndentLevel();
793  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlListItem)}\n");
794 }
795 
797 {
798  if (m_hide) return;
799  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlDescList)}\n");
800  //m_t << "{" << endl;
801  //m_t << rtf_Style_Reset << getStyle("ListContinue");
802  //m_lastIsPara=FALSE;
803 }
804 
806 {
807  if (m_hide) return;
808  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlDescList)}\n");
809  //m_t << "}" << endl;
810  //m_t << "\\par" << endl;
811  //m_lastIsPara=TRUE;
812 }
813 
815 {
816  if (m_hide) return;
817  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlDescTitle)}\n");
818  //m_t << "\\par" << endl;
819  //m_t << "{\\b ";
820  m_t << "{" << rtf_Style["Heading5"]->reference << endl;
822 }
823 
825 {
826  if (m_hide) return;
827  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlDescTitle)}\n");
828  m_t << "\\par" << endl;
829  m_t << "}" << endl;
831 }
832 
834 {
835  if (m_hide) return;
836  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlDescData)}\n");
837  incIndentLevel();
838  m_t << "{" << rtf_Style_Reset << getStyle("DescContinue");
839 }
840 
842 {
843  if (m_hide) return;
844  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlDescData)}\n");
845  m_t << "\\par";
846  m_t << "}" << endl;
847  decIndentLevel();
849 }
850 
852 {
853  if (m_hide) return;
854  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlTable)}\n");
855  if (!m_lastIsPara) m_t << "\\par" << endl;
857 }
858 
860 {
861  if (m_hide) return;
862  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlTable)}\n");
863  m_t << "\\pard\\plain" << endl;
864  m_t << "\\par" << endl;
866 }
867 
869 {
870  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlCaption)}\n");
871 }
872 
874 {
875  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlCaption)}\n");
876 }
877 
879 {
880  if (m_hide) return;
881  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlRow)}\n");
882  uint i,columnWidth=r->numCells()>0 ? rtf_pageWidth/r->numCells() : 10;
883  m_t << "\\trowd \\trgaph108\\trleft-108"
884  "\\trbrdrt\\brdrs\\brdrw10 "
885  "\\trbrdrl\\brdrs\\brdrw10 "
886  "\\trbrdrb\\brdrs\\brdrw10 "
887  "\\trbrdrr\\brdrs\\brdrw10 "
888  "\\trbrdrh\\brdrs\\brdrw10 "
889  "\\trbrdrv\\brdrs\\brdrw10 "<< endl;
890  for (i=0;i<r->numCells();i++)
891  {
892  if (r->isHeading())
893  {
894  m_t << "\\clcbpat16"; // set cell shading to light grey (color 16 in the clut)
895  }
896  m_t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10 "
897  "\\clbrdrl\\brdrs\\brdrw10 "
898  "\\clbrdrb\\brdrs\\brdrw10 "
899  "\\clbrdrr \\brdrs\\brdrw10 "
900  "\\cltxlrtb "
901  "\\cellx" << ((i+1)*columnWidth) << endl;
902  }
903  m_t << "\\pard \\widctlpar\\intbl\\adjustright" << endl;
905 }
906 
908 {
909  if (m_hide) return;
910  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlRow)}\n");
911  m_t << endl;
912  m_t << "\\pard \\widctlpar\\intbl\\adjustright" << endl;
913  m_t << "{\\row }" << endl;
915 }
916 
918 {
919  if (m_hide) return;
920  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlCell)}\n");
921  m_t << "{" << align(c);
923 }
924 
926 {
927  if (m_hide) return;
928  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlCell)}\n");
929  m_t << "\\cell }";
931 }
932 
934 {
935  if (m_hide) return;
936  //DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocInternal)}\n");
937  //m_t << "{"; // start desc
938  //m_t << "{\\b "; // start bold
939  //m_t << theTranslator->trForInternalUseOnly();
940  //m_t << "}"; // end bold
941  //m_t << "\\par" << endl;
942  //incIndentLevel();
943  //m_t << rtf_Style_Reset << getStyle("DescContinue");
944  //m_lastIsPara=FALSE;
945 }
946 
948 {
949  if (m_hide) return;
950  //DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocInternal)}\n");
951  //m_t << "\\par";
952  //decIndentLevel();
953  //m_t << "}"; // end desc
954  //m_lastIsPara=TRUE;
955 }
956 
958 {
959  if (m_hide) return;
960  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHRef)}\n");
961  if (Config_getBool("RTF_HYPERLINKS"))
962  {
963  m_t << "{\\field "
964  "{\\*\\fldinst "
965  "{ HYPERLINK \"" << href->url() << "\" "
966  "}{}"
967  "}"
968  "{\\fldrslt "
969  "{\\cs37\\ul\\cf2 ";
970 
971  }
972  else
973  {
974  m_t << "{\\f2 ";
975  }
977 }
978 
980 {
981  if (m_hide) return;
982  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHRef)}\n");
983  if (Config_getBool("RTF_HYPERLINKS"))
984  {
985  m_t << "}"
986  "}"
987  "}";
988  }
989  else
990  {
991  m_t << "}";
992  }
994 }
995 
997 {
998  if (m_hide) return;
999  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlHeader)}\n");
1000  m_t << "{" // start section
1001  << rtf_Style_Reset;
1002  QCString heading;
1003  int level = QMIN(header->level()+2,4);
1004  heading.sprintf("Heading%d",level);
1005  // set style
1006  m_t << rtf_Style[heading]->reference;
1007  // make table of contents entry
1008  m_t << "{\\tc\\tcl \\v " << level << "}";
1010 
1011 }
1012 
1014 {
1015  if (m_hide) return;
1016  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlHeader)}\n");
1017  m_t << "\\par";
1018  m_t << "}" << endl; // end section
1020 }
1021 
1023 {
1024  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocImage)}\n");
1025  if (img->type()==DocImage::Rtf)
1026  {
1027  m_t << "\\par" << endl;
1028  m_t << "{" << endl;
1029  m_t << rtf_Style_Reset << endl;
1030  m_t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
1031  m_t << img->name();
1032  m_t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
1033  m_t << "}" << endl;
1035  }
1036  else // other format -> skip
1037  {
1038  }
1039  // hide caption since it is not supported at the moment
1040  pushEnabled();
1041  m_hide=TRUE;
1042 }
1043 
1045 {
1046  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocImage)}\n");
1047  popEnabled();
1048 }
1049 
1051 {
1052  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocDotFile)}\n");
1053  writeDotFile(df->file());
1054 
1055  // hide caption since it is not supported at the moment
1056  pushEnabled();
1057  m_hide=TRUE;
1058 }
1059 
1061 {
1062  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocDotFile)}\n");
1063  popEnabled();
1064 }
1066 {
1067  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocMscFile)}\n");
1068  writeMscFile(df->file());
1069 
1070  // hide caption since it is not supported at the moment
1071  pushEnabled();
1072  m_hide=TRUE;
1073 }
1074 
1076 {
1077  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocMscFile)}\n");
1078  popEnabled();
1079 }
1080 
1082 {
1083  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocDiaFile)}\n");
1084  writeDiaFile(df->file());
1085 
1086  // hide caption since it is not supported at the moment
1087  pushEnabled();
1088  m_hide=TRUE;
1089 }
1090 
1092 {
1093  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocDiaFile)}\n");
1094  popEnabled();
1095 }
1096 
1098 {
1099  if (m_hide) return;
1100  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocLink)}\n");
1101  startLink(lnk->ref(),lnk->file(),lnk->anchor());
1102 }
1103 
1105 {
1106  if (m_hide) return;
1107  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocLink)}\n");
1108  endLink(lnk->ref());
1109 }
1110 
1112 {
1113  if (m_hide) return;
1114  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocRef)}\n");
1115  // when ref->isSubPage()==TRUE we use ref->file() for HTML and
1116  // ref->anchor() for LaTeX/RTF
1117  if (ref->isSubPage())
1118  {
1119  startLink(ref->ref(),0,ref->anchor());
1120  }
1121  else
1122  {
1123  if (!ref->file().isEmpty()) startLink(ref->ref(),ref->file(),ref->anchor());
1124  }
1125  if (!ref->hasLinkText()) filter(ref->targetTitle());
1126 }
1127 
1129 {
1130  if (m_hide) return;
1131  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocRef)}\n");
1132  if (!ref->file().isEmpty()) endLink(ref->ref());
1133  //m_t << " ";
1134 }
1135 
1136 
1138 {
1139  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSecRefItem)}\n");
1140 }
1141 
1143 {
1144  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSecRefItem)}\n");
1145 }
1146 
1148 {
1149  if (m_hide) return;
1150  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSecRefList)}\n");
1151  m_t << "{" << endl;
1152  incIndentLevel();
1153  m_t << rtf_Style_Reset << getStyle("LatexTOC") << endl;
1154  m_t << "\\par" << endl;
1156 }
1157 
1159 {
1160  if (m_hide) return;
1161  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSecRefList)}\n");
1162  decIndentLevel();
1163  m_t << "\\par";
1164  m_t << "}" << endl;
1166 }
1167 
1168 //void RTFDocVisitor::visitPre(DocLanguage *l)
1169 //{
1170 // DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocLanguage)}\n");
1171 // QCString langId = Config_getEnum("OUTPUT_LANGUAGE");
1172 // if (l->id().lower()!=langId.lower())
1173 // {
1174 // pushEnabled();
1175 // m_hide = TRUE;
1176 // }
1177 //}
1178 //
1179 //void RTFDocVisitor::visitPost(DocLanguage *l)
1180 //{
1181 // DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocLanguage)}\n");
1182 // QCString langId = Config_getEnum("OUTPUT_LANGUAGE");
1183 // if (l->id().lower()!=langId.lower())
1184 // {
1185 // popEnabled();
1186 // }
1187 //}
1188 
1190 {
1191  if (m_hide) return;
1192  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocParamSect)}\n");
1193  m_t << "{"; // start param list
1194  if (!m_lastIsPara) m_t << "\\par" << endl;
1195  //m_t << "{\\b "; // start bold
1196  m_t << "{" << rtf_Style["Heading5"]->reference << endl;
1197  switch(s->type())
1198  {
1199  case DocParamSect::Param:
1200  m_t << theTranslator->trParameters(); break;
1201  case DocParamSect::RetVal:
1202  m_t << theTranslator->trReturnValues(); break;
1204  m_t << theTranslator->trExceptions(); break;
1206  /* TODO: add this
1207  m_t << theTranslator->trTemplateParam(); break;
1208  */
1209  m_t << "Template Parameters"; break;
1210  default:
1211  ASSERT(0);
1212  }
1213  m_t << ":";
1214  m_t << "\\par";
1215  m_t << "}" << endl;
1216  bool useTable = s->type()==DocParamSect::Param ||
1217  s->type()==DocParamSect::RetVal ||
1218  s->type()==DocParamSect::Exception ||
1220  if (!useTable)
1221  {
1222  incIndentLevel();
1223  }
1224  m_t << rtf_Style_Reset << getStyle("DescContinue");
1226 }
1227 
1229 {
1230  if (m_hide) return;
1231  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocParamSect)}\n");
1232  //m_t << "\\par" << endl;
1233  bool useTable = s->type()==DocParamSect::Param ||
1234  s->type()==DocParamSect::RetVal ||
1235  s->type()==DocParamSect::Exception ||
1237  if (!useTable)
1238  {
1239  decIndentLevel();
1240  }
1241  m_t << "}" << endl;
1242 }
1243 
1245 {
1246  static int columnPos[4][5] =
1247  { { 2, 25, 100, 100, 100 }, // no inout, no type
1248  { 3, 14, 35, 100, 100 }, // inout, no type
1249  { 3, 25, 50, 100, 100 }, // no inout, type
1250  { 4, 14, 35, 55, 100 }, // inout, type
1251  };
1252  int config=0;
1253  if (m_hide) return;
1254  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocParamList)}\n");
1255 
1257  DocParamSect *sect = 0;
1258  if (pl->parent() && pl->parent()->kind()==DocNode::Kind_ParamSect)
1259  {
1260  parentType = ((DocParamSect*)pl->parent())->type();
1261  sect=(DocParamSect*)pl->parent();
1262  }
1263  bool useTable = parentType==DocParamSect::Param ||
1264  parentType==DocParamSect::RetVal ||
1265  parentType==DocParamSect::Exception ||
1266  parentType==DocParamSect::TemplateParam;
1267  if (sect && sect->hasInOutSpecifier()) config+=1;
1268  if (sect && sect->hasTypeSpecifier()) config+=2;
1269  if (useTable)
1270  {
1271  int i;
1272  m_t << "\\trowd \\trgaph108\\trleft426\\tblind426"
1273  "\\trbrdrt\\brdrs\\brdrw10\\brdrcf15 "
1274  "\\trbrdrl\\brdrs\\brdrw10\\brdrcf15 "
1275  "\\trbrdrb\\brdrs\\brdrw10\\brdrcf15 "
1276  "\\trbrdrr\\brdrs\\brdrw10\\brdrcf15 "
1277  "\\trbrdrh\\brdrs\\brdrw10\\brdrcf15 "
1278  "\\trbrdrv\\brdrs\\brdrw10\\brdrcf15 "<< endl;
1279  for (i=0;i<columnPos[config][0];i++)
1280  {
1281  m_t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10\\brdrcf15 "
1282  "\\clbrdrl\\brdrs\\brdrw10\\brdrcf15 "
1283  "\\clbrdrb\\brdrs\\brdrw10\\brdrcf15 "
1284  "\\clbrdrr \\brdrs\\brdrw10\\brdrcf15 "
1285  "\\cltxlrtb "
1286  "\\cellx" << (rtf_pageWidth*columnPos[config][i+1]/100) << endl;
1287  }
1288  m_t << "\\pard \\widctlpar\\intbl\\adjustright" << endl;
1289  }
1290 
1291  if (sect && sect->hasInOutSpecifier())
1292  {
1293  if (useTable)
1294  {
1295  m_t << "{";
1296  }
1297 
1298  // Put in the direction: in/out/in,out if specified.
1300  {
1301  if (pl->direction()==DocParamSect::In)
1302  {
1303  m_t << "in";
1304  }
1305  else if (pl->direction()==DocParamSect::Out)
1306  {
1307  m_t << "out";
1308  }
1309  else if (pl->direction()==DocParamSect::InOut)
1310  {
1311  m_t << "in,out";
1312  }
1313  }
1314 
1315  if (useTable)
1316  {
1317  m_t << "\\cell }";
1318  }
1319  }
1320 
1321  if (sect && sect->hasTypeSpecifier())
1322  {
1323  if (useTable)
1324  {
1325  m_t << "{";
1326  }
1328  DocNode *type;
1329  bool first=TRUE;
1330  for (li.toFirst();(type=li.current());++li)
1331  {
1332  if (!first) m_t << " | "; else first=FALSE;
1333  if (type->kind()==DocNode::Kind_Word)
1334  {
1335  visit((DocWord*)type);
1336  }
1337  else if (type->kind()==DocNode::Kind_LinkedWord)
1338  {
1339  visit((DocLinkedWord*)type);
1340  }
1341  }
1342  if (useTable)
1343  {
1344  m_t << "\\cell }";
1345  }
1346  }
1347 
1348 
1349  if (useTable)
1350  {
1351  m_t << "{";
1352  }
1353 
1354  m_t << "{\\i ";
1355  //QStrListIterator li(pl->parameters());
1356  //const char *s;
1358  DocNode *param;
1359  bool first=TRUE;
1360  for (li.toFirst();(param=li.current());++li)
1361  {
1362  if (!first) m_t << ","; else first=FALSE;
1363  if (param->kind()==DocNode::Kind_Word)
1364  {
1365  visit((DocWord*)param);
1366  }
1367  else if (param->kind()==DocNode::Kind_LinkedWord)
1368  {
1369  visit((DocLinkedWord*)param);
1370  }
1371  }
1372  m_t << "} ";
1373 
1374  if (useTable)
1375  {
1376  m_t << "\\cell }{";
1377  }
1379 }
1380 
1382 {
1383  if (m_hide) return;
1384  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocParamList)}\n");
1385 
1387  //DocParamSect *sect = 0;
1388  if (pl->parent() && pl->parent()->kind()==DocNode::Kind_ParamSect)
1389  {
1390  parentType = ((DocParamSect*)pl->parent())->type();
1391  //sect=(DocParamSect*)pl->parent();
1392  }
1393  bool useTable = parentType==DocParamSect::Param ||
1394  parentType==DocParamSect::RetVal ||
1395  parentType==DocParamSect::Exception ||
1396  parentType==DocParamSect::TemplateParam;
1397  if (useTable)
1398  {
1399  m_t << "\\cell }" << endl;
1400  //m_t << "\\pard \\widctlpar\\intbl\\adjustright" << endl;
1401  m_t << "{\\row }" << endl;
1402  }
1403  else
1404  {
1405  m_t << "\\par" << endl;
1406  }
1407 
1409 }
1410 
1412 {
1413  if (m_hide) return;
1414  if (x->title().isEmpty()) return;
1415  bool anonymousEnum = x->file()=="@";
1416  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocXRefItem)}\n");
1417  if (!m_lastIsPara)
1418  {
1419  m_t << "\\par" << endl;
1421  }
1422  m_t << "{"; // start param list
1423  //m_t << "{\\b "; // start bold
1424  m_t << "{" << rtf_Style["Heading5"]->reference << endl;
1425  if (Config_getBool("RTF_HYPERLINKS") && !anonymousEnum)
1426  {
1427  QCString refName;
1428  if (!x->file().isEmpty())
1429  {
1430  refName+=x->file();
1431  }
1432  if (!x->file().isEmpty() && !x->anchor().isEmpty())
1433  {
1434  refName+="_";
1435  }
1436  if (!x->anchor().isEmpty())
1437  {
1438  refName+=x->anchor();
1439  }
1440 
1441  m_t << "{\\field "
1442  "{\\*\\fldinst "
1443  "{ HYPERLINK \\\\l \"" << refName << "\" "
1444  "}{}"
1445  "}"
1446  "{\\fldrslt "
1447  "{\\cs37\\ul\\cf2 ";
1448  filter(x->title());
1449  m_t << "}"
1450  "}"
1451  "}";
1452  }
1453  else
1454  {
1455  filter(x->title());
1456  }
1457  m_t << ":";
1458  m_t << "\\par";
1459  m_t << "}"; // end bold
1460  incIndentLevel();
1461  m_t << rtf_Style_Reset << getStyle("DescContinue");
1463 }
1464 
1466 {
1467  if (m_hide) return;
1468  if (x->title().isEmpty()) return;
1469  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocXRefItem)}\n");
1470  m_t << "\\par" << endl;
1471  decIndentLevel();
1472  m_t << "}" << endl; // end xref item
1474 }
1475 
1477 {
1478  if (m_hide) return;
1479  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocInternalRef)}\n");
1480  startLink("",ref->file(),ref->anchor());
1481 }
1482 
1484 {
1485  if (m_hide) return;
1486  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocInternalRef)}\n");
1487  endLink("");
1488  m_t << " ";
1489 }
1490 
1492 {
1493  if (m_hide) return;
1494  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocCopy)}\n");
1495 }
1496 
1498 {
1499  if (m_hide) return;
1500  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocCopy)}\n");
1501 }
1502 
1504 {
1505  if (m_hide) return;
1506  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocText)}\n");
1507 }
1508 
1510 {
1511  if (m_hide) return;
1512  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocText)}\n");
1513 }
1514 
1516 {
1517  if (m_hide) return;
1518  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlBlockQuote)}\n");
1519  if (!m_lastIsPara) m_t << "\\par" << endl;
1520  m_t << "{"; // start desc
1521  incIndentLevel();
1522  m_t << rtf_Style_Reset << getStyle("DescContinue");
1523 }
1524 
1526 {
1527  if (m_hide) return;
1528  DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlBlockQuote)}\n");
1529  if (!m_lastIsPara) m_t << "\\par" << endl;
1530  decIndentLevel();
1531  m_t << "}"; // end desc
1533 }
1534 
1536 {
1537  if (m_hide) return;
1538 }
1539 
1541 {
1542  if (m_hide) return;
1543 }
1544 
1546 {
1547  if (m_hide) return;
1548 }
1549 
1551 {
1552  if (m_hide) return;
1553 }
1554 
1555 
1556 //static char* getMultiByte(int c)
1557 //{
1558 // static char s[10];
1559 // sprintf(s,"\\'%X",c);
1560 // return s;
1561 //}
1562 
1563 void RTFDocVisitor::filter(const char *str,bool verbatim)
1564 {
1565  if (str)
1566  {
1567  const unsigned char *p=(const unsigned char *)str;
1568  unsigned char c;
1569  //unsigned char pc='\0';
1570  while (*p)
1571  {
1572  //static bool MultiByte = FALSE;
1573  c=*p++;
1574 
1575  //if ( MultiByte )
1576  //{
1577  // m_t << getMultiByte( c );
1578  // MultiByte = FALSE;
1579  // continue;
1580  //}
1581  //if ( c >= 0x80 )
1582  //{
1583  // MultiByte = TRUE;
1584  // m_t << getMultiByte( c );
1585  // continue;
1586  //}
1587 
1588  switch (c)
1589  {
1590  case '{': m_t << "\\{"; break;
1591  case '}': m_t << "\\}"; break;
1592  case '\\': m_t << "\\\\"; break;
1593  case '\n': if (verbatim)
1594  {
1595  m_t << "\\par" << endl;
1596  }
1597  else
1598  {
1599  m_t << '\n';
1600  }
1601  break;
1602  default: m_t << (char)c;
1603  }
1604  //pc = c;
1605  }
1606  }
1607 }
1608 
1609 void RTFDocVisitor::startLink(const QCString &ref,const QCString &file,const QCString &anchor)
1610 {
1611  if (ref.isEmpty() && Config_getBool("RTF_HYPERLINKS"))
1612  {
1613  QCString refName;
1614  if (!file.isEmpty())
1615  {
1616  refName+=file;
1617  }
1618  if (!file.isEmpty() && anchor)
1619  {
1620  refName+='_';
1621  }
1622  if (anchor)
1623  {
1624  refName+=anchor;
1625  }
1626 
1627  m_t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \"";
1628  m_t << rtfFormatBmkStr(refName);
1629  m_t << "\" }{}";
1630  m_t << "}{\\fldrslt {\\cs37\\ul\\cf2 ";
1631  }
1632  else
1633  {
1634  m_t << "{\\b ";
1635  }
1637 }
1638 
1640 {
1641  if (ref.isEmpty() && Config_getBool("RTF_HYPERLINKS"))
1642  {
1643  m_t << "}}}";
1644  }
1645  else
1646  {
1647  m_t << "}";
1648  }
1650 }
1651 
1653 {
1654  m_enabled.push(new bool(m_hide));
1655 }
1656 
1658 {
1659  bool *v=m_enabled.pop();
1660  ASSERT(v!=0);
1661  m_hide = *v;
1662  delete v;
1663 }
1664 
1666 {
1668  int i;
1669  if ((i=baseName.findRev('/'))!=-1)
1670  {
1671  baseName=baseName.right(baseName.length()-i-1);
1672  }
1673  QCString outDir = Config_getString("RTF_OUTPUT");
1674  writeDotGraphFromFile(fileName,outDir,baseName,GOF_BITMAP);
1675  if (!m_lastIsPara) m_t << "\\par" << endl;
1676  m_t << "{" << endl;
1677  m_t << rtf_Style_Reset;
1678  m_t << "\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
1679  QCString imgExt = getDotImageExtension();
1680  m_t << baseName << "." << imgExt;
1681  m_t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
1682  m_t << "}" << endl;
1684 }
1685 
1687 {
1689  int i;
1690  if ((i=baseName.findRev('/'))!=-1)
1691  {
1692  baseName=baseName.right(baseName.length()-i-1);
1693  }
1694  QCString outDir = Config_getString("RTF_OUTPUT");
1695  writeMscGraphFromFile(fileName,outDir,baseName,MSC_BITMAP);
1696  if (!m_lastIsPara) m_t << "\\par" << endl;
1697  m_t << "{" << endl;
1698  m_t << rtf_Style_Reset;
1699  m_t << "\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
1700  m_t << baseName << ".png";
1701  m_t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
1702  m_t << "}" << endl;
1704 }
1705 
1707 {
1709  int i;
1710  if ((i=baseName.findRev('/'))!=-1)
1711  {
1712  baseName=baseName.right(baseName.length()-i-1);
1713  }
1714  QCString outDir = Config_getString("RTF_OUTPUT");
1715  writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP);
1716  if (!m_lastIsPara) m_t << "\\par" << endl;
1717  m_t << "{" << endl;
1718  m_t << rtf_Style_Reset;
1719  m_t << "\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
1720  m_t << baseName << ".png";
1721  m_t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
1722  m_t << "}" << endl;
1724 }
1725 
1727 {
1729  int i;
1730  if ((i=baseName.findRev('/'))!=-1)
1731  {
1732  baseName=baseName.right(baseName.length()-i-1);
1733  }
1734  QCString outDir = Config_getString("RTF_OUTPUT");
1735  generatePlantUMLOutput(fileName,outDir,PUML_BITMAP);
1736  if (!m_lastIsPara) m_t << "\\par" << endl;
1737  m_t << "{" << endl;
1738  m_t << rtf_Style_Reset;
1739  m_t << "\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
1740  m_t << baseName << ".png";
1741  m_t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
1742  m_t << "}" << endl;
1744 }
1745 
static QCString name
Definition: declinfo.cpp:673
DocNode * parent() const
Definition: docparser.h:147
QCString exampleFile() const
Definition: docparser.h:454
void visit(DocWord *)
QCString file() const
Definition: docparser.h:946
Type type() const
Definition: docparser.h:532
Type type() const
Definition: docparser.h:1034
virtual QCString trPrecondition()=0
virtual QCString trSince()=0
const HtmlAttribList & attribs() const
Definition: docparser.h:1267
ParserInterface * getParser(const char *extension)
Definition: parserintf.h:191
void filter(const char *str, bool verbatim=FALSE)
QCString name() const
Definition: docparser.h:695
QCString file() const
Definition: docparser.h:723
void startLink(const QCString &ref, const QCString &file, const QCString &anchor)
QCString anchor() const
Definition: docparser.h:830
QCString ref() const
Definition: docparser.h:219
QCString anchor() const
Definition: docparser.h:277
void writeMscGraphFromFile(const char *inFile, const char *outDir, const char *outFile, MscOutputFormat format)
Definition: msc.cpp:92
QCString url() const
Definition: docparser.h:239
QCString text() const
Definition: docparser.h:296
virtual QCString trAttention()=0
bool isFirst() const
Definition: docparser.h:537
bool isEmpty() const
Definition: qcstring.h:189
QCString file() const
Definition: docparser.h:747
static TemplateVariant parseCode(MemberDef *md, const QCString &scopeName, const QCString &relPath, const QCString &code, int startLine=-1, int endLine=-1, bool showLineNumbers=FALSE)
Definition: context.cpp:1266
uint length() const
Definition: qcstring.h:195
bool isEmail() const
Definition: docparser.h:242
int level() const
Definition: docparser.h:942
QCString anchor() const
Definition: docparser.h:944
#define IO_WriteOnly
Definition: qiodevice.h:62
virtual QCString trInvariant()=0
QCString blockId() const
Definition: docparser.h:505
std::size_t columnWidth(T const &coll, std::string const Elem::*cp, std::string const &header)
QDict< StyleData > rtf_Style
const int DocVisitor_RTF
Definition: docvisitor.h:26
virtual QCString trPostcondition()=0
QCString text() const
Definition: docparser.h:503
QCString file() const
Definition: docparser.h:278
CodeOutputInterface & m_ci
Type type() const
Definition: docparser.h:1101
const bool FALSE
Definition: qglobal.h:370
bool isHeading() const
Definition: docparser.h:1320
virtual QCString trWarning()=0
QCString writePlantUMLSource(const QCString &outDir, const QCString &fileName, const QCString &content)
Definition: plantuml.cpp:25
type * at(uint i) const
Definition: qlist.h:94
QCString m_langExt
virtual QCString trCopyright()=0
const QList< DocNode > & paramTypes()
Definition: docparser.h:1170
static HtmlEntityMapper * instance()
Definition: htmlentity.cpp:341
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
QCString file() const
Definition: docparser.h:827
bool singleLine() const
Definition: docparser.h:1408
Type type() const
Definition: docparser.h:502
virtual Kind kind() const =0
QCString anchor() const
Definition: docparser.h:859
void writePlantUMLFile(const QCString &fileName)
QCString ref() const
Definition: docparser.h:294
SrcLangExt
Definition: types.h:41
static QStrList * l
Definition: config.cpp:1044
QCString getStyle(const char *name)
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition: qcstring.cpp:95
virtual QCString trReturns()=0
virtual QCString trDate()=0
virtual QCString trNote()=0
void push(const type *d)
Definition: qstack.h:58
QCString exampleFile() const
Definition: docparser.h:542
QCString extractBlock(const QCString text, const QCString marker)
Definition: util.cpp:7998
int level() const
Definition: docparser.h:894
Abstract visitor that participates in the visitor pattern.
Definition: docvisitor.h:90
bool isExample() const
Definition: docparser.h:453
virtual QCString trExceptions()=0
#define QMIN(a, b)
Definition: qglobal.h:391
bool isSubPage() const
Definition: docparser.h:836
void incIndentLevel()
static ParserManager * parserManager
Definition: doxygen.h:141
QCString targetTitle() const
Definition: docparser.h:831
RTFListItemInfo rtf_listItemInfo[rtf_maxIndentLevels]
Definition: rtfstyle.cpp:28
uint count() const
Definition: qlist.h:66
void writeDiaFile(const QCString &fileName)
int writeBlock(const char *data, uint len)
Definition: qfile_unix.cpp:537
QCString file() const
Definition: docparser.h:292
QCString file() const
Definition: docparser.h:771
QCString ref() const
Definition: docparser.h:829
QCString value
Definition: htmlattrib.h:25
QCString file() const
Definition: docparser.h:857
virtual QCString trParameters()=0
QCString text() const
Definition: docparser.h:450
fileName
Definition: dumpTree.py:9
QCString text() const
Definition: docparser.h:563
void writeMscFile(const QCString &fileName)
QCString anchor() const
Definition: docparser.h:670
QCString word() const
Definition: docparser.h:199
static Config * config
Definition: config.cpp:1054
QCString right(uint len) const
Definition: qcstring.cpp:231
std::void_t< T > n
virtual QCString trAuthor(bool first_capital, bool singular)=0
bool open(int)
Definition: qfile_unix.cpp:134
bool isExample() const
Definition: docparser.h:541
QCString context() const
Definition: docparser.h:535
virtual QCString trReturnValues()=0
void writeDotGraphFromFile(const char *inFile, const char *outDir, const char *outFile, GraphOutputFormat format)
Definition: dot.cpp:4203
p
Definition: test.py:223
FTextStream & m_t
QCString text() const
Definition: docparser.h:533
A bunch of utility functions.
bool isLast() const
Definition: docparser.h:538
const char * data() const
Definition: qcstring.h:207
Definition: msc.h:24
#define Config_getString(val)
Definition: config.cpp:660
type * current() const
Definition: qlist.h:146
QCString url() const
Definition: docparser.h:876
virtual QCString trVersion()=0
#define Config_getBool(val)
Definition: config.cpp:664
Type type() const
Definition: docparser.h:1057
Style style() const
Definition: docparser.h:329
QCString getDotImageExtension(void)
Definition: util.cpp:8562
void generatePlantUMLOutput(const char *baseName, const char *outDir, PlantUMLOutputFormat format)
Definition: plantuml.cpp:54
const char * rtf(DocSymbol::SymType symb) const
Access routine to the RTF code of the HTML entity.
Definition: htmlentity.cpp:448
void err(const char *fmt,...)
Definition: message.cpp:226
QCString entry() const
Definition: docparser.h:586
bool isExample() const
Definition: docparser.h:506
type * pop()
Definition: qstack.h:59
QCString word() const
Definition: docparser.h:215
QCString language() const
Definition: docparser.h:456
char rtf_Style_Reset[]
Definition: rtfstyle.cpp:41
The QFile class is an I/O device that operates on files.
Definition: qfile.h:50
QCString & sprintf(const char *format,...)
Definition: qcstring.cpp:27
DocParamSect::Direction direction() const
Definition: docparser.h:1172
QCString title() const
Definition: docparser.h:943
const int rtf_pageWidth
Definition: rtfstyle.h:26
QCString file() const
Definition: docparser.h:495
bool indent() const
Definition: docparser.h:1407
bool hasInOutSpecifier() const
Definition: docparser.h:1103
void visitPre(DocAutoList *)
const QList< DocNode > & parameters()
Definition: docparser.h:1169
void writeDiaGraphFromFile(const char *inFile, const char *outDir, const char *outFile, DiaOutputFormat format)
Definition: dia.cpp:28
RTFDocVisitor(FTextStream &t, CodeOutputInterface &ci, const char *langExt)
uint numCells() const
Definition: docparser.h:1315
QCString context() const
Definition: docparser.h:451
SrcLangExt getLanguageFromFileName(const QCString fileName)
Definition: util.cpp:7061
bool isEnumList() const
Definition: docparser.h:621
bool hasTypeSpecifier() const
Definition: docparser.h:1104
SymType symbol() const
Definition: docparser.h:418
QCString file() const
Definition: docparser.h:669
bool hasLinkText() const
Definition: docparser.h:832
static QCString type
Definition: declinfo.cpp:672
char * reference
Definition: rtfstyle.h:67
bool remove()
Definition: qfile.cpp:205
Translator * theTranslator
Definition: language.cpp:157
QCString exampleFile() const
Definition: docparser.h:507
QCString context() const
Definition: docparser.h:504
QCString anchor() const
Definition: docparser.h:295
QStack< bool > m_enabled
list x
Definition: train.py:276
virtual QCString trRemarks()=0
QCString file() const
Definition: docparser.h:217
void decIndentLevel()
bool enable() const
Definition: docparser.h:331
QCString chars() const
Definition: docparser.h:434
virtual QCString trSeeAlso()=0
static QCString align(DocHtmlCell *cell)
QCString title() const
Definition: docparser.h:671
static QCString baseName
Definition: scanner.cpp:10890
QCString extension() const
Definition: docparser.h:496
QCString name
Definition: htmlattrib.h:24
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:51
Type type() const
Definition: docparser.h:449
QCString lower() const
Definition: qcstring.cpp:263
A list of Html attributes.
Definition: htmlattrib.h:32
Definition: dot.h:42
void writeDotFile(const QCString &fileName)
void close()
Definition: qfile_unix.cpp:614
Definition: dia.h:24
unsigned uint
Definition: qglobal.h:351
Type type() const
Definition: docparser.h:694
QCString anchor() const
Definition: docparser.h:220
virtual void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, SrcLangExt lang, bool isExampleBlock, const char *exampleName=0, FileDef *fileDef=0, int startLine=-1, int endLine=-1, bool inlineFragment=FALSE, MemberDef *memberDef=0, bool showLineNumbers=TRUE, Definition *searchCtx=0, bool collectXRefs=TRUE)=0
bool isLast() const
Definition: docparser.h:1125
void endLink(const QCString &ref)
static QCString * s
Definition: config.cpp:1042
const bool TRUE
Definition: qglobal.h:371
#define DBG_RTF(x)
static QCString str
QCString rtfFormatBmkStr(const char *name)
Definition: util.cpp:6744
void visitPost(DocAutoList *)
QTextStream & endl(QTextStream &s)
#define ASSERT(x)
Definition: qglobal.h:590
const int rtf_maxIndentLevels
Definition: rtfstyle.h:45