X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FTextClass.cpp;h=c48b68eb10fae4215bab05bfb95f3935718d3ac4;hb=e5a91999278253d597ad1e18f322884df4a4c94e;hp=d19c08b9242aed71e1a3527d368f32af7fea9397;hpb=f18af303fe2f9dca05beae7852f3904ac4bfddba;p=lyx.git diff --git a/src/TextClass.cpp b/src/TextClass.cpp index d19c08b924..c48b68eb10 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -60,7 +60,7 @@ namespace lyx { // development/tools/updatelayouts.sh script, to update the format of // all of our layout files. // -int const LAYOUT_FORMAT = 39; //sanda branch styling +int const LAYOUT_FORMAT = 45; // rgh: New Tag "NoInsetLayout" namespace { @@ -182,6 +182,7 @@ enum TextClassTags { TC_IFSTYLE, TC_DEFAULTSTYLE, TC_INSETLAYOUT, + TC_NOINSETLAYOUT, TC_NOSTYLE, TC_COLUMNS, TC_SIDES, @@ -222,50 +223,51 @@ enum TextClassTags { namespace { - LexerKeyword textClassTags[] = { - { "addtohtmlpreamble", TC_ADDTOHTMLPREAMBLE }, - { "addtohtmlstyles", TC_ADDTOHTMLSTYLES }, - { "addtopreamble", TC_ADDTOPREAMBLE }, - { "citeengine", TC_CITEENGINE }, - { "citeenginetype", TC_CITEENGINETYPE }, - { "citeformat", TC_CITEFORMAT }, - { "classoptions", TC_CLASSOPTIONS }, - { "columns", TC_COLUMNS }, - { "counter", TC_COUNTER }, - { "defaultbiblio", TC_DEFAULTBIBLIO }, - { "defaultfont", TC_DEFAULTFONT }, - { "defaultmodule", TC_DEFAULTMODULE }, - { "defaultstyle", TC_DEFAULTSTYLE }, - { "excludesmodule", TC_EXCLUDESMODULE }, - { "float", TC_FLOAT }, - { "format", TC_FORMAT }, - { "fullauthorlist", TC_FULLAUTHORLIST }, - { "htmlpreamble", TC_HTMLPREAMBLE }, - { "htmlstyles", TC_HTMLSTYLES }, - { "htmltocsection", TC_HTMLTOCSECTION }, - { "ifcounter", TC_IFCOUNTER }, - { "ifstyle", TC_IFSTYLE }, - { "input", TC_INPUT }, - { "insetlayout", TC_INSETLAYOUT }, - { "leftmargin", TC_LEFTMARGIN }, - { "nocounter", TC_NOCOUNTER }, - { "nofloat", TC_NOFLOAT }, - { "nostyle", TC_NOSTYLE }, - { "outputformat", TC_OUTPUTFORMAT }, - { "outputtype", TC_OUTPUTTYPE }, - { "pagestyle", TC_PAGESTYLE }, - { "preamble", TC_PREAMBLE }, - { "provides", TC_PROVIDES }, - { "providesmodule", TC_PROVIDESMODULE }, - { "requires", TC_REQUIRES }, - { "rightmargin", TC_RIGHTMARGIN }, - { "secnumdepth", TC_SECNUMDEPTH }, - { "sides", TC_SIDES }, - { "style", TC_STYLE }, - { "titlelatexname", TC_TITLELATEXNAME }, - { "titlelatextype", TC_TITLELATEXTYPE }, - { "tocdepth", TC_TOCDEPTH } - }; +LexerKeyword textClassTags[] = { + { "addtohtmlpreamble", TC_ADDTOHTMLPREAMBLE }, + { "addtohtmlstyles", TC_ADDTOHTMLSTYLES }, + { "addtopreamble", TC_ADDTOPREAMBLE }, + { "citeengine", TC_CITEENGINE }, + { "citeenginetype", TC_CITEENGINETYPE }, + { "citeformat", TC_CITEFORMAT }, + { "classoptions", TC_CLASSOPTIONS }, + { "columns", TC_COLUMNS }, + { "counter", TC_COUNTER }, + { "defaultbiblio", TC_DEFAULTBIBLIO }, + { "defaultfont", TC_DEFAULTFONT }, + { "defaultmodule", TC_DEFAULTMODULE }, + { "defaultstyle", TC_DEFAULTSTYLE }, + { "excludesmodule", TC_EXCLUDESMODULE }, + { "float", TC_FLOAT }, + { "format", TC_FORMAT }, + { "fullauthorlist", TC_FULLAUTHORLIST }, + { "htmlpreamble", TC_HTMLPREAMBLE }, + { "htmlstyles", TC_HTMLSTYLES }, + { "htmltocsection", TC_HTMLTOCSECTION }, + { "ifcounter", TC_IFCOUNTER }, + { "ifstyle", TC_IFSTYLE }, + { "input", TC_INPUT }, + { "insetlayout", TC_INSETLAYOUT }, + { "leftmargin", TC_LEFTMARGIN }, + { "nocounter", TC_NOCOUNTER }, + { "nofloat", TC_NOFLOAT }, + { "noinsetlayout", TC_NOINSETLAYOUT }, + { "nostyle", TC_NOSTYLE }, + { "outputformat", TC_OUTPUTFORMAT }, + { "outputtype", TC_OUTPUTTYPE }, + { "pagestyle", TC_PAGESTYLE }, + { "preamble", TC_PREAMBLE }, + { "provides", TC_PROVIDES }, + { "providesmodule", TC_PROVIDESMODULE }, + { "requires", TC_REQUIRES }, + { "rightmargin", TC_RIGHTMARGIN }, + { "secnumdepth", TC_SECNUMDEPTH }, + { "sides", TC_SIDES }, + { "style", TC_STYLE }, + { "titlelatexname", TC_TITLELATEXNAME }, + { "titlelatextype", TC_TITLELATEXTYPE }, + { "tocdepth", TC_TOCDEPTH } +}; } //namespace anon @@ -525,6 +527,16 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt) } break; + case TC_NOINSETLAYOUT: + if (lexrc.next()) { + docstring const style = from_utf8(subst(lexrc.getString(), + '_', ' ')); + if (!deleteInsetLayout(style)) + LYXERR0("Style `" << style << "' cannot be removed\n" + "because it was not found!"); + } + break; + case TC_COLUMNS: if (lexrc.next()) columns_ = lexrc.getInteger(); @@ -1237,6 +1249,7 @@ string const & TextClass::prerequisites(string const & sep) const return prerequisites_; } + bool TextClass::hasLayout(docstring const & n) const { docstring const name = n.empty() ? defaultLayoutName() : n; @@ -1251,12 +1264,8 @@ bool TextClass::hasInsetLayout(docstring const & n) const { if (n.empty()) return false; - InsetLayouts::const_iterator it = insetlayoutlist_.begin(); - InsetLayouts::const_iterator en = insetlayoutlist_.end(); - for (; it != en; ++it) - if (n == it->first) - return true; - return false; + InsetLayouts::const_iterator it = insetlayoutlist_.find(n); + return it != insetlayoutlist_.end(); } @@ -1318,6 +1327,12 @@ bool TextClass::deleteLayout(docstring const & name) } +bool TextClass::deleteInsetLayout(docstring const & name) +{ + return insetlayoutlist_.erase(name); +} + + // Load textclass info if not loaded yet bool TextClass::load(string const & path) const { @@ -1531,9 +1546,8 @@ Layout const & DocumentClass::getTOCLayout() const Layout const & DocumentClass::htmlTOCLayout() const { - if (html_toc_section_.empty()) { + if (html_toc_section_.empty()) html_toc_section_ = getTOCLayout().name(); - } return operator[](html_toc_section_); }