56#define RTF_LatexToc(lvl,nest,nxt,pos,twps) \
59 "\\s"#nest"\\li"#pos"\\sa"#twps"\\sb"#twps"\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ",\
60 "\\sbasedon0 \\snext"#nxt" LatexTOC "#lvl \
63#define RTF_ListBullet(lvl,nest,nxt,pos,lvl2) \
65 "\\s"#nest"\\fi-360\\li"#pos"\\widctlpar\\jclisttab\\tx"#pos"{\\*\\pn \\pnlvlbody\\ilvl0\\ls"#lvl2"\\pnrnot0\\pndec }\\ls1\\adjustright \\fs20\\cgrid ", \
66 "\\sbasedon0 \\snext"#nxt" \\sautoupd List Bullet "#lvl \
69#define RTF_ListEnum(lvl,nest,nxt,pos) \
71 "\\s"#nest"\\fi-360\\li"#pos"\\widctlpar\\fs20\\cgrid ", \
72 "\\sbasedon0 \\snext"#nxt" \\sautoupd List Enum "#lvl \
75#define RTF_CodeExample(lvl,nest,nxt,pos) \
76 { "CodeExample"#lvl, \
77 "\\s"#nest"\\li"#pos"\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", \
78 "\\sbasedon0 \\snext"#nxt" Code Example "#lvl \
81#define RTF_ListContinue(lvl,nest,nxt,pos) \
82 { "ListContinue"#lvl, \
83 "\\s"#nest"\\li"#pos"\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", \
84 "\\sbasedon0 \\snext"#nxt" List Continue "#lvl \
87#define RTF_DescContinue(lvl,nest,nxt,pos) \
88 { "DescContinue"#lvl, \
89 "\\s"#nest"\\li"#pos"\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", \
90 "\\sbasedon0 \\snext"#nxt" DescContinue "#lvl \
96 "\\s1\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs36\\kerning36\\cgrid ",
97 "\\sbasedon0 \\snext0 heading 1"
100 "\\s2\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs28\\kerning28\\cgrid ",
101 "\\sbasedon0 \\snext0 heading 2"
104 "\\s3\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\cgrid ",
105 "\\sbasedon0 \\snext0 heading 3"
108 "\\s4\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs20\\cgrid ",
109 "\\sbasedon0 \\snext0 heading 4;}{\\*\\cs10 \\additive Default Paragraph Font"
112 "\\s5\\sb90\\sa30\\keepn\\widctlpar\\adjustright \\b\\f1\\fs16\\cgrid ",
113 "\\sbasedon0 \\snext0 heading 5;}{\\*\\cs10 \\additive Default Paragraph Font"
116 "\\s6\\sb90\\sa30\\keepn\\widctlpar\\adjustright \\b\\f1\\fs12\\cgrid ",
117 "\\sbasedon0 \\snext0 heading 6;}{\\*\\cs10 \\additive Default Paragraph Font"
120 "\\s15\\qc\\sb240\\sa60\\widctlpar\\outlinelevel0\\adjustright \\b\\f1\\fs32\\kerning28\\cgrid ",
121 "\\sbasedon0 \\snext15 Title"
124 "\\s16\\qc\\sa60\\widctlpar\\outlinelevel1\\adjustright \\f1\\cgrid ",
125 "\\sbasedon0 \\snext16 Subtitle"
128 "\\s17\\sa60\\sb30\\widctlpar\\qj \\fs22\\cgrid ",
129 "\\sbasedon0 \\snext17 BodyText"
132 "\\s18\\widctlpar\\fs22\\cgrid ",
133 "\\sbasedon0 \\snext18 DenseText"
136 "\\s28\\widctlpar\\tqc\\tx4320\\tqr\\tx8640\\adjustright \\fs20\\cgrid ",
137 "\\sbasedon0 \\snext28 header"
140 "\\s29\\widctlpar\\tqc\\tx4320\\tqr\\tx8640\\qr\\adjustright \\fs20\\cgrid ",
141 "\\sbasedon0 \\snext29 footer"
144 "\\s30\\li360\\sa60\\sb120\\keepn\\widctlpar\\adjustright \\b\\f1\\fs20\\cgrid ",
145 "\\sbasedon0 \\snext30 GroupHeader"
244#define RTF_ListElement(id,lvl,pos,chr) \
246 "\\listlevel\\levelnfc23\\leveljc0\\levelstartat1\\levelfollow0{\\leveltext \\'01\\u"#chr" ?;}{\\levelnumbers;}\\f8\\dbch\\af3\\fi-360\\li"#pos, \
247 "{\\*\\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" \
296 m_index =
static_cast<int>(std::stoul(match[1].str()));
311 err(
"Style sheet '{}' contains no '\\s' clause.\n{{{}}}\n", styleName, command);
314 m_index =
static_cast<int>(std::stoul(match[1].str()));
328 std::ifstream file(name.
str());
331 err(
"Can't open RTF style sheet file {}. Using defaults.\n",name);
334 msg(
"Loading RTF style sheet {}...\n",name);
338 for (std::string line ; getline(file,line) ; )
340 if (line.empty() || line[0]==
'#')
continue;
341 static const reg::Ex assignment_splitter(R
"(\s*=\s*)");
345 DString key = match.prefix().str();
346 DString value = match.suffix().str();
347 auto it = map.find(key.
str());
355 warn(name,lineNr,
"Unknown style sheet name {} ignored.",key);
360 warn(name,lineNr,
"Assignment of style sheet name expected line='{}'!",line);
370 std::ifstream file(name.
str());
373 err(
"Can't open RTF extensions file {}. Using defaults.\n",name);
376 msg(
"Loading RTF extensions {}...\n",name);
380 for (std::string line ; getline(file,line) ; )
382 if (line.empty() || line[0]==
'#')
continue;
383 static const reg::Ex assignment_splitter(R
"(\s*=\s*)");
387 std::string key = match.prefix().str();
388 std::string value = match.suffix().str();
396 warn(name,lineNr,
"Ignoring unknown extension key '{}'...",key);
401 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)