X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBufferParams.cpp;h=9302a35c294e43881eeebd47bbbf8816bbb004f9;hb=700af7e7011f102d92222744791638ff2db18f94;hp=5eda910e937e576276236ea7131135579145cf23;hpb=6b28f08ff2f15fee2697fee4395225d6d9ec8daf;p=lyx.git diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 5eda910e93..9302a35c29 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -506,6 +506,8 @@ string BufferParams::readToken(Lexer & lex, string const & token, } else if (token == "\\begin_preamble") { readPreamble(lex); + } else if (token == "\\begin_local_layout") { + readLocalLayout(lex); } else if (token == "\\begin_modules") { readModules(lex); } else if (token == "\\options") { @@ -722,6 +724,15 @@ void BufferParams::writeFile(ostream & os) const os << "\\end_modules" << '\n'; } + // local layout information + if (!local_layout.empty()) { + // remove '\n' from the end + string const tmplocal = rtrim(local_layout, "\n"); + os << "\\begin_local_layout\n" + << tmplocal + << "\n\\end_local_layout\n"; + } + // then the text parameters if (language != ignore_language) os << "\\language " << language->lang() << '\n'; @@ -1501,6 +1512,12 @@ void BufferParams::makeDocumentClass() frontend::Alert::warning(_("Read Error"), msg); } } + if (!local_layout.empty()) { + if (!doc_class_->read(local_layout, TextClass::MODULE)) { + docstring const msg = _("Error reading internal layout information"); + frontend::Alert::warning(_("Read Error"), msg); + } + } } @@ -1555,6 +1572,16 @@ void BufferParams::readPreamble(Lexer & lex) } +void BufferParams::readLocalLayout(Lexer & lex) +{ + if (lex.getString() != "\\begin_local_layout") + lyxerr << "Error (BufferParams::readLocalLayout):" + "consistency check failed." << endl; + + local_layout = lex.getLongString("\\end_local_layout"); +} + + void BufferParams::readLanguage(Lexer & lex) { if (!lex.next()) return;