rtfgen.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  *
4  *
5  * Copyright (C) 1997-2015 by Parker Waechter & Dimitri van Heesch.
6  *
7  * Style sheet additions by Alexander Bartolich
8  *
9  * Permission to use, copy, modify, and distribute this software and its
10  * documentation under the terms of the GNU General Public License is hereby
11  * granted. No representations are made about the suitability of this software
12  * for any purpose. It is provided "as is" without express or implied warranty.
13  * See the GNU General Public License for more details.
14  *
15  * Documents produced by Doxygen are derivative works derived from the
16  * input used in their production; they are not affected by this license.
17  *
18  */
19 
20 #include <stdlib.h>
21 
22 #include <qdir.h>
23 #include <qregexp.h>
24 #include <qtextstream.h>
25 
26 #include "rtfgen.h"
27 #include "config.h"
28 #include "message.h"
29 #include "doxygen.h"
30 #include "util.h"
31 #include "diagram.h"
32 #include "language.h"
33 #include "dot.h"
34 #include "version.h"
35 #include "pagedef.h"
36 #include "rtfstyle.h"
37 #include "rtfdocvisitor.h"
38 #include "docparser.h"
39 #include "dirdef.h"
40 #include "vhdldocgen.h"
41 #include "portable.h"
42 #include "groupdef.h"
43 #include "classlist.h"
44 #include "filename.h"
45 #include "namespacedef.h"
46 
47 //#define DBG_RTF(x) x;
48 #define DBG_RTF(x)
49 
51 {
54  result.sprintf("\\yr%d\\mo%d\\dy%d\\hr%d\\min%d\\sec%d",
55  d.date().year(), d.date().month(), d.date().day(),
56  d.time().hour(),d.time().minute(),d.time().second());
57  return result;
58 }
59 
61 {
62  dir=Config_getString("RTF_OUTPUT");
63  col=0;
64  //insideTabbing=FALSE;
65  m_listLevel = 0;
68  m_numCols = 0;
69  m_prettyCode=Config_getBool("RTF_SOURCE_CODE");
70 }
71 
73 {
74 }
75 
76 //void RTFGenerator::append(const OutputGenerator *g)
77 //{
78 // t << g->getContents();
79 // col+=((RTFGenerator *)g)->col;
80 // //insideTabbing=insideTabbing || ((RTFGenerator *)g)->insideTabbing;
81 // m_listLevel=((RTFGenerator *)g)->m_listLevel;
82 // m_omitParagraph=((RTFGenerator *)g)->m_omitParagraph;
83 // //printf("RTFGenerator::append(%s) insideTabbing=%s\n", g->getContents().data(),
84 // // insideTabbing ? "TRUE" : "FALSE" );
85 //}
86 
87 //OutputGenerator *RTFGenerator::copy()
88 //{
89 // RTFGenerator *result = new RTFGenerator;
90 // //result->insideTabbing=insideTabbing;
91 // result->m_listLevel=m_listLevel;
92 // result->m_omitParagraph=m_omitParagraph;
93 // return result;
94 //}
95 
97 {
98  FTextStream t(&file);
99  t << "# Generated by doxygen " << versionString << "\n\n";
100  t << "# This file describes styles used for generating RTF output.\n";
101  t << "# All text after a hash (#) is considered a comment and will be ignored.\n";
102  t << "# Remove a hash to activate a line.\n\n";
103 
104  int i;
105  for ( i=0 ; rtf_Style_Default[i].reference!=0 ; i++ )
106  {
107  t << "# " << rtf_Style_Default[i].name << " = "
110  }
111 }
112 
114 {
115  FTextStream t(&file);
116  t << "# Generated by doxygen " << versionString << "\n\n";
117  t << "# This file describes extensions used for generating RTF output.\n";
118  t << "# All text after a hash (#) is considered a comment and will be ignored.\n";
119  t << "# Remove a hash to activate a line.\n\n";
120 
121  t << "# Overrides the project title.\n";
122 
123  t << "#Title = \n\n";
124 
125  t << "# Name of the company that produced this document.\n";
126  t << "#Company = \n\n";
127 
128  t << "# Filename of a company or project logo.\n";
129  t << "#LogoFilename = \n\n";
130 
131  t << "# Author of the document.\n";
132  t << "#Author = \n\n";
133 
134  t << "# Type of document (e.g. Design Specification, User Manual, etc.).\n";
135  t << "#DocumentType = \n\n";
136 
137  t << "# Document tracking number.\n";
138  t << "#DocumentId = \n\n";
139 
140  t << "# Name of the author's manager.\n";
141  t << "# This field is not displayed in the document itself, but it is \n";
142  t << "# available in the information block of the rtf file. In Microsoft \n";
143  t << "# Word, it is available under File:Properties.\n";
144  t << "#Manager = \n\n";
145 
146  t << "# Subject of the document.\n";
147  t << "# This field is not displayed in the document itself, but it is \n";
148  t << "# available in the information block of the rtf file. In Microsoft \n";
149  t << "# Word, it is available under File:Properties.\n";
150  t << "#Subject = \n\n";
151 
152  t << "# Comments regarding the document.\n";
153  t << "# This field is not displayed in the document itself, but it is \n";
154  t << "# available in the information block of the rtf file. In Microsoft \n";
155  t << "# Word, it is available under File:Properties.\n";
156  t << "#Comments = \n\n";
157 
158  t << "# Keywords associated with the document.\n";
159  t << "# This field is not displayed in the document itself, but it is \n";
160  t << "# available in the information block of the rtf file. In Microsoft \n";
161  t << "# Word, it is available under File:Properties.\n";
162  t << "#Keywords = \n\n";
163 }
164 
165 
167 {
168  QCString dir=Config_getString("RTF_OUTPUT");
169  QDir d(dir);
170  if (!d.exists() && !d.mkdir(dir))
171  {
172  err("Could not create output directory %s\n",dir.data());
173  exit(1);
174  }
175  rtf_Style.setAutoDelete(TRUE);
176 
177  // first duplicate strings of rtf_Style_Default
178  const struct Rtf_Style_Default* def = rtf_Style_Default;
179  while(def->reference != 0)
180  {
181  if (def->definition == 0)
182  err("Internal: rtf_Style_Default[%s] has no definition.\n", def->name);
183  StyleData* styleData = new StyleData(def->reference, def->definition);
184  rtf_Style.insert(def->name, styleData);
185  def++;
186  }
187 
188  // overwrite some (or all) definitions from file
189  QCString &rtfStyleSheetFile = Config_getString("RTF_STYLESHEET_FILE");
190  if (!rtfStyleSheetFile.isEmpty())
191  {
192  loadStylesheet(rtfStyleSheetFile, rtf_Style);
193  }
194 
195  // If user has defined an extension file, load its contents.
196  QCString &rtfExtensionsFile = Config_getString("RTF_EXTENSIONS_FILE");
197  if (!rtfExtensionsFile.isEmpty())
198  {
199  loadExtensions(rtfExtensionsFile);
200  }
201 
202  createSubDirs(d);
203 }
204 
205 static QCString makeIndexName(const char *s,int i)
206 {
207  QCString result=s;
208  result+=(char)(i+'0');
209  return result;
210 }
211 
213 {
214  /* all the included RTF files should begin with the
215  * same header
216  */
217  t <<"{\\rtf1\\ansi\\ansicpg" << theTranslator->trRTFansicp();
218  t <<"\\uc1 \\deff0\\deflang1033\\deflangfe1033\n";
219 
220  DBG_RTF(t <<"{\\comment Beginning font list}\n")
221  t <<"{\\fonttbl ";
222  t <<"{\\f0\\froman\\fcharset" << theTranslator->trRTFCharSet();
223  t <<"\\fprq2{\\*\\panose 02020603050405020304}Times New Roman;}\n";
224  t <<"{\\f1\\fswiss\\fcharset" << theTranslator->trRTFCharSet();
225  t <<"\\fprq2{\\*\\panose 020b0604020202020204}Arial;}\n";
226  t <<"{\\f2\\fmodern\\fcharset" << theTranslator->trRTFCharSet();
227  t <<"\\fprq1{\\*\\panose 02070309020205020404}Courier New;}\n";
228  t <<"{\\f3\\froman\\fcharset2\\fprq2{\\*\\panose 05050102010706020507}Symbol;}\n";
229  t <<"}\n";
230  DBG_RTF(t <<"{\\comment begin colors}\n")
231  t <<"{\\colortbl;";
232  t <<"\\red0\\green0\\blue0;";
233  t <<"\\red0\\green0\\blue255;";
234  t <<"\\red0\\green255\\blue255;";
235  t <<"\\red0\\green255\\blue0;";
236  t <<"\\red255\\green0\\blue255;";
237  t <<"\\red255\\green0\\blue0;";
238  t <<"\\red255\\green255\\blue0;";
239  t <<"\\red255\\green255\\blue255;";
240  t <<"\\red0\\green0\\blue128;";
241  t <<"\\red0\\green128\\blue128;";
242  t <<"\\red0\\green128\\blue0;";
243  t <<"\\red128\\green0\\blue128;";
244  t <<"\\red128\\green0\\blue0;";
245  t <<"\\red128\\green128\\blue0;";
246  t <<"\\red128\\green128\\blue128;";
247  t <<"\\red192\\green192\\blue192;}" << endl;
248 
249  DBG_RTF(t <<"{\\comment Beginning style list}\n")
250  t <<"{\\stylesheet\n";
251  t <<"{\\widctlpar\\adjustright \\fs20\\cgrid \\snext0 Normal;}\n";
252 
253  // sort styles ascending by \s-number via an intermediate QArray
255  array.fill(0);
256  QDictIterator<StyleData> iter(rtf_Style);
257  const StyleData* style;
258  for(; (style = iter.current()); ++iter)
259  {
260  unsigned index = style->index;
261  unsigned size = array.size();
262  if (index >= size)
263  {
264  // +1 to add at least one element, then align up to multiple of 8
265  array.resize((index + 1 + 7) & ~7);
266  array.fill(0, size);
267  ASSERT(index < array.size());
268  }
269  if (array.at(index) != 0)
270  {
271  QCString key(iter.currentKey());
272  msg("Style '%s' redefines \\s%d.\n", key.data(), index);
273  }
274  array.at(index) = style;
275  }
276 
277  // write array elements
278  unsigned size = array.size();
279  for(unsigned i = 0; i < size; i++)
280  {
281  const StyleData* style = array.at(i);
282  if (style != 0)
283  t <<"{" << style->reference << style->definition << ";}\n";
284  }
285 
286  t <<"}" << endl;
287  // this comment is needed for postprocessing!
288  t <<"{\\comment begin body}" << endl;
289 
290 }
291 
293 {
294  t <<"\n";
295  DBG_RTF(t << "{\\comment BeginRTFChapter}\n")
296  t << rtf_Style_Reset;
297 
298  // if we are compact, no extra page breaks...
299  if (Config_getBool("COMPACT_RTF"))
300  {
301  // t <<"\\sect\\sectd\\sbknone\n";
302  t <<"\\sect\\sbknone\n";
304  }
305  else
306  t <<"\\sect\\sbkpage\n";
307  //t <<"\\sect\\sectd\\sbkpage\n";
308 
309  t << rtf_Style["Heading1"]->reference << "\n";
310 }
311 
313 {
314  t <<"\n";
315  DBG_RTF(t << "{\\comment BeginRTFSection}\n")
316  t << rtf_Style_Reset;
317 
318  // if we are compact, no extra page breaks...
319  if (Config_getBool("COMPACT_RTF"))
320  {
321  // t <<"\\sect\\sectd\\sbknone\n";
322  t <<"\\sect\\sbknone\n";
324  }
325  else
326  t <<"\\sect\\sbkpage\n";
327  //t <<"\\sect\\sectd\\sbkpage\n";
328 
329  t << rtf_Style["Heading2"]->reference << "\n";
330 }
331 
332 void RTFGenerator::startFile(const char *name,const char *,const char *)
333 {
334  //setEncoding(QCString().sprintf("CP%s",theTranslator->trRTFansicp()));
336  relPath = relativePathToRoot(fileName);
337 
338  if (fileName.right(4)!=".rtf" ) fileName+=".rtf";
339  startPlainFile(fileName);
341 }
342 
344 {
345  DBG_RTF(t << "{\\comment endFile}\n")
346  t << "}";
347 
348  endPlainFile();
349 }
350 
352 {
353  DBG_RTF(t <<"{\\comment startProjectNumber }" << endl)
354  t << " ";
355 }
356 
358 {
359  DBG_RTF(t <<"{\\comment endProjectNumber }" << endl)
360 }
361 
363 {
364  //QCString paperName;
365 
366  m_listLevel = 0;
367 
368  switch (is)
369  {
370  case isTitlePageStart:
371  // basic RTFstart
372  // get readyfor author etc
373 
374  t << "{\\info \n";
375  t << "{\\title {\\comment ";
376  break;
377  case isTitlePageAuthor:
378  t << "}\n";
379  if (rtf_subject) t << "{\\subject " << rtf_subject << "}\n";
380  if (rtf_comments) t << "{\\comment " << rtf_comments << "}\n";
381  if (rtf_company) t << "{\\company " << rtf_company << "}\n";
382  if (rtf_author) t << "{\\author " << rtf_author << "}\n";
383  if (rtf_manager) t << "{\\manager " << rtf_manager << "}\n";
384  if (rtf_documentType) t << "{\\category " << rtf_documentType << "}\n";
385  if (rtf_keywords) t << "{\\keywords " << rtf_keywords << "}\n";
386  t << "{\\comment ";
387  break;
388  case isMainPage:
389  //Introduction
390  beginRTFChapter();
391  break;
392  //case isPackageIndex:
393  // //Package Index
394  // beginRTFChapter();
395  // break;
396  case isModuleIndex:
397  //Module Index
398  beginRTFChapter();
399  break;
400  case isDirIndex:
401  //Directory Index
402  beginRTFChapter();
403  break;
404  case isNamespaceIndex:
405  //Namespace Index
406  beginRTFChapter();
407  break;
409  //Hierarchical Index
410  DBG_RTF(t << "{\\comment start classhierarchy}\n")
411  beginRTFChapter();
412  break;
413  case isCompoundIndex:
414  //Annotated Compound Index
415  beginRTFChapter();
416  break;
417  case isFileIndex:
418  //Annotated File Index
419  beginRTFChapter();
420  break;
421  case isPageIndex:
422  //Related Page Index
423  beginRTFChapter();
424  break;
426  {
427  //Module Documentation
429  GroupDef *gd;
430  bool found=FALSE;
431  for (gli.toFirst();(gd=gli.current()) && !found;++gli)
432  {
433  if (!gd->isReference())
434  {
435  beginRTFChapter();
436  found=TRUE;
437  }
438  }
439  }
440  break;
441  case isDirDocumentation:
442  {
443  //Directory Documentation
445  DirDef *dd;
446  bool found=FALSE;
447  for (dli.toFirst();(dd=dli.current()) && !found;++dli)
448  {
449  if (dd->isLinkableInProject())
450  {
451  beginRTFChapter();
452  found=TRUE;
453  }
454  }
455  }
456  break;
458  {
459  // Namespace Documentation
461  NamespaceDef *nd;
462  bool found=FALSE;
463  for (nli.toFirst();(nd=nli.current()) && !found;++nli)
464  {
465  if (nd->isLinkableInProject())
466  {
467  beginRTFChapter();
468  found=TRUE;
469  }
470  }
471  }
472  break;
474  {
475  //Compound Documentation
477  ClassDef *cd=0;
478  bool found=FALSE;
479  for (cli.toFirst();(cd=cli.current()) && !found;++cli)
480  {
481  if (cd->isLinkableInProject() &&
482  cd->templateMaster()==0 &&
484  )
485  {
486  beginRTFChapter();
487  found=TRUE;
488  }
489  }
490  }
491  break;
492  case isFileDocumentation:
493  {
494  //File Documentation
495  bool isFirst=TRUE;
497  FileName *fn;
498  for (fnli.toFirst();(fn=fnli.current());++fnli)
499  {
500  FileNameIterator fni(*fn);
501  FileDef *fd;
502  for (;(fd=fni.current());++fni)
503  {
504  if (fd->isLinkableInProject())
505  {
506  if (isFirst)
507  {
508  beginRTFChapter();
509  isFirst=FALSE;
510  break;
511  }
512  }
513  }
514  }
515  }
516  break;
518  {
519  //Example Documentation
520  beginRTFChapter();
521  }
522  break;
523  case isPageDocumentation:
524  {
525  //Page Documentation
526  beginRTFChapter();
527  }
528  break;
530  {
531  t << "{\\tc \\v ";
532  }
533  break;
534  case isEndIndex:
535  break;
536  }
537 }
538 
540 {
541  bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
542  bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
543  static bool sourceBrowser = Config_getBool("SOURCE_BROWSER");
544  static QCString projectName = Config_getString("PROJECT_NAME");
545 
546  switch (is)
547  {
548  case isTitlePageStart:
549  if (rtf_title)
550  // User has overridden document title in extensions file
551  t << "}" << rtf_title;
552  else
553  t << "}" << projectName;
554  break;
555  case isTitlePageAuthor:
556  {
557  t << "Doxgyen. }\n";
558  t << "{\\creatim " << dateToRTFDateString() << "}\n}";
559  DBG_RTF(t << "{\\comment end of infoblock}\n");
560  // setup for this section
561  t << rtf_Style_Reset <<"\n";
562  t <<"\\sectd\\pgnlcrm\n";
563  t <<"{\\footer "<<rtf_Style["Footer"]->reference << "{\\chpgn}}\n";
564  // the title entry
565  DBG_RTF(t << "{\\comment begin title page}\n")
566 
567 
568  t << rtf_Style_Reset << rtf_Style["SubTitle"]->reference << endl; // set to title style
569 
570  t << "\\vertalc\\qc\\par\\par\\par\\par\\par\\par\\par\n";
571  if (rtf_logoFilename)
572  {
573  t << "{\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"" << rtf_logoFilename;
574  t << "\" \\\\d \\\\*MERGEFORMAT} {\\fldrslt IMAGE }}\\par\\par\n";
575  }
576  if (rtf_company)
577  {
578  t << rtf_company << "\\par\\par\n";
579  }
580 
581  t << rtf_Style_Reset << rtf_Style["Title"]->reference << endl; // set to title style
582  if (rtf_title)
583  // User has overridden document title in extensions file
584  t << "{\\field\\fldedit {\\*\\fldinst " << rtf_title << " \\\\*MERGEFORMAT}{\\fldrslt " << rtf_title << "}}\\par" << endl;
585  else
586  {
587  DocText *root = validatingParseText(projectName);
588  t << "{\\field\\fldedit {\\*\\fldinst TITLE \\\\*MERGEFORMAT}{\\fldrslt ";
589  writeDoc(root,0,0);
590  t << "}}\\par" << endl;
591 
592  }
593 
594  t << rtf_Style_Reset << rtf_Style["SubTitle"]->reference << endl; // set to title style
595  t << "\\par\n";
596  if (rtf_documentType)
597  {
598  t << rtf_documentType << "\\par\n";
599  }
600  if (rtf_documentId)
601  {
602  t << rtf_documentId << "\\par\n";
603  }
604  t << "\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\n";
605 
606  t << rtf_Style_Reset << rtf_Style["SubTitle"]->reference << endl; // set to subtitle style
607  if (rtf_author)
608  t << "{\\field\\fldedit {\\*\\fldinst AUTHOR \\\\*MERGEFORMAT}{\\fldrslt "<< rtf_author << " }}\\par" << endl;
609  else
610  t << "{\\field\\fldedit {\\*\\fldinst AUTHOR \\\\*MERGEFORMAT}{\\fldrslt AUTHOR}}\\par" << endl;
611 
612  t << theTranslator->trVersion() << " " << Config_getString("PROJECT_NUMBER") << "\\par";
613  t << "{\\field\\fldedit {\\*\\fldinst CREATEDATE \\\\*MERGEFORMAT}"
614  "{\\fldrslt "<< dateToString(FALSE) << " }}\\par"<<endl;
615  t << "\\page\\page";
616  DBG_RTF(t << "{\\comment End title page}" << endl)
617 
618  // table of contents section
619  DBG_RTF(t << "{\\comment Table of contents}\n")
620  t << "\\vertalt\n";
621  t << rtf_Style_Reset << endl;
622  t << rtf_Style["Heading1"]->reference;
623  t << theTranslator->trRTFTableOfContents() << "\\par"<< endl;
624  t << rtf_Style_Reset << "\\par" << endl;
625  t << "{\\field\\fldedit {\\*\\fldinst TOC \\\\f \\\\*MERGEFORMAT}{\\fldrslt Table of contents}}\\par\n";
626  t << rtf_Style_Reset << endl;
627  }
628  break;
629  case isMainPage:
630  t << "\\par " << rtf_Style_Reset << endl;
631  if (!Doxygen::mainPage || Doxygen::mainPage->title().isEmpty())
632  {
633  t << "{\\tc \\v " << theTranslator->trMainPage() << "}"<< endl;
634  }
635  else
636  {
637  t << "{\\tc \\v " << substitute(Doxygen::mainPage->title(),"%","") << "}"<< endl;
638  }
639  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
640  //if (Config_getBool("GENERATE_TREEVIEW")) t << "main"; else t << "index";
641  t << "index";
642  t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
643  break;
644  //case isPackageIndex:
645  // t << "\\par " << rtf_Style_Reset << endl;
646  // t << "{\\tc \\v " << theTranslator->trPackageList() << "}"<< endl;
647  // t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"packages.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
648  // break;
649  case isModuleIndex:
650  t << "\\par " << rtf_Style_Reset << endl;
651  t << "{\\tc \\v " << theTranslator->trModuleIndex() << "}"<< endl;
652  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"modules.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
653  break;
654  case isDirIndex:
655  t << "\\par " << rtf_Style_Reset << endl;
656  t << "{\\tc \\v " << theTranslator->trDirIndex() << "}"<< endl;
657  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"dirs.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
658  break;
659  case isNamespaceIndex:
660  t << "\\par " << rtf_Style_Reset << endl;
661  if (fortranOpt)
662  {
663  t << "{\\tc \\v " << theTranslator->trModulesIndex() << "}" << endl;
664  }
665  else
666  {
667  t << "{\\tc \\v " << theTranslator->trNamespaceIndex() << "}" << endl;
668  }
669 
670  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"namespaces.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
671  break;
673  t << "\\par " << rtf_Style_Reset << endl;
674  t << "{\\tc \\v " << theTranslator->trHierarchicalIndex() << "}"<< endl;
675  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"hierarchy.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
676  break;
677  case isCompoundIndex:
678  t << "\\par " << rtf_Style_Reset << endl;
679  if (fortranOpt)
680  {
681  t << "{\\tc \\v " << theTranslator->trCompoundIndexFortran() << "}"<< endl;
682  }
683  else if (vhdlOpt)
684  {
685  t << "{\\tc \\v " << VhdlDocGen::trDesignUnitIndex() << "}"<< endl;
686  }
687  else
688  {
689  t << "{\\tc \\v " << theTranslator->trCompoundIndex() << "}"<< endl;
690  }
691  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"annotated.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
692  break;
693  case isFileIndex:
694  t << "\\par " << rtf_Style_Reset << endl;
695  t << "{\\tc \\v " << theTranslator->trFileIndex() << "}"<< endl;
696  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"files.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
697  break;
698  case isPageIndex:
699  t << "\\par " << rtf_Style_Reset << endl;
700  t << "{\\tc \\v " << theTranslator->trPageIndex() << "}"<< endl;
701  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"pages.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
702  break;
704  {
706  GroupDef *gd;
707  t << "{\\tc \\v " << theTranslator->trModuleDocumentation() << "}"<< endl;
708  for (gli.toFirst();(gd=gli.current());++gli)
709  {
710  if (!gd->isReference())
711  {
712  t << "\\par " << rtf_Style_Reset << endl;
713  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
714  t << gd->getOutputFileBase();
715  t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
716  }
717  }
718  }
719  break;
720  case isDirDocumentation:
721  {
723  DirDef *dd;
724  t << "{\\tc \\v " << theTranslator->trDirDocumentation() << "}"<< endl;
725  for (dli.toFirst();(dd=dli.current());++dli)
726  {
727  if (dd->isLinkableInProject())
728  {
729  t << "\\par " << rtf_Style_Reset << endl;
730  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
731  t << dd->getOutputFileBase();
732  t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
733  }
734  }
735  }
736  break;
738  {
740  NamespaceDef *nd;
741  bool found=FALSE;
742  for (nli.toFirst();(nd=nli.current()) && !found;++nli)
743  {
744  if (nd->isLinkableInProject())
745  {
746  t << "\\par " << rtf_Style_Reset << endl;
747  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
748  t << nd->getOutputFileBase();
749  t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
750  found=TRUE;
751  }
752  }
753  while ((nd=nli.current()))
754  {
755  if (nd->isLinkableInProject())
756  {
757  t << "\\par " << rtf_Style_Reset << endl;
758  beginRTFSection();
759  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
760  t << nd->getOutputFileBase();
761  t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
762  }
763  ++nli;
764  }
765  }
766  break;
768  {
770  ClassDef *cd=0;
771  bool found=FALSE;
772  if (fortranOpt)
773  {
774  t << "{\\tc \\v " << theTranslator->trTypeDocumentation() << "}"<< endl;
775  }
776  else
777  {
778  t << "{\\tc \\v " << theTranslator->trClassDocumentation() << "}"<< endl;
779  }
780  for (cli.toFirst();(cd=cli.current()) && !found;++cli)
781  {
782  if (cd->isLinkableInProject() &&
783  cd->templateMaster()==0 &&
785  )
786  {
787  t << "\\par " << rtf_Style_Reset << endl;
788  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
789  t << cd->getOutputFileBase();
790  t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
791  found=TRUE;
792  }
793  }
794  for (;(cd=cli.current());++cli)
795  {
796  if (cd->isLinkableInProject() &&
797  cd->templateMaster()==0 &&
799  )
800  {
801  t << "\\par " << rtf_Style_Reset << endl;
802  beginRTFSection();
803  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
804  t << cd->getOutputFileBase();
805  t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
806  }
807  }
808  }
809  break;
810  case isFileDocumentation:
811  {
812  bool isFirst=TRUE;
813 
814  t << "{\\tc \\v " << theTranslator->trFileDocumentation() << "}"<< endl;
816  FileName *fn;
817  for (fnli.toFirst();(fn=fnli.current());++fnli)
818  {
819  FileNameIterator fni(*fn);
820  FileDef *fd;
821  for (;(fd=fni.current());++fni)
822  {
823  if (fd->isLinkableInProject())
824  {
825  if (isFirst)
826  {
827  t << "\\par " << rtf_Style_Reset << endl;
828  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
829  t << fd->getOutputFileBase();
830  t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
831  if (sourceBrowser && m_prettyCode && fd->generateSourceFile())
832  {
833  t << "\\par " << rtf_Style_Reset << endl;
834  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"" << fd->getSourceFileBase() << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
835  }
836  isFirst=FALSE;
837  }
838  else
839  {
840  t << "\\par " << rtf_Style_Reset << endl;
841  beginRTFSection();
842  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
843  t << fd->getOutputFileBase();
844  t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
845  if (sourceBrowser && m_prettyCode && fd->generateSourceFile())
846  {
847  t << "\\par " << rtf_Style_Reset << endl;
848  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"" << fd->getSourceFileBase() << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
849  }
850  }
851  }
852  }
853  }
854  }
855  break;
857  {
858  //t << "}\n";
859  t << "{\\tc \\v " << theTranslator->trExampleDocumentation() << "}"<< endl;
861  PageDef *pd=pdi.toFirst();
862  if (pd)
863  {
864  t << "\\par " << rtf_Style_Reset << endl;
865  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
866  t << pd->getOutputFileBase();
867  t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
868  }
869  for (++pdi;(pd=pdi.current());++pdi)
870  {
871  t << "\\par " << rtf_Style_Reset << endl;
872  beginRTFSection();
873  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
874  t << pd->getOutputFileBase();
875  t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
876  }
877  }
878  break;
879  case isPageDocumentation:
880  {
881 //#error "fix me in the same way as the latex index..."
882  //t << "{\\tc \\v " << theTranslator->trPageDocumentation() << "}"<< endl;
883  //t << "}"<< endl;
884  //PageSDict::Iterator pdi(*Doxygen::pageSDict);
885  //PageDef *pd=pdi.toFirst();
886  //bool first=TRUE;
887  //for (pdi.toFirst();(pd=pdi.current());++pdi)
888  //{
889  // if (!pd->getGroupDef() && !pd->isReference())
890  // {
891  // if (first) t << "\\par " << rtf_Style_Reset << endl;
892  // t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
893  // t << pd->getOutputFileBase();
894  // t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
895  // first=FALSE;
896  // }
897  //}
898  }
899  break;
901  {
902  t << "}";
903  t << "\\par " << rtf_Style_Reset << endl;
904  }
905  break;
906  case isEndIndex:
907  beginRTFChapter();
908  t << rtf_Style["Heading1"]->reference;
909  t << theTranslator->trRTFGeneralIndex() << "\\par "<< endl;
910  t << rtf_Style_Reset << endl;
911  t << "{\\tc \\v " << theTranslator->trRTFGeneralIndex() << "}" << endl;
912  t << "{\\field\\fldedit {\\*\\fldinst INDEX \\\\c2 \\\\*MERGEFORMAT}{\\fldrslt INDEX}}\n";
913 
914  break;
915  }
916 }
917 
918 void RTFGenerator::writePageLink(const char *name,bool first)
919 {
920  if (first) t << "\\par " << rtf_Style_Reset << endl;
921  t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
922  t << name;
923  t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
924 }
925 
927 {
928  DBG_RTF(t <<"{\\comment Beginning Body of RTF Document}\n")
929  // end page and setup for rest of document
930  t <<"\\sect \\sbkpage \\pgndec \\pgnrestart\n";
931  t <<"\\sect \\sectd \\sbknone\n";
932 
933  // set new footer with arabic numbers
934  t <<"{\\footer "<< rtf_Style["Footer"]->reference << "{\\chpgn}}\n";
935  //t << rtf_Style["Heading1"]->reference << "\n";
936 
937 }
938 
940 {
941 }
942 
943 void RTFGenerator::lineBreak(const char *)
944 {
945  DBG_RTF(t << "{\\comment (lineBreak)}" << endl)
946  t << "\\par" << endl;
948 }
949 
950 void RTFGenerator::writeString(const char *text)
951 {
952  t << text;
953 }
954 
956 {
957  DBG_RTF(t << "{\\comment (startIndexList)}" << endl)
958  t << "{" << endl;
959  t << "\\par" << endl;
963 }
964 
966 {
967  DBG_RTF(t << "{\\comment (endIndexList)}" << endl)
968  if (!m_omitParagraph)
969  {
970  t << "\\par";
972  }
973  t << "}";
975 }
976 
977 /*! start bullet list */
979 {
980  newParagraph();
981  DBG_RTF(t << "{\\comment (startItemList level=" << m_listLevel << ") }" << endl)
982  t << "{";
985 }
986 
987 /*! end bullet list */
989 {
990  newParagraph();
991  DBG_RTF(t << "{\\comment (endItemList level=" << m_listLevel << ")}" << endl)
992  t << "}";
995 }
996 
997 ///*! start enumeration list */
998 //void RTFGenerator::startEnumList() // starts an enumeration list
999 //{
1000 // DBG_RTF(t << "{\\comment (startEnumList)}" << endl)
1001 // t << "{" << endl;
1002 // incrementIndentLevel();
1003 // rtf_listItemInfo[m_listLevel].isEnum = TRUE;
1004 // rtf_listItemInfo[m_listLevel].number = 1;
1005 //}
1006 //
1007 ///*! end enumeration list */
1008 //void RTFGenerator::endEnumList()
1009 //{
1010 // newParagraph();
1011 // DBG_RTF(t << "{\\comment (endEnumList)}" << endl)
1012 // t << "}";
1013 // decrementIndentLevel();
1014 // m_omitParagraph = TRUE;
1015 //}
1016 
1017 /*! write bullet or enum item */
1019 {
1020  DBG_RTF(t << "{\\comment (startItemListItem)}" << endl)
1021  newParagraph();
1022  t << rtf_Style_Reset;
1023  if (rtf_listItemInfo[m_listLevel].isEnum)
1024  {
1025  t << rtf_EList_DepthStyle() << endl;
1026  t << rtf_listItemInfo[m_listLevel].number << ".\\tab ";
1028  }
1029  else
1030  {
1031  t << rtf_BList_DepthStyle() << endl;
1032  }
1034 }
1035 
1037 {
1038  DBG_RTF(t << "{\\comment (endItemListItem)}" << endl)
1039 }
1040 
1041 void RTFGenerator::startIndexItem(const char *,const char *)
1042 {
1043  DBG_RTF(t << "{\\comment (startIndexItem)}" << endl)
1044 
1045  if (!m_omitParagraph)
1046  {
1047  t << "\\par" << endl;
1049  }
1050 }
1051 
1052 void RTFGenerator::endIndexItem(const char *ref,const char *fn)
1053 {
1054  DBG_RTF(t << "{\\comment (endIndexItem)}" << endl)
1055  if (!ref && fn)
1056  {
1057  t << "\\tab ";
1058  writeRTFReference(fn);
1059  t << endl;
1060  }
1061  else
1062  {
1063  t << endl;
1064  }
1066 }
1067 
1068 //void RTFGenerator::writeIndexFileItem(const char *,const char *text)
1069 //{
1070 // t << "\\item\\contentsline{section}{";
1071 // docify(text);
1072 // t << "}{\\pageref{" << text << "}}" << endl;
1073 //}
1074 
1076 {
1077 
1078  if (Config_getBool("RTF_HYPERLINKS"))
1079  {
1080  t << "{\\field {\\*\\fldinst { HYPERLINK \"";
1081  t << url;
1082  t << "\" }{}";
1083  t << "}{\\fldrslt {\\cs37\\ul\\cf2 ";
1084  }
1085  else
1086  {
1087  startTypewriter();
1088  }
1089 }
1090 
1092 {
1093  if (Config_getBool("RTF_HYPERLINKS"))
1094  {
1095  t << "}}}" << endl;
1096  }
1097  else
1098  {
1099  endTypewriter();
1100  }
1101 }
1102 
1103 //void RTFGenerator::writeMailLink(const char *url)
1104 //{
1105 // startTypewriter();
1106 // docify(url);
1107 // endTypewriter();
1108 //}
1109 
1110 void RTFGenerator::writeStartAnnoItem(const char *,const char *f,
1111  const char *path,const char *name)
1112 {
1113  DBG_RTF(t << "{\\comment (writeStartAnnoItem)}" << endl)
1114  t << "{\\b ";
1115  if (path) docify(path);
1116  if (f && Config_getBool("RTF_HYPERLINKS"))
1117  {
1118  t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \"";
1119  t << rtfFormatBmkStr(f);
1120  t << "\" }{}";
1121  t << "}{\\fldrslt {\\cs37\\ul\\cf2 ";
1122 
1123  docify(name);
1124 
1125  t << "}}}" << endl;
1126  }
1127  else
1128  {
1129  docify(name);
1130  }
1131  t << "} ";
1132 }
1133 
1135 {
1136  DBG_RTF(t << "{\\comment (writeEndAnnoItem)}" << endl)
1137  if (name)
1138  {
1139  t << "\\tab ";
1140  writeRTFReference(name);
1141  t << endl;
1142  }
1143  else
1144  {
1145  t << endl;
1146  }
1147  newParagraph();
1148 }
1149 
1151 {
1152  DBG_RTF(t << "{\\comment (startIndexKey)}" << endl)
1153  t << "{\\b ";
1154 }
1155 
1157 {
1158  DBG_RTF(t << "{\\comment (endIndexKey)}" << endl)
1159 }
1160 
1162 {
1163  DBG_RTF(t << "{\\comment (startIndexValue)}" << endl)
1164  t << " ";
1165  if (hasBrief) t << "(";
1166 }
1167 
1168 void RTFGenerator::endIndexValue(const char *name,bool hasBrief)
1169 {
1170  DBG_RTF(t << "{\\comment (endIndexValue)}" << endl)
1171  if (hasBrief) t << ")";
1172  t << "} ";
1173  if (name)
1174  {
1175  t << "\\tab ";
1176  writeRTFReference(name);
1177  t << endl;
1178  }
1179  else
1180  {
1181  t << endl;
1182  }
1184  newParagraph();
1185 }
1186 
1188 {
1189  //beginRTFSubSection();
1190  t <<"\n";
1191  DBG_RTF(t << "{\\comment Begin SubSection}\n")
1192  t << rtf_Style_Reset;
1193  t << rtf_Style["Heading3"]->reference << "\n";
1194 }
1195 
1197 {
1198  newParagraph();
1199  t << rtf_Style_Reset << endl;
1200 }
1201 
1203 {
1204  //beginRTFSubSubSection();
1205  t << "\n";
1206  DBG_RTF(t << "{\\comment Begin SubSubSection}\n")
1207  t << "{" << endl;
1208  t << rtf_Style_Reset << rtf_Style["Heading4"]->reference << "\n";
1209 }
1210 
1212 {
1213  newParagraph();
1214  t << "}" << endl;
1215 }
1216 
1217 
1218 //void RTFGenerator::writeClassLink(const char *,const char *,
1219 // const char *,const char *name)
1220 //{
1221 // t << "{\\bf ";
1222 // docify(name);
1223 // t << "}";
1224 //}
1225 
1226 //void RTFGenerator::startTable(bool,int colNumbers)
1227 //{
1228 // DBG_RTF(t << "{\\comment startTable}\n";)
1229 // m_numCols=colNumbers;
1230 // t << "\\par\n";
1231 //}
1232 //
1233 //void RTFGenerator::endTable(bool hasCaption)
1234 //{
1235 // DBG_RTF(t << "{\\comment endTable}\n";)
1236 // if (!hasCaption)
1237 // t << "\n\\pard \\widctlpar\\intbl\\adjustright\n{\\row }\n";
1238 // t << "\\pard\n" << endl;
1239 //}
1240 //
1241 //void RTFGenerator::startCaption()
1242 //{
1243 // DBG_RTF(t << "{\\comment startCaption}\n";)
1244 // endTableRow();
1245 // t << "\\trowd \\trgaph108\\trleft-108\\trbrdrt\\brdrs\\brdrw10 \\trbrdrl\\brdrs\\brdrw10 \\trbrdrb\\brdrs\\brdrw10 \\trbrdrr\\brdrs\\brdrw10 \\trbrdrh\\brdrs\\brdrw10 \\trbrdrv\\brdrs\\brdrw10" << endl;
1246 // t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10 \\clbrdrl\\brdrs\\brdrw10 \\clbrdrb\\brdrs\\brdrw10 \\clbrdrr \\brdrs\\brdrw10 \\cltxlrtb \\cellx"<<rtf_pageWidth<<"\\pard \\qc\\nowidctlpar\\widctlpar\\intbl\\adjustright " << endl;
1247 // nextTableColumn();
1248 //}
1249 //
1250 //void RTFGenerator::endCaption()
1251 //{
1252 // DBG_RTF(t << "{\\comment endCaption}\n";)
1253 // endTableColumn();
1254 // endTableRow();
1255 //}
1256 //
1257 //void RTFGenerator::nextTableRow()
1258 //{
1259 // DBG_RTF(t << "{\\comment nextTableRow}\n";)
1260 // ASSERT(m_numCols>0 && m_numCols<25);
1261 // uint columnWidth=rtf_pageWidth/m_numCols;
1262 // t << "\\trowd \\trgaph108\\trleft-108\\trbrdrt\\brdrs\\brdrw10 "
1263 // "\\trbrdrl\\brdrs\\brdrw10 \\trbrdrb\\brdrs\\brdrw10 "
1264 // "\\trbrdrr\\brdrs\\brdrw10 \\trbrdrh\\brdrs\\brdrw10 "
1265 // "\\trbrdrv\\brdrs\\brdrw10 "<<endl;
1266 // for (int i=0;i<m_numCols;i++)
1267 // {
1268 // t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10 \\clbrdrl\\brdrs\\brdrw10 "
1269 // "\\clbrdrb\\brdrs\\brdrw10 \\clbrdrr \\brdrs\\brdrw10 \\cltxlrtb "
1270 // "\\cellx" << (i*columnWidth) << endl;
1271 // }
1272 // t << "\\pard \\widctlpar\\intbl\\adjustright\n{";
1273 //}
1274 //
1275 //void RTFGenerator::endTableRow()
1276 //{
1277 // DBG_RTF(t << "{\\comment endTableRow}\n";)
1278 // t << "\n\\pard \\widctlpar\\intbl\\adjustright\n{\\row }\n";
1279 //}
1280 //
1281 //void RTFGenerator::nextTableColumn()
1282 //{
1283 // DBG_RTF(t << "{\\comment nextTableColumn}\n";)
1284 // t << "{ ";
1285 //}
1286 //
1287 //void RTFGenerator::endTableColumn()
1288 //{
1289 // DBG_RTF(t << "{\\comment endTableColumn}\n";)
1290 // t << " \\cell }";
1291 //}
1292 //
1293 void RTFGenerator::startTextLink(const char *f,const char *anchor)
1294 {
1295  if (Config_getBool("RTF_HYPERLINKS"))
1296  {
1297  QCString ref;
1298  if (f)
1299  {
1300  ref+=f;
1301  }
1302  if (anchor)
1303  {
1304  ref+='_';
1305  ref+=anchor;
1306  }
1307 
1308  t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \"";
1309  t << rtfFormatBmkStr(ref);
1310  t << "\" }{}";
1311  t << "}{\\fldrslt {\\cs37\\ul\\cf2 ";
1312  }
1313 }
1314 
1316 {
1317  if (Config_getBool("RTF_HYPERLINKS"))
1318  {
1319  t << "}}}" << endl;
1320  }
1321 }
1322 
1323 void RTFGenerator::writeObjectLink(const char *ref, const char *f,
1324  const char *anchor, const char *text)
1325 {
1326  if (!ref && Config_getBool("RTF_HYPERLINKS"))
1327  {
1328  QCString refName;
1329  if (f)
1330  {
1331  refName+=f;
1332  }
1333  if (anchor)
1334  {
1335  refName+='_';
1336  refName+=anchor;
1337  }
1338 
1339  t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \"";
1340  t << rtfFormatBmkStr(refName);
1341  t << "\" }{}";
1342  t << "}{\\fldrslt {\\cs37\\ul\\cf2 ";
1343 
1344  docify(text);
1345 
1346  t << "}}}" << endl;
1347  }
1348  else
1349  {
1350  startBold();
1351  docify(text);
1352  endBold();
1353  }
1354 }
1355 
1357 {
1358  t << " (";
1359  startEmphasis();
1360 }
1361 
1362 void RTFGenerator::endPageRef(const char *clname, const char *anchor)
1363 {
1364  QCString ref;
1365  if (clname)
1366  {
1367  ref+=clname;
1368  }
1369  if (anchor)
1370  {
1371  ref+='_';
1372  ref+=anchor;
1373  }
1374  writeRTFReference(ref);
1375  endEmphasis();
1376  t << ")";
1377 }
1378 
1379 void RTFGenerator::writeCodeLink(const char *ref,const char *f,
1380  const char *anchor,const char *name,
1381  const char *)
1382 {
1383  if (!ref && Config_getBool("RTF_HYPERLINKS"))
1384  {
1385  QCString refName;
1386  if (f)
1387  {
1388  refName+=f;
1389  }
1390  if (anchor)
1391  {
1392  refName+='_';
1393  refName+=anchor;
1394  }
1395 
1396  t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \"";
1397  t << rtfFormatBmkStr(refName);
1398  t << "\" }{}";
1399  t << "}{\\fldrslt {\\cs37\\ul\\cf2 ";
1400 
1401  codify(name);
1402 
1403  t << "}}}" << endl;
1404  }
1405  else
1406  {
1407  codify(name);
1408  }
1409 }
1410 
1412 {
1413  DBG_RTF(t <<"{\\comment startTitleHead}" << endl)
1414 
1415  // beginRTFSection();
1416  t << rtf_Style_Reset << rtf_Style["Heading2"]->reference << endl;
1417 }
1418 
1419 void RTFGenerator::endTitleHead(const char *fileName,const char *name)
1420 {
1421  DBG_RTF(t <<"{\\comment endTitleHead}" << endl)
1422  t << "\\par " << rtf_Style_Reset << endl;
1423  if (name)
1424  {
1425  // make table of contents entry
1426  t << "{\\tc\\tcl2 \\v ";
1427  docify(name);
1428  t << "}" << endl;
1429 
1430  // make an index entry
1431  addIndexItem(name,0);
1432 
1433  //if (name)
1434  //{
1435  // writeAnchor(0,name);
1436  //}
1437  //
1438  //if (Config_getBool("RTF_HYPERLINKS") && fileName)
1439  //{
1440  writeAnchor(fileName,0);
1441  //}
1442  }
1443 }
1444 
1446 {
1447  DBG_RTF(t <<"{\\comment startTitle}" << endl)
1448  if (Config_getBool("COMPACT_RTF"))
1449  beginRTFSection();
1450  else
1451  beginRTFChapter();
1452 }
1453 
1454 void RTFGenerator::startGroupHeader(int extraIndent)
1455 {
1456  DBG_RTF(t <<"{\\comment startGroupHeader}" << endl)
1457  //newParagraph();
1458  t << rtf_Style_Reset;
1459  if (extraIndent==2)
1460  {
1461  t << rtf_Style["Heading5"]->reference;
1462  }
1463  else if (extraIndent==1)
1464  {
1465  t << rtf_Style["Heading4"]->reference;
1466  }
1467  else // extraIndent==0
1468  {
1469  t << rtf_Style["Heading3"]->reference;
1470  }
1471  t << endl;
1472 }
1473 
1475 {
1476  DBG_RTF(t <<"{\\comment endGroupHeader}" << endl)
1477  t << "\\par" << endl;
1478  t << rtf_Style_Reset << endl;
1479 }
1480 
1481 void RTFGenerator::startMemberDoc(const char *clname,
1482  const char *memname,
1483  const char *,
1484  const char *,
1485  bool showInline)
1486 {
1487  DBG_RTF(t << "{\\comment startMemberDoc}" << endl)
1488  if (memname && memname[0]!='@')
1489  {
1490  addIndexItem(memname,clname);
1491  addIndexItem(clname,memname);
1492  }
1493  t << rtf_Style_Reset << rtf_Style[showInline ? "Heading5" : "Heading4"]->reference;
1494  //styleStack.push(rtf_Style_Heading4);
1495  t << "{" << endl;
1496  //printf("RTFGenerator::startMemberDoc() `%s'\n",rtf_Style["Heading4"]->reference);
1497  startBold();
1498  t << endl;
1499 }
1500 
1502 {
1503  DBG_RTF(t << "{\\comment endMemberDoc}" << endl)
1504  //const char *style = styleStack.pop();
1505  //printf("RTFGenerator::endMemberDoc() `%s'\n",style);
1506  //ASSERT(style==rtf_Style["Heading4"]->reference);
1507  endBold();
1508  t << "}" << endl;
1509  newParagraph();
1510 }
1511 
1512 void RTFGenerator::startDoxyAnchor(const char *,const char *,
1513  const char *,const char *,
1514  const char *
1515  )
1516 {
1517  DBG_RTF(t << "{\\comment startDoxyAnchor}" << endl)
1518 }
1519 
1520 void RTFGenerator::endDoxyAnchor(const char *fName,const char *anchor)
1521 {
1522  QCString ref;
1523  if (fName)
1524  {
1525  ref+=fName;
1526  }
1527  if (anchor)
1528  {
1529  ref+='_';
1530  ref+=anchor;
1531  }
1532 
1533  DBG_RTF(t << "{\\comment endDoxyAnchor}" << endl)
1534  t << "{\\bkmkstart ";
1535  t << rtfFormatBmkStr(ref);
1536  t << "}" << endl;
1537  t << "{\\bkmkend ";
1538  t << rtfFormatBmkStr(ref);
1539  t << "}" << endl;
1540 }
1541 
1542 
1543 //void RTFGenerator::writeLatexLabel(const char *clName,const char *anchor)
1544 //{
1545 // writeDoxyAnchor(0,clName,anchor,0);
1546 //}
1547 
1548 void RTFGenerator::addIndexItem(const char *s1,const char *s2)
1549 {
1550  if (s1)
1551  {
1552  t << "{\\xe \\v ";
1553  docify(s1);
1554  if (s2)
1555  {
1556  t << "\\:";
1557  docify(s2);
1558  }
1559  t << "}" << endl;
1560  }
1561 }
1562 
1564 {
1566  DBG_RTF(t << "{\\comment (startIndent) }" << endl)
1567  t << "{" << endl;
1569 }
1570 
1572 {
1573  t << "}" << endl;
1575 }
1576 
1577 
1579 {
1580  DBG_RTF(t << "{\\comment (startDescription)}" << endl)
1581  t << "{" << endl;
1583 }
1584 
1586 {
1587  DBG_RTF(t << "{\\comment (endDescription)}" << endl)
1588  newParagraph();
1589  t << "}";
1590 }
1591 
1593 {
1594  newParagraph();
1595  DBG_RTF(t << "{\\comment (startDescItem)}" << endl)
1596  t << "{\\b ";
1597 }
1598 
1600 {
1601  DBG_RTF(t << "{\\comment (endDescItem)}" << endl)
1602  t << "}" << endl;
1603  newParagraph();
1604 }
1605 
1606 void RTFGenerator::startMemberDescription(const char *,const char *)
1607 {
1608  DBG_RTF(t << "{\\comment (startMemberDescription)}" << endl)
1609  t << "{" << endl;
1612  startEmphasis();
1613 }
1614 
1616 {
1617  DBG_RTF(t << "{\\comment (endMemberDescription)}" << endl)
1618  endEmphasis();
1619  newParagraph();
1621  //t << "\\par";
1622  t << "}" << endl;
1623  //m_omitParagraph = TRUE;
1624 }
1625 
1627 {
1628  DBG_RTF(t << "{\\comment (startDescList)}" << endl)
1629  t << "{"; // ends at endDescList
1630  t << "{"; // ends at endDescTitle
1631  startBold();
1632  newParagraph();
1633 }
1634 
1635 //void RTFGenerator::endDescTitle()
1636 //{
1637 // DBG_RTF(t << "{\\comment (endDescTitle) }" << endl)
1638 // endBold();
1639 // t << "}";
1640 // newParagraph();
1641 // incrementIndentLevel();
1642 // t << rtf_Style_Reset << rtf_DList_DepthStyle();
1643 //}
1644 
1646 {
1647  DBG_RTF(t << "{\\comment (startDescForItem) }" << endl)
1648 }
1649 
1651 {
1652  DBG_RTF(t << "{\\comment (endDescForItem) }" << endl)
1653 }
1654 
1655 //void RTFGenerator::endDescList()
1656 //{
1657 // DBG_RTF(t << "{\\comment (endDescList)}" << endl)
1658 // newParagraph();
1659 // decrementIndentLevel();
1660 // m_omitParagraph = TRUE;
1661 // t << "}";
1662 //}
1663 
1664 
1666 {
1667  DBG_RTF(t << "{\\comment (startSection)}" << endl)
1668  t << "{";
1669  t<< rtf_Style_Reset;
1670  int num=4;
1671  switch(type)
1672  {
1673  case SectionInfo::Page: num=2; break;
1674  case SectionInfo::Section: num=3; break;
1675  case SectionInfo::Subsection: num=4; break;
1676  case SectionInfo::Subsubsection: num=4; break;
1677  case SectionInfo::Paragraph: num=4; break;
1678  default: ASSERT(0); break;
1679  }
1680  QCString heading;
1681  heading.sprintf("Heading%d",num);
1682  // set style
1683  t << rtf_Style[heading]->reference;
1684  // make table of contents entry
1685  t << "{\\tc\\tcl" << num << " \\v ";
1686  docify(title);
1687  t << "}" << endl;
1688 }
1689 
1691 {
1692  DBG_RTF(t << "{\\comment (endSection)}" << endl)
1693  // make bookmark
1695  newParagraph();
1696  writeAnchor(0,lab);
1697  t << "}";
1698 }
1699 
1700 //void RTFGenerator::writeSectionRef(const char *ref,const char *,
1701 // const char *lab,const char *title)
1702 //{
1703 // if (ref)
1704 // {
1705 // docify(title);
1706 // }
1707 // else
1708 // {
1709 // startBold();
1710 // docify(title);
1711 // endBold();
1712 // t << " (";
1713 // docify(theTranslator->trPageAbbreviation());
1714 // writeRTFReference(lab);
1715 // t << ")" << endl;
1716 // }
1717 //}
1718 //
1719 //void RTFGenerator::writeSectionRefItem(const char *,const char *lab,
1720 // const char *title)
1721 //{
1722 // docify(title);
1723 // t << "\\tab";
1724 // writeRTFReference(lab);
1725 // t << endl;
1726 //}
1727 //
1728 //void RTFGenerator::writeSectionRefAnchor(const char *name,const char *lab,
1729 // const char *title)
1730 //{
1731 // writeSectionRef(name,lab,title);
1732 //}
1733 
1734 //char* RTFGenerator::getMultiByte(int c)
1735 //{
1736 // static char s[10];
1737 //
1738 // sprintf(s,"\\'%X",c);
1739 // return s;
1740 //}
1741 
1742 void RTFGenerator::docify(const char *str)
1743 {
1744  if (str)
1745  {
1746  const unsigned char *p=(const unsigned char *)str;
1747  unsigned char c;
1748  //unsigned char pc='\0';
1749  while (*p)
1750  {
1751  //static bool MultiByte = FALSE;
1752  c=*p++;
1753 
1754 #if 0
1755  if ( MultiByte )
1756  {
1757  t << getMultiByte( c );
1758  MultiByte = FALSE;
1759  continue;
1760  }
1761  if ( c >= 0x80 )
1762  {
1763  MultiByte = TRUE;
1764  t << getMultiByte( c );
1765  continue;
1766  }
1767 #endif
1768 
1769  switch (c)
1770  {
1771  case '{': t << "\\{"; break;
1772  case '}': t << "\\}"; break;
1773  case '\\': t << "\\\\"; break;
1774  default:
1775  {
1776  // see if we can insert an hyphenation hint
1777  //if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-";
1778  t << (char)c;
1779  }
1780  }
1781  //pc = c;
1783  }
1784  }
1785 }
1786 
1787 void RTFGenerator::codify(const char *str)
1788 {
1789  // note that RTF does not have a "verbatim", so "\n" means
1790  // nothing... add a "newParagraph()";
1791  //static char spaces[]=" ";
1792  if (str)
1793  {
1794  const unsigned char *p=(const unsigned char *)str;
1795  unsigned char c;
1796  int spacesToNextTabStop;
1797 
1798  while (*p)
1799  {
1800  //static bool MultiByte = FALSE;
1801 
1802  c=*p++;
1803 
1804  switch(c)
1805  {
1806  case '\t': spacesToNextTabStop = Config_getInt("TAB_SIZE") - (col%Config_getInt("TAB_SIZE"));
1807  t << Doxygen::spaces.left(spacesToNextTabStop);
1808  col+=spacesToNextTabStop;
1809  break;
1810  case '\n': newParagraph();
1811  t << '\n'; col=0;
1812  break;
1813  case '{': t << "\\{"; col++; break;
1814  case '}': t << "\\}"; col++; break;
1815  case '\\': t << "\\\\"; col++; break;
1816  default: p=(const unsigned char *)writeUtf8Char(t,(const char *)p-1); col++; break;
1817  }
1818  }
1819  }
1820 }
1821 
1823 {
1824  char cs[2];
1825  cs[0]=c;
1826  cs[1]=0;
1827  docify(cs);
1828 }
1829 
1831 {
1832  DBG_RTF(t <<"{\\comment startClassDiagram }" << endl)
1833 }
1834 
1836  const char *fileName,const char *)
1837 {
1838  newParagraph();
1839 
1840  // create a png file
1841  d.writeImage(t,dir,relPath,fileName,FALSE);
1842 
1843  // display the file
1844  t << "{" << endl;
1845  t << rtf_Style_Reset << endl;
1846  t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
1847  t << fileName << ".png\"";
1848  t << " \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
1849  t << "}" << endl;
1850 }
1851 
1852 //void RTFGenerator::writeFormula(const char *,const char *text)
1853 //{
1854 // t << text;
1855 //}
1856 
1857 void RTFGenerator::startMemberItem(const char *,int,const char *)
1858 {
1859  DBG_RTF(t <<"{\\comment startMemberItem }" << endl)
1860  t << rtf_Style_Reset << rtf_BList_DepthStyle() << endl; // set style to appropriate depth
1861 }
1862 
1864 {
1865  DBG_RTF(t <<"{\\comment endMemberItem }" << endl)
1866  newParagraph();
1867 }
1868 
1869 void RTFGenerator::writeAnchor(const char *fileName,const char *name)
1870 {
1871  QCString anchor;
1872  if (fileName)
1873  {
1874  anchor+=fileName;
1875  }
1876  if (fileName && name)
1877  {
1878  anchor+='_';
1879  }
1880  if (name)
1881  {
1882  anchor+=name;
1883  }
1884 
1885  DBG_RTF(t <<"{\\comment writeAnchor (" << anchor << ")}" << endl)
1886  t << "{\\bkmkstart " << rtfFormatBmkStr(anchor) << "}" << endl;
1887  t << "{\\bkmkend " << rtfFormatBmkStr(anchor) << "}" << endl;
1888 }
1889 
1891 {
1892  t << "{\\field\\fldedit {\\*\\fldinst PAGEREF ";
1893  t << rtfFormatBmkStr(label);
1894  t << " \\\\*MERGEFORMAT}{\\fldrslt pagenum}}";
1895 }
1896 
1898 {
1899  DBG_RTF(t << "{\\comment (startCodeFragment) }" << endl)
1900  t << "{" << endl;
1901  //newParagraph();
1903  //styleStack.push(rtf_Style_CodeExample);
1904 }
1905 
1907 {
1908  //newParagraph();
1909  //styleStack.pop();
1910  //printf("RTFGenerator::endCodeFrament() top=%s\n",styleStack.top());
1911  //t << rtf_Style_Reset << styleStack.top() << endl;
1912  DBG_RTF(t << "{\\comment (endCodeFragment) }" << endl)
1913  t << "}" << endl;
1915 }
1916 
1918 {
1919  t << "\\~ ";
1920 }
1921 
1922 
1924 {
1925  t << endl;
1926  DBG_RTF(t << "{\\comment (startMemberList) }" << endl)
1927  t << "{" << endl;
1928 #ifdef DELETEDCODE
1929  if (!insideTabbing)
1930  t << "\\begin{CompactItemize}" << endl;
1931 #endif
1932 }
1933 
1935 {
1936  DBG_RTF(t << "{\\comment (endMemberList) }" << endl)
1937  t << "}" << endl;
1938 #ifdef DELETEDCODE
1939  if (!insideTabbing)
1940  t << "\\end{CompactItemize}" << endl;
1941 #endif
1942 }
1943 
1944 //void RTFGenerator::startImage(const char *name,const char *,bool)
1945 //{
1946 // newParagraph();
1947 // t << "{" << endl;
1948 // t << rtf_Style_Reset << endl;
1949 // t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE ";
1950 // t << name;
1951 // t << " \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
1952 // t << "}" << endl;
1953 //}
1954 //
1955 //void RTFGenerator::endImage(bool)
1956 //{
1957 // // not yet implemented
1958 //}
1959 //
1960 //void RTFGenerator::startDotFile(const char *name,bool)
1961 //{
1962 // QCString baseName=name;
1963 // int i;
1964 // if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1)
1965 // {
1966 // baseName=baseName.right(baseName.length()-i-1);
1967 // }
1968 // QCString outDir = Config_getString("RTF_OUTPUT");
1969 // writeDotGraphFromFile(name,outDir,baseName,BITMAP);
1970 // newParagraph();
1971 // t << "{" << endl;
1972 // t << rtf_Style_Reset << endl;
1973 // t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE ";
1974 // t << outDir << "\\" << baseName;
1975 // t << " \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
1976 // t << "}" << endl;
1977 //}
1978 //
1979 //void RTFGenerator::endDotFile(bool)
1980 //{
1981 // // not yet implemented
1982 //}
1983 //
1985 {
1986  DBG_RTF(t << "{\\comment (startDescTable) }" << endl)
1987  startSimpleSect(EnumValues,0,0,title);
1988  startDescForItem();
1989  //t << "{" << endl;
1990  //incrementIndentLevel();
1991  //t << rtf_Style_Reset << rtf_CList_DepthStyle();
1992 }
1993 
1995 {
1996  //decrementIndentLevel();
1997  DBG_RTF(t << "{\\comment (endDescTable)}" << endl)
1998  endDescForItem();
1999  endSimpleSect();
2000  //t << "}" << endl;
2001  //t << rtf_Style_Reset << styleStack.top();
2002 }
2003 
2005 {
2006  //t << rtf_BList_DepthStyle() << endl;
2007  DBG_RTF(t << "{\\comment (startDescTableTitle) }" << endl)
2008  startBold();
2009  startEmphasis();
2010 }
2011 
2013 {
2014  DBG_RTF(t << "{\\comment (endDescTableTitle) }" << endl)
2015  endEmphasis();
2016  endBold();
2017  t << " ";
2018 }
2019 
2021 {
2022  DBG_RTF(t << "{\\comment (startDescTableData) }" << endl)
2024 }
2025 
2027 {
2028  DBG_RTF(t << "{\\comment (endDescTableData) }" << endl)
2029  newParagraph();
2031 }
2032 
2033 // a style for list formatted as a "bulleted list"
2034 
2036 {
2037  m_listLevel++;
2039  {
2040  err("Maximum indent level (%d) exceeded while generating RTF output!\n",rtf_maxIndentLevels);
2042  }
2043 }
2044 
2046 {
2047  m_listLevel--;
2048  if (m_listLevel<0)
2049  {
2050  err("Negative indent level while generating RTF output!\n");
2051  m_listLevel=0;
2052  }
2053 }
2054 
2055 // a style for list formatted with "list continue" style
2057 {
2058  QCString n=makeIndexName("ListContinue",m_listLevel);
2059  return rtf_Style[n]->reference;
2060 }
2061 
2062 // a style for list formatted as a "latext style" table of contents
2064 {
2065  QCString n=makeIndexName("LatexTOC",m_listLevel);
2066  return rtf_Style[n]->reference;
2067 }
2068 
2069 // a style for list formatted as a "bullet" style
2071 {
2072  QCString n=makeIndexName("ListBullet",m_listLevel);
2073  return rtf_Style[n]->reference;
2074 }
2075 
2076 // a style for list formatted as a "enumeration" style
2078 {
2079  QCString n=makeIndexName("ListEnum",m_listLevel);
2080  return rtf_Style[n]->reference;
2081 }
2082 
2084 {
2085  QCString n=makeIndexName("DescContinue",m_listLevel);
2086  return rtf_Style[n]->reference;
2087 }
2088 
2090 {
2091  QCString n=makeIndexName("CodeExample",m_listLevel);
2092  return rtf_Style[n]->reference;
2093 }
2094 
2096 {
2097  DBG_RTF(t << "{\\comment startTextBlock}" << endl)
2098  t << "{" << endl;
2099  t << rtf_Style_Reset;
2100  if (dense) // no spacing between "paragraphs"
2101  {
2102  t << rtf_Style["DenseText"]->reference;
2103  }
2104  else // some spacing
2105  {
2106  t << rtf_Style["BodyText"]->reference;
2107  }
2108 }
2109 
2110 void RTFGenerator::endTextBlock(bool /*paraBreak*/)
2111 {
2112  newParagraph();
2113  DBG_RTF(t << "{\\comment endTextBlock}" << endl)
2114  t << "}" << endl;
2115  //m_omitParagraph = TRUE;
2116 }
2117 
2119 {
2120  if (!m_omitParagraph)
2121  {
2122  DBG_RTF(t << "{\\comment (newParagraph)}" << endl)
2123  t << "\\par" << endl;
2124  }
2126 }
2127 
2129 {
2130  DBG_RTF(t << "{\\comment startParagraph}" << endl)
2131  newParagraph();
2132  t << "{" << endl;
2133 }
2134 
2136 {
2137  DBG_RTF(t << "{\\comment endParagraph}" << endl)
2138  t << "}\\par" << endl;
2140 }
2141 
2143 {
2144  DBG_RTF(t << "{\\comment startMemberSubtitle}" << endl)
2145  t << "{" << endl;
2147 }
2148 
2150 {
2151  DBG_RTF(t << "{\\comment endMemberSubtitle}" << endl)
2152  newParagraph();
2153  t << "}" << endl;
2154 }
2155 
2156 //void RTFGenerator::writeUmlaut(char c)
2157 //{
2158 // switch(c)
2159 // {
2160 // case 'A' : t << '\304'; break;
2161 // case 'E' : t << '\313'; break;
2162 // case 'I' : t << '\317'; break;
2163 // case 'O' : t << '\326'; break;
2164 // case 'U' : t << '\334'; break;
2165 // case 'Y' : t << 'Y'; break;
2166 // case 'a' : t << '\344'; break;
2167 // case 'e' : t << '\353'; break;
2168 // case 'i' : t << '\357'; break;
2169 // case 'o' : t << '\366'; break;
2170 // case 'u' : t << '\374'; break;
2171 // case 'y' : t << '\377'; break;
2172 // default: t << '?'; break;
2173 // }
2174 //}
2175 //
2176 //void RTFGenerator::writeAcute(char c)
2177 //{
2178 // switch(c)
2179 // {
2180 // case 'A' : t << '\301'; break;
2181 // case 'E' : t << '\311'; break;
2182 // case 'I' : t << '\315'; break;
2183 // case 'O' : t << '\323'; break;
2184 // case 'U' : t << '\332'; break;
2185 // case 'Y' : t << '\335'; break;
2186 // case 'a' : t << '\341'; break;
2187 // case 'e' : t << '\351'; break;
2188 // case 'i' : t << '\355'; break;
2189 // case 'o' : t << '\363'; break;
2190 // case 'u' : t << '\372'; break;
2191 // case 'y' : t << '\375'; break;
2192 // default: t << '?'; break;
2193 // }
2194 //}
2195 //
2196 //void RTFGenerator::writeGrave(char c)
2197 //{
2198 // switch(c)
2199 // {
2200 // case 'A' : t << '\300'; break;
2201 // case 'E' : t << '\310'; break;
2202 // case 'I' : t << '\314'; break;
2203 // case 'O' : t << '\322'; break;
2204 // case 'U' : t << '\331'; break;
2205 // case 'a' : t << '\340'; break;
2206 // case 'e' : t << '\350'; break;
2207 // case 'i' : t << '\354'; break;
2208 // case 'o' : t << '\362'; break;
2209 // case 'u' : t << '\371'; break;
2210 // default: t << '?'; break;
2211 // }
2212 //}
2213 //
2214 //void RTFGenerator::writeCirc(char c)
2215 //{
2216 // switch(c)
2217 // {
2218 // case 'A' : t << '\302'; break;
2219 // case 'E' : t << '\312'; break;
2220 // case 'I' : t << '\316'; break;
2221 // case 'O' : t << '\324'; break;
2222 // case 'U' : t << '\333'; break;
2223 // case 'a' : t << '\342'; break;
2224 // case 'e' : t << '\352'; break;
2225 // case 'i' : t << '\356'; break;
2226 // case 'o' : t << '\364'; break;
2227 // case 'u' : t << '\373'; break;
2228 // default: t << '?'; break;
2229 // }
2230 //}
2231 //
2232 //void RTFGenerator::writeTilde(char c)
2233 //{
2234 // switch(c)
2235 // {
2236 // case 'A' : t << '\303'; break;
2237 // case 'N' : t << '\321'; break;
2238 // case 'O' : t << '\325'; break;
2239 // case 'a' : t << '\343'; break;
2240 // case 'n' : t << '\361'; break;
2241 // case 'o' : t << '\365'; break;
2242 // default: t << '?'; break;
2243 // }
2244 //}
2245 //
2246 //void RTFGenerator::writeRing(char c)
2247 //{
2248 // switch(c)
2249 // {
2250 // case 'A' : t << '\305'; break;
2251 // case 'a' : t << '\345'; break;
2252 // default: t << '?'; break;
2253 // }
2254 //}
2255 //
2256 //void RTFGenerator::writeCCedil(char c)
2257 //{
2258 // switch(c)
2259 // {
2260 // case 'C' : t << '\307'; break;
2261 // case 'c' : t << '\347'; break;
2262 // default: t << '?'; break;
2263 // }
2264 //}
2265 //
2266 
2267 bool isLeadBytes(int c)
2268 {
2269  bool result;
2270 
2271  QCString codePage = theTranslator->trRTFansicp();
2272 
2273  if (codePage == "932") // cp932 (Japanese Shift-JIS)
2274  {
2275  result = (0x81<=c && c<=0x9f) || (0xe0<=c && c<=0xfc);
2276  }
2277  else if (codePage == "936") // cp936 (Simplified Chinese GBK)
2278  {
2279  result = 0x81<=c && c<=0xFE;
2280  }
2281  else if (codePage == "949") // cp949 (Korean)
2282  {
2283  result = 0x81<=c && c<=0xFE;
2284  }
2285  else if (codePage == "950") // cp950 (Traditional Chinese Big5)
2286  {
2287  result = 0x81<=c && c<=0xFE;
2288  }
2289  else // for SBCS Codepages (cp1252,1251 etc...)
2290  {
2291  result = false;
2292  }
2293 
2294  return result;
2295 }
2296 
2297 
2298 // note: function is not reentrant!
2299 static void encodeForOutput(FTextStream &t,const char *s)
2300 {
2301  if (s==0) return;
2303  bool converted=FALSE;
2304  int l = qstrlen(s);
2305  static QByteArray enc;
2306  if (l*4>(int)enc.size()) enc.resize(l*4); // worst case
2307  encoding.sprintf("CP%s",theTranslator->trRTFansicp().data());
2308  if (!encoding.isEmpty())
2309  {
2310  // convert from UTF-8 back to the output encoding
2311  void *cd = portable_iconv_open(encoding,"UTF-8");
2312  if (cd!=(void *)(-1))
2313  {
2314  size_t iLeft=l;
2315  size_t oLeft=enc.size();
2316  char *inputPtr = (char*)s;
2317  char *outputPtr = enc.data();
2318  if (!portable_iconv(cd, &inputPtr, &iLeft, &outputPtr, &oLeft))
2319  {
2320  enc.resize(enc.size()-(unsigned int)oLeft);
2321  converted=TRUE;
2322  }
2324  }
2325  }
2326  if (!converted) // if we did not convert anything, copy as is.
2327  {
2328  memcpy(enc.data(),s,l);
2329  enc.resize(l);
2330  }
2331  uint i;
2332  bool multiByte = FALSE;
2333 
2334  for (i=0;i<enc.size();i++)
2335  {
2336  uchar c = (uchar)enc.at(i);
2337 
2338  if (c>=0x80 || multiByte)
2339  {
2340  char esc[10];
2341  sprintf(esc,"\\'%X",c); // escape sequence for SBCS and DBCS(1st&2nd bytes).
2342  t << esc;
2343 
2344  if (!multiByte)
2345  {
2346  multiByte = isLeadBytes(c); // It may be DBCS Codepages.
2347  }
2348  else
2349  {
2350  multiByte = FALSE; // end of Double Bytes Character.
2351  }
2352  }
2353  else
2354  {
2355  t << (char)c;
2356  }
2357  }
2358 }
2359 
2360 /**
2361  * VERY brittle routine inline RTF's included by other RTF's.
2362  * it is recursive and ugly.
2363  */
2364 static bool preProcessFile(QDir &d,QCString &infName, FTextStream &t, bool bIncludeHeader=TRUE)
2365 {
2366  QFile f(infName);
2367  if (!f.open(IO_ReadOnly))
2368  {
2369  err("problems opening rtf file %s for reading\n",infName.data());
2370  return FALSE;
2371  }
2372 
2373  const int maxLineLength = 10240;
2374  static QCString lineBuf(maxLineLength);
2375 
2376  // scan until find end of header
2377  // this is EXTREEEEEEEMLY brittle. It works on OUR rtf
2378  // files because the first line before the body
2379  // ALWAYS contains "{\comment begin body}"
2380  int len;
2381  for(;;)
2382  {
2383  lineBuf.resize(maxLineLength);
2384  if ((len=f.readLine(lineBuf.rawData(),maxLineLength))==-1)
2385  {
2386  err("read error in %s before end of RTF header!\n",infName.data());
2387  return FALSE;
2388  }
2389  lineBuf.resize(len+1);
2390  if (lineBuf.find("\\comment begin body")!=-1) break;
2391  if (bIncludeHeader) encodeForOutput(t,lineBuf.data());
2392  }
2393 
2394 
2395  lineBuf.resize(maxLineLength);
2396  while ((len=f.readLine(lineBuf.rawData(),maxLineLength))!=-1)
2397  {
2398  lineBuf.resize(len+1);
2399  int pos;
2400  if ((pos=lineBuf.find("INCLUDETEXT"))!=-1)
2401  {
2402  int startNamePos = lineBuf.find('"',pos)+1;
2403  int endNamePos = lineBuf.find('"',startNamePos);
2404  QCString fileName = lineBuf.mid(startNamePos,endNamePos-startNamePos);
2405  DBG_RTF(t << "{\\comment begin include " << fileName << "}" << endl)
2406  if (!preProcessFile(d,fileName,t,FALSE)) return FALSE;
2407  DBG_RTF(t << "{\\comment end include " << fileName << "}" << endl)
2408  }
2409  else // no INCLUDETEXT on this line
2410  {
2411  // elaborate hoopla to skip the final "}" if we didn't include the
2412  // headers
2413  if (!f.atEnd() || bIncludeHeader)
2414  {
2415  encodeForOutput(t,lineBuf);
2416  }
2417  else // last line of included file
2418  {
2419  // null terminate at the last '}'
2420  //char *str = strrchr(buffer,'}');
2421  int pos = lineBuf.findRev('}');
2422 
2423  if (pos != -1)
2424  lineBuf.at(pos) = '\0';
2425  else
2426  err("Strange, the last char was not a '}'\n");
2427  encodeForOutput(t,lineBuf);
2428  }
2429  }
2430  lineBuf.resize(maxLineLength);
2431  }
2432  f.close();
2433  // remove temporary file
2434  d.remove(infName);
2435  return TRUE;
2436 }
2437 
2439 {
2440  DBG_RTF(t << "{\\comment (startDotGraph)}" << endl)
2441 }
2442 
2444 {
2445  newParagraph();
2446 
2447  QCString fn =
2449 
2450  // display the file
2451  t << "{" << endl;
2452  t << rtf_Style_Reset << endl;
2453  t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
2454  QCString imgExt = getDotImageExtension();
2455  t << fn << "." << imgExt;
2456  t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
2457  t << "}" << endl;
2458  newParagraph();
2459  DBG_RTF(t << "{\\comment (endDotGraph)}" << endl)
2460 }
2461 
2463 {
2464  DBG_RTF(t << "{\\comment (startInclDepGraph)}" << endl)
2465 }
2466 
2468 {
2469  newParagraph();
2470 
2473 
2474  // display the file
2475  t << "{" << endl;
2476  t << rtf_Style_Reset << endl;
2477  t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
2478  QCString imgExt = getDotImageExtension();
2479  t << fn << "." << imgExt;
2480  t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
2481  t << "}" << endl;
2482  DBG_RTF(t << "{\\comment (endInclDepGraph)}" << endl)
2483 }
2484 
2486 {
2487 }
2488 
2490 {
2491 }
2492 
2494 {
2495  DBG_RTF(t << "{\\comment (startCallGraph)}" << endl)
2496 }
2497 
2499 {
2500  newParagraph();
2501 
2504 
2505  // display the file
2506  t << "{" << endl;
2507  t << rtf_Style_Reset << endl;
2508  t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
2509  QCString imgExt = getDotImageExtension();
2510  t << fn << "." << imgExt;
2511  t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
2512  t << "}" << endl;
2513  DBG_RTF(t << "{\\comment (endCallGraph)}" << endl)
2514 }
2515 
2517 {
2518  DBG_RTF(t << "{\\comment (startDirDepGraph)}" << endl)
2519 }
2520 
2522 {
2523  newParagraph();
2524 
2527 
2528  // display the file
2529  t << "{" << endl;
2530  t << rtf_Style_Reset << endl;
2531  t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
2532  QCString imgExt = getDotImageExtension();
2533  t << fn << "." << imgExt;
2534  t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
2535  t << "}" << endl;
2536  DBG_RTF(t << "{\\comment (endDirDepGraph)}" << endl)
2537 }
2538 
2539 /** Tests the integrity of the result by counting brackets.
2540  *
2541  */
2542 void testRTFOutput(const char *name)
2543 {
2544  int bcount=0;
2545  int line=1;
2546  int c;
2547  QFile f(name);
2548  if (f.open(IO_ReadOnly))
2549  {
2550  while ((c=f.getch())!=-1)
2551  {
2552  if (c=='\\') // escape char
2553  {
2554  c=f.getch();
2555  if (c==-1) break;
2556  }
2557  else if (c=='{') // open bracket
2558  {
2559  bcount++;
2560  }
2561  else if (c=='}') // close bracket
2562  {
2563  bcount--;
2564  if (bcount<0)
2565  {
2566  goto err;
2567  break;
2568  }
2569  }
2570  else if (c=='\n') // newline
2571  {
2572  line++;
2573  }
2574  }
2575  }
2576  if (bcount==0) return; // file is OK.
2577 err:
2578  err("RTF integrity test failed at line %d of %s due to a bracket mismatch.\n"
2579  " Please try to create a small code example that produces this error \n"
2580  " and send that to dimitri@stack.nl.\n",line,name);
2581 }
2582 
2583 /**
2584  * This is an API to a VERY brittle RTF preprocessor that combines nested
2585  * RTF files. This version replaces the infile with the new file
2586  */
2587 bool RTFGenerator::preProcessFileInplace(const char *path,const char *name)
2588 {
2589  QDir d(path);
2590  // store the original directory
2591  if (!d.exists())
2592  {
2593  err("Output dir %s does not exist!\n",path);
2594  return FALSE;
2595  }
2596  QCString oldDir = QDir::currentDirPath().utf8();
2597 
2598  // go to the html output directory (i.e. path)
2600  QDir thisDir;
2601 
2602  QCString combinedName = (QCString)path+"/combined.rtf";
2603  QCString mainRTFName = (QCString)path+"/"+name;
2604 
2605  QFile outf(combinedName);
2606  if (!outf.open(IO_WriteOnly))
2607  {
2608  err("Failed to open %s for writing!\n",combinedName.data());
2609  QDir::setCurrent(oldDir);
2610  return FALSE;
2611  }
2612  FTextStream outt(&outf);
2613 
2614  if (!preProcessFile(thisDir,mainRTFName,outt))
2615  {
2616  // it failed, remove the temp file
2617  outf.close();
2618  thisDir.remove(combinedName);
2619  QDir::setCurrent(oldDir);
2620  return FALSE;
2621  }
2622 
2623  // everything worked, move the files
2624  outf.close();
2625  thisDir.remove(mainRTFName);
2626  thisDir.rename(combinedName,mainRTFName);
2627 
2628  testRTFOutput(mainRTFName);
2629 
2630  QDir::setCurrent(oldDir);
2631  return TRUE;
2632 }
2633 
2635 {
2636  DBG_RTF(t << "{\\comment startMemberGroupHeader}" << endl)
2637  t << "{" << endl;
2638  if (hasHeader) incrementIndentLevel();
2639  t << rtf_Style_Reset << rtf_Style["GroupHeader"]->reference;
2640 }
2641 
2643 {
2644  DBG_RTF(t << "{\\comment endMemberGroupHeader}" << endl)
2645  newParagraph();
2647 }
2648 
2650 {
2651  DBG_RTF(t << "{\\comment startMemberGroupDocs}" << endl)
2652  startEmphasis();
2653 }
2654 
2656 {
2657  DBG_RTF(t << "{\\comment endMemberGroupDocs}" << endl)
2658  endEmphasis();
2659  newParagraph();
2660 }
2661 
2663 {
2664  DBG_RTF(t << "{\\comment startMemberGroup}" << endl)
2666 }
2667 
2668 void RTFGenerator::endMemberGroup(bool hasHeader)
2669 {
2670  DBG_RTF(t << "{\\comment endMemberGroup}" << endl)
2671  if (hasHeader) decrementIndentLevel();
2672  t << "}";
2673 }
2674 
2675 void RTFGenerator::startSimpleSect(SectionTypes,const char *file,const char *anchor,const char *title)
2676 {
2677  DBG_RTF(t << "{\\comment (startSimpleSect)}" << endl)
2678  t << "{"; // ends at endDescList
2679  t << "{"; // ends at endDescTitle
2680  startBold();
2681  newParagraph();
2682  if (file)
2683  {
2684  writeObjectLink(0,file,anchor,title);
2685  }
2686  else
2687  {
2688  docify(title);
2689  }
2690  endBold();
2691  t << "}";
2692  newParagraph();
2695 }
2696 
2698 {
2699  DBG_RTF(t << "{\\comment (endSimpleSect)}" << endl)
2701  newParagraph();
2704  t << "}";
2705 }
2706 
2708 {
2709  DBG_RTF(t << "{\\comment (startParamList)}" << endl)
2710  t << "{"; // ends at endParamList
2711  t << "{"; // ends at endDescTitle
2712  startBold();
2713  newParagraph();
2714  docify(title);
2715  endBold();
2716  t << "}";
2717  newParagraph();
2720 }
2721 
2723 {
2724  DBG_RTF(t << "{\\comment (endParamList)}" << endl)
2725  newParagraph();
2728  t << "}";
2729 }
2730 
2731 void RTFGenerator::startParameterType(bool first,const char *key)
2732 {
2733  DBG_RTF(t << "{\\comment (startParameterType)}" << endl)
2734  if (!first && key)
2735  {
2736  t << " " << key << " ";
2737  }
2738 }
2739 
2741 {
2742  DBG_RTF(t << "{\\comment (endParameterType)}" << endl)
2743  t << " ";
2744 }
2745 
2746 void RTFGenerator::exceptionEntry(const char* prefix,bool closeBracket)
2747 {
2748  DBG_RTF(t << "{\\comment (exceptionEntry)}" << endl)
2749  if (prefix)
2750  t << " " << prefix;
2751  else if (closeBracket)
2752  t << ")";
2753  t << " ";
2754 }
2755 
2757 {
2758  RTFDocVisitor *visitor = new RTFDocVisitor(t,*this,ctx?ctx->getDefFileExtension():QCString(""));
2759  n->accept(visitor);
2760  delete visitor;
2762 }
2763 
2765 {
2766  DBG_RTF(t << "{\\comment (rtfwriteRuler_doubleline)}" << endl)
2767  t << "{\\pard\\widctlpar\\brdrb\\brdrdb\\brdrw15\\brsp20 \\adjustright \\par}" << endl;
2768 }
2769 
2771 {
2772  DBG_RTF(t << "{\\comment (rtfwriteRuler_emboss)}" << endl)
2773  t << "{\\pard\\widctlpar\\brdrb\\brdremboss\\brdrw15\\brsp20 \\adjustright \\par}" << endl;
2774 }
2775 
2777 {
2778  DBG_RTF(t << "{\\comment (rtfwriteRuler_thick)}" << endl)
2779  t << "{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw75\\brsp20 \\adjustright \\par}" << endl;
2780 }
2781 
2783 {
2784  DBG_RTF(t << "{\\comment (rtfwriteRuler_thin)}" << endl)
2785  t << "{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw5\\brsp20 \\adjustright \\par}" << endl;
2786 }
2787 
2788 #if 0
2789 void RTFGenerator::postProcess(QByteArray &a)
2790 {
2791  QByteArray enc(a.size()*4); // worst case
2792  int off=0;
2793  uint i;
2794  bool mbFlag=FALSE;
2795  for (i=0;i<a.size();i++)
2796  {
2797  unsigned char c = (unsigned char)a.at(i);
2798 
2799  // treat characters > 0x80 as multibyte characters, except when they
2800  // are control characters
2801  if (c>0x80 || (mbFlag && c!='\\' && c!='{' && c!='}'))
2802  {
2803  char s[10];
2804  sprintf(s,"\\'%X",c);
2805  qstrcpy(enc.data()+off,s);
2806  off+=qstrlen(s);
2807  mbFlag=c>0x80;
2808  }
2809  else
2810  {
2811  enc.at(off++)=c;
2812  }
2813  }
2814  enc.resize(off);
2815  a = enc;
2816 }
2817 #endif
2818 
2819 void RTFGenerator::startConstraintList(const char *header)
2820 {
2821  DBG_RTF(t << "{\\comment (startConstraintList)}" << endl)
2822  t << "{"; // ends at endConstraintList
2823  t << "{";
2824  startBold();
2825  newParagraph();
2826  docify(header);
2827  endBold();
2828  t << "}";
2829  newParagraph();
2832 }
2833 
2835 {
2836  DBG_RTF(t << "{\\comment (startConstraintParam)}" << endl)
2837  startEmphasis();
2838 }
2839 
2841 {
2842  DBG_RTF(t << "{\\comment (endConstraintParam)}" << endl)
2843  endEmphasis();
2844  t << " : ";
2845 }
2846 
2848 {
2849  DBG_RTF(t << "{\\comment (startConstraintType)}" << endl)
2850  startEmphasis();
2851 }
2852 
2854 {
2855  DBG_RTF(t << "{\\comment (endConstraintType)}" << endl)
2856  endEmphasis();
2857  t << " ";
2858 }
2859 
2861 {
2862  DBG_RTF(t << "{\\comment (startConstraintDocs)}" << endl)
2863 }
2864 
2866 {
2867  DBG_RTF(t << "{\\comment (endConstraintDocs)}" << endl)
2868  newParagraph();
2869 }
2870 
2872 {
2873  DBG_RTF(t << "{\\comment (endConstraintList)}" << endl)
2874  newParagraph();
2877  t << "}";
2878 }
2879 
2881 {
2882  DBG_RTF(t << "{\\comment (startIndexListItem)}" << endl)
2883 }
2884 
2886 {
2887  DBG_RTF(t << "{\\comment (endIndexListItem)}" << endl)
2888  t << "\\par" << endl;
2889 }
2890 
2892 {
2893  DBG_RTF(t << "{\\comment (startInlineHeader)}" << endl)
2894  t << "{" << endl;
2895  t << rtf_Style_Reset << rtf_Style["Heading5"]->reference;
2896  startBold();
2897 }
2898 
2900 {
2901  DBG_RTF(t << "{\\comment (endInlineHeader)}" << endl)
2902  endBold();
2903  t << "\\par";
2904  t << "}" << endl;
2905 }
2906 
2908 {
2909  DBG_RTF(t << "{\\comment (startMemberDocSimple)}" << endl)
2910  t << "{\\par" << endl;
2911  t << "{" << rtf_Style["Heading5"]->reference << endl;
2912  t << theTranslator->trCompoundMembers() << ":\\par}" << endl;
2914  t << "\\trowd \\trgaph108\\trleft426\\tblind426"
2915  "\\trbrdrt\\brdrs\\brdrw10\\brdrcf15 "
2916  "\\trbrdrl\\brdrs\\brdrw10\\brdrcf15 "
2917  "\\trbrdrb\\brdrs\\brdrw10\\brdrcf15 "
2918  "\\trbrdrr\\brdrs\\brdrw10\\brdrcf15 "
2919  "\\trbrdrh\\brdrs\\brdrw10\\brdrcf15 "
2920  "\\trbrdrv\\brdrs\\brdrw10\\brdrcf15 "<< endl;
2921  int i,columnPos[3] = { 25, 50, 100 };
2922  for (i=0;i<3;i++)
2923  {
2924  t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10\\brdrcf15 "
2925  "\\clbrdrl\\brdrs\\brdrw10\\brdrcf15 "
2926  "\\clbrdrb\\brdrs\\brdrw10\\brdrcf15 "
2927  "\\clbrdrr \\brdrs\\brdrw10\\brdrcf15 "
2928  "\\cltxlrtb "
2929  "\\cellx" << (rtf_pageWidth*columnPos[i]/100) << endl;
2930  }
2931  t << "\\pard \\widctlpar\\intbl\\adjustright" << endl;
2932 }
2933 
2935 {
2936  DBG_RTF(t << "{\\comment (endMemberDocSimple)}" << endl)
2937  t << "}" << endl;
2938 }
2939 
2941 {
2942  DBG_RTF(t << "{\\comment (startInlineMemberType)}" << endl)
2943  t << "{\\qr ";
2944 }
2945 
2947 {
2948  DBG_RTF(t << "{\\comment (endInlineMemberType)}" << endl)
2949  t << "\\cell }";
2950 }
2951 
2953 {
2954  DBG_RTF(t << "{\\comment (startInlineMemberName)}" << endl)
2955  t << "{";
2956 }
2957 
2959 {
2960  DBG_RTF(t << "{\\comment (endInlineMemberName)}" << endl)
2961  t << "\\cell }";
2962 }
2963 
2965 {
2966  DBG_RTF(t << "{\\comment (startInlineMemberDoc)}" << endl)
2967  t << "{";
2968 }
2969 
2971 {
2972  DBG_RTF(t << "{\\comment (endInlineMemberDoc)}" << endl)
2973  t << "\\cell }{\\row }" << endl;
2974 }
2975 
2977 {
2978 }
2979 
2980 void RTFGenerator::writeLabel(const char *l,bool isLast)
2981 {
2982  t << "{\\f2 [" << l << "]}";
2983  if (!isLast) t << ", ";
2984 }
2985 
2987 {
2988 }
2989 
2990 
2991 
static QCString name
Definition: declinfo.cpp:673
void startTextBlock(bool dense)
Definition: rtfgen.cpp:2095
Traverses directory structures and contents in a platform-independent way.
Definition: qdir.h:52
bool resize(uint newlen)
Definition: qcstring.h:225
static GroupSDict * groupSDict
Definition: doxygen.h:119
void endPlainFile()
Definition: outputgen.cpp:55
static QCString dateToRTFDateString()
Definition: rtfgen.cpp:50
virtual QCString trHierarchicalIndex()=0
char * rawData() const
Definition: qcstring.h:216
QCString rtf_comments
Definition: rtfstyle.cpp:32
void endDescTableTitle()
Definition: rtfgen.cpp:2012
bool isLinkableInProject() const
Definition: classdef.cpp:2707
void docify(const char *text)
Definition: rtfgen.cpp:1742
virtual QCString trRTFTableOfContents()=0
~RTFGenerator()
Definition: rtfgen.cpp:72
void beginRTFDocument()
Definition: rtfgen.cpp:212
bool isLeadBytes(int c)
Definition: rtfgen.cpp:2267
void startSubsection()
Definition: rtfgen.cpp:1187
void startDescForItem()
Definition: rtfgen.cpp:1645
void startInlineMemberName()
Definition: rtfgen.cpp:2952
static constexpr double g
Definition: Units.h:144
static PageSDict * exampleSDict
Definition: doxygen.h:101
static QCString result
bool isEmpty() const
Definition: qcstring.h:189
virtual bool remove(const QString &fileName, bool acceptAbsPath=TRUE)
Definition: qdir.cpp:915
void startFile(const char *name, const char *manName, const char *title)
Definition: rtfgen.cpp:332
void startGroupHeader(int)
Definition: rtfgen.cpp:1454
void writePageLink(const char *, bool)
Definition: rtfgen.cpp:918
void startMemberDoc(const char *, const char *, const char *, const char *, bool)
Definition: rtfgen.cpp:1481
void startTextLink(const char *f, const char *anchor)
Definition: rtfgen.cpp:1293
void msg(const char *fmt,...)
Definition: message.cpp:107
static void writeExtensionsFile(QFile &file)
Definition: rtfgen.cpp:113
#define DBG_RTF(x)
Definition: rtfgen.cpp:48
void startTitle()
Definition: rtfgen.cpp:1445
void testRTFOutput(const char *name)
Definition: rtfgen.cpp:2542
#define IO_WriteOnly
Definition: qiodevice.h:62
bool generateSourceFile() const
Definition: filedef.cpp:1396
void rtfwriteRuler_doubleline()
Definition: rtfgen.cpp:2764
void startMemberDescription(const char *, const char *)
Definition: rtfgen.cpp:1606
void endDotGraph(const DotClassGraph &)
Definition: rtfgen.cpp:2443
QCString getOutputFileBase() const
void startTypewriter()
Definition: rtfgen.h:94
bool resize(uint size)
Definition: qarray.h:69
virtual QCString trModuleIndex()=0
QCString rtf_documentId
Definition: rtfstyle.cpp:38
void endDescForItem()
Definition: rtfgen.cpp:1650
QDict< StyleData > rtf_Style
const char * rtf_Code_DepthStyle()
Definition: rtfgen.cpp:2089
void startItemListItem()
Definition: rtfgen.cpp:1018
QTime time() const
Definition: qdatetime.h:172
void endMemberItem()
Definition: rtfgen.cpp:1863
char & at(uint i) const
Definition: qcstring.h:326
QCString rtf_documentType
Definition: rtfstyle.cpp:37
virtual QCString trCompoundIndexFortran()=0
void startConstraintParam()
Definition: rtfgen.cpp:2834
void beginRTFChapter()
Definition: rtfgen.cpp:292
void endInlineMemberDoc()
Definition: rtfgen.cpp:2970
virtual QCString trCompoundIndex()=0
const char * rtf_EList_DepthStyle()
Definition: rtfgen.cpp:2077
void endTextBlock(bool)
Definition: rtfgen.cpp:2110
void endDescription()
Definition: rtfgen.cpp:1585
void startMemberDocSimple()
Definition: rtfgen.cpp:2907
size_t portable_iconv(void *cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Definition: portable_c.c:24
DocText * validatingParseText(const char *input)
Definition: docparser.cpp:7381
IndexSections
Definition: index.h:157
const bool FALSE
Definition: qglobal.h:370
void writeAnchor(const char *fileName, const char *name)
Definition: rtfgen.cpp:1869
static FileNameList * inputNameList
Definition: doxygen.h:109
void writeString(const char *text)
Definition: rtfgen.cpp:950
void decrementIndentLevel()
Definition: rtfgen.cpp:2045
static bool preProcessFileInplace(const char *path, const char *name)
Definition: rtfgen.cpp:2587
void endGroupCollaboration(const DotGroupCollaboration &g)
Definition: rtfgen.cpp:2489
QCString rtf_manager
Definition: rtfstyle.cpp:36
QCString rtf_subject
Definition: rtfstyle.cpp:31
int readLine(char *data, uint maxlen)
Definition: qfile.cpp:268
const char * rtf_DList_DepthStyle()
Definition: rtfgen.cpp:2083
const char * name
Definition: rtfstyle.h:51
Definition: qarray.h:46
void endDoxyAnchor(const char *, const char *)
Definition: rtfgen.cpp:1520
void endConstraintType()
Definition: rtfgen.cpp:2853
QCString left(uint len) const
Definition: qcstring.cpp:213
int m_numCols
Definition: rtfgen.h:285
virtual bool isReference() const
void startTitleHead(const char *)
Definition: rtfgen.cpp:1411
const char * rtf_BList_DepthStyle()
Definition: rtfgen.cpp:2070
QCString relativePathToRoot(const char *name)
Definition: util.cpp:5436
static QCString trDesignUnitIndex()
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
int find(char c, int index=0, bool cs=TRUE) const
Definition: qcstring.cpp:41
virtual QCString trModuleDocumentation()=0
void writeDoc(DocNode *, Definition *, MemberDef *)
Definition: rtfgen.cpp:2756
static QStrList * l
Definition: config.cpp:1044
virtual QString absPath() const
Definition: qdir.cpp:276
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition: qcstring.cpp:95
QCString relPath
Definition: rtfgen.h:286
void endMemberDoc(bool)
Definition: rtfgen.cpp:1501
void startSimpleSect(SectionTypes, const char *, const char *, const char *)
Definition: rtfgen.cpp:2675
void endConstraintList()
Definition: rtfgen.cpp:2871
unsigned char uchar
Definition: nybbler.cc:11
void startInlineMemberType()
Definition: rtfgen.cpp:2940
void startInclDepGraph()
Definition: rtfgen.cpp:2462
void endDirDepGraph(const DotDirDeps &g)
Definition: rtfgen.cpp:2521
void loadStylesheet(const char *name, QDict< StyleData > &dict)
Definition: rtfstyle.cpp:428
QCString getDefFileExtension() const
RTFGenerator()
Definition: rtfgen.cpp:60
#define IO_ReadOnly
Definition: qiodevice.h:61
virtual QCString trPageIndex()=0
int portable_iconv_close(void *cd)
Definition: portable_c.c:30
#define Config_getInt(val)
Definition: config.cpp:661
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
static NamespaceSDict * namespaceSDict
Definition: doxygen.h:120
int hour() const
Definition: qdatetime.cpp:648
type * data() const
Definition: qarray.h:63
QCString writeGraph(FTextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const char *path, const char *fileName, const char *relPath, bool TBRank=TRUE, bool imageMap=TRUE, int graphId=-1) const
Definition: dot.cpp:3133
void endLabels()
Definition: rtfgen.cpp:2986
ClassDef * templateMaster() const
Definition: classdef.cpp:4439
void startConstraintList(const char *)
Definition: rtfgen.cpp:2819
RTFListItemInfo rtf_listItemInfo[rtf_maxIndentLevels]
Definition: rtfstyle.cpp:28
def cli(ctx)
Definition: main.py:7
void startConstraintType()
Definition: rtfgen.cpp:2847
Definition: sortdict.h:73
bool fill(const type &d, int size=-1)
Definition: qarray.h:71
void startIndexItem(const char *ref, const char *file)
Definition: rtfgen.cpp:1041
void startSection(const char *, const char *, SectionInfo::SectionType)
Definition: rtfgen.cpp:1665
void endMemberGroupDocs()
Definition: rtfgen.cpp:2655
void startCodeFragment()
Definition: rtfgen.cpp:1897
void startIndexList()
Definition: rtfgen.cpp:955
virtual bool mkdir(const QString &dirName, bool acceptAbsPath=TRUE) const
Definition: qdir_unix.cpp:98
virtual QCString trMainPage()=0
QAsciiDict< Entry > fn
static void encodeForOutput(FTextStream &t, const char *s)
Definition: rtfgen.cpp:2299
int getch()
Definition: qfile.cpp:337
const char * rtf_CList_DepthStyle()
Definition: rtfgen.cpp:2056
Q_EXPORT uint qstrlen(const char *str)
Definition: qcstring.h:81
void endBold()
Definition: rtfgen.h:135
void startPlainFile(const char *name)
Definition: outputgen.cpp:42
void startMemberGroupHeader(bool)
Definition: rtfgen.cpp:2634
virtual QCString trFileDocumentation()=0
void endDescItem()
Definition: rtfgen.cpp:1599
bool isLinkableInProject() const
Definition: filedef.cpp:1877
void writeImage(FTextStream &t, const char *path, const char *relPath, const char *file, bool generateMap=TRUE) const
Definition: diagram.cpp:1353
void startMemberList()
Definition: rtfgen.cpp:1923
def key(type, name=None)
Definition: graph.py:13
virtual QCString trDirDocumentation()=0
void startDescTableData()
Definition: rtfgen.cpp:2020
void endDescTable()
Definition: rtfgen.cpp:1994
void rtfwriteRuler_thick()
Definition: rtfgen.cpp:2776
virtual QCString trDirIndex()=0
QCString getSourceFileBase() const
Definition: filedef.cpp:1771
QCString right(uint len) const
Definition: qcstring.cpp:231
std::void_t< T > n
void endIndexItem(const char *ref, const char *file)
Definition: rtfgen.cpp:1052
const double a
const char * writeUtf8Char(FTextStream &t, const char *s)
Definition: util.cpp:7165
bool open(int)
Definition: qfile_unix.cpp:134
void startIndexKey()
Definition: rtfgen.cpp:1150
static DirSDict * directories
Definition: doxygen.h:139
void startSubsubsection()
Definition: rtfgen.cpp:1202
static QString currentDirPath()
Definition: qdir_unix.cpp:141
void addIndexItem(const char *, const char *)
Definition: rtfgen.cpp:1548
char versionString[]
Definition: version.cpp:1
QCString rtf_logoFilename
Definition: rtfstyle.cpp:34
QCString rtf_author
Definition: rtfstyle.cpp:35
void endPageRef(const char *, const char *)
Definition: rtfgen.cpp:1362
const char * definition
Definition: rtfstyle.h:53
int m_listLevel
Definition: rtfgen.h:283
void startParagraph()
Definition: rtfgen.cpp:2128
void endInlineMemberType()
Definition: rtfgen.cpp:2946
void writeRTFReference(const char *label)
Definition: rtfgen.cpp:1890
virtual QCString trClassDocumentation()=0
const char * rtf_LCList_DepthStyle()
Definition: rtfgen.cpp:2063
void endIndent()
Definition: rtfgen.cpp:1571
p
Definition: test.py:223
virtual QCString trFileIndex()=0
unsigned index
Definition: rtfstyle.h:66
A bunch of utility functions.
Concrete visitor implementation for RTF output.
Definition: rtfdocvisitor.h:30
void startMemberSubtitle()
Definition: rtfgen.cpp:2142
const char * data() const
Definition: qcstring.h:207
bool isEmbeddedInOuterScope() const
Definition: classdef.cpp:4630
Definition: dirdef.h:44
void endSubsection()
Definition: rtfgen.cpp:1196
void endSection(const char *, SectionInfo::SectionType)
Definition: rtfgen.cpp:1690
void startDoxyAnchor(const char *, const char *, const char *, const char *, const char *)
Definition: rtfgen.cpp:1512
QCString dateToString(bool includeTime)
Definition: util.cpp:2473
#define Config_getString(val)
Definition: config.cpp:660
type * current() const
Definition: qlist.h:146
void * portable_iconv_open(const char *tocode, const char *fromcode)
Definition: portable_c.c:19
virtual QCString trVersion()=0
#define Config_getBool(val)
Definition: config.cpp:664
virtual QCString trRTFansicp()=0
QCString getDotImageExtension(void)
Definition: util.cpp:8562
void endEmphasis()
Definition: rtfgen.h:133
void writeLabel(const char *l, bool isLast)
Definition: rtfgen.cpp:2980
QFile * file
Definition: outputgen.h:487
void endIndexValue(const char *, bool)
Definition: rtfgen.cpp:1168
static void init()
Definition: rtfgen.cpp:166
bool m_omitParagraph
Definition: rtfgen.h:284
bool isLinkableInProject() const
Definition: dirdef.cpp:58
QCString rtf_keywords
Definition: rtfstyle.cpp:39
void err(const char *fmt,...)
Definition: message.cpp:226
void endSimpleSect()
Definition: rtfgen.cpp:2697
void lastIndexPage()
Definition: rtfgen.cpp:926
void endTypewriter()
Definition: rtfgen.h:95
int minute() const
Definition: qdatetime.cpp:657
void startConstraintDocs()
Definition: rtfgen.cpp:2860
void endTitleHead(const char *, const char *name)
Definition: rtfgen.cpp:1419
void endHtmlLink()
Definition: rtfgen.cpp:1091
void beginRTFSection()
Definition: rtfgen.cpp:312
QCString mid(uint index, uint len=0xffffffff) const
Definition: qcstring.cpp:246
char rtf_Style_Reset[]
Definition: rtfstyle.cpp:41
QCString getOutputFileBase() const
Definition: filedef.h:83
The QDateTime class provides date and time functions.
Definition: qdatetime.h:161
void lineBreak(const char *style=0)
Definition: rtfgen.cpp:943
void exceptionEntry(const char *, bool)
Definition: rtfgen.cpp:2746
void endProjectNumber()
Definition: rtfgen.cpp:357
The QFile class is an I/O device that operates on files.
Definition: qfile.h:50
virtual QCString trExampleDocumentation()=0
void startMemberGroup()
Definition: rtfgen.cpp:2662
void startItemList()
Definition: rtfgen.cpp:978
virtual QCString trRTFCharSet()=0
QCString & sprintf(const char *format,...)
Definition: qcstring.cpp:27
QCString fileName
Definition: outputgen.h:488
void endParamList()
Definition: rtfgen.cpp:2722
void endInlineHeader()
Definition: rtfgen.cpp:2899
void rtfwriteRuler_emboss()
Definition: rtfgen.cpp:2770
void startEmphasis()
Definition: rtfgen.h:132
QCString dir
Definition: outputgen.h:489
QCString getOutputFileBase() const
Definition: classdef.cpp:3533
void endIndexList()
Definition: rtfgen.cpp:965
void endMemberList()
Definition: rtfgen.cpp:1934
void startBold()
Definition: rtfgen.h:134
const int rtf_pageWidth
Definition: rtfstyle.h:26
void startIndexSection(IndexSections)
Definition: rtfgen.cpp:362
void startInlineHeader()
Definition: rtfgen.cpp:2891
auto array(Array const &a)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:228
void startParameterType(bool, const char *)
Definition: rtfgen.cpp:2731
void endConstraintParam()
Definition: rtfgen.cpp:2840
void writeObjectLink(const char *ref, const char *file, const char *anchor, const char *name)
Definition: rtfgen.cpp:1323
QCString getOutputFileBase() const
Definition: dirdef.cpp:113
QCString writeGraph(FTextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const char *path, const char *fileName, const char *relPath, bool writeImageMap=TRUE, int graphId=-1) const
Definition: dot.cpp:3824
void startDescItem()
Definition: rtfgen.cpp:1592
void startDescList(SectionTypes)
Definition: rtfgen.cpp:1626
FTextStream t
Definition: outputgen.h:486
virtual QCString trNamespaceIndex()=0
void endIndexListItem()
Definition: rtfgen.cpp:2885
QDate date() const
Definition: qdatetime.h:171
void codify(const char *text)
Definition: rtfgen.cpp:1787
void startGroupCollaboration()
Definition: rtfgen.cpp:2485
void startCallGraph()
Definition: rtfgen.cpp:2493
static QCString encoding
Definition: config.cpp:1052
void endTextLink()
Definition: rtfgen.cpp:1315
void endInclDepGraph(const DotInclDepGraph &)
Definition: rtfgen.cpp:2467
Definition: dot.h:43
void writeEndAnnoItem(const char *name)
Definition: rtfgen.cpp:1134
void endMemberGroup(bool)
Definition: rtfgen.cpp:2668
void startIndexListItem()
Definition: rtfgen.cpp:2880
void startInlineMemberDoc()
Definition: rtfgen.cpp:2964
A model of a page symbol.
Definition: pagedef.h:29
static QDateTime currentDateTime()
Definition: qdatetime.cpp:1340
void endItemList()
Definition: rtfgen.cpp:988
void newParagraph()
Definition: rtfgen.cpp:2118
void endParagraph()
Definition: rtfgen.cpp:2135
void line(double t, double *p, double &x, double &y, double &z)
void startDescTable(const char *title)
Definition: rtfgen.cpp:1984
static void writeStyleSheetFile(QFile &f)
Definition: rtfgen.cpp:96
Rtf_Style_Default rtf_Style_Default[]
Definition: rtfstyle.cpp:43
void endGroupHeader(int)
Definition: rtfgen.cpp:1474
void writeNonBreakableSpace(int)
Definition: rtfgen.cpp:1917
char * definition
Definition: rtfstyle.h:68
void endMemberDescription()
Definition: rtfgen.cpp:1615
void writeCodeLink(const char *ref, const char *file, const char *anchor, const char *name, const char *tooltip)
Definition: rtfgen.cpp:1379
Q_EXPORT char * qstrcpy(char *dst, const char *src)
Definition: qcstring.h:87
char * reference
Definition: rtfstyle.h:67
void endFile()
Definition: rtfgen.cpp:343
int month() const
Definition: qdatetime.cpp:202
const char * reference
Definition: rtfstyle.h:52
int year() const
Definition: qdatetime.cpp:189
QCString rtf_title
Definition: rtfstyle.cpp:30
void endSubsubsection()
Definition: rtfgen.cpp:1211
void startMemberItem(const char *, int, const char *)
Definition: rtfgen.cpp:1857
void startLabels()
Definition: rtfgen.cpp:2976
void endMemberSubtitle()
Definition: rtfgen.cpp:2149
Translator * theTranslator
Definition: language.cpp:157
QCString writeGraph(FTextStream &out, GraphOutputFormat gf, EmbeddedOutputFormat ef, const char *path, const char *fileName, const char *relPath, bool writeImageMap=TRUE, int graphId=-1, bool linkRelations=TRUE) const
Definition: dot.cpp:3977
int second() const
Definition: qdatetime.cpp:666
void endCallGraph(const DotCallGraph &)
Definition: rtfgen.cpp:2498
virtual QCString trCompoundMembers()=0
static bool preProcessFile(QDir &d, QCString &infName, FTextStream &t, bool bIncludeHeader=TRUE)
Definition: rtfgen.cpp:2364
void endDescTableData()
Definition: rtfgen.cpp:2026
void endClassDiagram(const ClassDiagram &, const char *filename, const char *name)
Definition: rtfgen.cpp:1835
void endInlineMemberName()
Definition: rtfgen.cpp:2958
void writeStartAnnoItem(const char *type, const char *file, const char *path, const char *name)
Definition: rtfgen.cpp:1110
static QCString makeIndexName(const char *s, int i)
Definition: rtfgen.cpp:205
void createSubDirs(QDir &d)
Definition: util.cpp:5458
friend class Iterator
Definition: sortdict.h:289
void endMemberGroupHeader()
Definition: rtfgen.cpp:2642
void endItemListItem()
Definition: rtfgen.cpp:1036
void startDotGraph()
Definition: rtfgen.cpp:2438
void incrementIndentLevel()
Definition: rtfgen.cpp:2035
QCString writeGraph(FTextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const char *path, const char *fileName, const char *relPath, bool writeImageMap=TRUE, int graphId=-1) const
Definition: dot.cpp:3503
void startClassDiagram()
Definition: rtfgen.cpp:1830
static QCString spaces
Definition: doxygen.h:151
const char * cs
void startHtmlLink(const char *url)
Definition: rtfgen.cpp:1075
void startDirDepGraph()
Definition: rtfgen.cpp:2516
bool isLinkableInProject() const
void startDescTableTitle()
Definition: rtfgen.cpp:2004
void startProjectNumber()
Definition: rtfgen.cpp:351
void loadExtensions(const char *name)
Definition: rtfstyle.cpp:475
QCString getOutputFileBase() const
Definition: groupdef.cpp:1512
void startIndent()
Definition: rtfgen.cpp:1563
void startPageRef()
Definition: rtfgen.cpp:1356
void endCodeFragment()
Definition: rtfgen.cpp:1906
Definition: dot.h:42
void close()
Definition: qfile_unix.cpp:614
void endParameterType()
Definition: rtfgen.cpp:2740
void startIndexValue(bool)
Definition: rtfgen.cpp:1161
QCString utf8() const
Definition: qstring.cpp:14507
type & at(uint i) const
Definition: qarray.h:98
uint size() const
Definition: qarray.h:65
unsigned uint
Definition: qglobal.h:351
int day() const
Definition: qdatetime.cpp:215
static ClassSDict * classSDict
Definition: doxygen.h:99
QCString getOutputFileBase() const
Definition: pagedef.cpp:58
void rtfwriteRuler_thin()
Definition: rtfgen.cpp:2782
bool m_prettyCode
Definition: rtfgen.h:280
void endIndexKey()
Definition: rtfgen.cpp:1156
static PageDef * mainPage
Definition: doxygen.h:103
void endConstraintDocs()
Definition: rtfgen.cpp:2865
QCString rtf_company
Definition: rtfstyle.cpp:33
virtual void accept(DocVisitor *v)=0
static QCString * s
Definition: config.cpp:1042
void endIndexSection(IndexSections)
Definition: rtfgen.cpp:539
virtual bool exists() const
Definition: qdir.cpp:820
virtual QCString trRTFGeneralIndex()=0
const bool TRUE
Definition: qglobal.h:371
static QCString str
virtual QCString trTypeDocumentation()=0
bool atEnd() const
Definition: qfile.cpp:239
Portable versions of functions that are platform dependent.
QCString rtfFormatBmkStr(const char *name)
Definition: util.cpp:6744
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition: util.cpp:5088
static bool setCurrent(const QString &path)
Definition: qdir_unix.cpp:134
QTextStream & endl(QTextStream &s)
virtual QCString trModulesIndex()=0
void endMemberDocSimple()
Definition: rtfgen.cpp:2934
#define ASSERT(x)
Definition: qglobal.h:590
void writeChar(char c)
Definition: rtfgen.cpp:1822
const int rtf_maxIndentLevels
Definition: rtfstyle.h:45
void writeStyleInfo(int part)
Definition: rtfgen.cpp:939
void startMemberGroupDocs()
Definition: rtfgen.cpp:2649
type * toFirst()
Definition: qlist.h:135
void startParamList(ParamListTypes, const char *)
Definition: rtfgen.cpp:2707
bool m_bstartedBody
Definition: rtfgen.h:282
void startDescription()
Definition: rtfgen.cpp:1578