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 '{}' contains no '\\s' clause.\n{{{}}}\n", styleName, command);
309 m_index =
static_cast<int>(std::stoul(match[1].str()));
323 std::ifstream file(name.
str());
326 err(
"Can't open RTF style sheet file {}. Using defaults.\n",name);
329 msg(
"Loading RTF style sheet {}...\n",name);
333 for (std::string line ; getline(file,line) ; )
335 if (line.empty() || line[0]==
'#')
continue;
336 static const reg::Ex assignment_splitter(R
"(\s*=\s*)");
340 DString key = match.prefix().str();
341 DString value = match.suffix().str();
342 auto it = map.find(key.
str());
350 warn(name,lineNr,
"Unknown style sheet name {} ignored.",key);
355 warn(name,lineNr,
"Assignment of style sheet name expected line='{}'!",line);
365 std::ifstream file(name.
str());
368 err(
"Can't open RTF extensions file {}. Using defaults.\n",name);
371 msg(
"Loading RTF extensions {}...\n",name);
375 for (std::string line ; getline(file,line) ; )
377 if (line.empty() || line[0]==
'#')
continue;
378 static const reg::Ex assignment_splitter(R
"(\s*=\s*)");
382 std::string key = match.prefix().str();
383 std::string value = match.suffix().str();
391 warn(name,lineNr,
"Ignoring unknown extension key '{}'...",key);
396 warn(name,lineNr,
"Assignment of style sheet name expected!");
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
DString mid(size_t index, size_t len=npos) const
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
size_t find(char c, size_t pos=0) const
DString left(size_t len) const
const std::string & str() const
Class representing a regular expression.
Object representing the matching results.
#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.
#define RTF_ListEnum(lvl, nest, nxt, pos)
Rtf_Style_Default rtf_Style_Default[]
#define RTF_CodeExample(lvl, nest, nxt, pos)
#define RTF_LatexToc(lvl, nest, nxt, pos, twps)
void loadExtensions(const DString &name)
void loadStylesheet(const DString &name, StyleDataMap &map)
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)
static std::map< std::string, DString & > g_styleMap
std::map< std::string, StyleData > StyleDataMap
DString reference() const
DString definition() const
bool setStyle(const DString &command, const DString &styleName)