-enum InsetLayoutTags {
- IL_FONT = 1,
- IL_BGCOLOR,
- IL_DECORATION,
- IL_FREESPACING,
- IL_FORCELTR,
- IL_LABELFONT,
- IL_LABELSTRING,
- IL_LATEXNAME,
- IL_LATEXPARAM,
- IL_LATEXTYPE,
- IL_LYXTYPE,
- IL_KEEPEMPTY,
- IL_MULTIPAR,
- IL_NEEDPROTECT,
- IL_PASSTHRU,
- IL_PREAMBLE,
- IL_END
-};
-
-
-void TextClass::readInsetLayout(Lexer & lexrc, docstring const & name)
-{
- keyword_item elementTags[] = {
- { "bgcolor", IL_BGCOLOR },
- { "decoration", IL_DECORATION },
- { "end", IL_END },
- { "font", IL_FONT },
- { "forceltr", IL_FORCELTR },
- { "freespacing", IL_FREESPACING },
- { "keepempty", IL_KEEPEMPTY },
- { "labelfont", IL_LABELFONT },
- { "labelstring", IL_LABELSTRING },
- { "latexname", IL_LATEXNAME },
- { "latexparam", IL_LATEXPARAM },
- { "latextype", IL_LATEXTYPE },
- { "lyxtype", IL_LYXTYPE },
- { "multipar", IL_MULTIPAR },
- { "needprotect", IL_NEEDPROTECT },
- { "passthru", IL_PASSTHRU },
- { "preamble", IL_PREAMBLE }
- };
-
- lexrc.pushTable(elementTags, IL_END);
-
- string lyxtype;
- docstring labelstring;
- string latextype;
- string decoration;
- string latexname;
- string latexparam;
- FontInfo font = inherit_font;
- FontInfo labelfont = inherit_font;
- ColorCode bgcolor(Color_background);
- string preamble;
- bool multipar = false;
- bool passthru = false;
- bool needprotect = false;
- bool keepempty = false;
- bool freespacing = false;
- bool forceltr = false;
-
- 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<InsetLayoutTags>(le)) {
- case IL_LYXTYPE:
- lexrc.next();
- lyxtype = lexrc.getString();
- break;
- case IL_LATEXTYPE:
- lexrc.next();
- latextype = lexrc.getString();
- break;
- case IL_LABELSTRING:
- lexrc.next();
- labelstring = lexrc.getDocString();
- break;
- case IL_DECORATION:
- lexrc.next();
- decoration = lexrc.getString();
- break;
- case IL_LATEXNAME:
- lexrc.next();
- latexname = lexrc.getString();
- break;
- case IL_LATEXPARAM:
- lexrc.next();
- latexparam = subst(lexrc.getString(), """, "\"");
- break;
- case IL_LABELFONT:
- labelfont = lyxRead(lexrc, inherit_font);
- break;
- case IL_FORCELTR:
- lexrc.next();
- forceltr = lexrc.getBool();
- break;
- case IL_MULTIPAR:
- lexrc.next();
- multipar = lexrc.getBool();
- break;
- case IL_PASSTHRU:
- lexrc.next();
- passthru = lexrc.getBool();
- break;
- case IL_KEEPEMPTY:
- lexrc.next();
- keepempty = lexrc.getBool();
- break;
- case IL_FREESPACING:
- lexrc.next();
- freespacing = lexrc.getBool();
- break;
- case IL_NEEDPROTECT:
- lexrc.next();
- needprotect = lexrc.getBool();
- break;
- case IL_FONT:
- font = lyxRead(lexrc, inherit_font);
- // So: define font before labelfont
- labelfont = font;
- break;
- case IL_BGCOLOR: {
- lexrc.next();
- string const token = lexrc.getString();
- bgcolor = lcolor.getFromLyXName(token);
- break;
- }
- case IL_PREAMBLE:
- preamble = lexrc.getLongString("EndPreamble");
- break;
- case IL_END:
- getout = true;
- break;
- }
- }
-
- //
- // Here add element to list if getout == true
- if (getout) {
- InsetLayout il;
- il.name = to_ascii(name);
- il.lyxtype = lyxtype;
- il.labelstring = labelstring;
- il.decoration = decoration;
- il.latextype = latextype;
- il.latexname = latexname;
- il.latexparam = latexparam;
- il.multipar = multipar;
- il.passthru = passthru;
- il.needprotect = needprotect;
- il.freespacing = freespacing;
- il.forceltr = forceltr;
- il.keepempty = keepempty;
- il.font = font;
- il.labelfont = labelfont;
- il.bgcolor = bgcolor;
- il.preamble = preamble;
- insetlayoutlist_[name] = il;
- }
-
- lexrc.popTable();
-}
-
-
-