X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLayout.cpp;h=7fedb3209c11fc16da9b7edc43a6c3d4626958e2;hb=0362c6aae73c293d1c20277c12d362acfe0b2ef6;hp=26c5c76d049679a857f3eed1e57a843730fb28d7;hpb=ff78ddc4fcababc8e23b5915367a56bba629a233;p=lyx.git diff --git a/src/Layout.cpp b/src/Layout.cpp index 26c5c76d04..7fedb3209c 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -15,21 +15,17 @@ #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 -namespace lyx { - -using support::subst; -using support::trim; +using namespace std; +using namespace lyx::support; -#ifndef FONT_H -extern FontInfo lyxRead(Lexer &, FontInfo const & fi = sane_font); -#endif +namespace lyx { /// Special value of toclevel for layouts that to not belong in a TOC const int Layout::NOT_IN_TOC = -1000; @@ -85,6 +81,7 @@ enum LayoutTags { LT_PARSKIP, //LT_PLAIN, LT_PREAMBLE, + LT_REQUIRES, LT_RIGHTMARGIN, LT_SPACING, LT_TOPSEP, @@ -182,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 }, @@ -225,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'"); @@ -487,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 const req = + getVectorFromString(lexrc.getString()); + requires_.insert(req.begin(), req.end()); + break; + } } lexrc.popTable(); - return error; + return !error; }