X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLayout.cpp;h=7801e8fcb27f96c4f4b0dba7799e55c171290650;hb=4300feb8595c8542050adedf664cd4bfda7ede12;hp=4f7f215b707b53839c932889e76499f2b5180b7a;hpb=99ecc6e2c9721c5885139d49436ba680fabf9cca;p=lyx.git diff --git a/src/Layout.cpp b/src/Layout.cpp index 4f7f215b70..7801e8fcb2 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -40,6 +40,8 @@ enum LayoutTags { LT_ALIGN = 1, LT_ALIGNPOSSIBLE, LT_ARGUMENT, + LT_AUTONESTS, + LT_AUTONESTEDBY, LT_MARGIN, LT_BOTTOMSEP, LT_CATEGORY, @@ -72,10 +74,10 @@ enum LayoutTags { LT_LATEXTYPE, LT_LEFTDELIM, LT_LEFTMARGIN, + LT_NEED_CPROTECT, LT_NEED_PROTECT, LT_NEWLINE, LT_NEXTNOINDENT, - LT_NESTS, LT_PAR_GROUP, LT_PARINDENT, LT_PARSEP, @@ -119,7 +121,7 @@ enum LayoutTags { ///////////////////// Layout::Layout() - : add_to_toc_(false), is_toc_caption_(false) + : add_to_toc_(false), is_toc_caption_(true) { unknown_ = false; margintype = MARGIN_STATIC; @@ -129,6 +131,7 @@ Layout::Layout() intitle = false; inpreamble = false; needprotect = false; + needcprotect = false; keepempty = false; font = inherit_font; labelfont = inherit_font; @@ -192,6 +195,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass) { "align", LT_ALIGN }, { "alignpossible", LT_ALIGNPOSSIBLE }, { "argument", LT_ARGUMENT }, + { "autonests", LT_AUTONESTS }, { "babelpreamble", LT_BABELPREAMBLE }, { "bottomsep", LT_BOTTOMSEP }, { "category", LT_CATEGORY }, @@ -218,6 +222,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass) { "innertag", LT_INNERTAG }, { "inpreamble", LT_INPREAMBLE }, { "intitle", LT_INTITLE }, + { "isautonestedby", LT_AUTONESTEDBY }, { "istoccaption", LT_ISTOCCAPTION }, { "itemcommand", LT_ITEMCOMMAND }, { "itemsep", LT_ITEMSEP }, @@ -239,8 +244,8 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass) { "leftdelim", LT_LEFTDELIM }, { "leftmargin", LT_LEFTMARGIN }, { "margin", LT_MARGIN }, + { "needcprotect", LT_NEED_CPROTECT }, { "needprotect", LT_NEED_PROTECT }, - { "nests", LT_NESTS }, { "newline", LT_NEWLINE }, { "nextnoindent", LT_NEXTNOINDENT }, { "obsoletedby", LT_OBSOLETEDBY }, @@ -391,6 +396,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass) lex >> needprotect; break; + case LT_NEED_CPROTECT: + lex >> needcprotect; + break; + case LT_KEEPEMPTY: lex >> keepempty; break; @@ -594,14 +603,27 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass) break; } - case LT_NESTS: { - docstring const nest = subst(subst(subst(lex.getLongString(from_ascii("EndNests")), - from_ascii("\n"), docstring()), - from_ascii(" "), docstring()), - from_ascii("\t"), docstring()); - vector const nests = - getVectorFromString(nest); - nests_.insert(nests.begin(), nests.end()); + case LT_AUTONESTS: { + docstring const autonest = + subst(subst(subst(lex.getLongString(from_ascii("EndAutoNests")), + from_ascii("\n"), docstring()), + from_ascii(" "), docstring()), + from_ascii("\t"), docstring()); + vector const autonests = + getVectorFromString(autonest); + autonests_.insert(autonests.begin(), autonests.end()); + break; + } + + case LT_AUTONESTEDBY: { + docstring const autonest = + subst(subst(subst(lex.getLongString(from_ascii("EndIsAutoNestedBy")), + from_ascii("\n"), docstring()), + from_ascii(" "), docstring()), + from_ascii("\t"), docstring()); + vector const autonests = + getVectorFromString(autonest); + autonested_by_.insert(autonests.begin(), autonests.end()); break; } @@ -1197,6 +1219,7 @@ void Layout::write(ostream & os) const it != postcommandargs_.end(); ++it) writeArgument(os, it->first, it->second); os << "\tNeedProtect " << needprotect << "\n" + "\tNeedCProtect " << needcprotect << "\n" "\tKeepEmpty " << keepempty << '\n'; if (labelfont == font) lyxWrite(os, font, "Font", 1); @@ -1400,15 +1423,25 @@ void Layout::write(ostream & os) const } os << '\n'; } - if (!nests_.empty()) { - os << "\tNests "; - for (set::const_iterator it = nests_.begin(); - it != nests_.end(); ++it) { - if (it != nests_.begin()) + if (!autonests_.empty()) { + os << "\tAutoNests\n\t"; + for (set::const_iterator it = autonests_.begin(); + it != autonests_.end(); ++it) { + if (it != autonests_.begin()) os << ','; os << to_utf8(*it); } - os << '\n'; + os << "\n\tEndAutoNests\n"; + } + if (!autonested_by_.empty()) { + os << "\tIsAutoNestedBy\n\t"; + for (set::const_iterator it = autonested_by_.begin(); + it != autonested_by_.end(); ++it) { + if (it != autonested_by_.begin()) + os << ','; + os << to_utf8(*it); + } + os << "\n\tIsAutoNestedBy\n"; } if (refprefix.empty()) os << "\tRefPrefix OFF\n";