]> git.lyx.org Git - lyx.git/blobdiff - src/output_latex.cpp
Improve verbatim for RTL
[lyx.git] / src / output_latex.cpp
index 6f9a040f254c3823e7f7381ad84c116cecce0aef..92c1ca77d54d3e087f9bf9a30ea81f0a99f074ed 100644 (file)
@@ -16,7 +16,9 @@
 #include "BufferParams.h"
 #include "debug.h"
 #include "Encoding.h"
+#include "InsetList.h"
 #include "Language.h"
+#include "Layout.h"
 #include "LyXRC.h"
 #include "OutputParams.h"
 #include "Paragraph.h"
@@ -30,6 +32,7 @@
 
 #include "support/lstrings.h"
 
+#include <boost/next_prior.hpp>
 
 namespace lyx {
 
@@ -170,12 +173,12 @@ TeXEnvironment(Buffer const & buf,
                        os << '\n';
                        texrow.newline();
                } else if (par->params().depth() > pit->params().depth()) {
-                           if (par->layout()->isParagraph()) {
+                       if (par->layout()->isParagraph()) {
+                         // Thinko!
+                         // How to handle this? (Lgb)
+                         //&& !suffixIs(os, "\n\n")
+                                 //) {
 
-                           // Thinko!
-                           // How to handle this? (Lgb)
-                           //&& !suffixIs(os, "\n\n")
-                                   //) {
                                // There should be at least one '\n' already
                                // but we need there to be two for Standard
                                // paragraphs that are depth-increment'ed to be
@@ -207,8 +210,9 @@ TeXEnvironment(Buffer const & buf,
                texrow.newline();
        }
 
-       if (par != paragraphs.end())
+       if (par != paragraphs.end()) {
                LYXERR(Debug::LATEX) << "TeXEnvironment...done " << &*par << endl;
+       }
        return par;
 }
 
@@ -220,10 +224,10 @@ int latexOptArgInsets(Buffer const & buf, Paragraph const & par,
 {
        int lines = 0;
 
-       InsetList::const_iterator it = par.insetlist.begin();
-       InsetList::const_iterator end = par.insetlist.end();
+       InsetList::const_iterator it = par.insetList().begin();
+       InsetList::const_iterator end = par.insetList().end();
        for (; it != end && number > 0 ; ++it) {
-               if (it->inset->lyxCode() == Inset::OPTARG_CODE) {
+               if (it->inset->lyxCode() == OPTARG_CODE) {
                        InsetOptArg * ins =
                                static_cast<InsetOptArg *>(it->inset);
                        lines += ins->latexOptional(buf, os, runparams);
@@ -249,6 +253,18 @@ TeXOnePar(Buffer const & buf,
        BufferParams const & bparams = buf.params();
        LayoutPtr style;
 
+       if (runparams_in.verbatim) {
+               Font const outerfont =
+                       outerFont(std::distance(paragraphs.begin(), pit),
+                                 paragraphs);
+               // FIXME UNICODE
+               bool need_par = pit->latex(buf, bparams, outerfont,
+                                            os, texrow, runparams_in);
+               os << '\n';
+               texrow.newline();
+               return ++pit;
+       }
+
        // In an inset with unlimited length (all in one row),
        // force layout to default
        if (!pit->forceDefaultParagraphs())
@@ -437,7 +453,7 @@ TeXOnePar(Buffer const & buf,
 
        // FIXME UNICODE
        os << from_utf8(everypar);
-       bool need_par = pit->simpleTeXOnePar(buf, bparams, outerfont,
+       bool need_par = pit->latex(buf, bparams, outerfont,
                                             os, texrow, runparams);
 
        // Make sure that \\par is done with the font of the last
@@ -585,8 +601,9 @@ TeXOnePar(Buffer const & buf,
                texrow.newline();
        }
 
-       if (boost::next(pit) != paragraphs.end())
+       if (boost::next(pit) != paragraphs.end()) {
                LYXERR(Debug::LATEX) << "TeXOnePar...done " << &*boost::next(pit) << endl;
+       }
 
        return ++pit;
 }