]> git.lyx.org Git - lyx.git/blobdiff - src/TextClass.cpp
Improvements to Parser::verbatimStuff
[lyx.git] / src / TextClass.cpp
index 40ff9c9ace8131261bc62db30e901c0f950fe55e..c48b68eb10fae4215bab05bfb95f3935718d3ac4 100644 (file)
@@ -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 = 42; // spitz: new Style tag ItemCommand
+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
 {