Doxygen
Loading...
Searching...
No Matches
rtfstyle.h File Reference
#include <map>
#include <string>
#include <cstdint>
#include "qcstring.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 QCString &name)
 
void loadStylesheet (const QCString &name, StyleDataMap &map)
 

Variables

const int rtf_pageWidth = 8748
 
QCString rtf_title
 
QCString rtf_subject
 
QCString rtf_comments
 
QCString rtf_company
 
QCString rtf_logoFilename
 
QCString rtf_author
 
QCString rtf_manager
 
QCString rtf_documentType
 
QCString rtf_documentId
 
QCString 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 QCString & name)

Definition at line 364 of file rtfstyle.cpp.

365{
366 std::ifstream file(name.str());
367 if (!file.is_open())
368 {
369 err("Can't open RTF extensions file %s. Using defaults.\n",qPrint(name));
370 return;
371 }
372 msg("Loading RTF extensions %s...\n",qPrint(name));
373
374 uint32_t lineNr=1;
375
376 for (std::string line ; getline(file,line) ; ) // for each line
377 {
378 if (line.empty() || line[0]=='#') continue; // skip blanks & comments
379 static const reg::Ex assignment_splitter(R"(\s*=\s*)");
381 if (reg::search(line,match,assignment_splitter))
382 {
383 std::string key = match.prefix().str();
384 std::string value = match.suffix().str();
385 auto it = g_styleMap.find(key);
386 if (it!=g_styleMap.end())
387 {
388 it->second = value;
389 }
390 else
391 {
392 warn(name,lineNr,"Ignoring unknown extension key '%s'...",key.c_str());
393 }
394 }
395 else
396 {
397 warn(name,lineNr,"Assignment of style sheet name expected!");
398 }
399 lineNr++;
400 }
401}
const std::string & str() const
Definition qcstring.h:526
Class representing a regular expression.
Definition regex.h:39
Object representing the matching results.
Definition regex.h:153
void msg(const char *fmt,...)
Definition message.cpp:98
#define warn(file, line, fmt,...)
Definition message.h:59
#define err(fmt,...)
Definition message.h:84
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:748
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:759
const char * qPrint(const char *s)
Definition qcstring.h:661
static std::map< std::string, QCString & > g_styleMap
Definition rtfstyle.cpp:34

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

Referenced by RTFGenerator::init().

◆ loadStylesheet()

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

Definition at line 322 of file rtfstyle.cpp.

323{
324 std::ifstream file(name.str());
325 if (!file.is_open())
326 {
327 err("Can't open RTF style sheet file %s. Using defaults.\n",qPrint(name));
328 return;
329 }
330 msg("Loading RTF style sheet %s...\n",qPrint(name));
331
332 uint32_t lineNr=1;
333
334 for (std::string line ; getline(file,line) ; ) // for each line
335 {
336 if (line.empty() || line[0]=='#') continue; // skip blanks & comments
337 static const reg::Ex assignment_splitter(R"(\s*=\s*)");
339 if (reg::search(line,match,assignment_splitter))
340 {
341 std::string key = match.prefix().str();
342 std::string value = match.suffix().str();
343 auto it = map.find(key);
344 if (it!=map.end())
345 {
346 StyleData& styleData = it->second;
347 styleData.setStyle(value,key);
348 }
349 else
350 {
351 warn(name,lineNr,"Unknown style sheet name %s ignored.",key.data());
352 }
353 }
354 else
355 {
356 warn(name,lineNr,"Assignment of style sheet name expected line='%s'!",line.c_str());
357 }
358 lineNr++;
359 }
360}
bool setStyle(const std::string &command, const std::string &styleName)
Definition rtfstyle.cpp:301

References QCString::data(), err, msg(), qPrint(), reg::search(), StyleData::setStyle(), QCString::str(), and warn.

Referenced by RTFGenerator::init().

Variable Documentation

◆ rtf_author

QCString rtf_author
extern

Definition at line 28 of file rtfstyle.cpp.

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

◆ rtf_comments

QCString rtf_comments
extern

Definition at line 25 of file rtfstyle.cpp.

Referenced by RTFGenerator::startIndexSection().

◆ rtf_company

QCString rtf_company
extern

Definition at line 26 of file rtfstyle.cpp.

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

◆ rtf_documentId

QCString rtf_documentId
extern

Definition at line 31 of file rtfstyle.cpp.

Referenced by RTFGenerator::endIndexSection().

◆ rtf_documentType

QCString rtf_documentType
extern

Definition at line 30 of file rtfstyle.cpp.

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

◆ rtf_keywords

QCString rtf_keywords
extern

Definition at line 32 of file rtfstyle.cpp.

Referenced by RTFGenerator::startIndexSection().

◆ rtf_logoFilename

QCString rtf_logoFilename
extern

Definition at line 27 of file rtfstyle.cpp.

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

◆ rtf_manager

QCString rtf_manager
extern

Definition at line 29 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 88 of file rtfstyle.cpp.

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

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

◆ rtf_Style_Reset

char rtf_Style_Reset[]
extern

Definition at line 49 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

QCString rtf_subject
extern

Definition at line 24 of file rtfstyle.cpp.

Referenced by RTFGenerator::startIndexSection().

◆ rtf_Table_Default

Rtf_Table_Default rtf_Table_Default[]
extern

Definition at line 245 of file rtfstyle.cpp.

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

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

◆ rtf_title

QCString rtf_title
extern

Definition at line 23 of file rtfstyle.cpp.

Referenced by RTFGenerator::endIndexSection().