X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxlayout.C;h=6533fe3051d59c0ee66fa45e439c1ad018a42913;hb=5d3718cad2a2ef6a4d6a495054ab0705ba27b6b5;hp=130c12803953e50a632c6b5a90679c6ffb900c15;hpb=8283e978f8d621041c432b9b88a476bfd567385c;p=lyx.git diff --git a/src/lyxlayout.C b/src/lyxlayout.C index 130c128039..6533fe3051 100644 --- a/src/lyxlayout.C +++ b/src/lyxlayout.C @@ -11,10 +11,6 @@ #include -#ifdef __GNUG__ -#pragma implementation -#endif - #include "lyxlayout.h" #include "lyxtextclass.h" #include "lyxlex.h" @@ -32,6 +28,7 @@ enum LayoutTags { LT_MARGIN, LT_BOTTOMSEP, LT_COPYSTYLE, + LT_DEPENDSON, LT_OBSOLETEDBY, //LT_EMPTY, LT_END, @@ -58,6 +55,7 @@ enum LayoutTags { LT_ENDLABELTYPE, LT_LATEXNAME, LT_LATEXPARAM, + LT_OPTARGS, LT_LATEXTYPE, LT_LEFTMARGIN, LT_NEED_PROTECT, @@ -82,6 +80,7 @@ LyXLayout::LyXLayout () margintype = MARGIN_STATIC; latextype = LATEX_PARAGRAPH; intitle = false; + optionalargs = 0; needprotect = false; keepempty = false; font = LyXFont(LyXFont::ALL_INHERIT); @@ -114,45 +113,47 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) { // This table is sorted alphabetically [asierra 30March96] keyword_item layoutTags[] = { - { "align", LT_ALIGN }, - { "alignpossible", LT_ALIGNPOSSIBLE }, - { "bottomsep", LT_BOTTOMSEP }, - { "copystyle", LT_COPYSTYLE }, - { "end", LT_END }, + { "align", LT_ALIGN }, + { "alignpossible", LT_ALIGNPOSSIBLE }, + { "bottomsep", LT_BOTTOMSEP }, + { "copystyle", LT_COPYSTYLE }, + { "dependson", LT_DEPENDSON }, + { "end", LT_END }, { "endlabelstring", LT_ENDLABELSTRING }, { "endlabeltype", LT_ENDLABELTYPE }, - { "fill_bottom", LT_FILL_BOTTOM }, - { "fill_top", LT_FILL_TOP }, - { "font", LT_FONT }, - { "freespacing", LT_FREE_SPACING }, - { "intitle", LT_INTITLE }, - { "itemsep", LT_ITEMSEP }, - { "keepempty", LT_KEEPEMPTY }, - { "labelbottomsep", LT_LABEL_BOTTOMSEP }, - { "labelfont", LT_LABELFONT }, + { "fill_bottom", LT_FILL_BOTTOM }, + { "fill_top", LT_FILL_TOP }, + { "font", LT_FONT }, + { "freespacing", LT_FREE_SPACING }, + { "intitle", LT_INTITLE }, + { "itemsep", LT_ITEMSEP }, + { "keepempty", LT_KEEPEMPTY }, + { "labelbottomsep", LT_LABEL_BOTTOMSEP }, + { "labelfont", LT_LABELFONT }, { "labelindent", LT_LABELINDENT }, - { "labelsep", LT_LABELSEP }, + { "labelsep", LT_LABELSEP }, { "labelstring", LT_LABELSTRING }, - { "labelstringappendix", LT_LABELSTRING_APPENDIX }, - { "labeltype", LT_LABELTYPE }, - { "latexname", LT_LATEXNAME }, - { "latexparam", LT_LATEXPARAM }, - { "latextype", LT_LATEXTYPE }, - { "leftmargin", LT_LEFTMARGIN }, - { "margin", LT_MARGIN }, - { "needprotect", LT_NEED_PROTECT }, - { "newline", LT_NEWLINE }, - { "nextnoindent", LT_NEXTNOINDENT }, - { "obsoletedby", LT_OBSOLETEDBY }, - { "parindent", LT_PARINDENT }, - { "parsep", LT_PARSEP }, - { "parskip", LT_PARSKIP }, - { "passthru", LT_PASS_THRU }, - { "preamble", LT_PREAMBLE }, - { "rightmargin", LT_RIGHTMARGIN }, - { "spacing", LT_SPACING }, - { "textfont", LT_TEXTFONT }, - { "topsep", LT_TOPSEP } + { "labelstringappendix", LT_LABELSTRING_APPENDIX }, + { "labeltype", LT_LABELTYPE }, + { "latexname", LT_LATEXNAME }, + { "latexparam", LT_LATEXPARAM }, + { "latextype", LT_LATEXTYPE }, + { "leftmargin", LT_LEFTMARGIN }, + { "margin", LT_MARGIN }, + { "needprotect", LT_NEED_PROTECT }, + { "newline", LT_NEWLINE }, + { "nextnoindent", LT_NEXTNOINDENT }, + { "obsoletedby", LT_OBSOLETEDBY }, + { "optionalargs", LT_OPTARGS }, + { "parindent", LT_PARINDENT }, + { "parsep", LT_PARSEP }, + { "parskip", LT_PARSKIP }, + { "passthru", LT_PASS_THRU }, + { "preamble", LT_PREAMBLE }, + { "rightmargin", LT_RIGHTMARGIN }, + { "spacing", LT_SPACING }, + { "textfont", LT_TEXTFONT }, + { "topsep", LT_TOPSEP } }; bool error = false; @@ -183,15 +184,20 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) if (tclass.hasLayout(style)) { string const tmpname = name_; - this->operator=(tclass[style]); + this->operator=(*tclass[style]); name_ = tmpname; } else { - lyxerr << "Cannot copy unknown style `" << style << "'" << endl; - LyXTextClass::const_iterator it = tclass.begin(); - LyXTextClass::const_iterator end = tclass.end(); - lyxerr << "All layouts so far:" << endl; + lyxerr << "Cannot copy unknown style `" + << style << "'\n" + << "All layouts so far:" + << endl; + LyXTextClass::const_iterator it = + tclass.begin(); + LyXTextClass::const_iterator end = + tclass.end(); for (; it != end; ++it) { - lyxerr << it->name() << endl; + lyxerr << (*it)->name() + << endl; } //lexrc.printError("Cannot copy known " @@ -206,12 +212,12 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) if (tclass.hasLayout(style)) { string const tmpname = name_; - this->operator=(tclass[style]); + this->operator=(*tclass[style]); name_ = tmpname; if (obsoleted_by().empty()) obsoleted_by_ = style; } else { - lyxerr << "Cannot replace with unknown style `" << style << "'" << endl; + lyxerr << "Cannot replace with unknown style `" << style << '\'' << endl; //lexrc.printError("Cannot replace with" // " unknown style " @@ -220,6 +226,12 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) } break; + case LT_DEPENDSON: + if (lexrc.next()) { + depends_on_ = lexrc.getString(); + } + break; + case LT_MARGIN: // Margin style definition. readMargin(lexrc); break; @@ -232,6 +244,12 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) intitle = lexrc.next() && lexrc.getInteger(); break; + case LT_OPTARGS: + if (lexrc.next()) { + optionalargs = lexrc.getInteger(); + } + break; + case LT_NEED_PROTECT: needprotect = lexrc.next() && lexrc.getInteger(); break; @@ -749,3 +767,9 @@ string const & LyXLayout::obsoleted_by() const { return obsoleted_by_; } + + +string const & LyXLayout::depends_on() const +{ + return depends_on_; +}