]> git.lyx.org Git - lyx.git/blobdiff - src/Layout.cpp
This is the first of a series of commits that will make InsetLayout a real class.
[lyx.git] / src / Layout.cpp
index 6d285881b53374a7abb5ece6428a24e58f63d95e..c29f0bd1f8a0d0a0359e18410488b417a7e38952 100644 (file)
 #include "TextClass.h"
 #include "Lexer.h"
 #include "Font.h"
-#include "support/debug.h"
-
 
+#include "support/debug.h"
 #include "support/lstrings.h"
 
 #include <ostream>
 
-using std::endl;
-using std::string;
+using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 
-using support::subst;
-using support::trim;
-
-
 /// Special value of toclevel for layouts that to not belong in a TOC
 const int Layout::NOT_IN_TOC = -1000;
 
@@ -86,6 +81,7 @@ enum LayoutTags {
        LT_PARSKIP,
        //LT_PLAIN,
        LT_PREAMBLE,
+       LT_REQUIRES,
        LT_RIGHTMARGIN,
        LT_SPACING,
        LT_TOPSEP,
@@ -183,6 +179,7 @@ bool Layout::read(Lexer & lexrc, TextClass const & tclass)
                { "parskip",        LT_PARSKIP },
                { "passthru",       LT_PASS_THRU },
                { "preamble",       LT_PREAMBLE },
+               { "requires",       LT_REQUIRES },
                { "rightmargin",    LT_RIGHTMARGIN },
                { "spacing",        LT_SPACING },
                { "textfont",       LT_TEXTFONT },
@@ -488,11 +485,19 @@ bool Layout::read(Lexer & lexrc, TextClass const & tclass)
                case LT_SPACING: // setspace.sty
                        readSpacing(lexrc);
                        break;
+
+               case LT_REQUIRES:
+                       lexrc.eatLine();
+                       vector<string> const req = 
+                               getVectorFromString(lexrc.getString());
+                       requires_.insert(req.begin(), req.end());
+                       break;
+
                }
        }
        lexrc.popTable();
 
-       return error;
+       return !error;
 }