-enum CharStyleTags {
- CS_FONT = 1,
- CS_LABELFONT,
- CS_LATEXTYPE,
- CS_LATEXNAME,
- CS_LATEXPARAM,
- CS_PREAMBLE,
- CS_END
-};
-
-
-void TextClass::readCharStyle(Lexer & lexrc, string const & name)
-{
- keyword_item elementTags[] = {
- { "end", CS_END },
- { "font", CS_FONT },
- { "labelfont", CS_LABELFONT },
- { "latexname", CS_LATEXNAME },
- { "latexparam", CS_LATEXPARAM },
- { "latextype", CS_LATEXTYPE },
- { "preamble", CS_PREAMBLE}
- };
-
- lexrc.pushTable(elementTags, CS_END);
-
- string latextype;
- string latexname;
- string latexparam;
- Font font(Font::ALL_INHERIT);
- Font labelfont(Font::ALL_INHERIT);
- string preamble;
-
- bool getout = false;
- while (!getout && lexrc.isOK()) {
- int le = lexrc.lex();
- switch (le) {
- case Lexer::LEX_UNDEF:
- lexrc.printError("Unknown ClassOption tag `$$Token'");
- continue;
- default: break;
- }
- switch (static_cast<CharStyleTags>(le)) {
- case CS_LATEXTYPE:
- lexrc.next();
- latextype = lexrc.getString();
- break;
- case CS_LATEXNAME:
- lexrc.next();
- latexname = lexrc.getString();
- break;
- case CS_LATEXPARAM:
- lexrc.next();
- latexparam = subst(lexrc.getString(), """, "\"");
- break;
- case CS_LABELFONT:
- labelfont.lyxRead(lexrc);
- break;
- case CS_FONT:
- font.lyxRead(lexrc);
- labelfont = font;
- break;
- case CS_PREAMBLE:
- preamble = lexrc.getLongString("EndPreamble");
- break;
- case CS_END:
- getout = true;
- break;
- }
- }
-
- //
- // Here add element to list if getout == true
- if (getout) {
- CharStyle cs;
- cs.name = name;
- cs.latextype = latextype;
- cs.latexname = latexname;
- cs.latexparam = latexparam;
- cs.font = font;
- cs.labelfont = labelfont;
- cs.preamble = from_utf8(preamble);
- charstyles().push_back(cs);
- }
-
- lexrc.popTable();
-}
-