]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetExternal.cpp
InsetSpace support for
[lyx.git] / src / insets / InsetExternal.cpp
index 78d7de47a23f0a539f5fbbb5b8eb23c54585b366..8126d459a9f9d5b637a6c2feae246db2a59a3240 100644 (file)
 
 #include "graphics/PreviewLoader.h"
 
+#include "support/bind.h"
 #include "support/convert.h"
 #include "support/debug.h"
 #include "support/ExceptionMessage.h"
 #include "support/filetools.h"
 #include "support/gettext.h"
+#include "support/lassert.h"
 #include "support/lstrings.h"
 #include "support/lyxlib.h"
-#include "support/Translator.h"
-
-#include "support/bind.h"
 
 #include <sstream>
+#include <vector>
 
 using namespace std;
 using namespace lyx::support;
@@ -518,13 +518,15 @@ static bool isPreviewWanted(InsetExternalParams const & params)
 
 static docstring latexString(InsetExternal const & inset)
 {
-       odocstringstream os;
+       TexRow texrow;
+       odocstringstream ods;
+       otexstream os(ods, texrow);
        // We don't need to set runparams.encoding since it is not used by
        // latex().
        OutputParams runparams(0);
        runparams.flavor = OutputParams::LATEX;
        inset.latex(os, runparams);
-       return os.str();
+       return ods.str();
 }
 
 
@@ -635,14 +637,14 @@ void InsetExternal::read(Lexer & lex)
 }
 
 
-int InsetExternal::latex(odocstream & os, OutputParams const & runparams) const
+void InsetExternal::latex(otexstream & os, OutputParams const & runparams) const
 {
        if (params_.draft) {
                // FIXME UNICODE
                os << "\\fbox{\\ttfamily{}"
                   << from_utf8(params_.filename.outputFileName(buffer().filePath()))
                   << "}\n";
-               return 1;
+               return;
        }
 
        // "nice" means that the buffer is exported to LaTeX format but not
@@ -658,25 +660,28 @@ int InsetExternal::latex(odocstream & os, OutputParams const & runparams) const
                external::Template const * const et_ptr =
                        external::getTemplatePtr(params_);
                if (!et_ptr)
-                       return 0;
+                       return;
                external::Template const & et = *et_ptr;
 
                external::Template::Formats::const_iterator cit =
                        et.formats.find("PDFLaTeX");
 
                if (cit != et.formats.end()) {
-                       return external::writeExternal(params_, "PDFLaTeX",
-                                                      buffer(), os,
-                                                      *(runparams.exportdata),
-                                                      external_in_tmpdir,
-                                                      dryrun);
+                       int l = external::writeExternal(params_, "PDFLaTeX",
+                                                       buffer(), os.os(),
+                                                       *(runparams.exportdata),
+                                                       external_in_tmpdir,
+                                                       dryrun);
+                       os.texrow().newlines(l);
+                       return;
                }
        }
 
-       return external::writeExternal(params_, "LaTeX", buffer(), os,
-                                      *(runparams.exportdata),
-                                      external_in_tmpdir,
-                                      dryrun);
+       int l = external::writeExternal(params_, "LaTeX", buffer(), os.os(),
+                                       *(runparams.exportdata),
+                                       external_in_tmpdir,
+                                       dryrun);
+       os.texrow().newlines(l);
 }
 
 
@@ -724,6 +729,7 @@ void InsetExternal::validate(LaTeXFeatures & features) const
        string format;
        switch (features.runparams().flavor) {
        case OutputParams::LATEX:
+       case OutputParams::DVILUATEX:
                format = "LaTeX";
                break;
        case OutputParams::LUATEX: