Doxygen
Loading...
Searching...
No Matches
rtfstyle.h File Reference

#include <src/rtfstyle.h>

Include dependency graph for rtfstyle.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Rtf_Style_Default
struct  Rtf_Table_Default
struct  StyleData

Typedefs

using StyleDataMap = std::map<std::string,StyleData>

Functions

void loadExtensions (const DString &name)
void loadStylesheet (const DString &name, StyleDataMap &map)

Variables

const int rtf_pageWidth = 8748
DString rtf_title
DString rtf_subject
DString rtf_comments
DString rtf_company
DString rtf_logoFilename
DString rtf_author
DString rtf_manager
DString rtf_documentType
DString rtf_documentId
DString rtf_keywords
char rtf_Style_Reset []
Rtf_Style_Default rtf_Style_Default []
Rtf_Table_Default rtf_Table_Default []
StyleDataMap rtf_Style

Typedef Documentation

◆ StyleDataMap

using StyleDataMap = std::map<std::string,StyleData>

Definition at line 79 of file rtfstyle.h.

Function Documentation

◆ loadExtensions()

void loadExtensions ( const DString & name)

Definition at line 368 of file rtfstyle.cpp.

369{
370 std::ifstream file(name.str());
371 if (!file.is_open())
372 {
373 err("Can't open RTF extensions file {}. Using defaults.\n",name);
374 return;
375 }
376 msg("Loading RTF extensions {}...\n",name);
377
378 uint32_t lineNr=1;
379
380 for (std::string line ; getline(file,line) ; ) // for each line
381 {
382 if (line.empty() || line[0]=='#') continue; // skip blanks & comments
383 static const reg::Ex assignment_splitter(R"(\s*=\s*)");
385 if (reg::search(line,match,assignment_splitter))
386 {
387 std::string key = match.prefix().str();
388 std::string value = match.suffix().str();
389 auto it = g_styleMap.find(key);
390 if (it!=g_styleMap.end())
391 {
392 it->second = value;
393 }
394 else
395 {
396 warn(name,lineNr,"Ignoring unknown extension key '{}'...",key);
397 }
398 }
399 else
400 {
401 warn(name,lineNr,"Assignment of style sheet name expected!");
402 }
403 lineNr++;
404 }
405}
const std::string & str() const
Definition dstring.h:645
Class representing a regular expression.
Definition regex.h:39
Object representing the matching results.
Definition regex.h:154
#define warn(file, line, fmt,...)
Definition message.h:97
#define msg(fmt,...)
Definition message.h:94
#define err(fmt,...)
Definition message.h:127
bool search(std::string_view str, Match &match, const Ex &re, size_t pos)
Search in a given string str starting at position pos for a match against regular expression re.
Definition regex.cpp:850
bool match(std::string_view str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
Definition regex.cpp:861
static std::map< std::string, DString & > g_styleMap
Definition rtfstyle.cpp:39

References err, g_styleMap, msg, reg::search(), DString::str(), and warn.

Referenced by RTFGenerator::init().

◆ loadStylesheet()

void loadStylesheet ( const DString & name,
StyleDataMap & map )

Definition at line 326 of file rtfstyle.cpp.

327{
328 std::ifstream file(name.str());
329 if (!file.is_open())
330 {
331 err("Can't open RTF style sheet file {}. Using defaults.\n",name);
332 return;
333 }
334 msg("Loading RTF style sheet {}...\n",name);
335
336 uint32_t lineNr=1;
337
338 for (std::string line ; getline(file,line) ; ) // for each line
339 {
340 if (line.empty() || line[0]=='#') continue; // skip blanks & comments
341 static const reg::Ex assignment_splitter(R"(\s*=\s*)");
343 if (reg::search(line,match,assignment_splitter))
344 {
345 DString key = match.prefix().str();
346 DString value = match.suffix().str();
347 auto it = map.find(key.str());
348 if (it!=map.end())
349 {
350 StyleData& styleData = it->second;
351 styleData.setStyle(value,key);
352 }
353 else
354 {
355 warn(name,lineNr,"Unknown style sheet name {} ignored.",key);
356 }
357 }
358 else
359 {
360 warn(name,lineNr,"Assignment of style sheet name expected line='{}'!",line);
361 }
362 lineNr++;
363 }
364}
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
bool setStyle(const DString &command, const DString &styleName)
Definition rtfstyle.cpp:306

References err, msg, reg::search(), StyleData::setStyle(), DString::str(), and warn.

Referenced by RTFGenerator::init().

Variable Documentation

◆ rtf_author

DString rtf_author
extern

Definition at line 33 of file rtfstyle.cpp.

Referenced by RTFGenerator::endIndexSection(), and RTFGenerator::startIndexSection().

◆ rtf_comments

DString rtf_comments
extern

Definition at line 30 of file rtfstyle.cpp.

Referenced by RTFGenerator::startIndexSection().

◆ rtf_company

DString rtf_company
extern

Definition at line 31 of file rtfstyle.cpp.

Referenced by RTFGenerator::endIndexSection(), and RTFGenerator::startIndexSection().

◆ rtf_documentId

DString rtf_documentId
extern

Definition at line 36 of file rtfstyle.cpp.

Referenced by RTFGenerator::endIndexSection().

◆ rtf_documentType

DString rtf_documentType
extern

Definition at line 35 of file rtfstyle.cpp.

Referenced by RTFGenerator::endIndexSection(), and RTFGenerator::startIndexSection().

◆ rtf_keywords

DString rtf_keywords
extern

Definition at line 37 of file rtfstyle.cpp.

Referenced by RTFGenerator::startIndexSection().

◆ rtf_logoFilename

DString rtf_logoFilename
extern

Definition at line 32 of file rtfstyle.cpp.

Referenced by RTFGenerator::endIndexSection(), and RTFGenerator::init().

◆ rtf_manager

DString rtf_manager
extern

Definition at line 34 of file rtfstyle.cpp.

Referenced by RTFGenerator::startIndexSection().

◆ rtf_pageWidth

const int rtf_pageWidth = 8748

◆ rtf_Style

◆ rtf_Style_Default

Rtf_Style_Default rtf_Style_Default[]
extern

Definition at line 93 of file rtfstyle.cpp.

93 {
94 { "Heading1",
95 "\\s1\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs36\\kerning36\\cgrid ",
96 "\\sbasedon0 \\snext0 heading 1"
97 },
98 { "Heading2",
99 "\\s2\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs28\\kerning28\\cgrid ",
100 "\\sbasedon0 \\snext0 heading 2"
101 },
102 { "Heading3",
103 "\\s3\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\cgrid ",
104 "\\sbasedon0 \\snext0 heading 3"
105 },
106 { "Heading4",
107 "\\s4\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs20\\cgrid ",
108 "\\sbasedon0 \\snext0 heading 4;}{\\*\\cs10 \\additive Default Paragraph Font"
109 },
110 { "Heading5",
111 "\\s5\\sb90\\sa30\\keepn\\widctlpar\\adjustright \\b\\f1\\fs16\\cgrid ",
112 "\\sbasedon0 \\snext0 heading 5;}{\\*\\cs10 \\additive Default Paragraph Font"
113 },
114 { "Heading6",
115 "\\s6\\sb90\\sa30\\keepn\\widctlpar\\adjustright \\b\\f1\\fs12\\cgrid ",
116 "\\sbasedon0 \\snext0 heading 6;}{\\*\\cs10 \\additive Default Paragraph Font"
117 },
118 { "Title",
119 "\\s15\\qc\\sb240\\sa60\\widctlpar\\outlinelevel0\\adjustright \\b\\f1\\fs32\\kerning28\\cgrid ",
120 "\\sbasedon0 \\snext15 Title"
121 },
122 { "SubTitle",
123 "\\s16\\qc\\sa60\\widctlpar\\outlinelevel1\\adjustright \\f1\\cgrid ",
124 "\\sbasedon0 \\snext16 Subtitle"
125 },
126 { "BodyText",
127 "\\s17\\sa60\\sb30\\widctlpar\\qj \\fs22\\cgrid ",
128 "\\sbasedon0 \\snext17 BodyText"
129 },
130 { "DenseText",
131 "\\s18\\widctlpar\\fs22\\cgrid ",
132 "\\sbasedon0 \\snext18 DenseText"
133 },
134 { "Header",
135 "\\s28\\widctlpar\\tqc\\tx4320\\tqr\\tx8640\\adjustright \\fs20\\cgrid ",
136 "\\sbasedon0 \\snext28 header"
137 },
138 { "Footer",
139 "\\s29\\widctlpar\\tqc\\tx4320\\tqr\\tx8640\\qr\\adjustright \\fs20\\cgrid ",
140 "\\sbasedon0 \\snext29 footer"
141 },
142 { "GroupHeader",
143 "\\s30\\li360\\sa60\\sb120\\keepn\\widctlpar\\adjustright \\b\\f1\\fs20\\cgrid ",
144 "\\sbasedon0 \\snext30 GroupHeader"
145 },
146
147 RTF_CodeExample( 0, 40, 41, 0),
148 RTF_CodeExample( 1, 41, 42, 360),
149 RTF_CodeExample( 2, 42, 43, 720),
150 RTF_CodeExample( 3, 43, 44,1080),
151 RTF_CodeExample( 4, 44, 45,1440),
152 RTF_CodeExample( 5, 45, 46,1800),
153 RTF_CodeExample( 6, 46, 47,2160),
154 RTF_CodeExample( 7, 47, 48,2520),
155 RTF_CodeExample( 8, 48, 49,2880),
156 RTF_CodeExample( 9, 49, 50,3240),
157 RTF_CodeExample(10, 50, 51,3600),
158 RTF_CodeExample(11, 51, 52,3960),
159 RTF_CodeExample(12, 52, 53,4320),
160 RTF_CodeExample(13, 53, 53,4680),
161
162 RTF_ListContinue( 0, 60, 61, 0),
163 RTF_ListContinue( 1, 61, 62, 360),
164 RTF_ListContinue( 2, 62, 63, 720),
165 RTF_ListContinue( 3, 63, 64,1080),
166 RTF_ListContinue( 4, 64, 65,1440),
167 RTF_ListContinue( 5, 65, 66,1800),
168 RTF_ListContinue( 6, 66, 67,2160),
169 RTF_ListContinue( 7, 67, 68,2520),
170 RTF_ListContinue( 8, 68, 69,2880),
171 RTF_ListContinue( 9, 69, 70,3240),
172 RTF_ListContinue(10, 70, 71,3600),
173 RTF_ListContinue(11, 71, 72,3960),
174 RTF_ListContinue(12, 72, 73,4320),
175 RTF_ListContinue(13, 73, 73,4680),
176
177 RTF_DescContinue( 0, 80, 81, 0),
178 RTF_DescContinue( 1, 81, 82, 360),
179 RTF_DescContinue( 2, 82, 83, 720),
180 RTF_DescContinue( 3, 83, 84,1080),
181 RTF_DescContinue( 4, 84, 85,1440),
182 RTF_DescContinue( 5, 85, 86,1800),
183 RTF_DescContinue( 6, 86, 87,2160),
184 RTF_DescContinue( 7, 87, 88,2520),
185 RTF_DescContinue( 8, 88, 89,2880),
186 RTF_DescContinue( 9, 89, 90,3240),
187 RTF_DescContinue(10, 90, 91,3600),
188 RTF_DescContinue(11, 91, 92,3960),
189 RTF_DescContinue(12, 92, 93,4320),
190 RTF_DescContinue(13, 93, 93,4680),
191
192 RTF_LatexToc( 0,100,101, 0,30),
193 RTF_LatexToc( 1,101,102, 360,27),
194 RTF_LatexToc( 2,102,103, 720,24),
195 RTF_LatexToc( 3,103,104,1080,21),
196 RTF_LatexToc( 4,104,105,1440,18),
197 RTF_LatexToc( 5,105,106,1800,15),
198 RTF_LatexToc( 6,106,107,2160,12),
199 RTF_LatexToc( 7,107,108,2520, 9),
200 RTF_LatexToc( 8,108,109,2880, 6),
201 RTF_LatexToc( 9,109,110,3240, 3),
202 RTF_LatexToc(10,110,111,3600, 3),
203 RTF_LatexToc(11,111,112,3960, 3),
204 RTF_LatexToc(12,112,113,4320, 3),
205 RTF_LatexToc(13,113,113,4680, 3),
206
207 RTF_ListBullet( 0,120,121, 360, 1),
208 RTF_ListBullet( 1,121,122, 720, 2),
209 RTF_ListBullet( 2,122,123,1080, 3),
210 RTF_ListBullet( 3,123,124,1440, 4),
211 RTF_ListBullet( 4,124,125,1800, 5),
212 RTF_ListBullet( 5,125,126,2160, 6),
213 RTF_ListBullet( 6,126,127,2520, 7),
214 RTF_ListBullet( 7,127,128,2880, 8),
215 RTF_ListBullet( 8,128,129,3240, 9),
216 RTF_ListBullet( 9,129,130,3600,10),
217 RTF_ListBullet(10,130,131,3960,11),
218 RTF_ListBullet(11,131,132,4320,12),
219 RTF_ListBullet(12,132,133,4680,13),
220 RTF_ListBullet(13,133,133,5040,14),
221
222 RTF_ListEnum( 0,140,141, 360),
223 RTF_ListEnum( 1,141,142, 720),
224 RTF_ListEnum( 2,142,143,1080),
225 RTF_ListEnum( 3,143,144,1440),
226 RTF_ListEnum( 4,144,145,1800),
227 RTF_ListEnum( 5,145,146,2160),
228 RTF_ListEnum( 6,146,147,2520),
229 RTF_ListEnum( 7,147,148,2880),
230 RTF_ListEnum( 8,148,149,3240),
231 RTF_ListEnum( 9,149,150,3600),
232 RTF_ListEnum(10,150,151,3960),
233 RTF_ListEnum(11,151,152,4320),
234 RTF_ListEnum(12,152,153,4680),
235 RTF_ListEnum(13,153,153,5040),
236
237 { nullptr,
238 nullptr,
239 nullptr
240 }
241};
#define RTF_ListEnum(lvl, nest, nxt, pos)
Definition rtfstyle.cpp:69
#define RTF_CodeExample(lvl, nest, nxt, pos)
Definition rtfstyle.cpp:75
#define RTF_LatexToc(lvl, nest, nxt, pos, twps)
Definition rtfstyle.cpp:56
#define RTF_DescContinue(lvl, nest, nxt, pos)
Definition rtfstyle.cpp:87
#define RTF_ListContinue(lvl, nest, nxt, pos)
Definition rtfstyle.cpp:81
#define RTF_ListBullet(lvl, nest, nxt, pos, lvl2)
Definition rtfstyle.cpp:63

Referenced by RTFGenerator::init(), and RTFGenerator::writeStyleSheetFile().

◆ rtf_Style_Reset

char rtf_Style_Reset[]
extern

Definition at line 54 of file rtfstyle.cpp.

Referenced by RTFGenerator::beginRTFChapter(), RTFGenerator::beginRTFSection(), RTFGenerator::endCallGraph(), RTFGenerator::endClassDiagram(), RTFGenerator::endDirDepGraph(), RTFGenerator::endDotGraph(), RTFGenerator::endGroupHeader(), RTFGenerator::endInclDepGraph(), RTFGenerator::endIndexSection(), RTFGenerator::endMemberGroupHeader(), RTFGenerator::endTitleHead(), RTFDocVisitor::includePicturePreRTF(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFCodeGenerator::startCodeFragment(), RTFGenerator::startCompoundTemplateParams(), RTFGenerator::startConstraintList(), RTFGenerator::startDescTable(), RTFGenerator::startExamples(), RTFGenerator::startGroupHeader(), RTFGenerator::startIndent(), RTFGenerator::startIndexList(), RTFGenerator::startInlineHeader(), RTFGenerator::startItemListItem(), RTFGenerator::startMemberDescription(), RTFGenerator::startMemberDoc(), RTFGenerator::startMemberDocSimple(), RTFGenerator::startMemberGroup(), RTFGenerator::startMemberGroupHeader(), RTFGenerator::startMemberItem(), RTFGenerator::startMemberSubtitle(), RTFGenerator::startSection(), RTFGenerator::startTextBlock(), RTFGenerator::startTitleHead(), RTFGenerator::writeInheritedSectionTitle(), and RTFGenerator::writePageLink().

◆ rtf_subject

DString rtf_subject
extern

Definition at line 29 of file rtfstyle.cpp.

Referenced by RTFGenerator::startIndexSection().

◆ rtf_Table_Default

Rtf_Table_Default rtf_Table_Default[]
extern

Definition at line 250 of file rtfstyle.cpp.

250 {
251 RTF_ListElement( 1,0, 360, 8226),
252 RTF_ListElement( 1,1, 720, 9702),
253 RTF_ListElement( 1,2,1080, 9642),
254 RTF_ListElement( 1,3,1440, 8226),
255 RTF_ListElement( 1,4,1800, 9702),
256 RTF_ListElement( 1,5,2160, 9642),
257 RTF_ListElement( 1,6,2520, 8662),
258 RTF_ListElement( 1,7,2880, 9702),
259 RTF_ListElement( 1,8,3600, 9642),
260
261 RTF_ListElement( 2,0, 360, 9744),
262 RTF_ListElement( 2,1, 720, 9744),
263 RTF_ListElement( 2,2,1080, 9744),
264 RTF_ListElement( 2,3,1440, 9744),
265 RTF_ListElement( 2,4,1800, 9744),
266 RTF_ListElement( 2,5,2160, 9744),
267 RTF_ListElement( 2,6,2520, 9744),
268 RTF_ListElement( 2,7,2880, 9744),
269 RTF_ListElement( 2,8,3600, 9744),
270
271 RTF_ListElement( 3,0, 360, 9746),
272 RTF_ListElement( 3,1, 720, 9746),
273 RTF_ListElement( 3,2,1080, 9746),
274 RTF_ListElement( 3,3,1440, 9746),
275 RTF_ListElement( 3,4,1800, 9746),
276 RTF_ListElement( 3,5,2160, 9746),
277 RTF_ListElement( 3,6,2520, 9746),
278 RTF_ListElement( 3,7,2880, 9746),
279 RTF_ListElement( 3,8,3600, 9746),
280
281 { 0,
282 0,
283 nullptr,
284 nullptr
285 }
286};
#define RTF_ListElement(id, lvl, pos, chr)
Definition rtfstyle.cpp:244

Referenced by RTFGenerator::beginRTFDocument(), and RTFDocVisitor::getListTable().

◆ rtf_title

DString rtf_title
extern

Definition at line 28 of file rtfstyle.cpp.

Referenced by RTFGenerator::endIndexSection().