]> git.lyx.org Git - lyx.git/blobdiff - src/output_plaintext.cpp
* src/LyXRC.{cpp,h}:
[lyx.git] / src / output_plaintext.cpp
index 0bbd74885685359a3cad599da71fe6ff076063cb..7f37f8d70c0deea41a000780cb231ff0e4733f19 100644 (file)
@@ -16,6 +16,7 @@
 #include "BufferParams.h"
 #include "debug.h"
 #include "gettext.h"
+#include "Layout.h"
 #include "output.h"
 #include "OutputParams.h"
 #include "Paragraph.h"
@@ -89,7 +90,7 @@ void writePlaintextParagraph(Buffer const & buf,
        depth_type depth = par.params().depth();
 
        // First write the layout
-       string const & tmp = 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;
@@ -142,10 +143,10 @@ void writePlaintextParagraph(Buffer const & buf,
 
        case 6: // Abstract
                if (runparams.linelen > 0) {
-                       os << _("Abstract") << "\n\n";
+                       os << buf.B_("Abstract") << "\n\n";
                        currlinelen = 0;
                } else {
-                       docstring const abst = _("Abstract: ");
+                       docstring const abst = buf.B_("Abstract: ");
                        os << abst;
                        currlinelen += abst.length();
                }
@@ -154,10 +155,10 @@ void writePlaintextParagraph(Buffer const & buf,
        case 7: // Bibliography
                if (!ref_printed) {
                        if (runparams.linelen > 0) {
-                               os << _("References") << "\n\n";
+                               os << buf.B_("References") << "\n\n";
                                currlinelen = 0;
                        } else {
-                               docstring const refs = _("References: ");
+                               docstring const refs = buf.B_("References: ");
                                os << refs;
                                currlinelen += refs.length();
                        }
@@ -191,7 +192,7 @@ void writePlaintextParagraph(Buffer const & buf,
 
                char_type c = par.getUChar(buf.params(), i);
 
-               if (c == Paragraph::META_INSET || c == ' ') {
+               if (par.isInset(i) || c == ' ') {
                        if (runparams.linelen > 0 &&
                            currlinelen + word.length() > runparams.linelen) {
                                os << '\n';
@@ -204,18 +205,18 @@ void writePlaintextParagraph(Buffer const & buf,
                        word.erase();
                }
 
-               switch (c) {
-               case Paragraph::META_INSET: {
+               if (par.isInset(i)) {
                        OutputParams rp = runparams;
                        rp.depth = par.params().depth();
                        int len = par.getInset(i)->plaintext(buf, os, rp);
-                       if (len >= InsetBase::PLAINTEXT_NEWLINE)
-                               currlinelen = len - InsetBase::PLAINTEXT_NEWLINE;
+                       if (len >= Inset::PLAINTEXT_NEWLINE)
+                               currlinelen = len - Inset::PLAINTEXT_NEWLINE;
                        else
                                currlinelen += len;
-                       break;
+                       continue;
                }
 
+               switch (c) {
                case ' ':
                        os << ' ';
                        currlinelen++;