diff options
Diffstat (limited to 'src/rtfgen.cpp')
-rw-r--r-- | src/rtfgen.cpp | 624 |
1 files changed, 390 insertions, 234 deletions
diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 5dd7aeb..b722d74 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -119,235 +119,307 @@ OutputGenerator *RTFGenerator::copy() return result; } -static const struct +static const char Rtf_Style_Reset[] = "\\pard\\plain "; + +struct Rtf_Style_Default { const char *name; - const char *value; -} Rtf_Style_Default[] = + const char *reference; + const char *definition; +}; + +static const struct Rtf_Style_Default Rtf_Style_Default[] = { - { "Reset", - "\\pard\\plain " - }, { "Heading1", - "\\s1\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs36\\kerning36\\cgrid " + "\\s1\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs36\\kerning36\\cgrid ", + "\\sbasedon0 \\snext0 heading 1" }, { "Heading2", - "\\s2\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs28\\kerning28\\cgrid " + "\\s2\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs28\\kerning28\\cgrid ", + "\\sbasedon0 \\snext0 heading 2" }, { "Heading3", - "\\s3\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\cgrid " + "\\s3\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\cgrid ", + "\\sbasedon0 \\snext0 heading 3" }, { "Heading4", - "\\s4\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs20\\cgrid " + "\\s4\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs20\\cgrid ", + "\\sbasedon0 \\snext0 heading 4;}{\\*\\cs10 \\additive Default Paragraph Font" }, { "Title", - "\\s15\\qc\\sb240\\sa60\\widctlpar\\outlinelevel0\\adjustright \\b\\f1\\fs32\\kerning28\\cgrid " + "\\s15\\qc\\sb240\\sa60\\widctlpar\\outlinelevel0\\adjustright \\b\\f1\\fs32\\kerning28\\cgrid ", + "\\sbasedon0 \\snext15 Title" }, { "SubTitle", - "\\s16\\qc\\sa60\\widctlpar\\outlinelevel1\\adjustright \\f1\\cgrid " + "\\s16\\qc\\sa60\\widctlpar\\outlinelevel1\\adjustright \\f1\\cgrid ", + "\\sbasedon0 \\snext16 Subtitle" }, { "BodyText", - "\\s17\\sa60\\sb30\\widctlpar\\qj \\fs22\\cgrid " + "\\s17\\sa60\\sb30\\widctlpar\\qj \\fs22\\cgrid ", + "\\sbasedon0 \\snext17 BodyText" }, { "DenseText", - "\\s18\\widctlpar\\fs22\\cgrid " + "\\s18\\widctlpar\\fs22\\cgrid ", + "\\sbasedon0 \\snext18 DenseText" }, { "Header", - "\\s28\\widctlpar\\tqc\\tx4320\\tqr\\tx8640\\adjustright \\fs20\\cgrid " + "\\s28\\widctlpar\\tqc\\tx4320\\tqr\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext28 header" }, { "Footer", - "\\s29\\widctlpar\\tqc\\tx4320\\tqr\\tx8640\\qr\\adjustright \\fs20\\cgrid " + "\\s29\\widctlpar\\tqc\\tx4320\\tqr\\tx8640\\qr\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext29 footer" }, { "GroupHeader", - "\\s30\\li360\\sa60\\sb120\\keepn\\widctlpar\\adjustright \\b\\f1\\fs20\\cgrid " + "\\s30\\li360\\sa60\\sb120\\keepn\\widctlpar\\adjustright \\b\\f1\\fs20\\cgrid ", + "\\sbasedon0 \\snext30 GroupHeader" }, { "CodeExample0", - "\\s40\\li0\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s40\\li0\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext41 Code Example 0" }, { "CodeExample1", - "\\s41\\li360\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s41\\li360\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext42 Code Example 1" }, { "CodeExample2", - "\\s42\\li720\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s42\\li720\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext43 Code Example 2" }, { "CodeExample3", - "\\s43\\li1080\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s43\\li1080\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext44 Code Example 3" }, { "CodeExample4", - "\\s44\\li1440\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s44\\li1440\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext45 Code Example 4" }, { "CodeExample5", - "\\s45\\li1800\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s45\\li1800\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext46 Code Example 5" }, { "CodeExample6", - "\\s46\\li2160\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s46\\li2160\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext47 Code Example 6" }, { "CodeExample7", - "\\s47\\li2520\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s47\\li2520\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext48 Code Example 7" }, { "CodeExample8", - "\\s48\\li2880\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s48\\li2880\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext49 Code Example 8" }, { "CodeExample9", - "\\s49\\li3240\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s49\\li3240\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext49 Code Example 9" }, { "ListContinue0", - "\\s50\\li0\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s50\\li0\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext51 List Continue 0" }, { "ListContinue1", - "\\s51\\li360\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s51\\li360\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext52 List Continue 1" }, { "ListContinue2", - "\\s52\\li720\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s52\\li720\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext53 List Continue 2" }, { "ListContinue3", - "\\s53\\li1080\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s53\\li1080\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext54 List Continue 3" }, { "ListContinue4", - "\\s54\\li1440\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s54\\li1440\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext55 List Continue 4" }, { "ListContinue5", - "\\s55\\li1800\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s55\\li1800\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext56 List Continue 5" }, { "ListContinue6", - "\\s56\\li2160\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s56\\li2160\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext57 List Continue 6" }, { "ListContinue7", - "\\s57\\li2520\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s57\\li2520\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext58 List Continue 7" }, { "ListContinue8", - "\\s58\\li2880\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s58\\li2880\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext59 List Continue 8" }, { "ListContinue9", - "\\s59\\li3240\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s59\\li3240\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext59 List Continue 9" }, { "DescContinue0", - "\\s60\\li0\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s60\\li0\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext61 DescContinue 0" }, { "DescContinue1", - "\\s61\\li360\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s61\\li360\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext62 DescContinue 1" }, { "DescContinue2", - "\\s62\\li720\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s62\\li720\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext63 DescContinue 2" }, { "DescContinue3", - "\\s63\\li1080\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s63\\li1080\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext64 DescContinue 3" }, { "DescContinue4", - "\\s64\\li1440\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s64\\li1440\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext65 DescContinue 4" }, { "DescContinue5", - "\\s65\\li1800\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s65\\li1800\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext66 DescContinue 5" }, { "DescContinue6", - "\\s66\\li2160\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s66\\li2160\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext67 DescContinue 6" }, { "DescContinue7", - "\\s67\\li2520\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s67\\li2520\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext68 DescContinue 7" }, { "DescContinue8", - "\\s68\\li2880\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s68\\li2880\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext69 DescContinue 8" }, { "DescContinue9", - "\\s69\\li3240\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s69\\li3240\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext69 DescContinue 9" }, { "LatexTOC0", - "\\s70\\li0\\sa30\\sb30\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s70\\li0\\sa30\\sb30\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext81 LatexTOC 0" }, { "LatexTOC1", - "\\s71\\li360\\sa27\\sb27\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s71\\li360\\sa27\\sb27\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext82 LatexTOC 1" }, { "LatexTOC2", - "\\s72\\li720\\sa24\\sb24\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s72\\li720\\sa24\\sb24\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext83 LatexTOC 2" }, { "LatexTOC3", - "\\s73\\li1080\\sa21\\sb21\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s73\\li1080\\sa21\\sb21\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext84 LatexTOC 3" }, { "LatexTOC4", - "\\s74\\li1440\\sa18\\sb18\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s74\\li1440\\sa18\\sb18\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext85 LatexTOC 4" }, { "LatexTOC5", - "\\s75\\li1800\\sa15\\sb15\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s75\\li1800\\sa15\\sb15\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext86 LatexTOC 5" }, { "LatexTOC6", - "\\s76\\li2160\\sa12\\sb12\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s76\\li2160\\sa12\\sb12\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext87 LatexTOC 6" }, { "LatexTOC7", - "\\s77\\li2520\\sa9\\sb9\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s77\\li2520\\sa9\\sb9\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext88 LatexTOC 7" }, { "LatexTOC8", - "\\s78\\li2880\\sa6\\sb6\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s78\\li2880\\sa6\\sb6\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext89 LatexTOC 8" }, { "LatexTOC9", - "\\s79\\li3240\\sa3\\sb3\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s79\\li3240\\sa3\\sb3\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext89 LatexTOC 9" }, { "ListBullet0", - "\\s80\\fi-360\\li360\\widctlpar\\jclisttab\\tx360{\\*\\pn \\pnlvlbody\\ilvl0\\ls1\\pnrnot0\\pndec }\\ls1\\adjustright \\fs20\\cgrid " + "\\s80\\fi-360\\li360\\widctlpar\\jclisttab\\tx360{\\*\\pn \\pnlvlbody\\ilvl0\\ls1\\pnrnot0\\pndec }\\ls1\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext81 \\sautoupd List Bullet 0" }, { "ListBullet1", - "\\s81\\fi-360\\li720\\widctlpar\\jclisttab\\tx720{\\*\\pn \\pnlvlbody\\ilvl0\\ls2\\pnrnot0\\pndec }\\ls2\\adjustright \\fs20\\cgrid " + "\\s81\\fi-360\\li720\\widctlpar\\jclisttab\\tx720{\\*\\pn \\pnlvlbody\\ilvl0\\ls2\\pnrnot0\\pndec }\\ls2\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext82 \\sautoupd List Bullet 1" }, { "ListBullet2", - "\\s82\\fi-360\\li1080\\widctlpar\\jclisttab\\tx1080{\\*\\pn \\pnlvlbody\\ilvl0\\ls3\\pnrnot0\\pndec }\\ls3\\adjustright \\fs20\\cgrid " + "\\s82\\fi-360\\li1080\\widctlpar\\jclisttab\\tx1080{\\*\\pn \\pnlvlbody\\ilvl0\\ls3\\pnrnot0\\pndec }\\ls3\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext83 \\sautoupd List Bullet 2" }, { "ListBullet3", - "\\s83\\fi-360\\li1440\\widctlpar\\jclisttab\\tx1440{\\*\\pn \\pnlvlbody\\ilvl0\\ls4\\pnrnot0\\pndec }\\ls4\\adjustright \\fs20\\cgrid " + "\\s83\\fi-360\\li1440\\widctlpar\\jclisttab\\tx1440{\\*\\pn \\pnlvlbody\\ilvl0\\ls4\\pnrnot0\\pndec }\\ls4\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext84 \\sautoupd List Bullet 3" }, { "ListBullet4", - "\\s84\\fi-360\\li1800\\widctlpar\\jclisttab\\tx1800{\\*\\pn \\pnlvlbody\\ilvl0\\ls5\\pnrnot0\\pndec }\\ls5\\adjustright \\fs20\\cgrid " + "\\s84\\fi-360\\li1800\\widctlpar\\jclisttab\\tx1800{\\*\\pn \\pnlvlbody\\ilvl0\\ls5\\pnrnot0\\pndec }\\ls5\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext85 \\sautoupd List Bullet 4" }, { "ListBullet5", - "\\s85\\fi-360\\li2160\\widctlpar\\jclisttab\\tx2160{\\*\\pn \\pnlvlbody\\ilvl0\\ls6\\pnrnot0\\pndec }\\ls6\\adjustright \\fs20\\cgrid " + "\\s85\\fi-360\\li2160\\widctlpar\\jclisttab\\tx2160{\\*\\pn \\pnlvlbody\\ilvl0\\ls6\\pnrnot0\\pndec }\\ls6\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext86 \\sautoupd List Bullet 5" }, { "ListBullet6", - "\\s86\\fi-360\\li2520\\widctlpar\\jclisttab\\tx2520{\\*\\pn \\pnlvlbody\\ilvl0\\ls7\\pnrnot0\\pndec }\\ls7\\adjustright \\fs20\\cgrid " + "\\s86\\fi-360\\li2520\\widctlpar\\jclisttab\\tx2520{\\*\\pn \\pnlvlbody\\ilvl0\\ls7\\pnrnot0\\pndec }\\ls7\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext87 \\sautoupd List Bullet 6" }, { "ListBullet7", - "\\s87\\fi-360\\li2880\\widctlpar\\jclisttab\\tx2880{\\*\\pn \\pnlvlbody\\ilvl0\\ls8\\pnrnot0\\pndec }\\ls8\\adjustright \\fs20\\cgrid " + "\\s87\\fi-360\\li2880\\widctlpar\\jclisttab\\tx2880{\\*\\pn \\pnlvlbody\\ilvl0\\ls8\\pnrnot0\\pndec }\\ls8\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext88 \\sautoupd List Bullet 7" }, { "ListBullet8", - "\\s88\\fi-360\\li3240\\widctlpar\\jclisttab\\tx3240{\\*\\pn \\pnlvlbody\\ilvl0\\ls9\\pnrnot0\\pndec }\\ls9\\adjustright \\fs20\\cgrid " + "\\s88\\fi-360\\li3240\\widctlpar\\jclisttab\\tx3240{\\*\\pn \\pnlvlbody\\ilvl0\\ls9\\pnrnot0\\pndec }\\ls9\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext89 \\sautoupd List Bullet 8" }, { "ListBullet9", - "\\s89\\fi-360\\li3600\\widctlpar\\jclisttab\\tx3600{\\*\\pn \\pnlvlbody\\ilvl0\\ls10\\pnrnot0\\pndec }\\ls10\\adjustright \\fs20\\cgrid " + "\\s89\\fi-360\\li3600\\widctlpar\\jclisttab\\tx3600{\\*\\pn \\pnlvlbody\\ilvl0\\ls10\\pnrnot0\\pndec }\\ls10\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext89 \\sautoupd List Bullet 9" }, { "ListEnum0", - "\\s90\\fi-360\\li360\\widctlpar\\fs20\\cgrid " + "\\s90\\fi-360\\li360\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext91 \\sautoupd List Enum 0" }, { "ListEnum1", - "\\s91\\fi-360\\li720\\widctlpar\\fs20\\cgrid " + "\\s91\\fi-360\\li720\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext92 \\sautoupd List Enum 1" }, { "ListEnum2", - "\\s92\\fi-360\\li1080\\widctlpar\\fs20\\cgrid " + "\\s92\\fi-360\\li1080\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext93 \\sautoupd List Enum 2" }, { "ListEnum3", - "\\s93\\fi-360\\li1440\\widctlpar\\fs20\\cgrid " + "\\s93\\fi-360\\li1440\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext94 \\sautoupd List Enum 3" }, { "ListEnum4", - "\\s94\\fi-360\\li1800\\widctlpar\\fs20\\cgrid " + "\\s94\\fi-360\\li1800\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext95 \\sautoupd List Enum 4" }, { "ListEnum5", - "\\s95\\fi-360\\li2160\\widctlpar\\fs20\\cgrid " + "\\s95\\fi-360\\li2160\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext96 \\sautoupd List Enum 5" }, { "ListEnum6", - "\\s96\\fi-360\\li2520\\widctlpar\\fs20\\cgrid " + "\\s96\\fi-360\\li2520\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext96 \\sautoupd List Enum 5" }, { "ListEnum7", - "\\s97\\fi-360\\li2880\\widctlpar\\fs20\\cgrid " + "\\s97\\fi-360\\li2880\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext98 \\sautoupd List Enum 7" }, { "ListEnum8", - "\\s98\\fi-360\\li3240\\widctlpar\\fs20\\cgrid " + "\\s98\\fi-360\\li3240\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext99 \\sautoupd List Enum 8" }, { "ListEnum9", - "\\s99\\fi-360\\li3600\\widctlpar\\fs20\\cgrid " + "\\s99\\fi-360\\li3600\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext99 \\sautoupd List Enum 9" }, { 0, - 0 + 0, + 0 } }; -static QDict<char> Rtf_Style(257); - void RTFGenerator::writeStyleSheetFile(QFile &file) { QTextStream t(&file); @@ -357,14 +429,115 @@ void RTFGenerator::writeStyleSheetFile(QFile &file) t << "# Remove a hash to activate a line.\n\n"; int i; - for (i=0;Rtf_Style_Default[i].name!=0;i++) + for (i=0;Rtf_Style_Default[i].reference!=0;i++) { t << "# " << Rtf_Style_Default[i].name << " = " - << Rtf_Style_Default[i].value << endl; + << Rtf_Style_Default[i].reference + << Rtf_Style_Default[i].definition << endl; + } +} + +struct StyleData +{ + // elements of this type are stored in dictionary Rtf_Style + // + // to define a tag in the header reference + definition is required + // to use a tag in the body of the document only reference is required + + unsigned index; // index in style-sheet, i.e. number in s-clause + char* reference; // everything required to apply the style + char* definition; // aditional tags like \snext and style name + + StyleData(const char* reference, const char* definition); + ~StyleData(); + bool setStyle(const char* s, const char* styleName); + + static const QRegExp s_clause; +}; + +const QRegExp StyleData::s_clause("\\\\s[0-9]+\\s*"); + +StyleData::StyleData(const char* reference, const char* definition) +{ + int start = s_clause.match(reference); ASSERT(start >= 0); + reference += start; + index = (int)atol(reference + 2); ASSERT(index > 0); + + ASSERT(reference != 0); + size_t size = 1 + strlen(reference); + memcpy(this->reference = new char[size], reference, size); + + ASSERT(definition != 0); + size = 1 + strlen(definition); + memcpy(this->definition = new char[size], definition, size); +} + +StyleData::~StyleData() +{ + delete[] reference; + delete[] definition; +} + +bool StyleData::setStyle(const char* s, const char* styleName) +{ + static const QRegExp subgroup("^{[^}]*}\\s*"); + static const QRegExp any_clause("^\\\\[a-z][a-z0-9-]*\\s*"); + + int len; + int start = s_clause.match(s, 0, &len); + if (start < 0) + { + err("Style sheet '%s' contains no '\\s' clause.\n{%s}\n", styleName, s); + return false; + } + s += start; + index = (int)atol(s + 2); ASSERT(index > 0); + + // search for the end of pure formatting codes + const char* end = s + len; + bool haveNewDefinition = true; + for(;;) + { + if (*end == '{') + { + // subgroups are used for \\additive + if (0 != subgroup.match(end, 0, &len)) + break; + else + end += len; + } + else if (*end == '\\') + { + if (0 == strncmp(end, "\\snext", 6)) + break; + if (0 == strncmp(end, "\\sbasedon", 9)) + break; + if (0 != any_clause.match(end, 0, &len)) + break; + end += len; + } + else if (*end == 0) + { // no style-definition part, keep default value + haveNewDefinition = false; + break; + } + else // plain name without leading \\snext + break; + } + delete[] reference; + reference = new char[len + 1]; + memcpy(reference, s, len); reference[len] = 0; + if (haveNewDefinition) + { + delete[] definition; + size_t size = 1 + strlen(end); + definition = new char[size]; + memcpy(definition, end, size); } + return true; } -static void loadStylesheet(const char *name) +static void loadStylesheet(const char *name, QDict<StyleData>& dict) { QFile file(name); if (!file.open(IO_ReadOnly)) @@ -390,21 +563,24 @@ static void loadStylesheet(const char *name) continue; } QCString key=s.left(sepStart); - if (Rtf_Style[key]==0) // not a valid style sheet name + if (dict[key]==0) // not a valid style sheet name { warn(name,lineNr,"Invalid style sheet name %s ignored.\n",key.data()); continue; } + StyleData* styleData = dict.find(key); + if (styleData == 0) + { + warn(name,lineNr,"Unknown style sheet name %s ignored.\n",key.data()); + continue; + } s+=" "; // add command separator - Rtf_Style.remove(key); // remove old key - int l = strlen(s.data()+sepStart+sepLength); - char *value = new char[l+1]; - strcpy(value,s.data()+sepStart+sepLength); - Rtf_Style.insert(key,value); // insert new key + styleData->setStyle(s.data() + sepStart + sepLength, key.data()); lineNr++; } } +static QDict<StyleData> Rtf_Style(257); void RTFGenerator::init() { @@ -415,25 +591,24 @@ void RTFGenerator::init() err("Could not create output directory %s\n",dir.data()); exit(1); } + Rtf_Style.setAutoDelete(true); - Rtf_Style.setAutoDelete(TRUE); - int i=0; - while (Rtf_Style_Default[i].name!=0) + // first duplicate strings of Rtf_Style_Default + const struct Rtf_Style_Default* def = Rtf_Style_Default; + while(def->reference != 0) { - int l = strlen(Rtf_Style_Default[i].value); - char *value = new char[l+1]; - strcpy(value,Rtf_Style_Default[i].value); - Rtf_Style.insert(Rtf_Style_Default[i].name,value); - i++; + if (def->definition == 0) + err("Internal error: 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 if (!Config::rtfStylesheetFile.isEmpty()) - { - loadStylesheet(Config::rtfStylesheetFile); - } + loadStylesheet(Config::rtfStylesheetFile, Rtf_Style); } - static QCString makeIndexName(const char *s,int i) { QCString result=s; @@ -443,7 +618,6 @@ static QCString makeIndexName(const char *s,int i) void RTFGenerator::beginRTFDocument() { - int i; /* all the included RTF files should begin with the * same header */ @@ -475,58 +649,40 @@ void RTFGenerator::beginRTFDocument() t <<"\\red128\\green128\\blue128;"; t <<"\\red192\\green192\\blue192;}" << endl; - DBG_RTF(t <<"{\\comment Begining style list}\n") + DBG_RTF(t <<"{\\comment Beginning style list}\n") t <<"{\\stylesheet\n"; t <<"{\\widctlpar\\adjustright \\fs20\\cgrid \\snext0 Normal;}\n"; - t <<"{" << Rtf_Style["Heading1"] <<"\\sbasedon0 \\snext0 heading 1;}\n"; - t <<"{" << Rtf_Style["Heading2"] <<"\\sbasedon0 \\snext0 heading 2;}\n"; - t <<"{" << Rtf_Style["Heading3"] <<"\\sbasedon0 \\snext0 heading 3;}\n"; - t <<"{" << Rtf_Style["Heading4"] <<"\\sbasedon0 \\snext0 heading 4;}\n"; - t <<"{\\*\\cs10 \\additive Default Paragraph Font;}\n"; - t <<"{" << Rtf_Style["Title"] << "\\sbasedon0 \\snext15 Title;}\n"; - t <<"{" << Rtf_Style["SubTitle"] << "\\sbasedon0 \\snext16 Subtitle;}\n"; - t <<"{" << Rtf_Style["BodyText"] << "\\sbasedon0 \\snext17 BodyText;}\n"; - t <<"{" << Rtf_Style["DenseText"] << "\\sbasedon0 \\snext18 DenseText;}\n"; - t <<"{" << Rtf_Style["Header"] << "\\sbasedon0 \\snext28 header;}\n"; - t <<"{" << Rtf_Style["Footer"] << "\\sbasedon0 \\snext29 footer;}\n"; - t <<"{" << Rtf_Style["GroupHeader"] << "\\sbasedon0 \\snext30 GroupHeader}\n"; - - for (i=0;i<indentLevels;i++) - { - QCString n=makeIndexName("CodeExample",i); - t <<"{" << Rtf_Style[n] <<"\\sbasedon0 \\snext4" - << (QMIN(i+1,indentLevels-1)) << " Code Example " << i << ";}\n"; - } - for (i=0;i<indentLevels;i++) - { - QCString n=makeIndexName("ListContinue",i); - t <<"{" << Rtf_Style[n] << "\\sbasedon0 \\snext5" - << (QMIN(i+1,indentLevels-1)) << " List Continue " << i << ";}\n"; - } - for (i=0;i<indentLevels;i++) - { - QCString n=makeIndexName("DescContinue",i); - t <<"{" << Rtf_Style[n] << "\\sbasedon0 \\snext6" - << (QMIN(i+1,indentLevels-1)) << " DescContinue " << i << ";}\n"; - } - for (i=0;i<indentLevels;i++) - { - QCString n=makeIndexName("LatexTOC",i); - t <<"{" << Rtf_Style[n] << "\\sbasedon50 \\snext7" - << (QMIN(i+1,indentLevels-1)) << " LatexTOC " << i << ";}\n"; - } - for (i=0;i<indentLevels;i++) + + // 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) { - QCString n=makeIndexName("ListBullet",i); - t <<"{" << Rtf_Style[n] << "\\sbasedon0 \\snext8" - << (QMIN(i+1,indentLevels-1)) << " \\sautoupd List Bullet " << i << ";}\n"; + 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) + msg("Style '%s' redefines \\s%d.\n", iter.currentKey(), index); + array.at(index) = style; } - for (i=0;i<indentLevels;i++) + + // write array elements + unsigned size = array.size(); + for(unsigned i = 0; i < size; i++) { - QCString n=makeIndexName("ListEnum",i); - t <<"{" << Rtf_Style[n] << "\\sbasedon0 \\snext9" - << (QMIN(i+1,indentLevels-1)) << " \\sautoupd List Enum " << i << ";}\n"; + 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; @@ -537,7 +693,7 @@ void RTFGenerator::beginRTFChapter() { t <<"\n"; DBG_RTF(t << "{\\comment Begin Chapter}\n") - t << Rtf_Style["Reset"]; + t << Rtf_Style_Reset; // if we are compact, no extra page breaks... if (Config::compactRTFFlag) @@ -550,14 +706,14 @@ void RTFGenerator::beginRTFChapter() t <<"\\sect\\sbkpage\n"; //t <<"\\sect\\sectd\\sbkpage\n"; - t << Rtf_Style["Heading1"] << "\n"; + t << Rtf_Style["Heading1"]->reference << "\n"; } void RTFGenerator::beginRTFSection() { t <<"\n"; DBG_RTF(t << "{\\comment Begin Section}\n") - t << Rtf_Style["Reset"]; + t << Rtf_Style_Reset; // if we are compact, no extra page breaks... if (Config::compactRTFFlag) @@ -570,7 +726,7 @@ void RTFGenerator::beginRTFSection() t <<"\\sect\\sbkpage\n"; //t <<"\\sect\\sectd\\sbkpage\n"; - t << Rtf_Style["Heading2"] << "\n"; + t << Rtf_Style["Heading2"]->reference << "\n"; } void RTFGenerator::startFile(const char *name,const char *, bool ) @@ -747,14 +903,14 @@ void RTFGenerator::endIndexSection(IndexSections is) "}"; DBG_RTF(t << "{\\comment end of infoblock}\n") // setup for this section - t << Rtf_Style["Reset"] <<"\n"; + t << Rtf_Style_Reset <<"\n"; t <<"\\sectd\\pgnlcrm\n"; - t <<"{\\footer "<<Rtf_Style["Footer"] << "{\\chpgn}}\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["Title"] << endl; // set to title style + 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"] << endl; // set to subtitle style + t << Rtf_Style_Reset << Rtf_Style["SubTitle"]->reference << endl; // set to subtitle style t << "{\\field\\fldedit {\\*\\fldinst AUTHOR \\\\*MERGEFORMAT}{\\fldrslt AUTHOR}}\\par" << endl; t << "{\\field\\fldedit {\\*\\fldinst CREATEDATE \\\\*MERGEFORMAT}" "{\\fldrslt CREATEDATE}}\\par"<<endl; @@ -762,44 +918,44 @@ void RTFGenerator::endIndexSection(IndexSections is) // table of contents section DBG_RTF(t << "{\\comment Table of contents}\n") - t << Rtf_Style["Reset"] << endl; + t << Rtf_Style_Reset << endl; t << "{\\field\\fldedit {\\*\\fldinst TOC \\\\f \\\\*MERGEFORMAT}{\\fldrslt Table of contents}}\\par\n"; - t << Rtf_Style["Reset"] << endl; + t << Rtf_Style_Reset << endl; } break; case isMainPage: - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\tc \\v " << theTranslator->trMainPage() << "}"<< endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"index.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isModuleIndex: - t << "\\par " << Rtf_Style["Reset"] << endl; + 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 isNamespaceIndex: - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; 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 << "\\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; + t << "\\par " << Rtf_Style_Reset << endl; 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 << "\\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 << "\\par " << Rtf_Style_Reset << endl; t << "{\\tc \\v " << theTranslator->trPageIndex() << "}"<< endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"pages.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; @@ -812,7 +968,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { if (gd->countMembers()>0) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << gd->getOutputFileBase(); t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; @@ -825,7 +981,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { if (gd->countMembers()>0) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; beginRTFSection(); t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << gd->getOutputFileBase(); @@ -843,7 +999,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { if (nd->isLinkableInProject()) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << nd->getOutputFileBase(); t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; @@ -855,7 +1011,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { if (nd->isLinkableInProject()) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; beginRTFSection(); t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << nd->getOutputFileBase(); @@ -875,7 +1031,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { if (cd->isLinkableInProject()) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << cd->getOutputFileBase(); t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; @@ -887,7 +1043,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { if (cd->isLinkableInProject()) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; beginRTFSection(); t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << cd->getOutputFileBase(); @@ -912,7 +1068,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { if (isFirst) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << fd->getOutputFileBase(); t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; @@ -920,7 +1076,7 @@ void RTFGenerator::endIndexSection(IndexSections is) } else { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; beginRTFSection(); t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << fd->getOutputFileBase(); @@ -941,14 +1097,14 @@ void RTFGenerator::endIndexSection(IndexSections is) PageInfo *pi=pdi.toFirst(); if (pi) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << convertFileName(pi->name); t << "-example.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; } for (++pdi;(pi=pdi.current());++pdi) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; beginRTFSection(); t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << convertFileName(pi->name); @@ -968,7 +1124,7 @@ void RTFGenerator::endIndexSection(IndexSections is) pageName=pi->name.copy(); else pageName=pi->name.lower(); - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << pageName; t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; @@ -980,7 +1136,7 @@ void RTFGenerator::endIndexSection(IndexSections is) pageName=pi->name.copy(); else pageName=pi->name.lower(); - //t << "\\par " << Rtf_Style["Reset"] << endl; + //t << "\\par " << Rtf_Style_Reset << endl; //beginRTFSection(); t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << pageName; @@ -990,9 +1146,9 @@ void RTFGenerator::endIndexSection(IndexSections is) break; case isEndIndex: beginRTFChapter(); - t << Rtf_Style["Heading1"]; + t << Rtf_Style["Heading1"]->reference; t << "Index\\par "<< endl; - t << Rtf_Style["Reset"] << endl; + t << Rtf_Style_Reset << endl; t << "{\\tc \\v Index}" << endl; t << "{\\field\\fldedit {\\*\\fldinst INDEX \\\\c2 \\\\*MERGEFORMAT}{\\fldrslt INDEX}}\n"; @@ -1008,8 +1164,8 @@ void RTFGenerator::lastIndexPage() t <<"\\sect \\sectd \\sbknone \\pgndec\n"; // set footer - t <<"{\\footer "<< Rtf_Style["Footer"] << "{\\chpgn}}\n"; - //t << Rtf_Style["Heading1"] << "\n"; + t <<"{\\footer "<< Rtf_Style["Footer"]->reference << "{\\chpgn}}\n"; + //t << Rtf_Style["Heading1"]->reference << "\n"; } @@ -1034,7 +1190,7 @@ void RTFGenerator::startIndexList() DBG_RTF(t << "{\\comment (startIndexList)}" << endl) t << "{" << endl; incrementIndentLevel(); - t << Rtf_Style["Reset"] << Rtf_LCList_DepthStyle() << endl; + t << Rtf_Style_Reset << Rtf_LCList_DepthStyle() << endl; newParagraph(); m_omitParagraph=TRUE; } @@ -1055,7 +1211,7 @@ void RTFGenerator::startItemList() t << "{"; incrementIndentLevel(); listItemInfo[m_listLevel].isEnum = FALSE; - //t << Rtf_Style["Reset"] << Rtf_BList_DepthStyle(); + //t << Rtf_Style_Reset << Rtf_BList_DepthStyle(); } /*! end bullet list */ @@ -1066,7 +1222,7 @@ void RTFGenerator::endItemList() t << "}"; decrementIndentLevel(); m_omitParagraph=TRUE; - //t << Rtf_Style["Reset"] << styleStack.top() << endl; + //t << Rtf_Style_Reset << styleStack.top() << endl; //printf("RTFGenerator::endItemList() `%s'\n",styleStack.top()); //newParagraph(); } @@ -1079,7 +1235,7 @@ void RTFGenerator::startEnumList() // starts an enumeration list incrementIndentLevel(); listItemInfo[m_listLevel].isEnum = TRUE; listItemInfo[m_listLevel].number = 1; - //t << Rtf_Style["Reset"] << Rtf_EList_DepthStyle() << endl; + //t << Rtf_Style_Reset << Rtf_EList_DepthStyle() << endl; //newParagraph(); //m_omitParagraph=TRUE; @@ -1100,7 +1256,7 @@ void RTFGenerator::writeListItem() { DBG_RTF(t << "{\\comment (writeListItem)}" << endl) newParagraph(); - t << Rtf_Style["Reset"]; + t << Rtf_Style_Reset; if (listItemInfo[m_listLevel].isEnum) { t << Rtf_EList_DepthStyle() << endl; @@ -1218,14 +1374,14 @@ void RTFGenerator::startSubsection() //beginRTFSubSection(); t <<"\n"; DBG_RTF(t << "{\\comment Begin SubSection}\n") - t << Rtf_Style["Reset"]; - t << Rtf_Style["Heading3"] << "\n"; + t << Rtf_Style_Reset; + t << Rtf_Style["Heading3"]->reference << "\n"; } void RTFGenerator::endSubsection() { newParagraph(); - t << Rtf_Style["Reset"] << endl; + t << Rtf_Style_Reset << endl; } void RTFGenerator::startSubsubsection() @@ -1234,7 +1390,7 @@ void RTFGenerator::startSubsubsection() t << "\n"; DBG_RTF(t << "{\\comment Begin SubSubSection}\n") t << "{" << endl; - t << Rtf_Style["Reset"] << Rtf_Style["Heading4"] << "\n"; + t << Rtf_Style_Reset << Rtf_Style["Heading4"]->reference << "\n"; } void RTFGenerator::endSubsubsection() @@ -1374,13 +1530,13 @@ void RTFGenerator::startTitleHead(const char *) DBG_RTF(t <<"{\\comment startTitleHead}" << endl) // beginRTFSection(); - t << Rtf_Style["Reset"] << Rtf_Style["Heading2"] << endl; + t << Rtf_Style_Reset << Rtf_Style["Heading2"]->reference << endl; } void RTFGenerator::endTitleHead(const char *fileName,const char *name) { DBG_RTF(t <<"{\\comment endTitleHead}" << endl) - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; if (name) { // make table of contents entry @@ -1416,8 +1572,8 @@ void RTFGenerator::startGroupHeader() { DBG_RTF(t <<"{\\comment startGroupHeader}" << endl) newParagraph(); - t << Rtf_Style["Reset"]; - t << Rtf_Style["Heading3"]; + t << Rtf_Style_Reset; + t << Rtf_Style["Heading3"]->reference; t << endl; } @@ -1425,7 +1581,7 @@ void RTFGenerator::endGroupHeader() { DBG_RTF(t <<"{\\comment endGroupHeader}" << endl) newParagraph(); - t << Rtf_Style["Reset"] << endl; + t << Rtf_Style_Reset << endl; } void RTFGenerator::startMemberDoc(const char *clname, @@ -1439,10 +1595,10 @@ void RTFGenerator::startMemberDoc(const char *clname, addToIndex(memname,clname); addToIndex(clname,memname); } - t << Rtf_Style["Reset"] << Rtf_Style["Heading4"]; + t << Rtf_Style_Reset << Rtf_Style["Heading4"]->reference; //styleStack.push(Rtf_Style_Heading4); t << "{" << endl; - //printf("RTFGenerator::startMemberDoc() `%s'\n",Rtf_Style["Heading4"]); + //printf("RTFGenerator::startMemberDoc() `%s'\n",Rtf_Style["Heading4"]->reference); startBold(); t << endl; } @@ -1453,7 +1609,7 @@ void RTFGenerator::endMemberDoc() t << "}" << endl; //const char *style = styleStack.pop(); //printf("RTFGenerator::endMemberDoc() `%s'\n",style); - //ASSERT(style==Rtf_Style["Heading4"]); + //ASSERT(style==Rtf_Style["Heading4"]->reference); endBold(); newParagraph(); } @@ -1509,7 +1665,7 @@ void RTFGenerator::startIndent() incrementIndentLevel(); DBG_RTF(t << "{\\comment (startIndent) }" << endl) t << "{" << endl; - t << Rtf_Style["Reset"] << Rtf_CList_DepthStyle() << endl; + t << Rtf_Style_Reset << Rtf_CList_DepthStyle() << endl; //styleStack.push(style); } @@ -1525,7 +1681,7 @@ void RTFGenerator::startDescription() { DBG_RTF(t << "{\\comment (startDescription)}" << endl) t << "{" << endl; - t << Rtf_Style["Reset"] << Rtf_CList_DepthStyle(); + t << Rtf_Style_Reset << Rtf_CList_DepthStyle(); } void RTFGenerator::endDescription() @@ -1554,7 +1710,7 @@ void RTFGenerator::startMemberDescription() DBG_RTF(t << "{\\comment (startMemberDescription)}" << endl) t << "{" << endl; incrementIndentLevel(); - t << Rtf_Style["Reset"] << Rtf_CList_DepthStyle(); + t << Rtf_Style_Reset << Rtf_CList_DepthStyle(); startEmphasis(); } @@ -1578,16 +1734,16 @@ void RTFGenerator::endDescTitle() { DBG_RTF(t << "{\\comment (endDescTitle) }" << endl) newParagraph(); - //t << Rtf_Style["Reset"] << styleStack.top(); + //t << Rtf_Style_Reset << styleStack.top(); incrementIndentLevel(); - t << Rtf_Style["Reset"] << Rtf_DList_DepthStyle(); + t << Rtf_Style_Reset << Rtf_DList_DepthStyle(); } void RTFGenerator::writeDescItem() { DBG_RTF(t << "{\\comment (writeDescItem) }" << endl) // incrementIndentLevel(); - //t << Rtf_Style["Reset"] << Rtf_CList_DepthStyle(); + //t << Rtf_Style_Reset << Rtf_CList_DepthStyle(); } void RTFGenerator::endDescList() @@ -1597,18 +1753,18 @@ void RTFGenerator::endDescList() t << "}"; decrementIndentLevel(); m_omitParagraph = TRUE; - //t << Rtf_Style["Reset"] << styleStack.top() << endl; + //t << Rtf_Style_Reset << styleStack.top() << endl; } -void RTFGenerator::writeSection(const char *lab,const char *title,bool sub) +void RTFGenerator::startSection(const char *,const char *title,bool sub) { - DBG_RTF(t << "{\\comment (writeSection)}" << endl) + DBG_RTF(t << "{\\comment (startSection)}" << endl) t << "{"; - t<< Rtf_Style["Reset"]; + t<< Rtf_Style_Reset; if (sub) { // set style - t << Rtf_Style["Heading3"]; + t << Rtf_Style["Heading3"]->reference; // make table of contents entry t << "{\\tc\\tcl3 \\v "; docify(title); @@ -1617,16 +1773,16 @@ void RTFGenerator::writeSection(const char *lab,const char *title,bool sub) else { // set style - t << Rtf_Style["Heading2"]; + t << Rtf_Style["Heading2"]->reference; // make table of contents entry t << "{\\tc\\tcl2 \\v "; docify(title); t << "}" << endl; } +} - // write out actual title - docify(title); - +void RTFGenerator::endSection(const char *lab,bool) +{ newParagraph(); // make bookmark writeAnchor(0,lab); @@ -1741,7 +1897,7 @@ void RTFGenerator::endClassDiagram(ClassDiagram &d, // display the file t << "{" << endl; - t << Rtf_Style["Reset"] << endl; + t << Rtf_Style_Reset << endl; t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE "; t << fileName << ".gif"; t << " \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl; @@ -1756,7 +1912,7 @@ void RTFGenerator::writeFormula(const char *,const char *text) void RTFGenerator::startMemberItem(int) { DBG_RTF(t <<"{\\comment startMemberItem }" << endl) - t << Rtf_Style["Reset"] << Rtf_BList_DepthStyle() << endl; // set style to apropriate depth + t << Rtf_Style_Reset << Rtf_BList_DepthStyle() << endl; // set style to apropriate depth } void RTFGenerator::endMemberItem(bool) @@ -1786,7 +1942,7 @@ void RTFGenerator::startCodeFragment() { t << "{" << endl; newParagraph(); - t << Rtf_Style["Reset"] << Rtf_Code_DepthStyle(); + t << Rtf_Style_Reset << Rtf_Code_DepthStyle(); //styleStack.push(Rtf_Style_CodeExample); } @@ -1795,7 +1951,7 @@ void RTFGenerator::endCodeFragment() newParagraph(); //styleStack.pop(); //printf("RTFGenerator::endCodeFrament() top=%s\n",styleStack.top()); - //t << Rtf_Style["Reset"] << styleStack.top() << endl; + //t << Rtf_Style_Reset << styleStack.top() << endl; t << "}" << endl; m_omitParagraph = TRUE; } @@ -1842,7 +1998,7 @@ void RTFGenerator::startDescTable() DBG_RTF(t << "{\\comment (startDescTable) }" << endl) t << "{" << endl; //incrementIndentLevel(); - //t << Rtf_Style["Reset"] << Rtf_CList_DepthStyle(); + //t << Rtf_Style_Reset << Rtf_CList_DepthStyle(); } void RTFGenerator::endDescTable() @@ -1850,7 +2006,7 @@ void RTFGenerator::endDescTable() //decrementIndentLevel(); DBG_RTF(t << "{\\comment (endDescTable)}" << endl) t << "}" << endl; - //t << Rtf_Style["Reset"] << styleStack.top(); + //t << Rtf_Style_Reset << styleStack.top(); } void RTFGenerator::startDescTableTitle() @@ -1904,54 +2060,54 @@ void RTFGenerator::decrementIndentLevel() const char * RTFGenerator::Rtf_CList_DepthStyle() { QCString n=makeIndexName("ListContinue",m_listLevel); - return Rtf_Style[n]; + return Rtf_Style[n]->reference; } // a style for list formatted as a "latext style" table of contents const char * RTFGenerator::Rtf_LCList_DepthStyle() { QCString n=makeIndexName("LatexTOC",m_listLevel); - return Rtf_Style[n]; + return Rtf_Style[n]->reference; } // a style for list formatted as a "bullet" style const char * RTFGenerator::Rtf_BList_DepthStyle() { QCString n=makeIndexName("ListBullet",m_listLevel); - return Rtf_Style[n]; + return Rtf_Style[n]->reference; } // a style for list formatted as a "enumeration" style const char * RTFGenerator::Rtf_EList_DepthStyle() { QCString n=makeIndexName("ListEnum",m_listLevel); - return Rtf_Style[n]; + return Rtf_Style[n]->reference; } const char * RTFGenerator::Rtf_DList_DepthStyle() { QCString n=makeIndexName("DescContinue",m_listLevel); - return Rtf_Style[n]; + return Rtf_Style[n]->reference; } const char * RTFGenerator::Rtf_Code_DepthStyle() { QCString n=makeIndexName("CodeExample",m_listLevel); - return Rtf_Style[n]; + return Rtf_Style[n]->reference; } void RTFGenerator::startTextBlock(bool dense) { DBG_RTF(t << "{\\comment Start TextBlock}" << endl) t << "{" << endl; - t << Rtf_Style["Reset"]; + t << Rtf_Style_Reset; if (dense) // no spacing between "paragraphs" { - t << Rtf_Style["DenseText"]; + t << Rtf_Style["DenseText"]->reference; } else // some spacing { - t << Rtf_Style["BodyText"]; + t << Rtf_Style["BodyText"]->reference; } } @@ -1972,7 +2128,7 @@ void RTFGenerator::newParagraph() void RTFGenerator::startMemberSubtitle() { t << "{" << endl; - t << Rtf_Style["Reset"] << Rtf_CList_DepthStyle() << endl; + t << Rtf_Style_Reset << Rtf_CList_DepthStyle() << endl; } void RTFGenerator::endMemberSubtitle() @@ -2165,7 +2321,7 @@ void RTFGenerator::endDotGraph(DotClassGraph &g) // display the file t << "{" << endl; - t << Rtf_Style["Reset"] << endl; + t << Rtf_Style_Reset << endl; t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE "; t << g.diskName() << ".gif"; t << " \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl; @@ -2186,7 +2342,7 @@ void RTFGenerator::endInclDepGraph(DotInclDepGraph &g) // display the file t << "{" << endl; - t << Rtf_Style["Reset"] << endl; + t << Rtf_Style_Reset << endl; t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE "; t << g.diskName() << ".gif"; t << " \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl; @@ -2246,14 +2402,14 @@ void RTFGenerator::startMemberGroupHeader(bool hasHeader) DBG_RTF(t << "{\\comment startMemberGroupHeader}" << endl) t << "{" << endl; if (hasHeader) incrementIndentLevel(); - t << Rtf_Style["Reset"] << Rtf_Style["GroupHeader"]; + t << Rtf_Style_Reset << Rtf_Style["GroupHeader"]->reference; } void RTFGenerator::endMemberGroupHeader() { DBG_RTF(t << "{\\comment endMemberGroupHeader}" << endl) newParagraph(); - t << Rtf_Style["Reset"] << Rtf_CList_DepthStyle(); + t << Rtf_Style_Reset << Rtf_CList_DepthStyle(); } void RTFGenerator::startMemberGroupDocs() @@ -2272,7 +2428,7 @@ void RTFGenerator::endMemberGroupDocs() void RTFGenerator::startMemberGroup() { DBG_RTF(t << "{\\comment startMemberGroup}" << endl) - t << Rtf_Style["Reset"] << Rtf_BList_DepthStyle() << endl; + t << Rtf_Style_Reset << Rtf_BList_DepthStyle() << endl; } void RTFGenerator::endMemberGroup(bool hasHeader) |