]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetInclude.cpp
tex2lyx/text.cpp: fix typos
[lyx.git] / src / insets / InsetInclude.cpp
index c4a437bc195a5a6c6e681d7d493a16597bb21722..82520768b9a1e44cd3d73441ded90a6ab5498795 100644 (file)
@@ -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"
@@ -793,7 +794,7 @@ docstring InsetInclude::xhtml(XHTMLStream & xs, OutputParams const & rp) const
        if (all_pars) {
                op.par_begin = 0;
                op.par_end = 0;
-               ibuf->writeLyXHTMLSource(xs.os(), op, Buffer::OnlyBody);
+               ibuf->writeLyXHTMLSource(xs.os(), op, Buffer::IncludedFile);
        } else
                xs << XHTMLStream::ESCAPE_NONE 
                   << "<!-- Included file: " 
@@ -804,7 +805,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 +813,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;
 }
 
 
@@ -1137,6 +1143,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);