X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Foutput_plaintext.cpp;h=97e3ab11270c5fab649507d74e8ae2a679c32a88;hb=d2e8e53bb1db324cf790c049af0c392a9def98c5;hp=eb11c576600a1bfa558f709c2cc7f6b79375f32e;hpb=974f44ea79acb58808f45e9a417e651b764de2ba;p=lyx.git diff --git a/src/output_plaintext.cpp b/src/output_plaintext.cpp index eb11c57660..97e3ab1127 100644 --- a/src/output_plaintext.cpp +++ b/src/output_plaintext.cpp @@ -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,26 +21,20 @@ #include "ParagraphList.h" #include "ParagraphParameters.h" +#include "support/debug.h" +#include "support/gettext.h" #include "support/lstrings.h" +using namespace std; +using namespace lyx::support; namespace lyx { -using support::ascii_lowercase; -using support::compare_ascii_no_case; -using support::contains; -using support::FileName; - -using std::endl; -using std::ostream; -using std::pair; -using std::string; - void writePlaintextFile(Buffer const & buf, FileName const & fname, OutputParams const & runparams) { - odocfstream ofs("UTF-8"); + ofdocstream ofs; if (!openFileWrite(ofs, fname)) return; writePlaintextFile(buf, ofs, runparams); @@ -53,7 +45,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; @@ -66,9 +58,7 @@ void writePlaintextFile(Buffer const & buf, odocstream & os, } -namespace { - -pair const addDepth(int depth, int ldepth) +static pair addDepth(int depth, int ldepth) { int d = depth * 2; if (ldepth > depth) @@ -76,9 +66,6 @@ pair const addDepth(int depth, int ldepth) return make_pair(d, docstring(d, ' ')); } -} - - void writePlaintextParagraph(Buffer const & buf, Paragraph const & par, odocstream & os, @@ -90,7 +77,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; @@ -208,7 +195,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 @@ -223,7 +210,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: