51#define RTF_LatexToc(lvl,nest,nxt,pos,twps) \
54 "\\s"#nest"\\li"#pos"\\sa"#twps"\\sb"#twps"\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ",\
55 "\\sbasedon0 \\snext"#nxt" LatexTOC "#lvl \
58#define RTF_ListBullet(lvl,nest,nxt,pos,lvl2) \
60 "\\s"#nest"\\fi-360\\li"#pos"\\widctlpar\\jclisttab\\tx"#pos"{\\*\\pn \\pnlvlbody\\ilvl0\\ls"#lvl2"\\pnrnot0\\pndec }\\ls1\\adjustright \\fs20\\cgrid ", \
61 "\\sbasedon0 \\snext"#nxt" \\sautoupd List Bullet "#lvl \
64#define RTF_ListEnum(lvl,nest,nxt,pos) \
66 "\\s"#nest"\\fi-360\\li"#pos"\\widctlpar\\fs20\\cgrid ", \
67 "\\sbasedon0 \\snext"#nxt" \\sautoupd List Enum "#lvl \
70#define RTF_CodeExample(lvl,nest,nxt,pos) \
71 { "CodeExample"#lvl, \
72 "\\s"#nest"\\li"#pos"\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", \
73 "\\sbasedon0 \\snext"#nxt" Code Example "#lvl \
76#define RTF_ListContinue(lvl,nest,nxt,pos) \
77 { "ListContinue"#lvl, \
78 "\\s"#nest"\\li"#pos"\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", \
79 "\\sbasedon0 \\snext"#nxt" List Continue "#lvl \
82#define RTF_DescContinue(lvl,nest,nxt,pos) \
83 { "DescContinue"#lvl, \
84 "\\s"#nest"\\li"#pos"\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", \
85 "\\sbasedon0 \\snext"#nxt" DescContinue "#lvl \
91 "\\s1\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs36\\kerning36\\cgrid ",
92 "\\sbasedon0 \\snext0 heading 1"
95 "\\s2\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs28\\kerning28\\cgrid ",
96 "\\sbasedon0 \\snext0 heading 2"
99 "\\s3\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\cgrid ",
100 "\\sbasedon0 \\snext0 heading 3"
103 "\\s4\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs20\\cgrid ",
104 "\\sbasedon0 \\snext0 heading 4;}{\\*\\cs10 \\additive Default Paragraph Font"
107 "\\s5\\sb90\\sa30\\keepn\\widctlpar\\adjustright \\b\\f1\\fs16\\cgrid ",
108 "\\sbasedon0 \\snext0 heading 5;}{\\*\\cs10 \\additive Default Paragraph Font"
111 "\\s6\\sb90\\sa30\\keepn\\widctlpar\\adjustright \\b\\f1\\fs12\\cgrid ",
112 "\\sbasedon0 \\snext0 heading 6;}{\\*\\cs10 \\additive Default Paragraph Font"
115 "\\s15\\qc\\sb240\\sa60\\widctlpar\\outlinelevel0\\adjustright \\b\\f1\\fs32\\kerning28\\cgrid ",
116 "\\sbasedon0 \\snext15 Title"
119 "\\s16\\qc\\sa60\\widctlpar\\outlinelevel1\\adjustright \\f1\\cgrid ",
120 "\\sbasedon0 \\snext16 Subtitle"
123 "\\s17\\sa60\\sb30\\widctlpar\\qj \\fs22\\cgrid ",
124 "\\sbasedon0 \\snext17 BodyText"
127 "\\s18\\widctlpar\\fs22\\cgrid ",
128 "\\sbasedon0 \\snext18 DenseText"
131 "\\s28\\widctlpar\\tqc\\tx4320\\tqr\\tx8640\\adjustright \\fs20\\cgrid ",
132 "\\sbasedon0 \\snext28 header"
135 "\\s29\\widctlpar\\tqc\\tx4320\\tqr\\tx8640\\qr\\adjustright \\fs20\\cgrid ",
136 "\\sbasedon0 \\snext29 footer"
139 "\\s30\\li360\\sa60\\sb120\\keepn\\widctlpar\\adjustright \\b\\f1\\fs20\\cgrid ",
140 "\\sbasedon0 \\snext30 GroupHeader"
239#define RTF_ListElement(id,lvl,pos,chr) \
241 "\\listlevel\\levelnfc23\\leveljc0\\levelstartat1\\levelfollow0{\\leveltext \\'01\\u"#chr" ?;}{\\levelnumbers;}\\f8\\dbch\\af3\\fi-360\\li"#pos, \
242 "{\\*\\hyphen2\\hyphlead2\\hyphtrail2\\hyphmax0}\\nowidctlpar\\cf0\\hich\\af0\\langfe2052\\dbch\\af0\\afs24\\lang1081\\loch\\f0\\fs24\\lang1033{\\listtext\\pard\\plain \\hich\\af3\\dbch\\af3\\loch\\f8 \\'01\\u"#chr"\\tab}\\ilvl"#lvl"\\ls"#id" \\li0\\ri0\\lin0\\rin0\\fi-360\\tx"#pos"\\li"#pos"\\ri0\\lin"#pos"\\rin0\\fi-360\\kerning1\\hich\\af4\\dbch\\af5\\rtlch \\ltrch\\loch\\fs20" \
291 m_index =
static_cast<int>(std::stoul(match[1].str()));
306 err(
"Style sheet '%s' contains no '\\s' clause.\n{%s}\n", styleName.c_str(), command.c_str());
309 m_index =
static_cast<int>(std::stoul(match[1].str()));
311 size_t index = command.find(
"\\sbasedon");
312 if (
index!=std::string::npos)
324 std::ifstream file(name.
str());
327 err(
"Can't open RTF style sheet file %s. Using defaults.\n",
qPrint(name));
330 msg(
"Loading RTF style sheet %s...\n",
qPrint(name));
334 for (std::string line ; getline(file,line) ; )
336 if (line.empty() || line[0]==
'#')
continue;
337 static const reg::Ex assignment_splitter(R
"(\s*=\s*)");
341 std::string key = match.prefix().str();
342 std::string value = match.suffix().str();
343 auto it = map.find(key);
351 warn(name,lineNr,
"Unknown style sheet name %s ignored.",key.
data());
356 warn(name,lineNr,
"Assignment of style sheet name expected line='%s'!",line.c_str());
366 std::ifstream file(name.
str());
369 err(
"Can't open RTF extensions file %s. Using defaults.\n",
qPrint(name));
372 msg(
"Loading RTF extensions %s...\n",
qPrint(name));
376 for (std::string line ; getline(file,line) ; )
378 if (line.empty() || line[0]==
'#')
continue;
379 static const reg::Ex assignment_splitter(R
"(\s*=\s*)");
383 std::string key = match.prefix().str();
384 std::string value = match.suffix().str();
392 warn(name,lineNr,
"Ignoring unknown extension key '%s'...",key.c_str());
397 warn(name,lineNr,
"Assignment of style sheet name expected!");
This is an alternative implementation of QCString.
const std::string & str() const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Class representing a regular expression.
Object representing the matching results.
void msg(const char *fmt,...)
#define warn(file, line, fmt,...)
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.
const char * qPrint(const char *s)
#define RTF_ListEnum(lvl, nest, nxt, pos)
QCString rtf_documentType
void loadStylesheet(const QCString &name, StyleDataMap &map)
Rtf_Style_Default rtf_Style_Default[]
#define RTF_CodeExample(lvl, nest, nxt, pos)
void loadExtensions(const QCString &name)
#define RTF_LatexToc(lvl, nest, nxt, pos, twps)
static std::map< std::string, QCString & > g_styleMap
QCString rtf_logoFilename
static const reg::Ex s_clause(R"(\\s(\d+)\s*)")
#define RTF_DescContinue(lvl, nest, nxt, pos)
#define RTF_ListContinue(lvl, nest, nxt, pos)
Rtf_Table_Default rtf_Table_Default[]
#define RTF_ListElement(id, lvl, pos, chr)
#define RTF_ListBullet(lvl, nest, nxt, pos, lvl2)
std::map< std::string, StyleData > StyleDataMap
bool setStyle(const std::string &command, const std::string &styleName)
const char * definition() const
const char * reference() const