bool InsetLayout::read(Lexer & lex, TextClass const & tclass) { enum { IL_ARGUMENT, IL_BABELPREAMBLE, IL_BGCOLOR, IL_CONTENTASLABEL, IL_COPYSTYLE, IL_COUNTER, IL_CUSTOMPARS, IL_DECORATION, IL_DISPLAY, IL_FONT, IL_FORCE_LOCAL_FONT_SWITCH, IL_FORCELTR, IL_FORCEPLAIN, IL_FREESPACING, IL_HTMLTAG, IL_HTMLATTR, IL_HTMLFORCECSS, IL_HTMLINNERTAG, IL_HTMLINNERATTR, IL_HTMLISBLOCK, IL_HTMLLABEL, IL_HTMLSTYLE, IL_HTMLPREAMBLE, IL_INTOC, IL_LABELFONT, IL_LABELSTRING, IL_LANGPREAMBLE, IL_LATEXNAME, IL_LATEXPARAM, IL_LATEXTYPE, IL_LEFTDELIM, IL_LYXTYPE, IL_KEEPEMPTY, IL_MULTIPAR, IL_NEEDPROTECT, IL_PASSTHRU, IL_PARBREAKISNEWLINE, IL_PREAMBLE, IL_REQUIRES, IL_RIGHTDELIM, IL_REFPREFIX, IL_RESETARGS, IL_RESETSFONT, IL_SPELLCHECK, IL_END }; LexerKeyword elementTags[] = { { "argument", IL_ARGUMENT }, { "babelpreamble", IL_BABELPREAMBLE }, { "bgcolor", IL_BGCOLOR }, { "contentaslabel", IL_CONTENTASLABEL }, { "copystyle", IL_COPYSTYLE }, { "counter", IL_COUNTER}, { "custompars", IL_CUSTOMPARS }, { "decoration", IL_DECORATION }, { "display", IL_DISPLAY }, { "end", IL_END }, { "font", IL_FONT }, { "forcelocalfontswitch", IL_FORCE_LOCAL_FONT_SWITCH }, { "forceltr", IL_FORCELTR }, { "forceplain", IL_FORCEPLAIN }, { "freespacing", IL_FREESPACING }, { "htmlattr", IL_HTMLATTR }, { "htmlforcecss", IL_HTMLFORCECSS }, { "htmlinnerattr", IL_HTMLINNERATTR}, { "htmlinnertag", IL_HTMLINNERTAG}, { "htmlisblock", IL_HTMLISBLOCK}, { "htmllabel", IL_HTMLLABEL }, { "htmlpreamble", IL_HTMLPREAMBLE }, { "htmlstyle", IL_HTMLSTYLE }, { "htmltag", IL_HTMLTAG }, { "intoc", IL_INTOC }, { "keepempty", IL_KEEPEMPTY }, { "labelfont", IL_LABELFONT }, { "labelstring", IL_LABELSTRING }, { "langpreamble", IL_LANGPREAMBLE }, { "latexname", IL_LATEXNAME }, { "latexparam", IL_LATEXPARAM }, { "latextype", IL_LATEXTYPE }, { "leftdelim", IL_LEFTDELIM }, { "lyxtype", IL_LYXTYPE }, { "multipar", IL_MULTIPAR }, { "needprotect", IL_NEEDPROTECT }, { "parbreakisnewline", IL_PARBREAKISNEWLINE }, { "passthru", IL_PASSTHRU }, { "preamble", IL_PREAMBLE }, { "refprefix", IL_REFPREFIX }, { "requires", IL_REQUIRES }, { "resetargs", IL_RESETARGS }, { "resetsfont", IL_RESETSFONT }, { "rightdelim", IL_RIGHTDELIM }, { "spellcheck", IL_SPELLCHECK } }; lex.pushTable(elementTags); labelfont_ = inherit_font; bgcolor_ = Color_none; bool getout = false; // whether we've read the CustomPars or ForcePlain tag // for issuing a warning in case MultiPars comes later bool readCustomOrPlain = false; string tmp; while (!getout && lex.isOK()) { int le = lex.lex(); switch (le) { case Lexer::LEX_UNDEF: lex.printError("Unknown InsetLayout tag"); continue; default: break; } switch (le) { // FIXME // Perhaps a more elegant way to deal with the next two would be the // way this sort of thing is handled in Layout::read(), namely, by // using the Lexer. case IL_LYXTYPE: { // make sure that we have the right sort of name. if (name_ != from_ascii("undefined") && name_.substr(0,5) != from_ascii("Flex:")) { LYXERR0("Flex insets must have names of the form `Flex:<name>'.\n" "This one has the name `" << to_utf8(name_) << "'\n" "Ignoring LyXType declaration."); break; } string lt; lex >> lt; lyxtype_ = translateLyXType(lt); if (lyxtype_ == NOLYXTYPE) LYXERR0("Unknown LyXType `" << lt << "'."); if (lyxtype_ == CHARSTYLE) multipar_ = false; break; } case IL_LATEXTYPE: { string lt; lex >> lt; latextype_ = translateLaTeXType(lt); if (latextype_ == ILT_ERROR) LYXERR0("Unknown LaTeXType `" << lt << "'."); break; } case IL_LABELSTRING: lex >> labelstring_; break; case IL_DECORATION: lex >> tmp; decoration_ = translateDecoration(tmp); break; case IL_LATEXNAME: lex >> latexname_; break; case IL_LATEXPARAM: lex >> tmp; latexparam_ = support::subst(tmp, """, "\""); break; case IL_LEFTDELIM: lex >> leftdelim_; leftdelim_ = support::subst(leftdelim_, from_ascii("<br/>"), from_ascii("\n")); break; case IL_FORCE_LOCAL_FONT_SWITCH: lex >> forcelocalfontswitch_; break; case IL_RIGHTDELIM: lex >> rightdelim_; rightdelim_ = support::subst(rightdelim_, from_ascii("<br/>"), from_ascii("\n")); break; case IL_LABELFONT: labelfont_ = lyxRead(lex, inherit_font); break; case IL_FORCELTR: lex >> forceltr_; break; case IL_INTOC: lex >> intoc_; break; case IL_MULTIPAR: lex >> multipar_; // the defaults for these depend upon multipar_ if (readCustomOrPlain) LYXERR0("Warning: Read MultiPar after CustomPars or ForcePlain. " "Previous value may be overwritten!"); readCustomOrPlain = false; custompars_ = multipar_; forceplain_ = !multipar_; break; case IL_COUNTER: lex >> counter_; break; case IL_CUSTOMPARS: lex >> custompars_; readCustomOrPlain = true; break; case IL_FORCEPLAIN: lex >> forceplain_; readCustomOrPlain = true; break; case IL_PASSTHRU: lex >> passthru_; break; case IL_PARBREAKISNEWLINE: lex >> parbreakisnewline_; break; case IL_KEEPEMPTY: lex >> keepempty_; break; case IL_FREESPACING: lex >> freespacing_; break; case IL_NEEDPROTECT: lex >> needprotect_; break; case IL_CONTENTASLABEL: lex >> contentaslabel_; break; case IL_COPYSTYLE: { // initialize with a known style docstring style; lex >> style; style = support::subst(style, '_', ' '); // We don't want to apply the algorithm in DocumentClass::insetLayout() // here. So we do it the long way. TextClass::InsetLayouts::const_iterator it = tclass.insetLayouts().find(style); if (it != tclass.insetLayouts().end()) { docstring const tmpname = name_; this->operator=(it->second); name_ = tmpname; } else { LYXERR0("Cannot copy unknown InsetLayout `" << style << "'\n" << "All InsetLayouts so far:"); TextClass::InsetLayouts::const_iterator lit = tclass.insetLayouts().begin(); TextClass::InsetLayouts::const_iterator len = tclass.insetLayouts().end(); for (; lit != len; ++lit) lyxerr << lit->second.name() << "\n"; } break; } case IL_FONT: { font_ = lyxRead(lex, inherit_font); // If you want to define labelfont, you need to do so after // font is defined. labelfont_ = font_; break; } case IL_RESETARGS: bool reset; lex >> reset; if (reset) latexargs_.clear(); break; case IL_ARGUMENT: readArgument(lex); break; case IL_BGCOLOR: lex >> tmp; bgcolor_ = lcolor.getFromLyXName(tmp); break; case IL_PREAMBLE: preamble_ = from_utf8(lex.getLongString("EndPreamble")); break; case IL_BABELPREAMBLE: babelpreamble_ = from_utf8(lex.getLongString("EndBabelPreamble")); break; case IL_LANGPREAMBLE: langpreamble_ = from_utf8(lex.getLongString("EndLangPreamble")); break; case IL_REFPREFIX: lex >> refprefix_; break; case IL_HTMLTAG: lex >> htmltag_; break; case IL_HTMLATTR: lex >> htmlattr_; break; case IL_HTMLFORCECSS: lex >> htmlforcecss_; break; case IL_HTMLINNERTAG: lex >> htmlinnertag_; break; case IL_HTMLINNERATTR: lex >> htmlinnerattr_; break; case IL_HTMLLABEL: lex >> htmllabel_; break; case IL_HTMLISBLOCK: lex >> htmlisblock_; break; case IL_HTMLSTYLE: htmlstyle_ = from_utf8(lex.getLongString("EndHTMLStyle")); break; case IL_HTMLPREAMBLE: htmlpreamble_ = from_utf8(lex.getLongString("EndPreamble")); break; case IL_REQUIRES: { lex.eatLine(); vector<string> const req = support::getVectorFromString(lex.getString()); requires_.insert(req.begin(), req.end()); break; } case IL_SPELLCHECK: lex >> spellcheck_; break; case IL_RESETSFONT: lex >> resetsfont_; break; case IL_DISPLAY: lex >> display_; break; case IL_END: getout = true; break; } } // Here add element to list if getout == true if (!getout) return false; // The label font is generally used as-is without // any realization against a given context. labelfont_.realize(sane_font); lex.popTable(); return true; }
bool TextClass::readFloat(Lexer & lexrc) { enum { FT_TYPE = 1, FT_NAME, FT_PLACEMENT, FT_EXT, FT_WITHIN, FT_STYLE, FT_LISTNAME, FT_NEEDSFLOAT, FT_HTMLSTYLE, FT_HTMLATTR, FT_HTMLTAG, FT_LISTCOMMAND, FT_REFPREFIX, FT_END }; LexerKeyword floatTags[] = { { "end", FT_END }, { "extension", FT_EXT }, { "guiname", FT_NAME }, { "htmlattr", FT_HTMLATTR }, { "htmlstyle", FT_HTMLSTYLE }, { "htmltag", FT_HTMLTAG }, { "listcommand", FT_LISTCOMMAND }, { "listname", FT_LISTNAME }, { "needsfloatpkg", FT_NEEDSFLOAT }, { "numberwithin", FT_WITHIN }, { "placement", FT_PLACEMENT }, { "refprefix", FT_REFPREFIX }, { "style", FT_STYLE }, { "type", FT_TYPE } }; lexrc.pushTable(floatTags); string ext; string htmlattr; string htmlstyle; string htmltag; string listname; string listcommand; string name; string placement; string refprefix; string style; string type; string within; bool needsfloat = true; bool getout = false; while (!getout && lexrc.isOK()) { int le = lexrc.lex(); switch (le) { case Lexer::LEX_UNDEF: lexrc.printError("Unknown float tag `$$Token'"); continue; default: break; } switch (le) { case FT_TYPE: lexrc.next(); type = lexrc.getString(); if (floatlist_.typeExist(type)) { Floating const & fl = floatlist_.getType(type); placement = fl.placement(); ext = fl.ext(); within = fl.within(); style = fl.style(); name = fl.name(); listname = fl.listName(); needsfloat = fl.needsFloatPkg(); listcommand = fl.listCommand(); refprefix = fl.refPrefix(); } break; case FT_NAME: lexrc.next(); name = lexrc.getString(); break; case FT_PLACEMENT: lexrc.next(); placement = lexrc.getString(); break; case FT_EXT: lexrc.next(); ext = lexrc.getString(); break; case FT_WITHIN: lexrc.next(); within = lexrc.getString(); if (within == "none") within.erase(); break; case FT_STYLE: lexrc.next(); style = lexrc.getString(); break; case FT_LISTCOMMAND: lexrc.next(); listcommand = lexrc.getString(); break; case FT_REFPREFIX: lexrc.next(); refprefix = lexrc.getString(); break; case FT_LISTNAME: lexrc.next(); listname = lexrc.getString(); break; case FT_NEEDSFLOAT: lexrc.next(); needsfloat = lexrc.getBool(); break; case FT_HTMLATTR: lexrc.next(); htmlattr = lexrc.getString(); break; case FT_HTMLSTYLE: lexrc.next(); htmlstyle = lexrc.getLongString("EndHTMLStyle"); break; case FT_HTMLTAG: lexrc.next(); htmltag = lexrc.getString(); break; case FT_END: getout = true; break; } } lexrc.popTable(); // Here we have a full float if getout == true if (getout) { if (!needsfloat && listcommand.empty()) LYXERR0("The layout does not provide a list command " << "for the builtin float `" << type << "'. LyX will " << "not be able to produce a float list."); Floating fl(type, placement, ext, within, style, name, listname, listcommand, refprefix, htmltag, htmlattr, htmlstyle, needsfloat); floatlist_.newFloat(fl); // each float has its own counter counters_.newCounter(from_ascii(type), from_ascii(within), docstring(), docstring()); // also define sub-float counters docstring const subtype = "sub-" + from_ascii(type); counters_.newCounter(subtype, from_ascii(type), "\\alph{" + subtype + "}", docstring()); } return getout; }
void Template::readTemplate(Lexer & lex) { enum { TO_GUINAME = 1, TO_HELPTEXT, TO_INPUTFORMAT, TO_FILTER, TO_AUTOMATIC, TO_PREVIEW, TO_TRANSFORM, TO_FORMAT, TO_END }; LexerKeyword templateoptiontags[] = { { "automaticproduction", TO_AUTOMATIC }, { "filefilter", TO_FILTER }, { "format", TO_FORMAT }, { "guiname", TO_GUINAME }, { "helptext", TO_HELPTEXT }, { "inputformat", TO_INPUTFORMAT }, { "preview", TO_PREVIEW }, { "templateend", TO_END }, { "transform", TO_TRANSFORM } }; PushPopHelper pph(lex, templateoptiontags); lex.setContext("Template::readTemplate"); string token; while (lex.isOK()) { switch (lex.lex()) { case TO_GUINAME: lex.next(true); guiName = lex.getString(); break; case TO_HELPTEXT: helpText = lex.getLongString("HelpTextEnd"); break; case TO_INPUTFORMAT: lex.next(true); inputFormat = lex.getString(); break; case TO_FILTER: lex.next(true); fileRegExp = lex.getString(); break; case TO_AUTOMATIC: lex.next(); automaticProduction = lex.getBool(); break; case TO_PREVIEW: lex >> token; if (token == "InstantPreview") preview_mode = PREVIEW_INSTANT; else if (token == "Graphics") preview_mode = PREVIEW_GRAPHICS; else preview_mode = PREVIEW_OFF; break; case TO_TRANSFORM: { lex >> token; TransformID id = transformIDTranslator().find(token); if (int(id) == -1) LYXERR0("Transform " << token << " is not recognized"); else transformIds.push_back(id); break; } case TO_FORMAT: lex.next(true); formats[lex.getString()].readFormat(lex); break; case TO_END: return; default: lex.printError("external::Template::readTemplate: " "Wrong tag: $$Token"); LASSERT(false, /**/); break; } } }
// Reads a textclass structure from file. TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt) { if (!lexrc.isOK()) return ERROR; // Format of files before the 'Format' tag was introduced int format = 1; bool error = false; // parsing while (lexrc.isOK() && !error) { int le = lexrc.lex(); switch (le) { case Lexer::LEX_FEOF: continue; case Lexer::LEX_UNDEF: lexrc.printError("Unknown TextClass tag `$$Token'"); error = true; continue; default: break; } // used below to track whether we are in an IfStyle or IfCounter tag. bool ifstyle = false; bool ifcounter = false; switch (static_cast<TextClassTags>(le)) { case TC_FORMAT: if (lexrc.next()) format = lexrc.getInteger(); break; case TC_OUTPUTFORMAT: if (lexrc.next()) outputFormat_ = lexrc.getString(); break; case TC_OUTPUTTYPE: readOutputType(lexrc); switch(outputType_) { case LATEX: outputFormat_ = "latex"; break; case DOCBOOK: outputFormat_ = "docbook"; break; case LITERATE: outputFormat_ = "literate"; break; } break; case TC_INPUT: // Include file if (lexrc.next()) { string const inc = lexrc.getString(); FileName tmp = libFileSearch("layouts", inc, "layout"); if (tmp.empty()) { lexrc.printError("Could not find input file: " + inc); error = true; } else if (!read(tmp, MERGE)) { lexrc.printError("Error reading input file: " + tmp.absFileName()); error = true; } } break; case TC_DEFAULTSTYLE: if (lexrc.next()) { docstring const name = from_utf8(subst(lexrc.getString(), '_', ' ')); defaultlayout_ = name; } break; case TC_IFSTYLE: ifstyle = true; // fall through case TC_STYLE: { if (!lexrc.next()) { lexrc.printError("No name given for style: `$$Token'."); error = true; break; } docstring const name = from_utf8(subst(lexrc.getString(), '_', ' ')); if (name.empty()) { string s = "Could not read name for style: `$$Token' " + lexrc.getString() + " is probably not valid UTF-8!"; lexrc.printError(s); Layout lay; // Since we couldn't read the name, we just scan the rest // of the style and discard it. error = !readStyle(lexrc, lay); } else if (hasLayout(name)) { Layout & lay = operator[](name); error = !readStyle(lexrc, lay); } else if (!ifstyle) { Layout layout; layout.setName(name); error = !readStyle(lexrc, layout); if (!error) layoutlist_.push_back(layout); if (defaultlayout_.empty()) { // We do not have a default layout yet, so we choose // the first layout we encounter. defaultlayout_ = name; } } else { // this was an ifstyle where we didn't have the style // scan the rest and discard it Layout lay; readStyle(lexrc, lay); } // reset flag ifstyle = false; break; } case TC_NOSTYLE: if (lexrc.next()) { docstring const style = from_utf8(subst(lexrc.getString(), '_', ' ')); if (!deleteLayout(style)) lyxerr << "Cannot delete style `" << to_utf8(style) << '\'' << endl; } break; case TC_COLUMNS: if (lexrc.next()) columns_ = lexrc.getInteger(); break; case TC_SIDES: if (lexrc.next()) { switch (lexrc.getInteger()) { case 1: sides_ = OneSide; break; case 2: sides_ = TwoSides; break; default: lyxerr << "Impossible number of page" " sides, setting to one." << endl; sides_ = OneSide; break; } } break; case TC_PAGESTYLE: lexrc.next(); pagestyle_ = rtrim(lexrc.getString()); break; case TC_DEFAULTFONT: defaultfont_ = lyxRead(lexrc); if (!defaultfont_.resolved()) { lexrc.printError("Warning: defaultfont should " "be fully instantiated!"); defaultfont_.realize(sane_font); } break; case TC_SECNUMDEPTH: lexrc.next(); secnumdepth_ = lexrc.getInteger(); break; case TC_TOCDEPTH: lexrc.next(); tocdepth_ = lexrc.getInteger(); break; // First step to support options case TC_CLASSOPTIONS: readClassOptions(lexrc); break; case TC_PREAMBLE: preamble_ = from_utf8(lexrc.getLongString("EndPreamble")); break; case TC_HTMLPREAMBLE: htmlpreamble_ = from_utf8(lexrc.getLongString("EndPreamble")); break; case TC_HTMLTOCSECTION: html_toc_section_ = from_utf8(trim(lexrc.getString())); break; case TC_ADDTOPREAMBLE: preamble_ += from_utf8(lexrc.getLongString("EndPreamble")); break; case TC_ADDTOHTMLPREAMBLE: htmlpreamble_ += from_utf8(lexrc.getLongString("EndPreamble")); break; case TC_PROVIDES: { lexrc.next(); string const feature = lexrc.getString(); lexrc.next(); if (lexrc.getInteger()) provides_.insert(feature); else provides_.erase(feature); break; } case TC_REQUIRES: { lexrc.eatLine(); vector<string> const req = getVectorFromString(lexrc.getString()); requires_.insert(req.begin(), req.end()); break; } case TC_DEFAULTMODULE: { lexrc.next(); string const module = lexrc.getString(); if (find(default_modules_.begin(), default_modules_.end(), module) == default_modules_.end()) default_modules_.push_back(module); break; } case TC_PROVIDESMODULE: { lexrc.next(); string const module = lexrc.getString(); if (find(provided_modules_.begin(), provided_modules_.end(), module) == provided_modules_.end()) provided_modules_.push_back(module); break; } case TC_EXCLUDESMODULE: { lexrc.next(); string const module = lexrc.getString(); // modules already have their own way to exclude other modules if (rt == MODULE) { LYXERR0("ExcludesModule tag cannot be used in a module!"); break; } if (find(excluded_modules_.begin(), excluded_modules_.end(), module) == excluded_modules_.end()) excluded_modules_.push_back(module); break; } case TC_LEFTMARGIN: // left margin type if (lexrc.next()) leftmargin_ = lexrc.getDocString(); break; case TC_RIGHTMARGIN: // right margin type if (lexrc.next()) rightmargin_ = lexrc.getDocString(); break; case TC_INSETLAYOUT: { if (!lexrc.next()) { lexrc.printError("No name given for InsetLayout: `$$Token'."); error = true; break; } docstring const name = subst(lexrc.getDocString(), '_', ' '); if (name.empty()) { string s = "Could not read name for InsetLayout: `$$Token' " + lexrc.getString() + " is probably not valid UTF-8!"; lexrc.printError(s); InsetLayout il; // Since we couldn't read the name, we just scan the rest // of the style and discard it. il.read(lexrc, *this); // Let's try to continue rather than abort. // error = true; } else if (hasInsetLayout(name)) { InsetLayout & il = insetlayoutlist_[name]; error = !il.read(lexrc, *this); } else { InsetLayout il; il.setName(name); error = !il.read(lexrc, *this); if (!error) insetlayoutlist_[name] = il; } break; } case TC_FLOAT: error = !readFloat(lexrc); break; case TC_CITEFORMAT: readCiteFormat(lexrc); break; case TC_IFCOUNTER: ifcounter = true; case TC_COUNTER: if (lexrc.next()) { docstring const name = lexrc.getDocString(); if (name.empty()) { string s = "Could not read name for counter: `$$Token' " + lexrc.getString() + " is probably not valid UTF-8!"; lexrc.printError(s.c_str()); Counter c; // Since we couldn't read the name, we just scan the rest // and discard it. c.read(lexrc); } else error = !counters_.read(lexrc, name, !ifcounter); } else { lexrc.printError("No name given for style: `$$Token'."); error = true; } // reset flag ifcounter = false; break; case TC_TITLELATEXTYPE: readTitleType(lexrc); break; case TC_TITLELATEXNAME: if (lexrc.next()) titlename_ = lexrc.getString(); break; case TC_NOFLOAT: if (lexrc.next()) { string const nofloat = lexrc.getString(); floatlist_.erase(nofloat); } break; } // end of switch // Note that this is triggered the first time through the loop unless // we hit a format tag. if (format != LAYOUT_FORMAT) return FORMAT_MISMATCH; } // at present, we abort if we encounter an error, // so there is no point continuing. if (error) return ERROR; if (rt != BASECLASS) return (error ? ERROR : OK); if (defaultlayout_.empty()) { LYXERR0("Error: Textclass '" << name_ << "' is missing a defaultstyle."); return ERROR; } // Try to erase "stdinsets" from the provides_ set. // The // Provides stdinsets 1 // declaration simply tells us that the standard insets have been // defined. (It's found in stdinsets.inc but could also be used in // user-defined files.) There isn't really any such package. So we // might as well go ahead and erase it. // If we do not succeed, then it was not there, which means that // the textclass did not provide the definitions of the standard // insets. So we need to try to load them. int erased = provides_.erase("stdinsets"); if (!erased) { FileName tmp = libFileSearch("layouts", "stdinsets.inc"); if (tmp.empty()) { frontend::Alert::warning(_("Missing File"), _("Could not find stdinsets.inc! This may lead to data loss!")); error = true; } else if (!read(tmp, MERGE)) { frontend::Alert::warning(_("Corrupt File"), _("Could not read stdinsets.inc! This may lead to data loss!")); error = true; } } min_toclevel_ = Layout::NOT_IN_TOC; max_toclevel_ = Layout::NOT_IN_TOC; const_iterator lit = begin(); const_iterator len = end(); for (; lit != len; ++lit) { int const toclevel = lit->toclevel; if (toclevel != Layout::NOT_IN_TOC) { if (min_toclevel_ == Layout::NOT_IN_TOC) min_toclevel_ = toclevel; else min_toclevel_ = min(min_toclevel_, toclevel); max_toclevel_ = max(max_toclevel_, toclevel); } } LYXERR(Debug::TCLASS, "Minimum TocLevel is " << min_toclevel_ << ", maximum is " << max_toclevel_); return (error ? ERROR : OK); }