]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetInclude.cpp
Cocoa based Qt-4.6 needs to paint every character separately to match metrics computa...
[lyx.git] / src / insets / InsetInclude.cpp
index 34b9e7064bcb8416869909833fdaa845728450f9..628cb00be31b421837ef16d98d0b2dcf6a2f4ca1 100644 (file)
@@ -547,8 +547,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
        LYXERR(Debug::LATEX, "exportfile:" << exportfile);
        LYXERR(Debug::LATEX, "writefile:" << writefile);
 
-       string const tex_format = (runparams.flavor == OutputParams::LATEX) ?
-                       "latex" : "pdflatex";
+       string const tex_format = flavor2format(runparams.flavor);
        if (runparams.inComment || runparams.dryrun) {
                //Don't try to load or copy the file if we're
                //in a comment or doing a dryrun
@@ -556,7 +555,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
                 isLyXFileName(included_file.absFileName())) {
                // if it's a LyX file and we're inputting or including,
                // try to load it so we can write the associated latex
-               
+
                Buffer * tmp = loadIfNeeded();
                if (!tmp) {
                        docstring text = bformat(_("Could not load included "
@@ -601,7 +600,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
                tmp->markDepClean(masterBuffer->temppath());
 
                // Don't assume the child's format is latex
-               string const inc_format = tmp->bufferFormat();
+               string const inc_format = tmp->params().bufferFormat();
                FileName const tmpwritefile(changeExtension(writefile.absFileName(),
                        formats.extension(inc_format)));
 
@@ -638,22 +637,25 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
                runparams.encoding = oldEnc;
                runparams.master_language = oldLang;
 
-               // Use converters to produce a latex file from the child
-               ErrorList el;
-               bool const success =
-               theConverters().convert(tmp, tmpwritefile, writefile, included_file,
-                       inc_format, tex_format, el);
-
-               if (!success) {
-                       docstring msg = bformat(_("Included file `%1$s' "
-                                       "was not exported correctly.\nWarning: "
-                                       "LaTeX export is probably incomplete."),
-                                       included_file.displayName());
-                       if (!el.empty())
-                               msg = bformat(from_ascii("%1$s\n\n%2$s\n\n%3$s"),
-                                               msg, el.begin()->error,
-                                               el.begin()->description);
-                       Alert::warning(_("Export failure"), msg);
+               // If needed, use converters to produce a latex file from the child
+               if (tmpwritefile != writefile) {
+                       ErrorList el;
+                       bool const success =
+                               theConverters().convert(tmp, tmpwritefile, writefile,
+                                                       included_file,
+                                                       inc_format, tex_format, el);
+
+                       if (!success) {
+                               docstring msg = bformat(_("Included file `%1$s' "
+                                               "was not exported correctly.\nWarning: "
+                                               "LaTeX export is probably incomplete."),
+                                               included_file.displayName());
+                               if (!el.empty())
+                                       msg = bformat(from_ascii("%1$s\n\n%2$s\n\n%3$s"),
+                                                       msg, el.begin()->error,
+                                                       el.begin()->description);
+                               Alert::warning(_("Export failure"), msg);
+                       }
                }
        } else {
                // In this case, it's not a LyX file, so we copy the file