X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLayout.cpp;h=db8c317764797306dd098b7e58958c7b05c9b9d9;hb=3826ff643433ad166c3402b146b3860ab5d6861e;hp=cb1f69bf8d65c616eeb0354b566bde6e7fdcb768;hpb=9162a3f40e74efe2cc663e884bac651c4a677ac4;p=lyx.git diff --git a/src/Layout.cpp b/src/Layout.cpp index cb1f69bf8d..db8c317764 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -75,6 +75,7 @@ enum LayoutTags { LT_NEED_PROTECT, LT_NEWLINE, LT_NEXTNOINDENT, + LT_PAR_GROUP, LT_PARINDENT, LT_PARSEP, LT_PARSKIP, @@ -107,12 +108,15 @@ enum LayoutTags { LT_RIGHTDELIM, LT_FORCELOCAL, LT_TOGGLE_INDENT, + LT_ADDTOTOC, + LT_ISTOCCAPTION, LT_INTITLE // keep this last! }; ///////////////////// Layout::Layout() + : add_to_toc_(false), is_toc_caption_(false) { unknown_ = false; margintype = MARGIN_STATIC; @@ -151,6 +155,7 @@ Layout::Layout() forcelocal = 0; itemcommand_ = "item"; toggle_indent = ITOGGLE_DOCUMENT_DEFAULT; + par_group_ = false; } @@ -178,6 +183,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass) { // This table is sorted alphabetically [asierra 30March96] LexerKeyword layoutTags[] = { + { "addtotoc", LT_ADDTOTOC }, { "align", LT_ALIGN }, { "alignpossible", LT_ALIGNPOSSIBLE }, { "argument", LT_ARGUMENT }, @@ -207,6 +213,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass) { "innertag", LT_INNERTAG }, { "inpreamble", LT_INPREAMBLE }, { "intitle", LT_INTITLE }, + { "istoccaption", LT_ISTOCCAPTION }, { "itemcommand", LT_ITEMCOMMAND }, { "itemsep", LT_ITEMSEP }, { "itemtag", LT_ITEMTAG }, @@ -231,6 +238,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass) { "newline", LT_NEWLINE }, { "nextnoindent", LT_NEXTNOINDENT }, { "obsoletedby", LT_OBSOLETEDBY }, + { "paragraphgroup", LT_PAR_GROUP }, { "parbreakisnewline", LT_PARBREAK_IS_NEWLINE }, { "parindent", LT_PARINDENT }, { "parsep", LT_PARSEP }, @@ -542,6 +550,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass) counter = trim(counter); break; + case LT_PAR_GROUP: + lex >> par_group_; + break; + case LT_FREE_SPACING: lex >> free_spacing; break; @@ -564,8 +576,8 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass) case LT_REQUIRES: { lex.eatLine(); - vector const req = - getVectorFromString(lex.getString()); + vector const req = + getVectorFromString(lex.getString(true)); requires_.insert(req.begin(), req.end()); break; } @@ -631,6 +643,16 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass) case LT_FORCELOCAL: lex >> forcelocal; break; + + case LT_ADDTOTOC: + lex >> toc_type_; + add_to_toc_ = !toc_type_.empty(); + break; + + case LT_ISTOCCAPTION: + lex >> is_toc_caption_; + break; + } } lex.popTable(); @@ -875,12 +897,15 @@ void Layout::readLatexType(Lexer & lex) return; case LATEX_PARAGRAPH: case LATEX_COMMAND: - case LATEX_ENVIRONMENT: case LATEX_ITEM_ENVIRONMENT: - case LATEX_BIB_ENVIRONMENT: case LATEX_LIST_ENVIRONMENT: latextype = static_cast(le); break; + case LATEX_ENVIRONMENT: + case LATEX_BIB_ENVIRONMENT: + latextype = static_cast(le); + par_group_ = true; + break; default: LYXERR0("Unhandled value " << le); break; @@ -936,10 +961,12 @@ void Layout::readArgument(Lexer & lex) // writeArgument() makes use of these default values arg.mandatory = false; arg.autoinsert = false; + arg.insertcotext = false; bool error = false; bool finished = false; arg.font = inherit_font; arg.labelfont = inherit_font; + arg.is_toc_caption = false; string id; lex >> id; bool const itemarg = prefixIs(id, "item:"); @@ -965,6 +992,9 @@ void Layout::readArgument(Lexer & lex) } else if (tok == "autoinsert") { lex.next(); arg.autoinsert = lex.getBool(); + } else if (tok == "insertcotext") { + lex.next(); + arg.insertcotext = lex.getBool(); } else if (tok == "leftdelim") { lex.next(); arg.ldelim = lex.getDocString(); @@ -997,6 +1027,9 @@ void Layout::readArgument(Lexer & lex) } else if (tok == "passthruchars") { lex.next(); arg.pass_thru_chars = lex.getDocString(); + } else if (tok == "istoccaption") { + lex.next(); + arg.is_toc_caption = lex.getBool(); } else { lex.printError("Unknown tag"); error = true; @@ -1024,6 +1057,8 @@ void writeArgument(ostream & os, string const & id, Layout::latexarg const & arg os << "\t\tMandatory " << arg.mandatory << '\n'; if (arg.autoinsert) os << "\t\tAutoinsert " << arg.autoinsert << '\n'; + if (arg.insertcotext) + os << "\t\tInsertCotext " << arg.insertcotext << '\n'; if (!arg.ldelim.empty()) os << "\t\tLeftDelim \"" << to_utf8(subst(arg.ldelim, from_ascii("\n"), from_ascii("
"))) @@ -1204,6 +1239,7 @@ void Layout::write(ostream & os) const os << "\tEndLabelType Static\n"; break; } + os << "\tParagraphGroup \"" << par_group_ << "\"\n"; if (!leftmargin.empty()) os << "\tLeftMargin \"" << to_utf8(leftmargin) << "\"\n"; if (!rightmargin.empty()) @@ -1248,8 +1284,6 @@ void Layout::write(ostream & os) const bool first = true; os << "\tAlignPossible"; if (alignpossible & LYX_ALIGN_BLOCK) { - if (!first) - os << ','; os << " Block"; first = false; }