X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FTextClass.cpp;h=c48b68eb10fae4215bab05bfb95f3935718d3ac4;hb=e5a91999278253d597ad1e18f322884df4a4c94e;hp=55b90c6cfe6f32f0610931d7c609e74089a62f9b;hpb=aafd52f44167d5510be1ddcb974daa9dae486933;p=lyx.git diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 55b90c6cfe..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 = 40; // rgh categorized layouts +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, @@ -250,6 +251,7 @@ LexerKeyword textClassTags[] = { { "leftmargin", TC_LEFTMARGIN }, { "nocounter", TC_NOCOUNTER }, { "nofloat", TC_NOFLOAT }, + { "noinsetlayout", TC_NOINSETLAYOUT }, { "nostyle", TC_NOSTYLE }, { "outputformat", TC_OUTPUTFORMAT }, { "outputtype", TC_OUTPUTTYPE }, @@ -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(); @@ -1252,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(); } @@ -1319,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 {