]> git.lyx.org Git - lyx.git/blobdiff - src/output_latex.cpp
make frontend::Application a bit slimmer
[lyx.git] / src / output_latex.cpp
index bf04a243c35e73af5ccdd1e063dbdf791a444859..085a6f1ccdf21cc077eaa855cac740d31781941b 100644 (file)
@@ -24,6 +24,7 @@
 #include "Paragraph.h"
 #include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
+#include "TextClass.h"
 #include "TexRow.h"
 #include "VSpace.h"
 
@@ -69,7 +70,7 @@ TeXDeeper(Buffer const & buf,
          odocstream & os, TexRow & texrow,
          OutputParams const & runparams)
 {
-       LYXERR(Debug::LATEX) << "TeXDeeper...     " << &*pit << endl;
+       LYXERR(Debug::LATEX, "TeXDeeper...     " << &*pit);
        ParagraphList::const_iterator par = pit;
 
        while (par != paragraphs.end() &&
@@ -82,7 +83,7 @@ TeXDeeper(Buffer const & buf,
                                             os, texrow, runparams);
                }
        }
-       LYXERR(Debug::LATEX) << "TeXDeeper...done " << endl;
+       LYXERR(Debug::LATEX, "TeXDeeper...done ");
 
        return par;
 }
@@ -95,7 +96,7 @@ TeXEnvironment(Buffer const & buf,
               odocstream & os, TexRow & texrow,
               OutputParams const & runparams)
 {
-       LYXERR(Debug::LATEX) << "TeXEnvironment...     " << &*pit << endl;
+       LYXERR(Debug::LATEX, "TeXEnvironment...     " << &*pit);
 
        BufferParams const & bparams = buf.params();
 
@@ -210,9 +211,9 @@ TeXEnvironment(Buffer const & buf,
                texrow.newline();
        }
 
-       if (par != paragraphs.end()) {
-               LYXERR(Debug::LATEX) << "TeXEnvironment...done " << &*par << endl;
-       }
+       if (par != paragraphs.end())
+               LYXERR(Debug::LATEX, "TeXEnvironment...done " << &*par);
+
        return par;
 }
 
@@ -248,11 +249,27 @@ TeXOnePar(Buffer const & buf,
          OutputParams const & runparams_in,
          string const & everypar)
 {
-       LYXERR(Debug::LATEX) << "TeXOnePar...     " << &*pit << " '"
-               << everypar << "'" << endl;
+       LYXERR(Debug::LATEX, "TeXOnePar...     " << &*pit << " '"
+               << everypar << "'");
        BufferParams const & bparams = buf.params();
        LayoutPtr style;
 
+       if (runparams_in.verbatim) {
+               int const dist = std::distance(paragraphs.begin(), pit);
+               Font const outerfont = outerFont(dist, paragraphs);
+
+               // No newline if only one paragraph in this lyxtext
+               if (dist > 0) {
+                       os << '\n';
+                       texrow.newline();
+               }
+
+               /*bool need_par = */ pit->latex(buf, bparams, outerfont,
+                       os, texrow, runparams_in);
+
+               return ++pit;
+       }
+
        // In an inset with unlimited length (all in one row),
        // force layout to default
        if (!pit->forceDefaultParagraphs())
@@ -461,7 +478,7 @@ TeXOnePar(Buffer const & buf,
 
        bool is_command = style->isCommand();
 
-       if (style->resfont.size() != font.size()
+       if (style->resfont.size() != font.fontInfo().size()
            && boost::next(pit) != paragraphs.end()
            && !is_command) {
                if (!need_par)
@@ -558,7 +575,7 @@ TeXOnePar(Buffer const & buf,
        if (closing_rtl_ltr_environment)
                os << "}";
 
-       if (pending_newline && !runparams.verbatim) {
+       if (pending_newline) {
                os << '\n';
                texrow.newline();
        }
@@ -589,9 +606,8 @@ TeXOnePar(Buffer const & buf,
                texrow.newline();
        }
 
-       if (boost::next(pit) != paragraphs.end()) {
-               LYXERR(Debug::LATEX) << "TeXOnePar...done " << &*boost::next(pit) << endl;
-       }
+       if (boost::next(pit) != paragraphs.end())
+               LYXERR(Debug::LATEX, "TeXOnePar...done " << &*boost::next(pit));
 
        return ++pit;
 }
@@ -717,14 +733,13 @@ pair<bool, int> switchEncoding(odocstream & os, BufferParams const & bparams,
                || newEnc.package() == Encoding::none)
                return make_pair(false, 0);
 
-       LYXERR(Debug::LATEX) << "Changing LaTeX encoding from "
-               << oldEnc.name() << " to "
-               << newEnc.name() << endl;
+       LYXERR(Debug::LATEX, "Changing LaTeX encoding from "
+               << oldEnc.name() << " to " << newEnc.name());
        os << setEncoding(newEnc.iconvName());
        if (bparams.inputenc == "default")
                return make_pair(true, 0);
 
-       docstring const inputenc(from_ascii(newEnc.latexName()));
+       docstring const inputenc = from_ascii(newEnc.latexName());
        switch (newEnc.package()) {
                case Encoding::none:
                        // shouldn't ever reach here, see above
@@ -737,7 +752,7 @@ pair<bool, int> switchEncoding(odocstream & os, BufferParams const & bparams,
                        }
                        os << "\\inputencoding{" << inputenc << '}';
                        return make_pair(true, count + 16);
-                }
+               }
                case Encoding::CJK: {
                        int count = inputenc.length();
                        if (oldEnc.package() == Encoding::CJK) {