]> git.lyx.org Git - lyx.git/blobdiff - src/Layout.cpp
Andre's s/getTextClass/textClass/ cleanup.
[lyx.git] / src / Layout.cpp
index 13edbf46dd6ad01fbbe23205b466fa5f66a951cc..7fedb3209c11fc16da9b7edc43a6c3d4626958e2 100644 (file)
 #include "Layout.h"
 #include "TextClass.h"
 #include "Lexer.h"
-#include "debug.h"
+#include "Font.h"
 
+#include "support/debug.h"
 #include "support/lstrings.h"
 
-using std::endl;
-using std::string;
+#include <ostream>
 
-namespace lyx {
-
-using support::subst;
-using support::trim;
+using namespace std;
+using namespace lyx::support;
 
-extern FontInfo lyxRead(Lexer &, FontInfo const & fi = sane_font);
+namespace lyx {
 
 /// Special value of toclevel for layouts that to not belong in a TOC
 const int Layout::NOT_IN_TOC = -1000;
@@ -83,6 +81,7 @@ enum LayoutTags {
        LT_PARSKIP,
        //LT_PLAIN,
        LT_PREAMBLE,
+       LT_REQUIRES,
        LT_RIGHTMARGIN,
        LT_SPACING,
        LT_TOPSEP,
@@ -180,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 },
@@ -223,14 +223,9 @@ bool Layout::read(Lexer & lexrc, TextClass const & tclass)
                                               << to_utf8(style) << "'\n"
                                               << "All layouts so far:"
                                               << endl;
-                                       TextClass::const_iterator it =
-                                               tclass.begin();
-                                       TextClass::const_iterator end =
-                                               tclass.end();
-                                       for (; it != end; ++it) {
-                                               lyxerr << to_utf8((*it)->name())
+                                       for (size_t i = 0; i != tclass.layoutCount(); ++i)
+                                               lyxerr << to_utf8(tclass.layout(i)->name())
                                                       << endl;
-                                       }
 
                                        //lexrc.printError("Cannot copy known "
                                        //               "style `$$Token'");
@@ -485,11 +480,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;
 }