X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLayout.cpp;h=7fedb3209c11fc16da9b7edc43a6c3d4626958e2;hb=0362c6aae73c293d1c20277c12d362acfe0b2ef6;hp=26740fc2b62f41d5fec4dfe6e853a7c9db75a94f;hpb=5ddc612b735317d5b22553a63aad7879503e3950;p=lyx.git diff --git a/src/Layout.cpp b/src/Layout.cpp index 26740fc2b6..7fedb3209c 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -15,19 +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; -extern FontInfo lyxRead(Lexer &); +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'"); @@ -311,16 +306,16 @@ bool Layout::read(Lexer & lexrc, TextClass const & tclass) break; case LT_FONT: - font = lyxRead(lexrc); + font = lyxRead(lexrc, font); labelfont = font; break; case LT_TEXTFONT: - font = lyxRead(lexrc); + font = lyxRead(lexrc, font); break; case LT_LABELFONT: - labelfont = lyxRead(lexrc); + labelfont = lyxRead(lexrc, labelfont); break; case LT_NEXTNOINDENT: // Indent next paragraph? @@ -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 const req = + getVectorFromString(lexrc.getString()); + requires_.insert(req.begin(), req.end()); + break; + } } lexrc.popTable(); - return error; + return !error; }