/
rtfgen.cpp
2950 lines (2667 loc) · 74.2 KB
/
rtfgen.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/******************************************************************************
*
*
*
* Copyright (C) 1997-2014 by Parker Waechter & Dimitri van Heesch.
*
* Style sheet additions by Alexander Bartolich
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
#include <stdlib.h>
#include <qdir.h>
#include <qregexp.h>
#include <qtextstream.h>
#include "rtfgen.h"
#include "config.h"
#include "message.h"
#include "doxygen.h"
#include "util.h"
#include "diagram.h"
#include "language.h"
#include "dot.h"
#include "version.h"
#include "pagedef.h"
#include "rtfstyle.h"
#include "rtfdocvisitor.h"
#include "docparser.h"
#include "dirdef.h"
#include "vhdldocgen.h"
#include "portable.h"
#include "groupdef.h"
#include "classlist.h"
#include "filename.h"
#include "namespacedef.h"
//#define DBG_RTF(x) x;
#define DBG_RTF(x)
static QCString dateToRTFDateString()
{
const QDateTime &d = QDateTime::currentDateTime();
QCString result;
result.sprintf("\\yr%d\\mo%d\\dy%d\\hr%d\\min%d\\sec%d",
d.date().year(), d.date().month(), d.date().day(),
d.time().hour(),d.time().minute(),d.time().second());
return result;
}
RTFGenerator::RTFGenerator() : OutputGenerator()
{
dir=Config_getString("RTF_OUTPUT");
col=0;
//insideTabbing=FALSE;
m_listLevel = 0;
m_bstartedBody = FALSE;
m_omitParagraph = FALSE;
m_numCols = 0;
}
RTFGenerator::~RTFGenerator()
{
}
//void RTFGenerator::append(const OutputGenerator *g)
//{
// t << g->getContents();
// col+=((RTFGenerator *)g)->col;
// //insideTabbing=insideTabbing || ((RTFGenerator *)g)->insideTabbing;
// m_listLevel=((RTFGenerator *)g)->m_listLevel;
// m_omitParagraph=((RTFGenerator *)g)->m_omitParagraph;
// //printf("RTFGenerator::append(%s) insideTabbing=%s\n", g->getContents().data(),
// // insideTabbing ? "TRUE" : "FALSE" );
//}
//OutputGenerator *RTFGenerator::copy()
//{
// RTFGenerator *result = new RTFGenerator;
// //result->insideTabbing=insideTabbing;
// result->m_listLevel=m_listLevel;
// result->m_omitParagraph=m_omitParagraph;
// return result;
//}
void RTFGenerator::writeStyleSheetFile(QFile &file)
{
QTextStream t(&file);
t << "# Generated by doxygen " << versionString << "\n\n";
t << "# This file describes styles used for generating RTF output.\n";
t << "# All text after a hash (#) is considered a comment and will be ignored.\n";
t << "# Remove a hash to activate a line.\n\n";
int i;
for ( i=0 ; rtf_Style_Default[i].reference!=0 ; i++ )
{
t << "# " << rtf_Style_Default[i].name << " = "
<< rtf_Style_Default[i].reference
<< rtf_Style_Default[i].definition << endl;
}
}
void RTFGenerator::writeExtensionsFile(QFile &file)
{
QTextStream t(&file);
t << "# Generated by doxygen " << versionString << "\n\n";
t << "# This file describes extensions used for generating RTF output.\n";
t << "# All text after a hash (#) is considered a comment and will be ignored.\n";
t << "# Remove a hash to activate a line.\n\n";
t << "# Overrides the project title.\n";
t << "#Title = \n\n";
t << "# Name of the company that produced this document.\n";
t << "#Company = \n\n";
t << "# Filename of a company or project logo.\n";
t << "#LogoFilename = \n\n";
t << "# Author of the document.\n";
t << "#Author = \n\n";
t << "# Type of document (e.g. Design Specification, User Manual, etc.).\n";
t << "#DocumentType = \n\n";
t << "# Document tracking number.\n";
t << "#DocumentId = \n\n";
t << "# Name of the author's manager.\n";
t << "# This field is not displayed in the document itself, but it is \n";
t << "# available in the information block of the rtf file. In Microsoft \n";
t << "# Word, it is available under File:Properties.\n";
t << "#Manager = \n\n";
t << "# Subject of the document.\n";
t << "# This field is not displayed in the document itself, but it is \n";
t << "# available in the information block of the rtf file. In Microsoft \n";
t << "# Word, it is available under File:Properties.\n";
t << "#Subject = \n\n";
t << "# Comments regarding the document.\n";
t << "# This field is not displayed in the document itself, but it is \n";
t << "# available in the information block of the rtf file. In Microsoft \n";
t << "# Word, it is available under File:Properties.\n";
t << "#Comments = \n\n";
t << "# Keywords associated with the document.\n";
t << "# This field is not displayed in the document itself, but it is \n";
t << "# available in the information block of the rtf file. In Microsoft \n";
t << "# Word, it is available under File:Properties.\n";
t << "#Keywords = \n\n";
}
void RTFGenerator::init()
{
QCString dir=Config_getString("RTF_OUTPUT");
QDir d(dir);
if (!d.exists() && !d.mkdir(dir))
{
err("Could not create output directory %s\n",dir.data());
exit(1);
}
rtf_Style.setAutoDelete(TRUE);
// first duplicate strings of rtf_Style_Default
const struct Rtf_Style_Default* def = rtf_Style_Default;
while(def->reference != 0)
{
if (def->definition == 0)
err("Internal: rtf_Style_Default[%s] has no definition.\n", def->name);
StyleData* styleData = new StyleData(def->reference, def->definition);
rtf_Style.insert(def->name, styleData);
def++;
}
// overwrite some (or all) definitions from file
QCString &rtfStyleSheetFile = Config_getString("RTF_STYLESHEET_FILE");
if (!rtfStyleSheetFile.isEmpty())
{
loadStylesheet(rtfStyleSheetFile, rtf_Style);
}
// If user has defined an extension file, load its contents.
QCString &rtfExtensionsFile = Config_getString("RTF_EXTENSIONS_FILE");
if (!rtfExtensionsFile.isEmpty())
{
loadExtensions(rtfExtensionsFile);
}
createSubDirs(d);
}
static QCString makeIndexName(const char *s,int i)
{
QCString result=s;
result+=(char)(i+'0');
return result;
}
void RTFGenerator::beginRTFDocument()
{
/* all the included RTF files should begin with the
* same header
*/
t <<"{\\rtf1\\ansi\\ansicpg" << theTranslator->trRTFansicp();
t <<"\\uc1 \\deff0\\deflang1033\\deflangfe1033\n";
DBG_RTF(t <<"{\\comment Beginning font list}\n")
t <<"{\\fonttbl ";
t <<"{\\f0\\froman\\fcharset" << theTranslator->trRTFCharSet();
t <<"\\fprq2{\\*\\panose 02020603050405020304}Times New Roman;}\n";
t <<"{\\f1\\fswiss\\fcharset" << theTranslator->trRTFCharSet();
t <<"\\fprq2{\\*\\panose 020b0604020202020204}Arial;}\n";
t <<"{\\f2\\fmodern\\fcharset" << theTranslator->trRTFCharSet();
t <<"\\fprq1{\\*\\panose 02070309020205020404}Courier New;}\n";
t <<"{\\f3\\froman\\fcharset2\\fprq2{\\*\\panose 05050102010706020507}Symbol;}\n";
t <<"}\n";
DBG_RTF(t <<"{\\comment begin colors}\n")
t <<"{\\colortbl;";
t <<"\\red0\\green0\\blue0;";
t <<"\\red0\\green0\\blue255;";
t <<"\\red0\\green255\\blue255;";
t <<"\\red0\\green255\\blue0;";
t <<"\\red255\\green0\\blue255;";
t <<"\\red255\\green0\\blue0;";
t <<"\\red255\\green255\\blue0;";
t <<"\\red255\\green255\\blue255;";
t <<"\\red0\\green0\\blue128;";
t <<"\\red0\\green128\\blue128;";
t <<"\\red0\\green128\\blue0;";
t <<"\\red128\\green0\\blue128;";
t <<"\\red128\\green0\\blue0;";
t <<"\\red128\\green128\\blue0;";
t <<"\\red128\\green128\\blue128;";
t <<"\\red192\\green192\\blue192;}" << endl;
DBG_RTF(t <<"{\\comment Beginning style list}\n")
t <<"{\\stylesheet\n";
t <<"{\\widctlpar\\adjustright \\fs20\\cgrid \\snext0 Normal;}\n";
// sort styles ascending by \s-number via an intermediate QArray
QArray<const StyleData*> array(128);
array.fill(0);
QDictIterator<StyleData> iter(rtf_Style);
const StyleData* style;
for(; (style = iter.current()); ++iter)
{
unsigned index = style->index;
unsigned size = array.size();
if (index >= size)
{
// +1 to add at least one element, then align up to multiple of 8
array.resize((index + 1 + 7) & ~7);
array.fill(0, size);
ASSERT(index < array.size());
}
if (array.at(index) != 0)
{
QCString key(iter.currentKey());
msg("Style '%s' redefines \\s%d.\n", key.data(), index);
}
array.at(index) = style;
}
// write array elements
unsigned size = array.size();
for(unsigned i = 0; i < size; i++)
{
const StyleData* style = array.at(i);
if (style != 0)
t <<"{" << style->reference << style->definition << ";}\n";
}
t <<"}" << endl;
// this comment is needed for postprocessing!
t <<"{\\comment begin body}" << endl;
}
void RTFGenerator::beginRTFChapter()
{
t <<"\n";
DBG_RTF(t << "{\\comment BeginRTFChapter}\n")
t << rtf_Style_Reset;
// if we are compact, no extra page breaks...
if (Config_getBool("COMPACT_RTF"))
{
// t <<"\\sect\\sectd\\sbknone\n";
t <<"\\sect\\sbknone\n";
rtfwriteRuler_thick();
}
else
t <<"\\sect\\sbkpage\n";
//t <<"\\sect\\sectd\\sbkpage\n";
t << rtf_Style["Heading1"]->reference << "\n";
}
void RTFGenerator::beginRTFSection()
{
t <<"\n";
DBG_RTF(t << "{\\comment BeginRTFSection}\n")
t << rtf_Style_Reset;
// if we are compact, no extra page breaks...
if (Config_getBool("COMPACT_RTF"))
{
// t <<"\\sect\\sectd\\sbknone\n";
t <<"\\sect\\sbknone\n";
rtfwriteRuler_emboss();
}
else
t <<"\\sect\\sbkpage\n";
//t <<"\\sect\\sectd\\sbkpage\n";
t << rtf_Style["Heading2"]->reference << "\n";
}
void RTFGenerator::startFile(const char *name,const char *,const char *)
{
//setEncoding(QCString().sprintf("CP%s",theTranslator->trRTFansicp()));
QCString fileName=name;
relPath = relativePathToRoot(fileName);
if (fileName.right(4)!=".rtf" ) fileName+=".rtf";
startPlainFile(fileName);
beginRTFDocument();
}
void RTFGenerator::endFile()
{
DBG_RTF(t << "{\\comment endFile}\n")
t << "}";
endPlainFile();
}
void RTFGenerator::startProjectNumber()
{
DBG_RTF(t <<"{\\comment startProjectNumber }" << endl)
t << " ";
}
void RTFGenerator::endProjectNumber()
{
DBG_RTF(t <<"{\\comment endProjectNumber }" << endl)
}
void RTFGenerator::startIndexSection(IndexSections is)
{
//QCString paperName;
m_listLevel = 0;
switch (is)
{
case isTitlePageStart:
// basic RTFstart
// get readyfor author etc
t << "{\\info \n";
t << "{\\title {\\comment ";
break;
case isTitlePageAuthor:
t << "}\n";
if (rtf_subject) t << "{\\subject " << rtf_subject << "}\n";
if (rtf_comments) t << "{\\comment " << rtf_comments << "}\n";
if (rtf_company) t << "{\\company " << rtf_company << "}\n";
if (rtf_author) t << "{\\author " << rtf_author << "}\n";
if (rtf_manager) t << "{\\manager " << rtf_manager << "}\n";
if (rtf_documentType) t << "{\\category " << rtf_documentType << "}\n";
if (rtf_keywords) t << "{\\keywords " << rtf_keywords << "}\n";
t << "{\\comment ";
break;
case isMainPage:
//Introduction
beginRTFChapter();
break;
//case isPackageIndex:
// //Package Index
// beginRTFChapter();
// break;
case isModuleIndex:
//Module Index
beginRTFChapter();
break;
case isDirIndex:
//Directory Index
beginRTFChapter();
break;
case isNamespaceIndex:
//Namespace Index
beginRTFChapter();
break;
case isClassHierarchyIndex:
//Hierarchical Index
DBG_RTF(t << "{\\comment start classhierarchy}\n")
beginRTFChapter();
break;
case isCompoundIndex:
//Annotated Compound Index
beginRTFChapter();
break;
case isFileIndex:
//Annotated File Index
beginRTFChapter();
break;
case isPageIndex:
//Related Page Index
beginRTFChapter();
break;
case isModuleDocumentation:
{
//Module Documentation
GroupSDict::Iterator gli(*Doxygen::groupSDict);
GroupDef *gd;
bool found=FALSE;
for (gli.toFirst();(gd=gli.current()) && !found;++gli)
{
if (!gd->isReference())
{
beginRTFChapter();
found=TRUE;
}
}
}
break;
case isDirDocumentation:
{
//Directory Documentation
SDict<DirDef>::Iterator dli(*Doxygen::directories);
DirDef *dd;
bool found=FALSE;
for (dli.toFirst();(dd=dli.current()) && !found;++dli)
{
if (dd->isLinkableInProject())
{
beginRTFChapter();
found=TRUE;
}
}
}
break;
case isNamespaceDocumentation:
{
// Namespace Documentation
NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict);
NamespaceDef *nd;
bool found=FALSE;
for (nli.toFirst();(nd=nli.current()) && !found;++nli)
{
if (nd->isLinkableInProject())
{
beginRTFChapter();
found=TRUE;
}
}
}
break;
case isClassDocumentation:
{
//Compound Documentation
ClassSDict::Iterator cli(*Doxygen::classSDict);
ClassDef *cd=0;
bool found=FALSE;
for (cli.toFirst();(cd=cli.current()) && !found;++cli)
{
if (cd->isLinkableInProject() &&
cd->templateMaster()==0 &&
!cd->isEmbeddedInOuterScope()
)
{
beginRTFChapter();
found=TRUE;
}
}
}
break;
case isFileDocumentation:
{
//File Documentation
bool isFirst=TRUE;
FileNameListIterator fnli(*Doxygen::inputNameList);
FileName *fn;
for (fnli.toFirst();(fn=fnli.current());++fnli)
{
FileNameIterator fni(*fn);
FileDef *fd;
for (;(fd=fni.current());++fni)
{
if (fd->isLinkableInProject())
{
if (isFirst)
{
beginRTFChapter();
isFirst=FALSE;
break;
}
}
}
}
}
break;
case isExampleDocumentation:
{
//Example Documentation
beginRTFChapter();
}
break;
case isPageDocumentation:
{
//Page Documentation
beginRTFChapter();
}
break;
case isPageDocumentation2:
{
t << "{\\tc \\v ";
}
break;
case isEndIndex:
break;
}
}
void RTFGenerator::endIndexSection(IndexSections is)
{
bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
switch (is)
{
case isTitlePageStart:
if (rtf_title)
// User has overridden document title in extensions file
t << "}" << rtf_title;
else
t << "}" << Config_getString("PROJECT_NAME");
break;
case isTitlePageAuthor:
{
t << "Doxgyen. }\n";
t << "{\\creatim " << dateToRTFDateString() << "}\n}";
DBG_RTF(t << "{\\comment end of infoblock}\n");
// setup for this section
t << rtf_Style_Reset <<"\n";
t <<"\\sectd\\pgnlcrm\n";
t <<"{\\footer "<<rtf_Style["Footer"]->reference << "{\\chpgn}}\n";
// the title entry
DBG_RTF(t << "{\\comment begin title page}\n")
t << rtf_Style_Reset << rtf_Style["SubTitle"]->reference << endl; // set to title style
t << "\\vertalc\\qc\\par\\par\\par\\par\\par\\par\\par\n";
if (rtf_logoFilename)
{
t << "{\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"" << rtf_logoFilename;
t << "\" \\\\d \\\\*MERGEFORMAT} {\\fldrslt IMAGE }}\\par\\par\n";
}
if (rtf_company)
{
t << rtf_company << "\\par\\par\n";
}
t << rtf_Style_Reset << rtf_Style["Title"]->reference << endl; // set to title style
t << "{\\field\\fldedit {\\*\\fldinst TITLE \\\\*MERGEFORMAT}{\\fldrslt TITLE}}\\par" << endl;
t << rtf_Style_Reset << rtf_Style["SubTitle"]->reference << endl; // set to title style
t << "\\par\n";
if (rtf_documentType)
{
t << rtf_documentType << "\\par\n";
}
if (rtf_documentId)
{
t << rtf_documentId << "\\par\n";
}
t << "\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\n";
t << rtf_Style_Reset << rtf_Style["SubTitle"]->reference << endl; // set to subtitle style
t << "{\\field\\fldedit {\\*\\fldinst AUTHOR \\\\*MERGEFORMAT}{\\fldrslt AUTHOR}}\\par" << endl;
t << "Version " << Config_getString("PROJECT_NUMBER") << "\\par";
t << "{\\field\\fldedit {\\*\\fldinst CREATEDATE \\\\*MERGEFORMAT}"
"{\\fldrslt CREATEDATE}}\\par"<<endl;
t << "\\page\\page";
DBG_RTF(t << "{\\comment End title page}" << endl)
// table of contents section
DBG_RTF(t << "{\\comment Table of contents}\n")
t << "\\vertalt\n";
t << rtf_Style_Reset << endl;
t << rtf_Style["Heading1"]->reference;
t << theTranslator->trRTFTableOfContents() << "\\par"<< endl;
t << rtf_Style_Reset << "\\par" << endl;
t << "{\\field\\fldedit {\\*\\fldinst TOC \\\\f \\\\*MERGEFORMAT}{\\fldrslt Table of contents}}\\par\n";
t << rtf_Style_Reset << endl;
}
break;
case isMainPage:
t << "\\par " << rtf_Style_Reset << endl;
if (!Doxygen::mainPage || Doxygen::mainPage->title().isEmpty())
{
t << "{\\tc \\v " << theTranslator->trMainPage() << "}"<< endl;
}
else
{
t << "{\\tc \\v " << substitute(Doxygen::mainPage->title(),"%","") << "}"<< endl;
}
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
//if (Config_getBool("GENERATE_TREEVIEW")) t << "main"; else t << "index";
t << "index";
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
break;
//case isPackageIndex:
// t << "\\par " << rtf_Style_Reset << endl;
// t << "{\\tc \\v " << theTranslator->trPackageList() << "}"<< endl;
// t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"packages.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
// break;
case isModuleIndex:
t << "\\par " << rtf_Style_Reset << endl;
t << "{\\tc \\v " << theTranslator->trModuleIndex() << "}"<< endl;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"modules.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
break;
case isDirIndex:
t << "\\par " << rtf_Style_Reset << endl;
t << "{\\tc \\v " << theTranslator->trDirIndex() << "}"<< endl;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"dirs.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
break;
case isNamespaceIndex:
t << "\\par " << rtf_Style_Reset << endl;
if (fortranOpt)
{
t << "{\\tc \\v " << theTranslator->trModulesIndex() << "}" << endl;
}
else
{
t << "{\\tc \\v " << theTranslator->trNamespaceIndex() << "}" << endl;
}
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"namespaces.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
break;
case isClassHierarchyIndex:
t << "\\par " << rtf_Style_Reset << endl;
t << "{\\tc \\v " << theTranslator->trHierarchicalIndex() << "}"<< endl;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"hierarchy.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
break;
case isCompoundIndex:
t << "\\par " << rtf_Style_Reset << endl;
if (fortranOpt)
{
t << "{\\tc \\v " << theTranslator->trCompoundIndexFortran() << "}"<< endl;
}
else if (vhdlOpt)
{
t << "{\\tc \\v " << VhdlDocGen::trDesignUnitIndex() << "}"<< endl;
}
else
{
t << "{\\tc \\v " << theTranslator->trCompoundIndex() << "}"<< endl;
}
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"annotated.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
break;
case isFileIndex:
t << "\\par " << rtf_Style_Reset << endl;
t << "{\\tc \\v " << theTranslator->trFileIndex() << "}"<< endl;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"files.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
break;
case isPageIndex:
t << "\\par " << rtf_Style_Reset << endl;
t << "{\\tc \\v " << theTranslator->trPageIndex() << "}"<< endl;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"pages.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
break;
case isModuleDocumentation:
{
GroupSDict::Iterator gli(*Doxygen::groupSDict);
GroupDef *gd;
t << "{\\tc \\v " << theTranslator->trModuleDocumentation() << "}"<< endl;
for (gli.toFirst();(gd=gli.current());++gli)
{
if (!gd->isReference())
{
t << "\\par " << rtf_Style_Reset << endl;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
t << gd->getOutputFileBase();
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
}
}
}
break;
case isDirDocumentation:
{
SDict<DirDef>::Iterator dli(*Doxygen::directories);
DirDef *dd;
t << "{\\tc \\v " << theTranslator->trDirDocumentation() << "}"<< endl;
for (dli.toFirst();(dd=dli.current());++dli)
{
if (dd->isLinkableInProject())
{
t << "\\par " << rtf_Style_Reset << endl;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
t << dd->getOutputFileBase();
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
}
}
}
break;
case isNamespaceDocumentation:
{
NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict);
NamespaceDef *nd;
bool found=FALSE;
for (nli.toFirst();(nd=nli.current()) && !found;++nli)
{
if (nd->isLinkableInProject())
{
t << "\\par " << rtf_Style_Reset << endl;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
t << nd->getOutputFileBase();
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
found=TRUE;
}
}
while ((nd=nli.current()))
{
if (nd->isLinkableInProject())
{
t << "\\par " << rtf_Style_Reset << endl;
beginRTFSection();
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
t << nd->getOutputFileBase();
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
}
++nli;
}
}
break;
case isClassDocumentation:
{
ClassSDict::Iterator cli(*Doxygen::classSDict);
ClassDef *cd=0;
bool found=FALSE;
if (fortranOpt)
{
t << "{\\tc \\v " << theTranslator->trTypeDocumentation() << "}"<< endl;
}
else
{
t << "{\\tc \\v " << theTranslator->trClassDocumentation() << "}"<< endl;
}
for (cli.toFirst();(cd=cli.current()) && !found;++cli)
{
if (cd->isLinkableInProject() &&
cd->templateMaster()==0 &&
!cd->isEmbeddedInOuterScope()
)
{
t << "\\par " << rtf_Style_Reset << endl;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
t << cd->getOutputFileBase();
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
found=TRUE;
}
}
for (;(cd=cli.current());++cli)
{
if (cd->isLinkableInProject() &&
cd->templateMaster()==0 &&
!cd->isEmbeddedInOuterScope()
)
{
t << "\\par " << rtf_Style_Reset << endl;
beginRTFSection();
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
t << cd->getOutputFileBase();
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
}
}
}
break;
case isFileDocumentation:
{
bool isFirst=TRUE;
t << "{\\tc \\v " << theTranslator->trFileDocumentation() << "}"<< endl;
FileNameListIterator fnli(*Doxygen::inputNameList);
FileName *fn;
for (fnli.toFirst();(fn=fnli.current());++fnli)
{
FileNameIterator fni(*fn);
FileDef *fd;
for (;(fd=fni.current());++fni)
{
if (fd->isLinkableInProject())
{
if (isFirst)
{
t << "\\par " << rtf_Style_Reset << endl;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
t << fd->getOutputFileBase();
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
isFirst=FALSE;
}
else
{
t << "\\par " << rtf_Style_Reset << endl;
beginRTFSection();
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
t << fd->getOutputFileBase();
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
}
}
}
}
}
break;
case isExampleDocumentation:
{
//t << "}\n";
t << "{\\tc \\v " << theTranslator->trExampleDocumentation() << "}"<< endl;
PageSDict::Iterator pdi(*Doxygen::exampleSDict);
PageDef *pd=pdi.toFirst();
if (pd)
{
t << "\\par " << rtf_Style_Reset << endl;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
t << pd->getOutputFileBase();
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
}
for (++pdi;(pd=pdi.current());++pdi)
{
t << "\\par " << rtf_Style_Reset << endl;
beginRTFSection();
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
t << pd->getOutputFileBase();
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
}
}
break;
case isPageDocumentation:
{
//#error "fix me in the same way as the latex index..."
//t << "{\\tc \\v " << theTranslator->trPageDocumentation() << "}"<< endl;
//t << "}"<< endl;
//PageSDict::Iterator pdi(*Doxygen::pageSDict);
//PageDef *pd=pdi.toFirst();
//bool first=TRUE;
//for (pdi.toFirst();(pd=pdi.current());++pdi)
//{
// if (!pd->getGroupDef() && !pd->isReference())
// {
// if (first) t << "\\par " << rtf_Style_Reset << endl;
// t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
// t << pd->getOutputFileBase();
// t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
// first=FALSE;
// }
//}
}
break;
case isPageDocumentation2:
{
t << "}";
t << "\\par " << rtf_Style_Reset << endl;
}
break;
case isEndIndex:
beginRTFChapter();
t << rtf_Style["Heading1"]->reference;
t << theTranslator->trRTFGeneralIndex() << "\\par "<< endl;
t << rtf_Style_Reset << endl;
t << "{\\tc \\v " << theTranslator->trRTFGeneralIndex() << "}" << endl;
t << "{\\field\\fldedit {\\*\\fldinst INDEX \\\\c2 \\\\*MERGEFORMAT}{\\fldrslt INDEX}}\n";
break;
}
}
void RTFGenerator::writePageLink(const char *name,bool first)
{
if (first) t << "\\par " << rtf_Style_Reset << endl;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
t << name;
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
}
void RTFGenerator::lastIndexPage()
{
DBG_RTF(t <<"{\\comment Beginning Body of RTF Document}\n")
// end page and setup for rest of document
t <<"\\sect \\sbkpage \\pgndec \\pgnrestart\n";
t <<"\\sect \\sectd \\sbknone\n";
// set new footer with arabic numbers
t <<"{\\footer "<< rtf_Style["Footer"]->reference << "{\\chpgn}}\n";
//t << rtf_Style["Heading1"]->reference << "\n";
}
void RTFGenerator::writeStyleInfo(int)
{
}
void RTFGenerator::lineBreak(const char *)
{
DBG_RTF(t << "{\\comment (lineBreak)}" << endl)
t << "\\par" << endl;
m_omitParagraph = TRUE;
}
void RTFGenerator::writeString(const char *text)
{
t << text;
}
void RTFGenerator::startIndexList()
{
DBG_RTF(t << "{\\comment (startIndexList)}" << endl)
t << "{" << endl;
t << "\\par" << endl;
incrementIndentLevel();
t << rtf_Style_Reset << rtf_LCList_DepthStyle() << endl;
m_omitParagraph = TRUE;
}
void RTFGenerator::endIndexList()
{
DBG_RTF(t << "{\\comment (endIndexList)}" << endl)
if (!m_omitParagraph)
{
t << "\\par";
m_omitParagraph = TRUE;
}
t << "}";
decrementIndentLevel();
}
/*! start bullet list */
void RTFGenerator::startItemList()
{
newParagraph();
DBG_RTF(t << "{\\comment (startItemList level=" << m_listLevel << ") }" << endl)
t << "{";
incrementIndentLevel();
rtf_listItemInfo[m_listLevel].isEnum = FALSE;
}
/*! end bullet list */
void RTFGenerator::endItemList()
{
newParagraph();
DBG_RTF(t << "{\\comment (endItemList level=" << m_listLevel << ")}" << endl)
t << "}";
decrementIndentLevel();
m_omitParagraph = TRUE;
}
///*! start enumeration list */
//void RTFGenerator::startEnumList() // starts an enumeration list
//{
// DBG_RTF(t << "{\\comment (startEnumList)}" << endl)
// t << "{" << endl;
// incrementIndentLevel();
// rtf_listItemInfo[m_listLevel].isEnum = TRUE;
// rtf_listItemInfo[m_listLevel].number = 1;
//}
//
///*! end enumeration list */
//void RTFGenerator::endEnumList()
//{
// newParagraph();
// DBG_RTF(t << "{\\comment (endEnumList)}" << endl)
// t << "}";
// decrementIndentLevel();
// m_omitParagraph = TRUE;
//}
/*! write bullet or enum item */
void RTFGenerator::startItemListItem()
{
DBG_RTF(t << "{\\comment (startItemListItem)}" << endl)
newParagraph();
t << rtf_Style_Reset;
if (rtf_listItemInfo[m_listLevel].isEnum)
{
t << rtf_EList_DepthStyle() << endl;
t << rtf_listItemInfo[m_listLevel].number << ".\\tab ";
rtf_listItemInfo[m_listLevel].number++;
}