X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetInclude.cpp;h=2c0c412d04591f706e1f7018e1db6ebfb6fe9f1d;hb=9914f21bceef9610bd1822f96eff0aa6d1a8df7c;hp=904096069e9804efe7de848255940ea51de15b13;hpb=e56ee0b2e656ccd3a466315c2867c82966629d51;p=lyx.git diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index 904096069e..2c0c412d04 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -34,6 +34,7 @@ #include "LyXRC.h" #include "Lexer.h" #include "MetricsInfo.h" +#include "output_plaintext.h" #include "output_xhtml.h" #include "OutputParams.h" #include "TextClass.h" @@ -623,6 +624,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const runparams.master_language = buffer().params().language; runparams.par_begin = 0; runparams.par_end = tmp->paragraphs().size(); + runparams.is_child = true; if (!tmp->makeLaTeXFile(tmpwritefile, masterFileName(buffer()). onlyPath().absFileName(), runparams, Buffer::OnlyBody)) { docstring msg = bformat(_("Included file `%1$s' " @@ -638,6 +640,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const } runparams.encoding = oldEnc; runparams.master_language = oldLang; + runparams.is_child = false; // If needed, use converters to produce a latex file from the child if (tmpwritefile != writefile) { @@ -804,7 +807,7 @@ docstring InsetInclude::xhtml(XHTMLStream & xs, OutputParams const & rp) const } -int InsetInclude::plaintext(odocstream & os, OutputParams const &) const +int InsetInclude::plaintext(odocstream & os, OutputParams const & op) const { if (isVerbatim(params()) || isListings(params())) { os << '[' << screenLabel() << '\n'; @@ -812,11 +815,16 @@ int InsetInclude::plaintext(odocstream & os, OutputParams const &) const os << includedFileName(buffer(), params()).fileContents("UTF-8"); os << "\n]"; return PLAINTEXT_NEWLINE + 1; // one char on a separate line - } else { + } + + Buffer const * const ibuf = loadIfNeeded(); + if (!ibuf) { docstring const str = '[' + screenLabel() + ']'; os << str; return str.size(); } + writePlaintextFile(*ibuf, os, op); + return 0; } @@ -926,7 +934,9 @@ void InsetInclude::validate(LaTeXFeatures & features) const // otherwise it would always be the master buffer, // and nested includes would not work. features.setBuffer(*tmp); + features.runparams().is_child = true; tmp->validate(features); + features.runparams().is_child = false; features.setBuffer(buffer()); } } @@ -1137,6 +1147,8 @@ void InsetInclude::updateCommand() void InsetInclude::updateBuffer(ParIterator const & it, UpdateType utype) { + button_.update(screenLabel(), true); + Buffer const * const childbuffer = getChildBuffer(); if (childbuffer) { childbuffer->updateBuffer(Buffer::UpdateChildOnly, utype);