]> git.lyx.org Git - lyx.git/blobdiff - src/output_plaintext.cpp
Translations for listings insets
[lyx.git] / src / output_plaintext.cpp
index 452b4c10d834f4fc792cec6bfaa87bb53df0de27..d58c44a7964f42fdc5e75e5cb75451c1e0aa609c 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -14,8 +14,6 @@
 
 #include "Buffer.h"
 #include "BufferParams.h"
-#include "support/debug.h"
-#include "support/gettext.h"
 #include "Layout.h"
 #include "output.h"
 #include "OutputParams.h"
@@ -23,6 +21,8 @@
 #include "ParagraphList.h"
 #include "ParagraphParameters.h"
 
+#include "support/debug.h"
+#include "support/gettext.h"
 #include "support/lstrings.h"
 
 using namespace std;
@@ -34,9 +34,14 @@ namespace lyx {
 void writePlaintextFile(Buffer const & buf, FileName const & fname,
        OutputParams const & runparams)
 {
-       odocfstream ofs;
+       ofdocstream ofs;
        if (!openFileWrite(ofs, fname))
                return;
+
+       // make sure we are ready to export
+       buf.updateBuffer();
+       buf.updateMacroInstances(OutputUpdate);
+
        writePlaintextFile(buf, ofs, runparams);
 }
 
@@ -45,7 +50,7 @@ void writePlaintextFile(Buffer const & buf, odocstream & os,
        OutputParams const & runparams)
 {
        bool ref_printed = false;
-       ParagraphList const par = buf.paragraphs();
+       ParagraphList const par = buf.paragraphs();
        ParagraphList::const_iterator beg = par.begin();
        ParagraphList::const_iterator end = par.end();
        ParagraphList::const_iterator it = beg;
@@ -58,9 +63,7 @@ void writePlaintextFile(Buffer const & buf, odocstream & os,
 }
 
 
-namespace {
-
-pair<int, docstring> const addDepth(int depth, int ldepth)
+static pair<int, docstring> addDepth(int depth, int ldepth)
 {
        int d = depth * 2;
        if (ldepth > depth)
@@ -68,9 +71,6 @@ pair<int, docstring> const addDepth(int depth, int ldepth)
        return make_pair(d, docstring(d, ' '));
 }
 
-}
-
-
 void writePlaintextParagraph(Buffer const & buf,
                    Paragraph const & par,
                    odocstream & os,
@@ -82,7 +82,7 @@ void writePlaintextParagraph(Buffer const & buf,
        depth_type depth = par.params().depth();
 
        // First write the layout
-       string const tmp = to_utf8(par.layout()->name());
+       string const tmp = to_utf8(par.layout().name());
        if (compare_ascii_no_case(tmp, "itemize") == 0) {
                ltype = 1;
                ltype_depth = depth + 1;
@@ -200,7 +200,7 @@ void writePlaintextParagraph(Buffer const & buf,
                if (par.isInset(i)) {
                        OutputParams rp = runparams;
                        rp.depth = par.params().depth();
-                       int len = par.getInset(i)->plaintext(buf, os, rp);
+                       int len = par.getInset(i)->plaintext(os, rp);
                        if (len >= Inset::PLAINTEXT_NEWLINE)
                                currlinelen = len - Inset::PLAINTEXT_NEWLINE;
                        else
@@ -215,7 +215,7 @@ void writePlaintextParagraph(Buffer const & buf,
                        break;
 
                case '\0':
-                       LYXERR(Debug::INFO, "writePlaintextFile: NULL char in structure.");
+                       LYXERR(Debug::INFO, "writePlaintextFile: NUL char in structure.");
                        break;
 
                default: