]> git.lyx.org Git - lyx.git/blobdiff - src/output_latex.cpp
Buffer: Rename function names:
[lyx.git] / src / output_latex.cpp
index 727fe4206df92ebe009ba13b5cb015f1e06a7eac..69991ffa2f7519189557946c195c15afd500c92b 100644 (file)
@@ -27,7 +27,7 @@
 #include "VSpace.h"
 
 #include "insets/InsetBibitem.h"
-#include "insets/InsetOptArg.h"
+#include "insets/InsetArgument.h"
 
 #include "support/lassert.h"
 #include "support/debug.h"
@@ -284,18 +284,18 @@ int latexArgInsets(Paragraph const & par, odocstream & os,
        unsigned int optargs)
 {
        unsigned int totalargs = reqargs + optargs;
-       list<InsetOptArg const *> ilist;
+       list<InsetArgument const *> ilist;
 
        InsetList::const_iterator it = par.insetList().begin();
        InsetList::const_iterator end = par.insetList().end();
        for (; it != end; ++it) {
-               if (it->inset->lyxCode() == OPTARG_CODE) {
+               if (it->inset->lyxCode() == ARG_CODE) {
                        if (ilist.size() >= totalargs) {
                                LYXERR0("WARNING: Found extra argument inset.");
                                continue;
                        }
-                       InsetOptArg const * ins =
-                               static_cast<InsetOptArg const *>(it->inset);
+                       InsetArgument const * ins =
+                               static_cast<InsetArgument const *>(it->inset);
                        ilist.push_back(ins);
                }
        }
@@ -308,7 +308,7 @@ int latexArgInsets(Paragraph const & par, odocstream & os,
        if (have_optional_args) {
                unsigned int todo = ilist.size() - reqargs;
                for (unsigned int i = 0; i < todo; ++i) {
-                       InsetOptArg const * ins = ilist.front();
+                       InsetArgument const * ins = ilist.front();
                        ilist.pop_front();
                        lines += ins->latexArgument(os, runparams, true);
                }
@@ -325,7 +325,7 @@ int latexArgInsets(Paragraph const & par, odocstream & os,
                        // a required argument wasn't given, so we output {}
                        os << "{}";
                else {
-                       InsetOptArg const * ins = ilist.front();
+                       InsetArgument const * ins = ilist.front();
                        ilist.pop_front();
                        lines += ins->latexArgument(os, runparams, false);
                }
@@ -345,14 +345,22 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf,
 {
        LYXERR(Debug::LATEX, "TeXOnePar...     " << &*pit << " '"
                << everypar << "'");
+
        BufferParams const & bparams = buf.params();
-       ParagraphList const & paragraphs = text.paragraphs();
+       // FIXME This check should not really be needed.
+       // Perhaps we should issue an error if it is.
+       Layout const style = text.inset().forcePlainLayout() ?
+               bparams.documentClass().plainLayout() : pit->layout();
 
+       ParagraphList const & paragraphs = text.paragraphs();
        ParagraphList::const_iterator const priorpit = 
                pit == paragraphs.begin() ? pit : boost::prior(pit);
        ParagraphList::const_iterator const nextpit = 
                pit == paragraphs.end() ? pit : boost::next(pit);
 
+       if (style.inpreamble)
+               return nextpit;
+
        OutputParams runparams = runparams_in;
        runparams.isLastPar = nextpit == paragraphs.end();
 
@@ -365,7 +373,7 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf,
                open_encoding_ = none;
        }
 
-       if (runparams.verbatim) {
+       if (runparams.pass_thru) {
                int const dist = distance(paragraphs.begin(), pit);
                Font const outerfont = text.outerFont(dist);
 
@@ -375,16 +383,11 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf,
                        texrow.newline();
                }
 
-               /*bool need_par = */ pit->latex(bparams, outerfont,
-                       os, texrow, runparams, start_pos, end_pos);
+               pit->latex(bparams, outerfont, os, texrow,
+                          runparams, start_pos, end_pos);
                return nextpit;
        }
 
-       // FIXME This check should not really be needed.
-       // Perhaps we should issue an error if it is.
-       Layout const style = text.inset().forcePlainLayout() ?
-               bparams.documentClass().plainLayout() : pit->layout();
-
        // This paragraph's language
        Language const * const par_language = pit->getParLanguage(bparams);
        // The document's language
@@ -605,8 +608,8 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf,
 
        // FIXME UNICODE
        os << from_utf8(everypar);
-       bool need_par = pit->latex(bparams, outerfont,
-                                            os, texrow, runparams, start_pos, end_pos);
+       pit->latex(bparams, outerfont, os, texrow,
+                                                runparams, start_pos, end_pos);
 
        // Make sure that \\par is done with the font of the last
        // character if this has another size as the default.
@@ -627,11 +630,8 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf,
        if (style.resfont.size() != font.fontInfo().size()
            && nextpit != paragraphs.end()
            && !is_command) {
-               if (!need_par)
-                       os << '{';
+               os << '{';
                os << "\\" << from_ascii(font.latexSize()) << " \\par}";
-       } else if (need_par) {
-               os << "\\par}";
        } else if (is_command) {
                os << '}';
                if (runparams.encoding != prev_encoding) {