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 {}. Using defaults.\n",name);
370 return;
371 }
372 msg("Loading RTF extensions {}...\n",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 '{}'...",key);
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:552
Class representing a regular expression.
Definition regex.h:39
Object representing the matching results.
Definition regex.h:151
#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:844
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:855
static std::map< std::string, QCString & > g_styleMap
Definition rtfstyle.cpp:34

References err, g_styleMap, msg, 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 {}. Using defaults.\n",name);
328 return;
329 }
330 msg("Loading RTF style sheet {}...\n",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 QCString key = match.prefix().str();
342 QCString value = match.suffix().str();
343 auto it = map.find(key.str());
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 {} ignored.",key);
352 }
353 }
354 else
355 {
356 warn(name,lineNr,"Assignment of style sheet name expected line='{}'!",line);
357 }
358 lineNr++;
359 }
360}
This is an alternative implementation of QCString.
Definition qcstring.h:101
bool setStyle(const QCString &command, const QCString &styleName)
Definition rtfstyle.cpp:301

References err, msg, 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.

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

245 {
246 RTF_ListElement( 1,0, 360, 8226),
247 RTF_ListElement( 1,1, 720, 9702),
248 RTF_ListElement( 1,2,1080, 9642),
249 RTF_ListElement( 1,3,1440, 8226),
250 RTF_ListElement( 1,4,1800, 9702),
251 RTF_ListElement( 1,5,2160, 9642),
252 RTF_ListElement( 1,6,2520, 8662),
253 RTF_ListElement( 1,7,2880, 9702),
254 RTF_ListElement( 1,8,3600, 9642),
255
256 RTF_ListElement( 2,0, 360, 9744),
257 RTF_ListElement( 2,1, 720, 9744),
258 RTF_ListElement( 2,2,1080, 9744),
259 RTF_ListElement( 2,3,1440, 9744),
260 RTF_ListElement( 2,4,1800, 9744),
261 RTF_ListElement( 2,5,2160, 9744),
262 RTF_ListElement( 2,6,2520, 9744),
263 RTF_ListElement( 2,7,2880, 9744),
264 RTF_ListElement( 2,8,3600, 9744),
265
266 RTF_ListElement( 3,0, 360, 9746),
267 RTF_ListElement( 3,1, 720, 9746),
268 RTF_ListElement( 3,2,1080, 9746),
269 RTF_ListElement( 3,3,1440, 9746),
270 RTF_ListElement( 3,4,1800, 9746),
271 RTF_ListElement( 3,5,2160, 9746),
272 RTF_ListElement( 3,6,2520, 9746),
273 RTF_ListElement( 3,7,2880, 9746),
274 RTF_ListElement( 3,8,3600, 9746),
275
276 { 0,
277 0,
278 nullptr,
279 nullptr
280 }
281};
#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().