]> git.lyx.org Git - features.git/commitdiff
Use UTF8 for LaTeX export.
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Thu, 19 Oct 2006 16:51:30 +0000 (16:51 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Thu, 19 Oct 2006 16:51:30 +0000 (16:51 +0000)
Known problems:
- No space is output after a \hfill. I probably broke this with the
  InsetCommand patch. I'll have a look later.
- Although the encoding is now UTF8 the arguments of the inputenc package
  are still the old ones, so LaTeX will not run.
- Labels and references with non-ASCII characters are broken. This needs to
  be fixed in lyx::support::escape(), but this is a file format change.
- Something seems to be wrong with index entries, but this is probably also
  due to the InsetCommand changes.

Have fun!

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15378 a592a061-630c-0410-9148-cb99ea01b6c8

124 files changed:
src/buffer.C
src/buffer.h
src/bufferparams.C
src/bufferparams.h
src/changes.C
src/changes.h
src/cursor.C
src/frontends/controllers/ControlViewSource.C
src/frontends/controllers/ControlViewSource.h
src/graphics/PreviewLoader.C
src/insets/ExternalSupport.C
src/insets/ExternalSupport.h
src/insets/insetbase.C
src/insets/insetbase.h
src/insets/insetbibitem.C
src/insets/insetbibtex.C
src/insets/insetbibtex.h
src/insets/insetbox.C
src/insets/insetbox.h
src/insets/insetbranch.C
src/insets/insetbranch.h
src/insets/insetcaption.C
src/insets/insetcaption.h
src/insets/insetcharstyle.C
src/insets/insetcharstyle.h
src/insets/insetcite.C
src/insets/insetcite.h
src/insets/insetcommand.C
src/insets/insetcommand.h
src/insets/insetcommandparams.C
src/insets/insetcommandparams.h
src/insets/insetenv.C
src/insets/insetenv.h
src/insets/insetert.C
src/insets/insetert.h
src/insets/insetexternal.C
src/insets/insetexternal.h
src/insets/insetfloat.C
src/insets/insetfloat.h
src/insets/insetfloatlist.C
src/insets/insetfloatlist.h
src/insets/insetfoot.C
src/insets/insetfoot.h
src/insets/insetgraphics.C
src/insets/insetgraphics.h
src/insets/insethfill.C
src/insets/insethfill.h
src/insets/insetinclude.C
src/insets/insetinclude.h
src/insets/insetlabel.C
src/insets/insetlabel.h
src/insets/insetlatexaccent.C
src/insets/insetlatexaccent.h
src/insets/insetline.C
src/insets/insetline.h
src/insets/insetmarginal.C
src/insets/insetmarginal.h
src/insets/insetnewline.C
src/insets/insetnewline.h
src/insets/insetnote.C
src/insets/insetnote.h
src/insets/insetoptarg.C
src/insets/insetoptarg.h
src/insets/insetpagebreak.C
src/insets/insetpagebreak.h
src/insets/insetquotes.C
src/insets/insetquotes.h
src/insets/insetref.C
src/insets/insetref.h
src/insets/insetspace.C
src/insets/insetspace.h
src/insets/insetspecialchar.C
src/insets/insetspecialchar.h
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/insets/insettheorem.C
src/insets/insettheorem.h
src/insets/insettoc.C
src/insets/inseturl.C
src/insets/inseturl.h
src/insets/insetvspace.C
src/insets/insetvspace.h
src/insets/insetwrap.C
src/insets/insetwrap.h
src/insets/render_preview.C
src/insets/render_preview.h
src/lyxfont.C
src/lyxfont.h
src/mathed/InsetFormulaMacro.C
src/mathed/InsetFormulaMacro.h
src/mathed/InsetMath.C
src/mathed/InsetMath.h
src/mathed/InsetMathCommand.C
src/mathed/InsetMathGrid.C
src/mathed/InsetMathHull.C
src/mathed/InsetMathMBox.C
src/mathed/InsetMathMBox.h
src/mathed/InsetMathNest.C
src/mathed/InsetMathNest.h
src/mathed/MathData.C
src/mathed/MathData.h
src/mathed/MathExtern.C
src/mathed/MathExtern.h
src/mathed/MathMLStream.C
src/mathed/MathMLStream.h
src/mathed/MathMacroTemplate.C
src/mathed/MathStream.C
src/mathed/MathSupport.C
src/mathed/TextPainter.C
src/mathed/TextPainter.h
src/output_latex.C
src/output_latex.h
src/paragraph.C
src/paragraph.h
src/paragraph_pimpl.C
src/paragraph_pimpl.h
src/rowpainter.C
src/support/lstrings.C
src/support/lstrings.h
src/support/unicode.C
src/tabular.C
src/tabular.h

index b14f3be740a917c1f783edc7ac25bd728190d7e0..efcb980715f464e46489dfb0f7454083d031ee7f 100644 (file)
@@ -94,6 +94,7 @@ namespace io = boost::iostreams;
 
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::pos_type;
 using lyx::pit_type;
 
@@ -824,7 +825,10 @@ void Buffer::makeLaTeXFile(string const & fname,
 {
        lyxerr[Debug::LATEX] << "makeLaTeXFile..." << endl;
 
-       ofstream ofs;
+       // FIXME UNICODE
+       // This creates an utf8 encoded file, but the inputenc commands
+       // specify other encodings
+       lyx::odocfstream ofs;
        if (!openFileWrite(ofs, fname))
                return;
 
@@ -837,7 +841,7 @@ void Buffer::makeLaTeXFile(string const & fname,
 }
 
 
-void Buffer::writeLaTeXSource(ostream & os,
+void Buffer::writeLaTeXSource(odocstream & os,
                           string const & original_path,
                           OutputParams const & runparams_in,
                           bool const output_preamble, bool const output_body)
@@ -883,11 +887,13 @@ void Buffer::writeLaTeXSource(ostream & os,
                        texrow().newline();
                }
                if (!original_path.empty()) {
-                       string const inputpath = latex_path(original_path);
+                       // FIXME UNICODE
+                       // We don't know the encoding of inputpath
+                       docstring const inputpath = lyx::from_utf8(latex_path(original_path));
                        os << "\\makeatletter\n"
-                           << "\\def\\input@path{{"
-                           << inputpath << "/}}\n"
-                           << "\\makeatother\n";
+                          << "\\def\\input@path{{"
+                          << inputpath << "/}}\n"
+                          << "\\makeatother\n";
                        texrow().newline();
                        texrow().newline();
                        texrow().newline();
@@ -906,9 +912,11 @@ void Buffer::writeLaTeXSource(ostream & os,
        lyxerr[Debug::INFO] << "preamble finished, now the body." << endl;
 
        if (!lyxrc.language_auto_begin) {
-               os << subst(lyxrc.language_command_begin, "$$lang",
-                            params().language->babel())
-                   << endl;
+               // FIXME UNICODE
+               os << lyx::from_utf8(subst(lyxrc.language_command_begin,
+                                          "$$lang",
+                                          params().language->babel()))
+                  << '\n';
                texrow().newline();
        }
 
@@ -933,9 +941,10 @@ void Buffer::writeLaTeXSource(ostream & os,
        texrow().newline();
 
        if (!lyxrc.language_auto_end) {
-               os << subst(lyxrc.language_command_end, "$$lang",
-                            params().language->babel())
-                   << endl;
+               os << lyx::from_utf8(subst(lyxrc.language_command_end,
+                                          "$$lang",
+                                          params().language->babel()))
+                  << '\n';
                texrow().newline();
        }
 
@@ -1590,7 +1599,7 @@ void Buffer::changeRefsIfUnique(string const & from, string const & to, InsetBas
 }
 
 
-void Buffer::getSourceCode(ostream & os, lyx::pit_type par_begin, lyx::pit_type par_end, bool full_source)
+void Buffer::getSourceCode(odocstream & os, lyx::pit_type par_begin, lyx::pit_type par_end, bool full_source)
 {
        OutputParams runparams;
        runparams.nice = true;
@@ -1603,8 +1612,12 @@ void Buffer::getSourceCode(ostream & os, lyx::pit_type par_begin, lyx::pit_type
                os << "% Preview source code\n\n";
                if (isLatex())
                        writeLaTeXSource(os, filePath(), runparams, true, true);
-               else
-                       writeDocBookSource(os, fileName(), runparams, false);
+               else {
+                       // FIXME UNICODE
+                       ostringstream oss;
+                       writeDocBookSource(oss, fileName(), runparams, false);
+                       os << lyx::from_utf8(oss.str());
+               }
        } else {
                runparams.par_begin = par_begin;
                runparams.par_end = par_end;
@@ -1616,8 +1629,13 @@ void Buffer::getSourceCode(ostream & os, lyx::pit_type par_begin, lyx::pit_type
                if (isLatex()) {
                        texrow().reset();
                        latexParagraphs(*this, paragraphs(), os, texrow(), runparams);
-               } else // DocBook
-                       docbookParagraphs(paragraphs(), *this, os, runparams);
+               } else {
+                       // DocBook
+                       // FIXME UNICODE
+                       ostringstream oss;
+                       docbookParagraphs(paragraphs(), *this, oss, runparams);
+                       os << lyx::from_utf8(oss.str());
+               }
        }
 }
 
index 301622f9d26ee1332974097b3a2234e361e642f3..bbb28b15c210aca72a8846b567d7096ee1c48d8d 100644 (file)
@@ -146,7 +146,7 @@ public:
                           bool output_preamble = true,
                           bool output_body = true);
        ///
-       void writeLaTeXSource(std::ostream & os,
+       void writeLaTeXSource(lyx::odocstream & os,
                           std::string const & original_path,
                           OutputParams const &,
                           bool output_preamble = true,
@@ -339,7 +339,7 @@ public:
        void changeRefsIfUnique(std::string const & from, std::string const & to, InsetBase::Code code);
        /// get source code (latex/docbook) for some paragraphs, or all paragraphs
        /// including preamble
-       void getSourceCode(std::ostream & os, lyx::pit_type par_begin, lyx::pit_type par_end, bool full_source);
+       void getSourceCode(lyx::odocstream & os, lyx::pit_type par_begin, lyx::pit_type par_end, bool full_source);
 
        /// errorLists_ accessors.
        //@{
index d45bbe0c0d4cf770b340a642bb89358c1dd141eb..fa34a76207548fe7ca539e0cae379ca141807d82 100644 (file)
@@ -49,6 +49,7 @@
 namespace support = lyx::support;
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::support::bformat;
 using lyx::support::rtrim;
 using lyx::support::tokenPos;
@@ -714,7 +715,7 @@ void BufferParams::writeFile(ostream & os) const
 }
 
 
-bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
+bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
                              TexRow & texrow) const
 {
        os << "\\documentclass";
@@ -811,10 +812,11 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
        string strOptions(clsoptions.str());
        if (!strOptions.empty()) {
                strOptions = rtrim(strOptions, ",");
-               os << '[' << strOptions << ']';
+               // FIXME UNICODE
+               os << '[' << lyx::from_utf8(strOptions) << ']';
        }
 
-       os << '{' << tclass.latexname() << "}\n";
+       os << '{' << lyx::from_ascii(tclass.latexname()) << "}\n";
        texrow.newline();
        // end of \documentclass defs
 
@@ -824,15 +826,15 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
                          fontsTypewriter, fontsSC, fontsOSF,
                          fontsSansScale, fontsTypewriterScale);
        if (!fonts.empty()) {
-               os << fonts;
+               os << lyx::from_ascii(fonts);
                texrow.newline();
        }
        if (fontsDefaultFamily != "default")
                os << "\\renewcommand{\\familydefault}{\\"
-                  << fontsDefaultFamily << "}\n";
+                  << lyx::from_ascii(fontsDefaultFamily) << "}\n";
        // this one is not per buffer
        if (lyxrc.fontenc != "default") {
-               os << "\\usepackage[" << lyxrc.fontenc
+               os << "\\usepackage[" << lyx::from_ascii(lyxrc.fontenc)
                   << "]{fontenc}\n";
                texrow.newline();
        }
@@ -847,12 +849,14 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
                        features.getEncodingSet(doc_encoding);
 
                os << "\\usepackage[";
-               std::copy(encodings.begin(), encodings.end(),
-                         std::ostream_iterator<string>(os, ","));
-               os << doc_encoding << "]{inputenc}\n";
+               std::set<string>::const_iterator it = encodings.begin();
+               std::set<string>::const_iterator const end = encodings.end();
+               for (; it != end; ++it)
+                       os << lyx::from_ascii(*it) << ',';
+               os << lyx::from_ascii(doc_encoding) << "]{inputenc}\n";
                texrow.newline();
        } else if (inputenc != "default") {
-               os << "\\usepackage[" << inputenc
+               os << "\\usepackage[" << lyx::from_ascii(inputenc)
                   << "]{inputenc}\n";
                texrow.newline();
        }
@@ -867,10 +871,10 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
                case PAPER_CUSTOM:
                        if (!paperwidth.empty())
                                os << ",paperwidth="
-                                  << paperwidth;
+                                  << lyx::from_ascii(paperwidth);
                        if (!paperheight.empty())
                                os << ",paperheight="
-                                  << paperheight;
+                                  << lyx::from_ascii(paperheight);
                        break;
                case PAPER_USLETTER:
                        os << ",letterpaper";
@@ -931,19 +935,19 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
                        }
                }
                if (!topmargin.empty())
-                       os << ",tmargin=" << topmargin;
+                       os << ",tmargin=" << lyx::from_ascii(topmargin);
                if (!bottommargin.empty())
-                       os << ",bmargin=" << bottommargin;
+                       os << ",bmargin=" << lyx::from_ascii(bottommargin);
                if (!leftmargin.empty())
-                       os << ",lmargin=" << leftmargin;
+                       os << ",lmargin=" << lyx::from_ascii(leftmargin);
                if (!rightmargin.empty())
-                       os << ",rmargin=" << rightmargin;
+                       os << ",rmargin=" << lyx::from_ascii(rightmargin);
                if (!headheight.empty())
-                       os << ",headheight=" << headheight;
+                       os << ",headheight=" << lyx::from_ascii(headheight);
                if (!headsep.empty())
-                       os << ",headsep=" << headsep;
+                       os << ",headsep=" << lyx::from_ascii(headsep);
                if (!footskip.empty())
-                       os << ",footskip=" << footskip;
+                       os << ",footskip=" << lyx::from_ascii(footskip);
                os << "}\n";
                texrow.newline();
        }
@@ -954,7 +958,7 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
                        os << "\\usepackage{fancyhdr}\n";
                        texrow.newline();
                }
-               os << "\\pagestyle{" << pagestyle << "}\n";
+               os << "\\pagestyle{" << lyx::from_ascii(pagestyle) << "}\n";
                texrow.newline();
        }
 
@@ -987,7 +991,7 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
                        break;
                case VSpace::LENGTH:
                        os << "\\setlength\\parskip{"
-                          << getDefSkip().length().asLatexString()
+                          << lyx::from_ascii(getDefSkip().length().asLatexString())
                           << "}\n";
                        break;
                default: // should never happen // Then delete it.
@@ -1002,9 +1006,9 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
 
        // If we use jurabib, we have to call babel here.
        if (use_babel && features.isRequired("jurabib")) {
-               os << babelCall(language_options.str())
+               os << lyx::from_ascii(babelCall(language_options.str()))
                   << '\n'
-                  << features.getBabelOptions();
+                  << lyx::from_ascii(features.getBabelOptions());
                texrow.newline();
        }
 
@@ -1101,7 +1105,8 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
                texrow.newline();
        }
 
-       os << lyxpreamble;
+       // FIXME UNICODE
+       os << lyx::from_utf8(lyxpreamble);
        return use_babel;
 }
 
index 3ea4bc7cf86e6bff8cf873eb71a9a233e6d32c9e..45e29a8540fb0c05495060d1b99b531edf3e6274 100644 (file)
@@ -86,7 +86,7 @@ public:
         *  the BufferParams and a LyXRC variable).
         *  This returned value can then be passed to the insets...
         */
-       bool writeLaTeX(std::ostream &, LaTeXFeatures &, TexRow &) const;
+       bool writeLaTeX(lyx::odocstream &, LaTeXFeatures &, TexRow &) const;
 
        ///
        void useClassDefaults();
index 3f688d827d476b16423ca1c28fd7a014857a630a..0f45939dc029367e6aac5c5fbd631fb908278a59 100644 (file)
@@ -17,6 +17,8 @@
 
 #include <boost/assert.hpp>
 
+using lyx::docstring;
+using lyx::odocstream;
 using lyx::pos_type;
 
 using std::endl;
@@ -450,17 +452,17 @@ void Changes::check() const
 }
 
 
-int Changes::latexMarkChange(std::ostream & os,
+int Changes::latexMarkChange(odocstream & os,
                             Change::Type const old, Change::Type const change,
                             bool const & output)
 {
        if (!output || old == change)
                return 0;
 
-       string const start("\\changestart{}");
-       string const end("\\changeend{}");
-       string const son("\\overstrikeon{}");
-       string const soff("\\overstrikeoff{}");
+       static docstring const start(lyx::from_ascii("\\changestart{}"));
+       static docstring const end(lyx::from_ascii("\\changeend{}"));
+       static docstring const son(lyx::from_ascii("\\overstrikeon{}"));
+       static docstring const soff(lyx::from_ascii("\\overstrikeoff{}"));
 
        int column = 0;
 
index 9ef77e03c769426730b70f31c951dd28dcb34eec..75c83e3c442a443c1e0a8cbc0f4032600914a2c2 100644 (file)
 #ifndef CHANGES_H
 #define CHANGES_H
 
-#include "support/types.h"
+#include "support/docstream.h"
 #include "support/lyxtime.h"
 
 #include <vector>
-#include <iosfwd>
 
 
 class Change {
@@ -84,7 +83,7 @@ public:
 
        /// output latex to mark a transition between two changetypes
        /// returns length of text outputted
-       static int latexMarkChange(std::ostream & os, Change::Type old,
+       static int latexMarkChange(lyx::odocstream & os, Change::Type old,
                Change::Type change, bool const & output);
 
        /// output .lyx file format for transitions between changes
index 8bf0a5788bcc8c8b9785754d874667535dcfe4f0..d37ff98a7276495e047c7a4860109a180fb50101 100644 (file)
@@ -970,9 +970,10 @@ void LCursor::normalize()
                lyxerr << "this should not really happen - 2: "
                        << pos() << ' ' << lastpos() <<  " in idx: " << idx()
                       << " in atom: '";
-               WriteStream wi(lyxerr, false, true);
+               lyx::odocstringstream os;
+               WriteStream wi(os, false, true);
                inset().asInsetMath()->write(wi);
-               lyxerr << endl;
+               lyxerr << lyx::to_utf8(os.str()) << endl;
                pos() = lastpos();
        }
 }
index 47a7bca30f89b69e7d481c6d3fedaf5f775cc107..fc778a8c3c528908e9ca8492ddf056df5fb70053 100644 (file)
@@ -21,7 +21,6 @@
 #include <sstream>
 
 using std::string;
-using std::ostringstream;
 
 namespace lyx {
 namespace frontend {
@@ -36,7 +35,7 @@ bool ControlViewSource::initialiseParams(string const & /*source*/)
        return true;
 }
 
-string const ControlViewSource::updateContent(bool fullSource)
+docstring const ControlViewSource::updateContent(bool fullSource)
 {
        // get the *top* level paragraphs that contain the cursor,
        // or the selected text
@@ -53,7 +52,7 @@ string const ControlViewSource::updateContent(bool fullSource)
        }
        if (par_begin > par_end)
                std::swap(par_begin, par_end);
-       ostringstream ostr;
+       lyx::odocstringstream ostr;
        view->buffer()->getSourceCode(ostr, par_begin, par_end + 1, fullSource);
        return ostr.str();
 }
index 16598cfbf6e652fd40aaae5ae4ca1b7279f5a8ae..f55ca2d222a47899fbc8b8379400c64266a9f0e8 100644 (file)
@@ -42,7 +42,7 @@ public:
        /** get the source code of selected paragraphs, or the whole document
                \param fullSource get full source code
         */
-       std::string const updateContent(bool fullSource);
+       lyx::docstring const updateContent(bool fullSource);
 };
 
 } // namespace frontend
index 57d100d72233a08204caef0cff09fdb7af7edb1d..f98ae0161f53576f7186b72f4e23490b0319511b 100644 (file)
@@ -43,6 +43,8 @@
 
 namespace support = lyx::support;
 
+using lyx::odocstream;
+
 using std::endl;
 using std::find;
 using std::fill;
@@ -54,8 +56,6 @@ using boost::bind;
 using std::ifstream;
 using std::list;
 using std::map;
-using std::ofstream;
-using std::ostream;
 using std::ostringstream;
 using std::pair;
 using std::vector;
@@ -149,9 +149,9 @@ private:
        /// Called by the Forkedcall process that generated the bitmap files.
        void finishedGenerating(pid_t, int);
        ///
-       void dumpPreamble(ostream &) const;
+       void dumpPreamble(odocstream &) const;
        ///
-       void dumpData(ostream &, BitmapFile const &) const;
+       void dumpData(odocstream &, BitmapFile const &) const;
 
        /** cache_ allows easy retrieval of already-generated images
         *  using the LaTeX snippet as the identifier.
@@ -481,7 +481,10 @@ void PreviewLoader::Impl::startLoading()
        // Output the LaTeX file.
        string const latexfile = filename_base + ".tex";
 
-       ofstream of(latexfile.c_str());
+       // FIXME UNICODE
+       // This creates an utf8 encoded file, but the proper inputenc
+       // command is missing.
+       lyx::odocfstream of(latexfile.c_str());
        if (!of) {
                lyxerr[Debug::GRAPHICS] << "PreviewLoader::startLoading()\n"
                                        << "Unable to create LaTeX file\n"
@@ -582,7 +585,7 @@ void PreviewLoader::Impl::finishedGenerating(pid_t pid, int retval)
 }
 
 
-void PreviewLoader::Impl::dumpPreamble(ostream & os) const
+void PreviewLoader::Impl::dumpPreamble(odocstream & os) const
 {
        // Why on earth is Buffer::makeLaTeXFile a non-const method?
        Buffer & tmp = const_cast<Buffer &>(buffer_);
@@ -596,7 +599,7 @@ void PreviewLoader::Impl::dumpPreamble(ostream & os) const
 
        // FIXME! This is a HACK! The proper fix is to control the 'true'
        // passed to WriteStream below:
-       // int InsetFormula::latex(Buffer const &, ostream & os,
+       // int InsetFormula::latex(Buffer const &, odocstream & os,
        //                         OutputParams const & runparams) const
        // {
        //      WriteStream wi(os, runparams.moving_arg, true);
@@ -629,7 +632,7 @@ void PreviewLoader::Impl::dumpPreamble(ostream & os) const
 }
 
 
-void PreviewLoader::Impl::dumpData(ostream & os,
+void PreviewLoader::Impl::dumpData(odocstream & os,
                                   BitmapFile const & vec) const
 {
        if (vec.empty())
@@ -639,8 +642,9 @@ void PreviewLoader::Impl::dumpData(ostream & os,
        BitmapFile::const_iterator end = vec.end();
 
        for (; it != end; ++it) {
+               // FIXME UNICODE
                os << "\\begin{preview}\n"
-                  << it->first
+                  << lyx::from_utf8(it->first)
                   << "\n\\end{preview}\n\n";
        }
 }
index 7018d37db4e66076ca2dd65ff6e27f89154bed3f..5795a2d5f66f9f480bd459b4806e38bf1f8d18ea 100644 (file)
 #include "support/package.h"
 #include "support/path.h"
 
-#include "support/std_ostream.h"
-
 namespace support = lyx::support;
 
 using std::endl;
 
-using std::ostream;
 using std::string;
 using std::vector;
 
@@ -334,7 +331,7 @@ string const substituteOptions(InsetExternalParams const & params,
 
 int writeExternal(InsetExternalParams const & params,
                  string const & format,
-                 Buffer const & buffer, ostream & os,
+                 Buffer const & buffer, lyx::odocstream & os,
                  ExportData & exportdata,
                  bool external_in_tmpdir,
                  bool external_in_comment)
@@ -362,7 +359,8 @@ int writeExternal(InsetExternalParams const & params,
                                    use_latex_path, external_in_tmpdir);
        str = substituteCommands(params, str, format);
        str = substituteOptions(params, str, format);
-       os << str;
+       // FIXME UNICODE
+       os << lyx::from_utf8(str);
        return int(lyx::count(str.begin(), str.end(),'\n'));
 }
 
index e2a8d66b00f65d636ee90880bc7de6f3ed45b769..5fcbe40407048e2f56cac7807a208bfbb7378743 100644 (file)
@@ -13,8 +13,7 @@
 #ifndef EXTERNALSUPPORT_H
 #define EXTERNALSUPPORT_H
 
-#include <iosfwd>
-#include <string>
+#include "support/docstream.h"
 
 class Buffer;
 class ExportData;
@@ -63,7 +62,7 @@ std::string const doSubstitution(InsetExternalParams const & params,
 int writeExternal(InsetExternalParams const &,
                  std::string const & format,
                  Buffer const &,
-                 std::ostream &,
+                 lyx::odocstream &,
                  ExportData &,
                  bool external_in_tmpdir,
                  bool external_in_comment);
index 8fe2477d24bd7549aef552c9eb4952f99ac05311..4a9de2f6e7d3aca028bde66a028f2bdae19d1448 100644 (file)
@@ -34,6 +34,9 @@
 #include <typeinfo>
 
 
+using lyx::odocstream;
+
+
 namespace {
 
 class InsetName {
@@ -221,7 +224,7 @@ bool InsetBase::idxUpDown(LCursor &, bool) const
 
 
 int InsetBase::plaintext(Buffer const &,
-       lyx::odocstream &, OutputParams const &) const
+       odocstream &, OutputParams const &) const
 {
        return 0;
 }
index 3f99b98e6c32b31438567ae849233b9fa629ee69..4f20e9021651142050da55c8bcb51c86d83fc6a8 100644 (file)
@@ -356,7 +356,7 @@ public:
        /// read inset in .lyx format
        virtual void read(Buffer const &, LyXLex &) {}
        /// returns the number of rows (\n's) of generated tex code.
-       virtual int latex(Buffer const &, std::ostream &,
+       virtual int latex(Buffer const &, lyx::odocstream &,
                          OutputParams const &) const { return 0; }
        /// returns true to override begin and end inset in file
        virtual bool directWrite() const;
index 1a973127d1e6f771b83a0b243a11127d97b740d9..8939ff6dfa09110f7f17e34ad75f54bf1ed5cb54 100644 (file)
@@ -26,6 +26,7 @@
 #include "support/convert.h"
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::support::prefixIs;
 
 using std::max;
@@ -109,7 +110,7 @@ docstring const InsetBibitem::getScreenLabel(Buffer const &) const
 }
 
 
-int InsetBibitem::plaintext(Buffer const &, lyx::odocstream & os,
+int InsetBibitem::plaintext(Buffer const &, odocstream & os,
                            OutputParams const &) const
 {
        os << '[' << getCounter() << "] ";
index 3760f8f8af3faa62fb30a28358d5e20824bb797d..ae89a8696a654050be337474c6328503cfd59fb2 100644 (file)
@@ -37,6 +37,7 @@
 #include <sstream>
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::support::absolutePath;
 using lyx::support::ascii_lowercase;
 using lyx::support::changeExtension;
@@ -126,7 +127,7 @@ string normalize_name(Buffer const & buffer, OutputParams const & runparams,
 }
 
 
-int InsetBibtex::latex(Buffer const & buffer, ostream & os,
+int InsetBibtex::latex(Buffer const & buffer, odocstream & os,
                       OutputParams const & runparams) const
 {
        // the sequence of the commands:
@@ -234,8 +235,9 @@ int InsetBibtex::latex(Buffer const & buffer, ostream & os,
                                       << endl;
                        }
                }
+               // FIXME UNICODE
                os << "\\bibliographystyle{"
-                  << latex_path(normalize_name(buffer, runparams, base, ".bst"))
+                  << lyx::from_utf8(latex_path(normalize_name(buffer, runparams, base, ".bst")))
                   << "}\n";
                nlines += 1;
        }
@@ -244,18 +246,18 @@ int InsetBibtex::latex(Buffer const & buffer, ostream & os,
        static bool warned_about_bst_spaces = false;
        if (!warned_about_bst_spaces && runparams.nice && contains(style, ' ')) {
                warned_about_bst_spaces = true;
-               // FIXME UNICODE
                Alert::warning(_("Export Warning!"),
                               _("There are spaces in the path to your BibTeX style file.\n"
                                              "BibTeX will be unable to find it."));
        }
 
        if (!db_out.empty() && buffer.params().use_bibtopic){
-               os << "\\begin{btSect}{" << db_out << "}\n";
-               string btprint = getSecOptions();
+               // FIXME UNICODE
+               os << "\\begin{btSect}{" << lyx::from_utf8(db_out) << "}\n";
+               docstring btprint = getParam("btprint");
                if (btprint.empty())
                        // default
-                       btprint = "btPrintCited";
+                       btprint = lyx::from_ascii("btPrintCited");
                os << "\\" << btprint << "\n"
                   << "\\end{btSect}\n";
                nlines += 3;
@@ -287,7 +289,8 @@ int InsetBibtex::latex(Buffer const & buffer, ostream & os,
        }
 
        if (!db_out.empty() && !buffer.params().use_bibtopic){
-               os << "\\bibliography{" << db_out << "}\n";
+               // FIXME UNICODE
+               os << "\\bibliography{" << lyx::from_utf8(db_out) << "}\n";
                nlines += 1;
        }
 
index 09ba9816f806a162f26b54d6de5e8beb6bd7e897..78e2d7b41e22dc95aa258aefb34648e086b3686a 100644 (file)
@@ -31,7 +31,7 @@ public:
        ///
        bool display() const { return true; }
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        void fillWithBibKeys(Buffer const & buffer,
index c87311d5e0cc90b1c6b010a16d0def60e4b719bd..88a4716cf67e07265fc9e1d5fd466d8b453c827f 100644 (file)
@@ -31,6 +31,7 @@
 #include <sstream>
 
 using lyx::docstring;
+using lyx::odocstream;
 
 using std::auto_ptr;
 using std::string;
@@ -245,7 +246,7 @@ bool InsetBox::getStatus(LCursor & cur, FuncRequest const & cmd,
 }
 
 
-int InsetBox::latex(Buffer const & buf, ostream & os,
+int InsetBox::latex(Buffer const & buf, odocstream & os,
                                OutputParams const & runparams) const
 {
        BoxType btype = boxtranslator().find(params_.type);
@@ -292,11 +293,14 @@ int InsetBox::latex(Buffer const & buf, ostream & os,
                if (!params_.inner_box) {
                        os << "{\\makebox";
                        // Special widths, see usrguide §3.5
+                       // FIXME UNICODE
                        if (params_.special != "none") {
                                os << "[" << params_.width.value()
-                                  << "\\" << params_.special << "]";
+                                  << '\\' << lyx::from_utf8(params_.special)
+                                  << ']';
                        } else
-                               os << "[" << width_string << "]";
+                               os << '[' << lyx::from_ascii(width_string)
+                                  << ']';
                        if (params_.hor_pos != 'c')
                                os << "[" << params_.hor_pos << "]";
                }
@@ -325,16 +329,21 @@ int InsetBox::latex(Buffer const & buf, ostream & os,
 
                os << "[" << params_.pos << "]";
                if (params_.height_special == "none") {
-                       os << "[" << params_.height.asLatexString() << "]";
+                       // FIXME UNICODE
+                       os << '[' << lyx::from_ascii(params_.height.asLatexString())
+                          << ']';
                } else {
                        // Special heights
+                       // FIXME UNICODE
                        os << "[" << params_.height.value()
-                          << "\\" << params_.height_special << "]";
+                          << '\\' << lyx::from_utf8(params_.height_special)
+                          << ']';
                }
                if (params_.inner_pos != params_.pos)
                        os << "[" << params_.inner_pos << "]";
 
-               os << "{" << width_string << "}";
+               // FIXME UNICODE
+               os << '{' << lyx::from_ascii(width_string) << '}';
 
                if (params_.use_parbox)
                        os << "{";
@@ -381,7 +390,7 @@ int InsetBox::docbook(Buffer const & buf, std::ostream & os,
 }
 
 
-int InsetBox::plaintext(Buffer const & buf, lyx::odocstream & os,
+int InsetBox::plaintext(Buffer const & buf, odocstream & os,
                    OutputParams const & runparams) const
 {
        BoxType const btype = boxtranslator().find(params_.type);
index c3ff251896ca9be5f75a06c1fef8f4ab23015ba4..f3c77eacf41f0fba657a8dfc47a49a527a97ffe2 100644 (file)
@@ -82,7 +82,7 @@ public:
        ///
        bool noFontChange() const { return true; }
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                        OutputParams const &) const;
        ///
        int docbook(Buffer const &, std::ostream &,
index fd3932db6483b84602ce43cbe2bec146a5a69ea4..e215b444e80c194d80100f97c407268fdaf7ecbe 100644 (file)
@@ -27,6 +27,7 @@
 #include <sstream>
 
 using lyx::docstring;
+using lyx::odocstream;
 
 using std::string;
 using std::auto_ptr;
@@ -220,7 +221,7 @@ bool InsetBranch::isBranchSelected(Buffer const & buffer) const
 }
 
 
-int InsetBranch::latex(Buffer const & buf, ostream & os,
+int InsetBranch::latex(Buffer const & buf, odocstream & os,
                       OutputParams const & runparams) const
 {
        return isBranchSelected(buf) ?
@@ -236,7 +237,7 @@ int InsetBranch::docbook(Buffer const & buf, std::ostream & os,
 }
 
 
-int InsetBranch::plaintext(Buffer const & buf, lyx::odocstream & os,
+int InsetBranch::plaintext(Buffer const & buf, odocstream & os,
                           OutputParams const & runparams) const
 {
        return isBranchSelected(buf) ?
index 65e2310fb6938f47c3902cb8f56392572d4590c9..c811790ccf2facf2f326308d5b70ef187c8f16a4 100644 (file)
@@ -53,7 +53,7 @@ public:
        ///
        bool showInsetDialog(BufferView *) const;
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                        OutputParams const &) const;
        ///
        int docbook(Buffer const &, std::ostream &,
index bf4c5c976e252efef95b81fffe2e950c4bcd0db5..791e4566a4c5a1e7417e767bd289b2ee8af0a392 100644 (file)
 #include <sstream>
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::support::bformat;
 
 using std::auto_ptr;
 using std::endl;
 using std::string;
 using std::ostream;
-using std::ostringstream;
 
 
 InsetCaption::InsetCaption(BufferParams const & bp)
@@ -176,7 +176,7 @@ InsetBase * InsetCaption::editXY(LCursor & cur, int x, int y)
 }
 
 
-int InsetCaption::latex(Buffer const & buf, ostream & os,
+int InsetCaption::latex(Buffer const & buf, odocstream & os,
                        OutputParams const & runparams) const
 {
        // This is a bit too simplistic to take advantage of
@@ -184,14 +184,14 @@ int InsetCaption::latex(Buffer const & buf, ostream & os,
        // This code is currently only able to handle the simple
        // \caption{...}, later we will make it take advantage
        // of the one of the caption packages. (Lgb)
-       ostringstream ost;
+       lyx::odocstringstream ost;
        int const l = InsetText::latex(buf, ost, runparams);
        os << "\\caption{" << ost.str() << "}\n";
        return l + 1;
 }
 
 
-int InsetCaption::plaintext(Buffer const & /*buf*/, lyx::odocstream & /*os*/,
+int InsetCaption::plaintext(Buffer const & /*buf*/, odocstream & /*os*/,
                        OutputParams const & /*runparams*/) const
 {
        // FIXME: Implement me!
index ab6d9711556321c4841d68c61222ff726cf8cca5..ed4607d235be962d3d935dc75266648519f3ecde 100644 (file)
@@ -48,7 +48,7 @@ public:
        ///
        virtual InsetBase * editXY(LCursor & cur, int x, int y);
        ///
-       virtual int latex(Buffer const & buf, std::ostream & os,
+       virtual int latex(Buffer const & buf, lyx::odocstream & os,
                          OutputParams const &) const;
        ///
        int plaintext(Buffer const & buf, lyx::odocstream & os,
index c187b4f4e9e4cbd5345b1b304ce3f99422fa8a8d..1f5a0520b16c215703c5f74d161dfc11bdb912e4 100644 (file)
@@ -39,6 +39,7 @@
 #include <sstream>
 
 using lyx::docstring;
+using lyx::odocstream;
 
 using std::string;
 using std::auto_ptr;
@@ -282,14 +283,15 @@ bool InsetCharStyle::getStatus(LCursor & cur, FuncRequest const & cmd,
 }
 
 
-int InsetCharStyle::latex(Buffer const & buf, ostream & os,
+int InsetCharStyle::latex(Buffer const & buf, odocstream & os,
                     OutputParams const & runparams) const
 {
        if (!undefined()) {
-               os << "\\" << params_.latexname;
+               // FIXME UNICODE
+               os << '\\' << lyx::from_utf8(params_.latexname);
                if (!params_.latexparam.empty())
-                       os << params_.latexparam;
-               os << "{";
+                       os << lyx::from_utf8(params_.latexparam);
+               os << '{';
        }
        int i = InsetText::latex(buf, os, runparams);
        if (!undefined())
@@ -322,14 +324,14 @@ int InsetCharStyle::docbook(Buffer const & buf, ostream & os,
 }
 
 
-int InsetCharStyle::plaintext(Buffer const & buf, lyx::odocstream & os,
+int InsetCharStyle::plaintext(Buffer const & buf, odocstream & os,
                              OutputParams const & runparams) const
 {
        return InsetText::plaintext(buf, os, runparams);
 }
 
 
-int InsetCharStyle::textString(Buffer const & buf, lyx::odocstream & os,
+int InsetCharStyle::textString(Buffer const & buf, odocstream & os,
                       OutputParams const & op) const
 {
        return plaintext(buf, os, op);
index a497a81dbbc203882d382d17e4e7392d8cbad0c0..8fa1e9b58c049f30d2e6ced34712f4294b8c4b2e 100644 (file)
@@ -73,7 +73,7 @@ public:
        ///
        bool forceDefaultParagraphs(idx_type) const { return true; }
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int docbook(Buffer const &, std::ostream &,
index 1d8a16cf4b6c22ff95d09d6f19c498eee4eead2b..7ec2e87b483eac30e7302292c27a0fbffab30ff4 100644 (file)
@@ -31,6 +31,7 @@
 #include <boost/filesystem/exception.hpp>
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::support::ascii_lowercase;
 using lyx::support::contains;
 using lyx::support::getStringFromVector;
@@ -357,7 +358,7 @@ docstring const InsetCitation::getScreenLabel(Buffer const & buffer) const
 }
 
 
-int InsetCitation::plaintext(Buffer const & buffer, lyx::odocstream & os,
+int InsetCitation::plaintext(Buffer const & buffer, odocstream & os,
                              OutputParams const &) const
 {
        if (cache.params == params() &&
@@ -398,7 +399,7 @@ int InsetCitation::docbook(Buffer const &, ostream & os, OutputParams const &) c
 }
 
 
-int InsetCitation::textString(Buffer const & buf, lyx::odocstream & os,
+int InsetCitation::textString(Buffer const & buf, odocstream & os,
                       OutputParams const & op) const
 {
        return plaintext(buf, os, op);
@@ -409,23 +410,25 @@ int InsetCitation::textString(Buffer const & buf, lyx::odocstream & os,
 // the \cite command is valid. Eg, the user has natbib enabled, inputs some
 // citations and then changes his mind, turning natbib support off. The output
 // should revert to \cite[]{}
-int InsetCitation::latex(Buffer const & buffer, ostream & os,
+int InsetCitation::latex(Buffer const & buffer, odocstream & os,
                         OutputParams const &) const
 {
        biblio::CiteEngine const cite_engine = buffer.params().cite_engine;
-       string const cite_str =
-               biblio::asValidLatexCommand(getCmdName(), cite_engine);
+       // FIXME UNICODE
+       docstring const cite_str = lyx::from_utf8(
+               biblio::asValidLatexCommand(getCmdName(), cite_engine));
 
        os << "\\" << cite_str;
 
-       string const before = getSecOptions();
-       string const after  = getOptions();
+       docstring const & before = getParam("before");
+       docstring const & after  = getParam("after");
        if (!before.empty() && cite_engine != biblio::ENGINE_BASIC)
                os << '[' << before << "][" << after << ']';
        else if (!after.empty())
                os << '[' << after << ']';
 
-       os << '{' << cleanupWhitespace(getContents()) << '}';
+       // FIXME UNICODE
+       os << '{' << lyx::from_utf8(cleanupWhitespace(getContents())) << '}';
 
        return 0;
 }
index 4a05147a11aa209a3f591de112142ae0bcd77289..34d43d4c1e709aa5e431ead5a1d52d2f1c5f120a 100644 (file)
@@ -33,7 +33,7 @@ public:
        ///
        int plaintext(Buffer const &, lyx::odocstream &, OutputParams const &) const;
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int docbook(Buffer const &, std::ostream &,
index 12f6f386fa899a803ba454cfd1107e3bd6780bef..764b63d90d21fa6cd82a01ad25df5ac3ea3a76cf 100644 (file)
@@ -23,6 +23,8 @@
 #include <sstream>
 
 
+using lyx::odocstream;
+
 using std::string;
 using std::istringstream;
 using std::ostream;
@@ -70,7 +72,7 @@ void InsetCommand::setParams(InsetCommandParams const & p)
 }
 
 
-int InsetCommand::latex(Buffer const &, ostream & os,
+int InsetCommand::latex(Buffer const &, odocstream & os,
                        OutputParams const &) const
 {
        os << getCommand();
@@ -78,7 +80,7 @@ int InsetCommand::latex(Buffer const &, ostream & os,
 }
 
 
-int InsetCommand::plaintext(Buffer const &, lyx::odocstream &,
+int InsetCommand::plaintext(Buffer const &, odocstream &,
                        OutputParams const &) const
 {
        return 0;
index 7a98c8d2be0a2a4802ccdb2c7af8460ece336934..af224f7846a480ba13385ae833e92108b8d51cec 100644 (file)
@@ -48,7 +48,7 @@ public:
        /// FIXME remove
        void scanCommand(std::string const & c) { p_.scanCommand(c); };
        ///
-       virtual int latex(Buffer const &, std::ostream &,
+       virtual int latex(Buffer const &, lyx::odocstream &,
                          OutputParams const &) const;
        ///
        int plaintext(Buffer const &, lyx::odocstream &,
@@ -95,7 +95,7 @@ protected:
        ///
        bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
        ///
-       std::string const getCommand() const { return p_.getCommand(); }
+       lyx::docstring const getCommand() const { return p_.getCommand(); }
        ///
        std::string const & getCmdName() const { return p_.getCmdName(); }
        ///
index 80bb576d5ab8c1aa362e1774d4a75c26aa22a205..288f885609a806b0ebdfea88aa1ddd3f4564860a 100644 (file)
@@ -228,7 +228,7 @@ void InsetCommandParams::scanCommand(string const & cmd)
 
        if (lyxerr.debugging(Debug::PARSER))
                lyxerr << "Command <" <<  cmd
-                      << "> == <" << getCommand()
+                      << "> == <" << lyx::to_utf8(getCommand())
                       << "> == <" << getCmdName()
                       << '|' << getContents()
                       << '|' << getOptions()
@@ -284,7 +284,7 @@ void InsetCommandParams::write(ostream & os) const
 }
 
 
-string const InsetCommandParams::getCommand() const
+docstring const InsetCommandParams::getCommand() const
 {
        docstring s = '\\' + lyx::from_ascii(name_);
        for (size_t i = 0; i < info_->n; ++i) {
@@ -306,7 +306,7 @@ string const InsetCommandParams::getCommand() const
                } else
                        s += '{' + params_[i] + '}';
        }
-       return lyx::to_utf8(s);
+       return s;
 }
 
 
index 97f871ba92399b6c812e7d07281c7e74efcf551c..3b26fbce7c962b1ba822343c61b51dc041166129 100644 (file)
@@ -34,7 +34,7 @@ public:
        ///
        void write(std::ostream &) const;
        /// Build the complete LaTeX command
-       std::string const getCommand() const;
+       lyx::docstring const getCommand() const;
        /// Return the command name
        std::string const & getCmdName() const { return name_; }
        /// FIXME remove
index 5bfb58db251ab9363d0502067915e443b3b11cdf..a8e7a13575baea2f9d2d4b1490145f1885f72e7d 100644 (file)
 #include "output_latex.h"
 #include "texrow.h"
 
-#include "support/std_ostream.h"
-
 
 using lyx::docstring;
+using lyx::odocstream;
 
 using std::string;
 using std::auto_ptr;
@@ -69,14 +68,16 @@ docstring const InsetEnvironment::editMessage() const
 }
 
 
-int InsetEnvironment::latex(Buffer const & buf, ostream & os,
+int InsetEnvironment::latex(Buffer const & buf, odocstream & os,
                            OutputParams const & runparams) const
 {
-       os << layout_->latexheader;
+       // FIXME UNICODE
+       os << lyx::from_utf8(layout_->latexheader);
        TexRow texrow;
        latexParagraphs(buf, paragraphs(), os, texrow, runparams,
                        layout_->latexparagraph);
-       os << layout_->latexfooter;
+       // FIXME UNICODE
+       os << lyx::from_utf8(layout_->latexfooter);
        return texrow.rows();
 }
 
index 51592f29c205a5060bd5c4ac720d34db9b739ee9..8a10862c7092955b918627862a6ddb2d2464e034 100644 (file)
@@ -27,7 +27,7 @@ public:
        ///
        InsetBase::Code lyxCode() const { return InsetBase::ENVIRONMENT_CODE; }
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        virtual lyx::docstring const editMessage() const;
index 4bc0275f6163031139cf9c861afeb1714ef52cc9..2bc7bc89b4898916ae649ffd432a6fa0171fc292 100644 (file)
@@ -36,6 +36,7 @@
 #include <sstream>
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::pos_type;
 using lyx::support::token;
 
@@ -143,7 +144,7 @@ docstring const InsetERT::editMessage() const
 }
 
 
-int InsetERT::latex(Buffer const &, ostream & os,
+int InsetERT::latex(Buffer const &, odocstream & os,
                    OutputParams const &) const
 {
        ParagraphList::const_iterator par = paragraphs().begin();
@@ -157,7 +158,7 @@ int InsetERT::latex(Buffer const &, ostream & os,
                        if (par->isDeleted(i))
                                continue;
 
-                       os << par->getChar(i);
+                       os.put(par->getChar(i));
                }
                ++par;
                if (par != end) {
@@ -170,7 +171,7 @@ int InsetERT::latex(Buffer const &, ostream & os,
 }
 
 
-int InsetERT::plaintext(Buffer const &, lyx::odocstream &,
+int InsetERT::plaintext(Buffer const &, odocstream &,
                    OutputParams const & /*runparams*/) const
 {
        return 0;
@@ -187,7 +188,7 @@ int InsetERT::docbook(Buffer const &, ostream & os,
        while (par != end) {
                pos_type siz = par->size();
                for (pos_type i = 0; i < siz; ++i)
-                       os << par->getChar(i);
+                       os.put(par->getChar(i));
                ++par;
                if (par != end) {
                        os << "\n";
index 801f4e4a44fae6d7295375581f4344880d19f77d..3a93e067dbb16e3b3c079b0efefbda46c0d1f697 100644 (file)
@@ -49,7 +49,7 @@ public:
        ///
        bool insetAllowed(InsetBase::Code code) const;
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int plaintext(Buffer const &, lyx::odocstream &,
index 586b46cfd894339886d6ee9f76adb35fb328d29f..51fd1a8916e199223b734cd4ed71db41060cd31a 100644 (file)
@@ -49,6 +49,8 @@ namespace external = lyx::external;
 namespace graphics = lyx::graphics;
 
 using lyx::docstring;
+using lyx::odocstream;
+
 using std::endl;
 using std::string;
 using std::auto_ptr;
@@ -676,12 +678,13 @@ void InsetExternal::read(Buffer const & buffer, LyXLex & lex)
 }
 
 
-int InsetExternal::latex(Buffer const & buf, ostream & os,
+int InsetExternal::latex(Buffer const & buf, odocstream & os,
                         OutputParams const & runparams) const
 {
        if (params_.draft) {
+               // FIXME UNICODE
                os << "\\fbox{\\ttfamily{}"
-                  << params_.filename.outputFilename(buf.filePath())
+                  << lyx::from_utf8(params_.filename.outputFilename(buf.filePath()))
                   << "}\n";
                return 1;
        }
@@ -717,25 +720,25 @@ int InsetExternal::latex(Buffer const & buf, ostream & os,
 }
 
 
-int InsetExternal::plaintext(Buffer const & buf, lyx::odocstream & os,
+int InsetExternal::plaintext(Buffer const & buf, odocstream & os,
                         OutputParams const & runparams) const
 {
-       std::ostringstream oss;
-       int const retval = external::writeExternal(params_, "Ascii", buf, oss,
+       return external::writeExternal(params_, "Ascii", buf, os,
                                       *(runparams.exportdata), false,
                                       runparams.inComment);
-       // FIXME UNICODE
-       os << lyx::from_utf8(oss.str());
-       return retval;
 }
 
 
 int InsetExternal::docbook(Buffer const & buf, ostream & os,
                           OutputParams const & runparams) const
 {
-       return external::writeExternal(params_, "DocBook", buf, os,
+       lyx::odocstringstream oss;
+       int const retval = external::writeExternal(params_, "DocBook", buf, oss,
                                       *(runparams.exportdata), false,
                                       runparams.inComment);
+       // FIXME UNICODE
+       os << lyx::to_utf8(oss.str());
+       return retval;
 }
 
 
@@ -802,9 +805,9 @@ bool preview_wanted(InsetExternalParams const & params)
 }
 
 
-string const latex_string(InsetExternal const & inset, Buffer const & buffer)
+docstring const latex_string(InsetExternal const & inset, Buffer const & buffer)
 {
-       ostringstream os;
+       lyx::odocstringstream os;
        OutputParams runparams;
        runparams.flavor = OutputParams::LATEX;
        inset.latex(buffer, os, runparams);
@@ -822,7 +825,7 @@ void add_preview_and_start_loading(RenderMonitoredPreview & renderer,
        if (RenderPreview::status() != LyXRC::PREVIEW_OFF &&
            preview_wanted(params)) {
                renderer.setAbsFile(params.filename.absFilename());
-               string const snippet = latex_string(inset, buffer);
+               docstring const snippet = latex_string(inset, buffer);
                renderer.addPreview(snippet, buffer);
                renderer.startLoading(buffer);
        }
@@ -839,7 +842,7 @@ void InsetExternal::addPreview(graphics::PreviewLoader & ploader) const
 
        if (preview_wanted(params())) {
                ptr->setAbsFile(params_.filename.absFilename());
-               string const snippet = latex_string(*this, ploader.buffer());
+               docstring const snippet = latex_string(*this, ploader.buffer());
                ptr->addPreview(snippet, ploader);
        }
 }
index 7ad563a070fb98577c6c9d31db7eec6c4fd72190..fefcc2a840063066bb0b954be2c6688a53d682fc 100644 (file)
@@ -123,7 +123,7 @@ public:
        virtual void read(Buffer const &, LyXLex & lex);
 
        /// \returns the number of rows (\n's) of generated code.
-       virtual int latex(Buffer const &, std::ostream &,
+       virtual int latex(Buffer const &, lyx::odocstream &,
                          OutputParams const &) const;
        ///
        virtual int plaintext(Buffer const &, lyx::odocstream &,
index 6e617210a43067c440f7302edb31d65e6aa4cfea..5af4753feaa3d01070edb94d6a07113a151e6f98 100644 (file)
@@ -37,6 +37,7 @@
 #include <sstream>
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::support::contains;
 
 using std::endl;
@@ -279,7 +280,7 @@ docstring const InsetFloat::editMessage() const
 }
 
 
-int InsetFloat::latex(Buffer const & buf, ostream & os,
+int InsetFloat::latex(Buffer const & buf, odocstream & os,
                      OutputParams const & runparams) const
 {
        FloatList const & floats = buf.params().getLyXTextClass().floats();
@@ -310,11 +311,11 @@ int InsetFloat::latex(Buffer const & buf, ostream & os,
        // The \n is used to force \begin{<floatname>} to appear in a new line.
        // The % is needed to prevent two consecutive \n chars in the case
        // when the current output line is empty.
-       os << "%\n\\begin{" << tmptype << '}';
+       os << "%\n\\begin{" << lyx::from_ascii(tmptype) << '}';
        // We only output placement if different from the def_placement.
        // sidewaysfloats always use their own page
        if (!placement.empty() && !params_.sideways) {
-               os << '[' << placement << ']';
+               os << '[' << lyx::from_ascii(placement) << ']';
        }
        os << '\n';
 
@@ -322,7 +323,7 @@ int InsetFloat::latex(Buffer const & buf, ostream & os,
 
        // The \n is used to force \end{<floatname>} to appear in a new line.
        // In this case, we do not case if the current output line is empty.
-       os << "\n\\end{" << tmptype << "}\n";
+       os << "\n\\end{" << lyx::from_ascii(tmptype) << "}\n";
 
        return i + 4;
 }
index 0303197b57e9502c90ac20708c85a0b15a7effa3..10774bb2961c5c992d014c56844fda0c49e36e32 100644 (file)
@@ -54,7 +54,7 @@ public:
        ///
        InsetBase::Code lyxCode() const { return InsetBase::FLOAT_CODE; }
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int docbook(Buffer const &, std::ostream &,
index 0064f2dedeb94a267d9b661feeac7c734cd37c2a..11d40d24ffb06c9a60453d5d403fa4d7560b293e 100644 (file)
@@ -28,6 +28,7 @@
 #include "support/lstrings.h"
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::support::bformat;
 
 using std::endl;
@@ -79,7 +80,7 @@ void InsetFloatList::read(Buffer const & buf, LyXLex & lex)
 }
 
 
-int InsetFloatList::latex(Buffer const & buf, ostream & os,
+int InsetFloatList::latex(Buffer const & buf, odocstream & os,
                          OutputParams const &) const
 {
        FloatList const & floats = buf.params().getLyXTextClass().floats();
@@ -98,20 +99,20 @@ int InsetFloatList::latex(Buffer const & buf, ostream & os,
                        }
                } else {
                        // FIXME UNICODE
-                       os << "\\listof{" << getCmdName() << "}{"
-                          << lyx::to_utf8(buf.B_(cit->second.listName())) << "}\n";
+                       os << "\\listof{" << lyx::from_ascii(getCmdName()) << "}{"
+                          << buf.B_(cit->second.listName()) << "}\n";
                }
        } else {
                // FIXME UNICODE
-               os << "%%\\listof{" << getCmdName() << "}{"
-                  << lyx::to_utf8(bformat(_("List of %1$s"), lyx::from_utf8(cit->second.name())))
+               os << "%%\\listof{" << lyx::from_ascii(getCmdName()) << "}{"
+                  << bformat(_("List of %1$s"), lyx::from_utf8(cit->second.name()))
                   << "}\n";
        }
        return 1;
 }
 
 
-int InsetFloatList::plaintext(Buffer const & buffer, lyx::odocstream & os,
+int InsetFloatList::plaintext(Buffer const & buffer, odocstream & os,
                               OutputParams const &) const
 {
        os << getScreenLabel(buffer) << "\n\n";
index 301d14c8a08e99644adac567835e605b77662e8c..9392089e0df405e1bdca2c05a152bb5ef91e3764 100644 (file)
@@ -36,7 +36,7 @@ public:
        ///
        void read(Buffer const &, LyXLex &);
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int docbook(Buffer const &, std::ostream &,
index 3ba32488b753afe9ae297c649f7f572826e2a85d..43bad6df9734e257faf317908233c8dfcfc8d0c2 100644 (file)
@@ -24,6 +24,7 @@
 #include "support/std_ostream.h"
 
 using lyx::docstring;
+using lyx::odocstream;
 
 using std::string;
 using std::auto_ptr;
@@ -58,7 +59,7 @@ docstring const InsetFoot::editMessage() const
 }
 
 
-int InsetFoot::latex(Buffer const & buf, ostream & os,
+int InsetFoot::latex(Buffer const & buf, odocstream & os,
                     OutputParams const & runparams_in) const
 {
        OutputParams runparams = runparams_in;
index 640014c1332432905b400bac74df9ccdc44da3d5..2d35572338f7f417740d4fe2ec0e6c4f8150a310 100644 (file)
@@ -25,7 +25,7 @@ public:
        ///
        InsetBase::Code lyxCode() const { return InsetBase::FOOT_CODE; }
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int docbook(Buffer const &, std::ostream &,
index cceb22e3faacf5a86110d13700b0ea17bc2ac734..12a810ae9de32467c24c9532fe71ae562273bef8 100644 (file)
@@ -87,6 +87,8 @@ TODO
 
 #include <sstream>
 
+using lyx::odocstream;
+
 namespace support = lyx::support;
 
 using lyx::support::absolutePath;
@@ -735,7 +737,7 @@ string const InsetGraphics::prepareFile(Buffer const & buf,
 }
 
 
-int InsetGraphics::latex(Buffer const & buf, ostream & os,
+int InsetGraphics::latex(Buffer const & buf, odocstream & os,
                         OutputParams const & runparams) const
 {
        // If there is no file specified or not existing,
@@ -795,7 +797,8 @@ int InsetGraphics::latex(Buffer const & buf, ostream & os,
        // (when there are several versions in different formats)
        latex_str += prepareFile(buf, runparams);
        latex_str += '}' + after;
-       os << latex_str;
+       // FIXME UNICODE
+       os << lyx::from_utf8(latex_str);
 
        lyxerr[Debug::GRAPHICS] << "InsetGraphics::latex outputting:\n"
                                << latex_str << endl;
@@ -804,7 +807,7 @@ int InsetGraphics::latex(Buffer const & buf, ostream & os,
 }
 
 
-int InsetGraphics::plaintext(Buffer const &, lyx::odocstream & os,
+int InsetGraphics::plaintext(Buffer const &, odocstream & os,
                         OutputParams const &) const
 {
        // No graphics in ascii output. Possible to use gifscii to convert
index effe8489e034627b6cf19b950556975a0b5b43af..3d3a89ea6f61cbe237a093089bcbcfa48b1af10b 100644 (file)
@@ -43,7 +43,7 @@ public:
         #fragile == true# means, that the inset should take care about
         fragile commands by adding a #\protect# before.
         */
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int plaintext(Buffer const &, lyx::odocstream &,
index 03d7abb2fac96023692e1d0776519b2e8e4d2e8f..dbf49cb9c1b7017232607e5c6ecfcea12873b8df 100644 (file)
@@ -15,6 +15,7 @@
 #include "support/std_ostream.h"
 
 using lyx::docstring;
+using lyx::odocstream;
 
 using std::ostream;
 
@@ -45,7 +46,7 @@ docstring const InsetHFill::getScreenLabel(Buffer const &) const
 }
 
 
-int InsetHFill::latex(Buffer const &, ostream & os,
+int InsetHFill::latex(Buffer const &, odocstream & os,
                      OutputParams const &) const
 {
        os << getCommand();
@@ -53,7 +54,7 @@ int InsetHFill::latex(Buffer const &, ostream & os,
 }
 
 
-int InsetHFill::plaintext(Buffer const &, lyx::odocstream & os,
+int InsetHFill::plaintext(Buffer const &, odocstream & os,
                      OutputParams const &) const
 {
        os << '\t';
index cd66169d102eb3eca5a0420d978008ca3176e86a..309d4975f8e838768c491563b0bb5ddb137d8488 100644 (file)
@@ -26,7 +26,7 @@ public:
        ///
        InsetBase::Code lyxCode() const { return InsetBase::HFILL_CODE; }
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int plaintext(Buffer const &, lyx::odocstream &,
index a25756aedeeec5fb8f8c3823031f4668260e3f84..682f78b303f7f0631de0690956521cec65eb341d 100644 (file)
@@ -54,6 +54,7 @@
 #include <sstream>
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::support::addName;
 using lyx::support::absolutePath;
 using lyx::support::bformat;
@@ -258,7 +259,7 @@ void InsetInclude::write(Buffer const &, ostream & os) const
 
 void InsetInclude::write(ostream & os) const
 {
-       os << "Include " << params_.getCommand() << '\n'
+       os << "Include " << lyx::to_utf8(params_.getCommand()) << '\n'
           << "preview " << convert<string>(params_.preview()) << '\n';
 }
 
@@ -350,7 +351,7 @@ bool loadIfNeeded(Buffer const & buffer, InsetCommandParams const & params)
 } // namespace anon
 
 
-int InsetInclude::latex(Buffer const & buffer, ostream & os,
+int InsetInclude::latex(Buffer const & buffer, odocstream & os,
                        OutputParams const & runparams) const
 {
        string incfile(params_.getContents());
@@ -435,7 +436,9 @@ int InsetInclude::latex(Buffer const & buffer, ostream & os,
                        "latex" : "pdflatex";
        if (isVerbatim(params_)) {
                incfile = latex_path(incfile);
-               os << '\\' << params_.getCmdName() << '{' << incfile << '}';
+               // FIXME UNICODE
+               os << '\\' << lyx::from_ascii(params_.getCmdName()) << '{'
+                  << lyx::from_utf8(incfile) << '}';
        } else if (type(params_) == INPUT) {
                runparams.exportdata->addExternalFile(tex_format, writefile,
                                                      exportfile);
@@ -443,13 +446,15 @@ int InsetInclude::latex(Buffer const & buffer, ostream & os,
                // \input wants file with extension (default is .tex)
                if (!isLyXFilename(included_file)) {
                        incfile = latex_path(incfile);
-                       os << '\\' << params_.getCmdName() << '{' << incfile << '}';
+                       // FIXME UNICODE
+                       os << '\\' << lyx::from_ascii(params_.getCmdName())
+                          << '{' << lyx::from_utf8(incfile) << '}';
                } else {
                incfile = changeExtension(incfile, ".tex");
                incfile = latex_path(incfile);
-                       os << '\\' << params_.getCmdName() << '{'
-                          << incfile
-                          <<  '}';
+                       // FIXME UNICODE
+                       os << '\\' << lyx::from_ascii(params_.getCmdName())
+                          << '{' << lyx::from_utf8(incfile) <<  '}';
                }
        } else {
                runparams.exportdata->addExternalFile(tex_format, writefile,
@@ -459,16 +464,16 @@ int InsetInclude::latex(Buffer const & buffer, ostream & os,
                // file really have .tex
                incfile = changeExtension(incfile, string());
                incfile = latex_path(incfile);
-               os << '\\' << params_.getCmdName() << '{'
-                  << incfile
-                  << '}';
+               // FIXME UNICODE
+               os << '\\' << lyx::from_ascii(params_.getCmdName()) << '{'
+                  << lyx::from_utf8(incfile) << '}';
        }
 
        return 0;
 }
 
 
-int InsetInclude::plaintext(Buffer const & buffer, lyx::odocstream & os,
+int InsetInclude::plaintext(Buffer const & buffer, odocstream & os,
                        OutputParams const &) const
 {
        if (isVerbatim(params_)) {
@@ -708,9 +713,9 @@ bool preview_wanted(InsetCommandParams const & params, Buffer const & buffer)
 }
 
 
-string const latex_string(InsetInclude const & inset, Buffer const & buffer)
+docstring const latex_string(InsetInclude const & inset, Buffer const & buffer)
 {
-       ostringstream os;
+       lyx::odocstringstream os;
        OutputParams runparams;
        runparams.flavor = OutputParams::LATEX;
        inset.latex(buffer, os, runparams);
@@ -726,7 +731,7 @@ void add_preview(RenderMonitoredPreview & renderer, InsetInclude const & inset,
        if (RenderPreview::status() != LyXRC::PREVIEW_OFF &&
            preview_wanted(params, buffer)) {
                renderer.setAbsFile(includedFilename(buffer, params));
-               string const snippet = latex_string(inset, buffer);
+               docstring const snippet = latex_string(inset, buffer);
                renderer.addPreview(snippet, buffer);
        }
 }
@@ -739,7 +744,7 @@ void InsetInclude::addPreview(lyx::graphics::PreviewLoader & ploader) const
        Buffer const & buffer = ploader.buffer();
        if (preview_wanted(params(), buffer)) {
                preview_->setAbsFile(includedFilename(buffer, params()));
-               string const snippet = latex_string(*this, buffer);
+               docstring const snippet = latex_string(*this, buffer);
                preview_->addPreview(snippet, ploader);
        }
 }
index 6b911ce5630feded40487bb60456bfeac5d2bda1..cf0a660643d395dced5ecc40acd3434f262aee24 100644 (file)
@@ -75,7 +75,7 @@ public:
        ///
        void read(Buffer const &, LyXLex &);
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int plaintext(Buffer const &, lyx::odocstream &,
index 53b53e29b8d2e24581f52f2d48e7b20812b7eecc..98110bdc1495fed0bbb012a166a22ad9f5fc1e58 100644 (file)
@@ -27,6 +27,7 @@
 #include "support/std_ostream.h"
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::support::escape;
 
 using std::string;
@@ -84,7 +85,7 @@ void InsetLabel::doDispatch(LCursor & cur, FuncRequest & cmd)
 }
 
 
-int InsetLabel::latex(Buffer const &, ostream & os,
+int InsetLabel::latex(Buffer const &, odocstream & os,
                      OutputParams const &) const
 {
        os << escape(getCommand());
@@ -92,7 +93,7 @@ int InsetLabel::latex(Buffer const &, ostream & os,
 }
 
 
-int InsetLabel::plaintext(Buffer const &, lyx::odocstream & os,
+int InsetLabel::plaintext(Buffer const &, odocstream & os,
                      OutputParams const &) const
 {
        // FIXME UNICODE
index 255f503f420dacd131cda1da46e39b77ed15e259..a67e2f7c291f3ed6b4f4f8de7d6f2cdfef6b8801 100644 (file)
@@ -27,7 +27,7 @@ public:
        /// Appends \c list with this label
        void getLabelList(Buffer const &, std::vector<lyx::docstring> & list) const;
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int plaintext(Buffer const &, lyx::odocstream &,
index 901fa926fba11dbc144c678020d0429b9f987fcb..720c858fc484d086e9c651e33fea8d9999bc4f00 100644 (file)
@@ -26,6 +26,7 @@
 
 using lyx::char_type;
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::support::contains;
 using lyx::support::trim;
 
@@ -571,15 +572,15 @@ void InsetLatexAccent::read(Buffer const &, LyXLex & lex)
 }
 
 
-int InsetLatexAccent::latex(Buffer const &, ostream & os,
+int InsetLatexAccent::latex(Buffer const &, odocstream & os,
                            OutputParams const &) const
 {
-       os << contents;
+       os << lyx::from_ascii(contents);
        return 0;
 }
 
 
-int InsetLatexAccent::plaintext(Buffer const &, lyx::odocstream & os,
+int InsetLatexAccent::plaintext(Buffer const &, odocstream & os,
                            OutputParams const &) const
 {
        os << lyx::from_ascii(contents);
@@ -595,7 +596,7 @@ int InsetLatexAccent::docbook(Buffer const &, ostream & os,
 }
 
 
-int InsetLatexAccent::textString(Buffer const & buf, lyx::odocstream & os,
+int InsetLatexAccent::textString(Buffer const & buf, odocstream & os,
                       OutputParams const & op) const
 {
        return plaintext(buf, os, op);
index 4e3fd9cc06d08c6eac5e621981d4e5e839c7b80d..a96358dfb5ab75333f5e7bcd85848b58f0dbffed 100644 (file)
@@ -43,7 +43,7 @@ public:
        ///
        void read(Buffer const &, LyXLex & lex);
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int plaintext(Buffer const &, lyx::odocstream &,
index 8a83f7c17c6fd1bd254fd6d6fd53bee39f71c796..f6390c91b6d93dae0d5e92e334ccb8c72fdc4487 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "frontends/Painter.h"
 
+using lyx::odocstream;
 using lyx::frontend::Painter;
 
 using std::endl;
@@ -55,15 +56,16 @@ void InsetLine::draw(PainterInfo & pi, int x, int y) const
 }
 
 
-int InsetLine::latex(Buffer const &, ostream & os,
+int InsetLine::latex(Buffer const &, odocstream & os,
                        OutputParams const & runparams) const
 {
-       os << "\\lyxline{\\" << runparams.local_font->latexSize() << '}';
+       os << "\\lyxline{\\"
+          << lyx::from_ascii(runparams.local_font->latexSize()) << '}';
        return 0;
 }
 
 
-int InsetLine::plaintext(Buffer const &, lyx::odocstream & os,
+int InsetLine::plaintext(Buffer const &, odocstream & os,
                     OutputParams const &) const
 {
        os << "-------------------------------------------";
index 1297b6fcc2beed63234e56bb5770c5a9a9084f80..5950b47d9859c742290c4cccd7d11b569045c594 100644 (file)
@@ -26,7 +26,7 @@ public:
 
        void draw(PainterInfo & pi, int x, int y) const;
 
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                          OutputParams const &) const;
 
        int plaintext(Buffer const &, lyx::odocstream &,
index 4498db12e43f5b6e511d334fd8275239152f8bb5..b106cc152db19ded112d11d8821ed2db11a1a491 100644 (file)
@@ -19,6 +19,7 @@
 #include "support/std_ostream.h"
 
 using lyx::docstring;
+using lyx::odocstream;
 
 using std::string;
 using std::auto_ptr;
@@ -53,7 +54,7 @@ docstring const InsetMarginal::editMessage() const
 }
 
 
-int InsetMarginal::latex(Buffer const & buf, ostream & os,
+int InsetMarginal::latex(Buffer const & buf, odocstream & os,
                         OutputParams const & runparams) const
 {
        os << "%\n\\marginpar{";
index 3552a49baef358725e3c9aaeb60cdabdc1f9390d..68d595d9d6bd51e6e3f793c8af0c6fe61ee2e714 100644 (file)
@@ -26,7 +26,7 @@ public:
        ///
        InsetBase::Code lyxCode() const { return InsetBase::MARGIN_CODE; }
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int docbook(Buffer const &, std::ostream &,
index 0079488fe54f1586a0f4e20f4ef71066d7c750c0..6057da5080805da936f0450216cff11766348c4e 100644 (file)
@@ -22,6 +22,8 @@
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
+using lyx::odocstream;
+
 using std::endl;
 using std::ostream;
 
@@ -49,7 +51,7 @@ void InsetNewline::metrics(MetricsInfo & mi, Dimension & dim) const
 }
 
 
-int InsetNewline::latex(Buffer const &, ostream &,
+int InsetNewline::latex(Buffer const &, odocstream &,
                        OutputParams const &) const
 {
        lyxerr << "Eek, calling InsetNewline::latex !" << endl;
@@ -57,7 +59,7 @@ int InsetNewline::latex(Buffer const &, ostream &,
 }
 
 
-int InsetNewline::plaintext(Buffer const &, lyx::odocstream & os,
+int InsetNewline::plaintext(Buffer const &, odocstream & os,
                        OutputParams const &) const
 {
        os << '\n';
index b8e2da897aaf8fe2a95bf37d9cd477d1262caea0..2a17ae4d0f408754030d2e7d03141dfc5103a429 100644 (file)
@@ -26,7 +26,7 @@ public:
 
        virtual void draw(PainterInfo & pi, int x, int y) const;
 
-       virtual int latex(Buffer const &, std::ostream &,
+       virtual int latex(Buffer const &, lyx::odocstream &,
                          OutputParams const &) const;
 
        virtual int plaintext(Buffer const &, lyx::odocstream &,
index 33916d7cae1de5830950c896c5a54dd18ed40148..decb4785a26186575e79cf5b3ad24e2da30d4a99 100644 (file)
@@ -35,6 +35,7 @@
 #include <sstream>
 
 using lyx::docstring;
+using lyx::odocstream;
 
 using std::string;
 using std::auto_ptr;
@@ -250,7 +251,7 @@ bool InsetNote::getStatus(LCursor & cur, FuncRequest const & cmd,
 }
 
 
-int InsetNote::latex(Buffer const & buf, ostream & os,
+int InsetNote::latex(Buffer const & buf, odocstream & os,
                     OutputParams const & runparams_in) const
 {
        if (params_.type == InsetNoteParams::Note)
@@ -270,10 +271,10 @@ int InsetNote::latex(Buffer const & buf, ostream & os,
        else if (params_.type == InsetNoteParams::Shaded)
                type = "shaded";
 
-       ostringstream ss;
-       ss << "%\n\\begin{" << type << "}\n";
+       lyx::odocstringstream ss;
+       ss << "%\n\\begin{" << lyx::from_ascii(type) << "}\n";
        InsetText::latex(buf, ss, runparams);
-       ss << "\n\\end{" << type << "}\n";
+       ss << "\n\\end{" << lyx::from_ascii(type) << "}\n";
        // the space after the comment in 'a[comment] b' will be eaten by the
        // comment environment since the space before b is ignored with the
        // following latex output:
@@ -288,10 +289,10 @@ int InsetNote::latex(Buffer const & buf, ostream & os,
        if (params_.type == InsetNoteParams::Comment)
                ss << "{}";
 
-       string const str = ss.str();
+       docstring const str = ss.str();
        os << str;
        // Return how many newlines we issued.
-       return int(lyx::count(str.begin(), str.end(),'\n'));
+       return int(lyx::count(str.begin(), str.end(), '\n'));
 }
 
 
@@ -322,7 +323,7 @@ int InsetNote::docbook(Buffer const & buf, std::ostream & os,
 }
 
 
-int InsetNote::plaintext(Buffer const & buf, lyx::odocstream & os,
+int InsetNote::plaintext(Buffer const & buf, odocstream & os,
                         OutputParams const & runparams_in) const
 {
        if (params_.type == InsetNoteParams::Note)
index 4fe09a452ebb1d5f1459539ba51cc9c60d083ac0..3b4d739a85020763d600e3cb05ff82cf5eaf59b5 100644 (file)
@@ -57,7 +57,7 @@ public:
        /// show the note dialog
        bool showInsetDialog(BufferView * bv) const;
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
               OutputParams const &) const;
        ///
        int docbook(Buffer const &, std::ostream &,
index 7eb44dafc4c6affa4e3cfe6747ecd10d96260d31..e78ce9076c16cea12cfe51571a5088bc770d1576 100644 (file)
@@ -20,6 +20,7 @@
 #include <sstream>
 
 using lyx::docstring;
+using lyx::odocstream;
 
 using std::string;
 using std::auto_ptr;
@@ -66,7 +67,7 @@ void InsetOptArg::write(Buffer const & buf, ostream & os) const
 }
 
 
-int InsetOptArg::latex(Buffer const &, ostream &,
+int InsetOptArg::latex(Buffer const &, odocstream &,
                       OutputParams const &) const
 {
        return 0;
@@ -79,20 +80,20 @@ int InsetOptArg::docbook(Buffer const &, ostream &,
 }
 
 
-int InsetOptArg::plaintext(Buffer const &, lyx::odocstream &,
+int InsetOptArg::plaintext(Buffer const &, odocstream &,
                       OutputParams const &) const
 {
        return 0;
 }
 
 
-int InsetOptArg::latexOptional(Buffer const & buf, ostream & os,
+int InsetOptArg::latexOptional(Buffer const & buf, odocstream & os,
                               OutputParams const & runparams) const
 {
-       ostringstream ss;
+       lyx::odocstringstream ss;
        int ret = InsetText::latex(buf, ss, runparams);
-       string str = ss.str();
-       if (str.find(']') != string::npos)
+       docstring str = ss.str();
+       if (str.find(']') != docstring::npos)
                str = '{' + str + '}';
        os << '[' << str << ']';
        return ret;
index 0454519740f45f1d346bdca1e990882e9537027b..09f7f70f3cade90a3726cb67805c0c30648fbc06 100644 (file)
@@ -30,7 +30,7 @@ public:
        virtual lyx::docstring const editMessage() const;
 
        /// Standard LaTeX output -- short-circuited
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        /// Standard DocBook output -- short-circuited
        int docbook(Buffer const &, std::ostream &,
@@ -41,7 +41,7 @@ public:
                  OutputParams const &) const;
 
        /// Outputting the optional parameter of a LaTeX command
-       int latexOptional(Buffer const &, std::ostream &,
+       int latexOptional(Buffer const &, lyx::odocstream &,
                          OutputParams const &) const;
        /// Write out tothe .lyx file
        void write(Buffer const & buf, std::ostream & os) const;
index 9c55d83d885d00409a0f40d6652dcfda0737233b..e63e8039f1ac431f9fd67e64d404ccb13f42a94e 100644 (file)
@@ -22,6 +22,7 @@
 #include "frontends/Painter.h"
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::frontend::Painter;
 
 using std::endl;
@@ -75,7 +76,7 @@ void InsetPagebreak::draw(PainterInfo & pi, int x, int y) const
 }
 
 
-int InsetPagebreak::latex(Buffer const &, ostream & os,
+int InsetPagebreak::latex(Buffer const &, odocstream & os,
                          OutputParams const &) const
 {
        os << "\\newpage{}";
@@ -83,7 +84,7 @@ int InsetPagebreak::latex(Buffer const &, ostream & os,
 }
 
 
-int InsetPagebreak::plaintext(Buffer const &, lyx::odocstream & os,
+int InsetPagebreak::plaintext(Buffer const &, odocstream & os,
                          OutputParams const &) const
 {
        os << '\n';
index 8ee273ec06a06e00385d36cdf761097ea439c0a1..9e3f627482949d3cebed5816d79b654673153f33 100644 (file)
@@ -26,7 +26,7 @@ public:
 
        void draw(PainterInfo & pi, int x, int y) const;
 
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
 
        int plaintext(Buffer const &, lyx::odocstream &,
index 378a6e34ce97749f434c458c223b4a06972f2316..c18861011ec6c30eca8d090a405c26a7cdb41b22 100644 (file)
@@ -31,6 +31,7 @@
 
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::support::prefixIs;
 
 using std::endl;
@@ -268,7 +269,7 @@ void InsetQuotes::read(Buffer const &, LyXLex & lex)
 }
 
 
-int InsetQuotes::latex(Buffer const &, ostream & os,
+int InsetQuotes::latex(Buffer const &, odocstream & os,
                       OutputParams const & runparams) const
 {
        const int quoteind = quote_index[side_][language_];
@@ -296,12 +297,12 @@ int InsetQuotes::latex(Buffer const &, ostream & os,
        if (prefixIs(qstr, "`"))
                qstr.insert(0, "{}");
 
-       os << qstr;
+       os << lyx::from_ascii(qstr);
        return 0;
 }
 
 
-int InsetQuotes::plaintext(Buffer const &, lyx::odocstream & os,
+int InsetQuotes::plaintext(Buffer const &, odocstream & os,
                       OutputParams const &) const
 {
        os << '"';
@@ -327,7 +328,7 @@ int InsetQuotes::docbook(Buffer const &, ostream & os,
 }
 
 
-int InsetQuotes::textString(Buffer const & buf, lyx::odocstream & os,
+int InsetQuotes::textString(Buffer const & buf, odocstream & os,
                       OutputParams const & op) const
 {
        return plaintext(buf, os, op);
index 0d51ecfb55e4e3ff8b6585d770ac36e23abc97ab..bc39895d08a8e872cbd2e62ab993928d702f80dd 100644 (file)
@@ -84,7 +84,7 @@ public:
        ///
        void read(Buffer const &, LyXLex & lex);
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int plaintext(Buffer const &, lyx::odocstream &,
index 2955e7205554d77205b9236ac109319113456a44..5ae1406d103145109cec01f4d8e0494eaad9464f 100644 (file)
@@ -25,6 +25,7 @@
 
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::support::escape;
 
 using std::string;
@@ -84,7 +85,7 @@ docstring const InsetRef::getScreenLabel(Buffer const &) const
 }
 
 
-int InsetRef::latex(Buffer const &, ostream & os,
+int InsetRef::latex(Buffer const &, odocstream & os,
                    OutputParams const &) const
 {
        // Don't output p_["name"], this is only used in docbook
@@ -95,7 +96,7 @@ int InsetRef::latex(Buffer const &, ostream & os,
 }
 
 
-int InsetRef::plaintext(Buffer const &, lyx::odocstream & os,
+int InsetRef::plaintext(Buffer const &, odocstream & os,
                    OutputParams const &) const
 {
        // FIXME UNICODE
@@ -120,7 +121,7 @@ int InsetRef::docbook(Buffer const & buf, ostream & os,
 }
 
 
-int InsetRef::textString(Buffer const & buf, lyx::odocstream & os,
+int InsetRef::textString(Buffer const & buf, odocstream & os,
                       OutputParams const & op) const
 {
        return plaintext(buf, os, op);
index 35550dde373f8fd1cf14612302bd44d8b422d0de..cbeba3fbc1ea0c57b67c980b6fdaf7ca2b93bc7a 100644 (file)
@@ -44,7 +44,7 @@ public:
        ///
        bool display() const { return false; }
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int plaintext(Buffer const &, lyx::odocstream &,
index bd7faede4a1f3277319aea85fa7e79132cf899e6..e41017b33c01c085512ef98e494c6f3e65202c2f 100644 (file)
@@ -25,6 +25,8 @@
 #include "frontends/Painter.h"
 
 
+using lyx::odocstream;
+
 using std::string;
 using std::max;
 using std::auto_ptr;
@@ -162,7 +164,7 @@ void InsetSpace::read(Buffer const &, LyXLex & lex)
 }
 
 
-int InsetSpace::latex(Buffer const &, ostream & os,
+int InsetSpace::latex(Buffer const &, odocstream & os,
                      OutputParams const & runparams) const
 {
        switch (kind_) {
@@ -195,7 +197,7 @@ int InsetSpace::latex(Buffer const &, ostream & os,
 }
 
 
-int InsetSpace::plaintext(Buffer const &, lyx::odocstream & os,
+int InsetSpace::plaintext(Buffer const &, odocstream & os,
                      OutputParams const &) const
 {
        switch (kind_) {
@@ -235,7 +237,7 @@ int InsetSpace::docbook(Buffer const &, ostream & os,
 }
 
 
-int InsetSpace::textString(Buffer const & buf, lyx::odocstream & os,
+int InsetSpace::textString(Buffer const & buf, odocstream & os,
                       OutputParams const & op) const
 {
        return plaintext(buf, os, op);
index 4d84e7c0c0597ced3080777e938f9ade9d56658a..4dd793e6437ebda548e61b45ba3b6c216ac10d39 100644 (file)
@@ -61,7 +61,7 @@ public:
        /// Will not be used when lyxf3
        void read(Buffer const &, LyXLex & lex);
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int plaintext(Buffer const &, lyx::odocstream &,
index 386fca533aa3c935765810a2b19d21817f555de2..853fdfaec1ee70e682557041f936425a6fa868cc 100644 (file)
@@ -24,6 +24,7 @@
 #include "frontends/Painter.h"
 
 using lyx::docstring;
+using lyx::odocstream;
 
 using std::string;
 using std::auto_ptr;
@@ -164,7 +165,7 @@ void InsetSpecialChar::read(Buffer const &, LyXLex & lex)
 }
 
 
-int InsetSpecialChar::latex(Buffer const &, ostream & os,
+int InsetSpecialChar::latex(Buffer const &, odocstream & os,
                            OutputParams const &) const
 {
        switch (kind_) {
@@ -188,7 +189,7 @@ int InsetSpecialChar::latex(Buffer const &, ostream & os,
 }
 
 
-int InsetSpecialChar::plaintext(Buffer const &, lyx::odocstream & os,
+int InsetSpecialChar::plaintext(Buffer const &, odocstream & os,
                            OutputParams const &) const
 {
        switch (kind_) {
@@ -230,7 +231,7 @@ int InsetSpecialChar::docbook(Buffer const &, ostream & os,
 }
 
 
-int InsetSpecialChar::textString(Buffer const & buf, lyx::odocstream & os,
+int InsetSpecialChar::textString(Buffer const & buf, odocstream & os,
                       OutputParams const & op) const
 {
        return plaintext(buf, os, op);
index 3606f9633ff9b403003de1563461be1fc24792de..2b4ef0e7db2b53c66039653c693b578d64990ca2 100644 (file)
@@ -53,7 +53,7 @@ public:
        /// Will not be used when lyxf3
        void read(Buffer const &, LyXLex & lex);
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int plaintext(Buffer const &, lyx::odocstream &,
index df79c6718efd1e11ae5949b3c80142ac52d76394..a3c5c67a5aa8280383a068588fdcd9a493ee40c0 100644 (file)
@@ -47,6 +47,7 @@
 #include <limits>
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::Point;
 
 using lyx::cap::dirtyTabularStack;
@@ -1054,14 +1055,14 @@ bool InsetTabular::getStatus(LCursor & cur, FuncRequest const & cmd,
 }
 
 
-int InsetTabular::latex(Buffer const & buf, ostream & os,
+int InsetTabular::latex(Buffer const & buf, odocstream & os,
                        OutputParams const & runparams) const
 {
        return tabular.latex(buf, os, runparams);
 }
 
 
-int InsetTabular::plaintext(Buffer const & buf, lyx::odocstream & os,
+int InsetTabular::plaintext(Buffer const & buf, odocstream & os,
                        OutputParams const & runparams) const
 {
        int const dp = runparams.linelen ? runparams.depth : 0;
index 2c4505e1471f68ffd33df603ebe009f5a4924c58..4d9971ec6be5c771aae36d376f31c2acc36a9c8e 100644 (file)
@@ -84,7 +84,7 @@ public:
        ///
        bool display() const { return tabular.isLongTabular(); }
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int plaintext(Buffer const &, lyx::odocstream &,
index 7e6449879f5ecdfff5e637fe2be2f971d0a279f2..5079038526b0f24086fe6fbacc37d66b27c9811c 100644 (file)
@@ -53,6 +53,7 @@
 #include <sstream>
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::pos_type;
 
 using lyx::graphics::PreviewLoader;
@@ -260,7 +261,7 @@ bool InsetText::getStatus(LCursor & cur, FuncRequest const & cmd,
 }
 
 
-int InsetText::latex(Buffer const & buf, ostream & os,
+int InsetText::latex(Buffer const & buf, odocstream & os,
                     OutputParams const & runparams) const
 {
        TexRow texrow;
@@ -269,7 +270,7 @@ int InsetText::latex(Buffer const & buf, ostream & os,
 }
 
 
-int InsetText::plaintext(Buffer const & buf, lyx::odocstream & os,
+int InsetText::plaintext(Buffer const & buf, odocstream & os,
                     OutputParams const & runparams) const
 {
        ParagraphList::const_iterator beg = paragraphs().begin();
index d7d93eedf8d4a8f48e959f9a9ba1c44dafb72a8d..578109343f2f206c7836626f6dc053a4dc8e7f66 100644 (file)
@@ -61,7 +61,7 @@ public:
        ///
        InsetText const * asTextInset() const { return this; }
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int plaintext(Buffer const &, lyx::odocstream &,
index 4b168ca38f1f31f9d94f90e34b326f982ee3c879..ceb90555ba3f6f804755e0157ad7641587b30cc9 100644 (file)
@@ -87,7 +87,7 @@ string const InsetTheorem::editMessage() const
 }
 
 
-int InsetTheorem::latex(Buffer const * buf, ostream & os,
+int InsetTheorem::latex(Buffer const * buf, odocstream & os,
                        OutputParams const & runparams) const
 {
        os << "\\begin{theorem}%\n";
index ed9b88f81c473b138fb1d61720d0c03c2bc0b347..b516d87c316828611a8f268f692d1f428309635a 100644 (file)
@@ -31,7 +31,7 @@ public:
        ///
        void draw(PainterInfo & pi, int x, int y) const;
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        virtual lyx::docstring const editMessage() const;
index c08da017e20598290d13d90e0d26ab212dacbad2..0a454b4e6a5991b62968c30c7458d5652235d6e2 100644 (file)
@@ -21,6 +21,7 @@
 #include "support/std_ostream.h"
 
 using lyx::docstring;
+using lyx::odocstream;
 
 using std::string;
 using std::ostream;
@@ -54,7 +55,7 @@ InsetBase::Code InsetTOC::lyxCode() const
 }
 
 
-int InsetTOC::plaintext(Buffer const & buffer, lyx::odocstream & os,
+int InsetTOC::plaintext(Buffer const & buffer, odocstream & os,
                    OutputParams const &) const
 {
        os << getScreenLabel(buffer) << "\n\n";
index ffceee1cf92e2821b444d48d0e44d4295ee8c638..b6d87341e665010ea62826fce3d6b5372c979b55 100644 (file)
@@ -23,6 +23,7 @@
 #include "support/std_ostream.h"
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::support::subst;
 
 using std::string;
@@ -56,19 +57,20 @@ docstring const InsetUrl::getScreenLabel(Buffer const &) const
 }
 
 
-int InsetUrl::latex(Buffer const &, ostream & os,
+int InsetUrl::latex(Buffer const &, odocstream & os,
                    OutputParams const & runparams) const
 {
-       if (!getOptions().empty())
-               os << getOptions() + ' ';
+       docstring const & name = getParam("name");
+       if (!name.empty())
+               os << name + ' ';
        if (runparams.moving_arg)
                os << "\\protect";
-       os << "\\url{" << getContents() << '}';
+       os << "\\url{" << getParam("target") << '}';
        return 0;
 }
 
 
-int InsetUrl::plaintext(Buffer const &, lyx::odocstream & os,
+int InsetUrl::plaintext(Buffer const &, odocstream & os,
                    OutputParams const &) const
 {
        // FIXME UNICODE
@@ -91,7 +93,7 @@ int InsetUrl::docbook(Buffer const &, ostream & os,
 }
 
 
-int InsetUrl::textString(Buffer const & buf, lyx::odocstream & os,
+int InsetUrl::textString(Buffer const & buf, odocstream & os,
                       OutputParams const & op) const
 {
        return plaintext(buf, os, op);
index a509ea60e1250f17d8e7b9c8601cd12a110444b0..014b7c9c2083a6f1286ff58fb239c71ee40e9256 100644 (file)
@@ -35,7 +35,7 @@ public:
        ///
        bool display() const { return false; }
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int plaintext(Buffer const &, lyx::odocstream &,
index 65cb980c0d9d0ccae860b1f7eb167ff17d948073..7aca1a822155a2f20edb8c40b1df28c74647bff5 100644 (file)
@@ -29,6 +29,7 @@
 #include <sstream>
 
 using lyx::docstring;
+using lyx::odocstream;
 
 using std::istringstream;
 using std::ostream;
@@ -202,15 +203,15 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
 }
 
 
-int InsetVSpace::latex(Buffer const & buf, ostream & os,
+int InsetVSpace::latex(Buffer const & buf, odocstream & os,
                          OutputParams const &) const
 {
-       os << space_.asLatexCommand(buf.params()) << '\n';
+       os << lyx::from_ascii(space_.asLatexCommand(buf.params())) << '\n';
        return 1;
 }
 
 
-int InsetVSpace::plaintext(Buffer const &, lyx::odocstream & os,
+int InsetVSpace::plaintext(Buffer const &, odocstream & os,
                           OutputParams const &) const
 {
        os << "\n\n";
index e96024dd434513950078664f77f338633fcfc3ab..ecfe67cc4dcf79f5beac181d4388f8a4eaf56e85 100644 (file)
@@ -30,7 +30,7 @@ public:
        ///
        void draw(PainterInfo & pi, int x, int y) const;
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int plaintext(Buffer const &, lyx::odocstream &,
index f3903c16d3473b8294ed94538234b092b81d0dbd..06d4bca32ceebcc694a5d5cd39c32e45c944815b 100644 (file)
@@ -32,9 +32,8 @@
 
 #include "support/convert.h"
 
-#include <sstream>
-
 using lyx::docstring;
+using lyx::odocstream;
 
 using std::string;
 using std::endl;
@@ -180,15 +179,15 @@ docstring const InsetWrap::editMessage() const
 }
 
 
-int InsetWrap::latex(Buffer const & buf, ostream & os,
+int InsetWrap::latex(Buffer const & buf, odocstream & os,
                     OutputParams const & runparams) const
 {
-       os << "\\begin{floating" << params_.type << '}';
+       os << "\\begin{floating" << lyx::from_ascii(params_.type) << '}';
        if (!params_.placement.empty())
-               os << '[' << params_.placement << ']';
-       os << '{' << params_.width.asLatexString() << "}%\n";
+               os << '[' << lyx::from_ascii(params_.placement) << ']';
+       os << '{' << lyx::from_ascii(params_.width.asLatexString()) << "}%\n";
        int const i = InsetText::latex(buf, os, runparams);
-       os << "\\end{floating" << params_.type << "}%\n";
+       os << "\\end{floating" << lyx::from_ascii(params_.type) << "}%\n";
        return i + 2;
 }
 
index 07541764652367a5496039fe2d2efeb01f4f70f3..516c6ba27ea6f12ea91093a9158f9ff3d5f13070 100644 (file)
@@ -50,7 +50,7 @@ public:
        ///
        InsetBase::Code lyxCode() const { return InsetBase::WRAP_CODE; }
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
        int docbook(Buffer const &, std::ostream &,
index d88289181d3ebc875c0e32f80ba7722f0fce4865..f7ebd00a0a35767ac9cacb6ac4f40cc3645ea291 100644 (file)
@@ -184,7 +184,7 @@ void RenderPreview::startLoading(Buffer const & buffer) const
 }
 
 
-void RenderPreview::addPreview(string const & latex_snippet,
+void RenderPreview::addPreview(docstring const & latex_snippet,
                               Buffer const & buffer)
 {
        if (status() == LyXRC::PREVIEW_OFF)
@@ -195,13 +195,15 @@ void RenderPreview::addPreview(string const & latex_snippet,
 }
 
 
-void RenderPreview::addPreview(string const & latex_snippet,
+void RenderPreview::addPreview(docstring const & latex_snippet,
                               graphics::PreviewLoader & ploader)
 {
        if (status() == LyXRC::PREVIEW_OFF)
                return;
 
-       snippet_ = support::trim(latex_snippet);
+       // FIXME UNICODE
+       // We have to make sure that we call latex with the right encoding
+       snippet_ = support::trim(lyx::to_utf8(latex_snippet));
        if (snippet_.empty())
                return;
 
index ecec3237a0c163069703a006ff7cd60acc11f7b3..672dccc889ecb62a145f2d2d8abea33f0fb524da 100644 (file)
@@ -19,6 +19,7 @@
 #include "render_base.h"
 
 #include "support/FileMonitor.h"
+#include "support/docstring.h"
 
 #include <boost/signal.hpp>
 #include <boost/signals/trackable.hpp>
@@ -56,12 +57,12 @@ public:
        /** Find the PreviewLoader and add a LaTeX snippet to it.
         *  Do not start the loading process.
         */
-       void addPreview(std::string const & latex_snippet, Buffer const &);
+       void addPreview(lyx::docstring const & latex_snippet, Buffer const &);
 
        /** Add a LaTeX snippet to the PreviewLoader.
         *  Do not start the loading process.
         */
-       void addPreview(std::string const & latex_snippet,
+       void addPreview(lyx::docstring const & latex_snippet,
                        lyx::graphics::PreviewLoader & ploader);
 
        /// Begin the loading process.
index cebd9954fb60071e7f9e088e45fd510c69e37006..2ab85fd7b5f7e24ae88e404ad6243b8ee58102b7 100644 (file)
@@ -26,8 +26,7 @@
 
 #include "support/lstrings.h"
 
-#include <sstream>
-
+using lyx::odocstream;
 using lyx::support::ascii_lowercase;
 using lyx::support::bformat;
 using lyx::support::rtrim;
@@ -743,7 +742,7 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont,
 
 /// Writes the head of the LaTeX needed to impose this font
 // Returns number of chars written.
-int LyXFont::latexWriteStartChanges(ostream & os, LyXFont const & base,
+int LyXFont::latexWriteStartChanges(odocstream & os, LyXFont const & base,
                                    LyXFont const & prev) const
 {
        int count = 0;
@@ -763,7 +762,7 @@ int LyXFont::latexWriteStartChanges(ostream & os, LyXFont const & base,
                        string const tmp =
                                subst(lyxrc.language_command_local,
                                      "$$lang", language()->babel());
-                       os << tmp;
+                       os << lyx::from_ascii(tmp);
                        count += tmp.length();
                }
        }
@@ -800,7 +799,7 @@ int LyXFont::latexWriteStartChanges(ostream & os, LyXFont const & base,
        }
        if (f.color() != LColor::inherit && f.color() != LColor::ignore) {
                os << "\\textcolor{"
-                  << lcolor.getLaTeXName(f.color())
+                  << lyx::from_ascii(lcolor.getLaTeXName(f.color()))
                   << "}{";
                count += lcolor.getLaTeXName(f.color()).length() + 13;
                env = true; //We have opened a new environment
@@ -839,7 +838,7 @@ int LyXFont::latexWriteStartChanges(ostream & os, LyXFont const & base,
 /// Writes ending block of LaTeX needed to close use of this font
 // Returns number of chars written
 // This one corresponds to latexWriteStartChanges(). (Asger)
-int LyXFont::latexWriteEndChanges(ostream & os, LyXFont const & base,
+int LyXFont::latexWriteEndChanges(odocstream & os, LyXFont const & base,
                                  LyXFont const & next) const
 {
        int count = 0;
index 8d0d3a26102418fb33c3c2dce3712750ad58d8bf..e5b38c0cde3bb883672a1efaf2354bff85788fcc 100644 (file)
@@ -16,9 +16,8 @@
 #define LYXFONT_H
 
 #include "LColor.h"
+#include "support/docstream.h"
 
-#include <iosfwd>
-#include <string>
 
 class LyXLex;
 class BufferParams;
@@ -295,14 +294,14 @@ public:
            to this font. Returns number of chars written. Base is the
            font state active now.
        */
-       int latexWriteStartChanges(std::ostream &, LyXFont const & base,
+       int latexWriteStartChanges(lyx::odocstream &, LyXFont const & base,
                                   LyXFont const & prev) const;
 
        /** Writes the tail of the LaTeX needed to change to this font.
            Returns number of chars written. Base is the font state we want
            to achieve.
        */
-       int latexWriteEndChanges(std::ostream &, LyXFont const & base,
+       int latexWriteEndChanges(lyx::odocstream &, LyXFont const & base,
                                 LyXFont const & next) const;
 
        /// Build GUI description of font state
index 1c0df28003ef5f48af63335d27c765f18d547064..f0f76de90dc7beb72568ebbc3246c75bee647114 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <sstream>
 
+using lyx::odocstream;
 using lyx::support::bformat;
 
 using std::string;
@@ -75,7 +76,7 @@ void InsetFormulaMacro::write(Buffer const &, ostream & os) const
 }
 
 
-int InsetFormulaMacro::latex(Buffer const &, ostream & os,
+int InsetFormulaMacro::latex(Buffer const &, odocstream & os,
                             OutputParams const & runparams) const
 {
        //lyxerr << "InsetFormulaMacro::latex" << endl;
@@ -85,7 +86,7 @@ int InsetFormulaMacro::latex(Buffer const &, ostream & os,
 }
 
 
-int InsetFormulaMacro::plaintext(Buffer const &, lyx::odocstream & os,
+int InsetFormulaMacro::plaintext(Buffer const &, odocstream & os,
                             OutputParams const &) const
 {
        WriteStream wi(os, false, true);
index 5c0a325957a52c9befa4918acf57ba321465e573..b32ac582341fcf967d799b8f5d404408db875a32 100644 (file)
@@ -44,7 +44,7 @@ public:
        int plaintext(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        ///
-       int latex(Buffer const &, std::ostream & os,
+       int latex(Buffer const &, lyx::odocstream & os,
                  OutputParams const &) const;
        ///
        int docbook(Buffer const &, std::ostream &,
index 57fed3d60425a14a195ea698cc9e3b48f3203923..967904dc87ef728c91f1f764692803c21e4b1c16 100644 (file)
@@ -20,8 +20,9 @@
 
 #include <boost/current_function.hpp>
 
+using lyx::odocstream;
+
 using std::string;
-using std::ostream;
 using std::endl;
 
 
@@ -44,8 +45,10 @@ MathArray const & InsetMath::cell(idx_type) const
 void InsetMath::dump() const
 {
        lyxerr << "---------------------------------------------" << endl;
-       WriteStream wi(lyxerr, false, true);
+       lyx::odocstringstream os;
+       WriteStream wi(os, false, true);
        write(wi);
+       lyxerr << lyx::to_utf8(os.str());
        lyxerr << "\n---------------------------------------------" << endl;
 }
 
@@ -131,7 +134,16 @@ string InsetMath::name() const
 }
 
 
-ostream & operator<<(ostream & os, MathAtom const & at)
+std::ostream & operator<<(std::ostream & os, MathAtom const & at)
+{
+       lyx::odocstringstream oss;
+       WriteStream wi(oss, false, false);
+       at->write(wi);
+       return os << lyx::to_utf8(oss.str());
+}
+
+
+odocstream & operator<<(odocstream & os, MathAtom const & at)
 {
        WriteStream wi(os, false, false);
        at->write(wi);
index 91a1d1d86b1a537458db663e70e4c0b53b2b1fec..40d54df7b0b69c2a07c41608ac563204a75715e5 100644 (file)
@@ -17,8 +17,6 @@
 
 #include "insets/insetbase.h"
 
-#include <string>
-
 enum HullType {
        hullNone,
        hullSimple,
@@ -198,7 +196,10 @@ public:
        virtual bool allowedIn(mode_type mode) const { return mode == MATH_MODE; }
 };
 
+///
 std::ostream & operator<<(std::ostream &, MathAtom const &);
+///
+lyx::odocstream & operator<<(lyx::odocstream &, MathAtom const &);
 
 // initialize math
 void initMath();
index a001ff413292120ebc161339650ffda37c85d19f..070517924deb1d624162ec7c1277bb1fb7710745 100644 (file)
@@ -22,7 +22,6 @@ using lyx::docstring;
 
 using std::string;
 using std::auto_ptr;
-using std::ostringstream;
 
 
 CommandInset::CommandInset(string const & name)
@@ -80,10 +79,10 @@ docstring const CommandInset::screenLabel() const
 
 string const CommandInset::createDialogStr(string const & name) const
 {
-       ostringstream os;
-       os << name << " LatexCommand ";
+       lyx::odocstringstream os;
+       os << lyx::from_ascii(name) << " LatexCommand ";
        WriteStream ws(os);
        write(ws);
        ws << "\n\\end_inset\n\n";
-       return os.str();
+       return lyx::to_utf8(os.str());
 }
index 63d96f6a3ef8833ca1f9fab8801a7d3a786dfc46..8c160fc63961ba36078bd0485311020cd285990b 100644 (file)
@@ -44,7 +44,6 @@ using std::string;
 using std::auto_ptr;
 using std::istream;
 using std::istringstream;
-using std::ostringstream;
 using std::vector;
 
 
@@ -60,12 +59,12 @@ public:
        ///
        virtual string const inset2string(Buffer const &) const
        {
-               ostringstream data;
+               lyx::odocstringstream data;
                //data << name() << " active_cell " << inset.getActCell() << '\n';
-               data << name() << " active_cell " << 0 << '\n';
+               data << lyx::from_utf8(name()) << " active_cell " << 0 << '\n';
                WriteStream ws(data);
                inset_.write(ws);
-               return data.str();
+               return lyx::to_utf8(data.str());
        }
 
 protected:
index 4a640da966943ebef6204bfaaef9a912401e2b90..d8666be8bbd78495d8e599ca94fe1b8ed9f3706f 100644 (file)
@@ -61,6 +61,8 @@
 #include <sstream>
 
 using lyx::docstring;
+using lyx::odocstream;
+using lyx::odocstringstream;
 using lyx::cap::grabAndEraseSelection;
 using lyx::support::bformat;
 using lyx::support::subst;
@@ -360,7 +362,7 @@ void InsetMathHull::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
        if (display()) {
                InsetMathGrid::metricsT(mi, dim);
        } else {
-               ostringstream os;
+               odocstringstream os;
                WriteStream wi(os, false, true);
                write(wi);
                dim.wid = os.str().size();
@@ -375,7 +377,7 @@ void InsetMathHull::drawT(TextPainter & pain, int x, int y) const
        if (display()) {
                InsetMathGrid::drawT(pain, x, y);
        } else {
-               ostringstream os;
+               odocstringstream os;
                WriteStream wi(os, false, true);
                write(wi);
                pain.draw(x, y, os.str().c_str());
@@ -385,9 +387,9 @@ void InsetMathHull::drawT(TextPainter & pain, int x, int y) const
 
 namespace {
 
-string const latex_string(InsetMathHull const & inset)
+docstring const latex_string(InsetMathHull const & inset)
 {
-       ostringstream ls;
+       odocstringstream ls;
        WriteStream wi(ls, false, false);
        inset.write(wi);
        return ls.str();
@@ -399,7 +401,7 @@ string const latex_string(InsetMathHull const & inset)
 void InsetMathHull::addPreview(lyx::graphics::PreviewLoader & ploader) const
 {
        if (RenderPreview::status() == LyXRC::PREVIEW_ON) {
-               string const snippet = latex_string(*this);
+               docstring const snippet = latex_string(*this);
                preview_->addPreview(snippet, ploader);
        }
 }
@@ -409,7 +411,7 @@ bool InsetMathHull::notifyCursorLeaves(LCursor & cur)
 {
        if (RenderPreview::status() == LyXRC::PREVIEW_ON) {
                Buffer const & buffer = cur.buffer();
-               string const snippet = latex_string(*this);
+               docstring const snippet = latex_string(*this);
                preview_->addPreview(snippet, buffer);
                preview_->startLoading(buffer);
        }
@@ -951,12 +953,13 @@ void InsetMathHull::check() const
 
 void InsetMathHull::doExtern(LCursor & cur, FuncRequest & func)
 {
-       string lang;
-       string extra;
-       istringstream iss(lyx::to_utf8(func.argument()));
-       iss >> lang >> extra;
+       docstring dlang;
+       docstring extra;
+       lyx::idocstringstream iss(func.argument());
+       iss >> dlang >> extra;
        if (extra.empty())
-               extra = "noextra";
+               extra = lyx::from_ascii("noextra");
+       string const lang = lyx::to_ascii(dlang);
 
 #ifdef WITH_WARNINGS
 #warning temporarily disabled
@@ -1412,9 +1415,11 @@ bool InsetMathHull::searchForward(BufferView * bv, string const & str,
 
 void InsetMathHull::write(Buffer const &, std::ostream & os) const
 {
-       WriteStream wi(os, false, false);
-       os << "Formula ";
+       odocstringstream oss;
+       WriteStream wi(oss, false, false);
+       oss << "Formula ";
        write(wi);
+       os << lyx::to_utf8(oss.str());
 }
 
 
@@ -1426,7 +1431,7 @@ void InsetMathHull::read(Buffer const &, LyXLex & lex)
 }
 
 
-int InsetMathHull::plaintext(Buffer const &, lyx::odocstream & os,
+int InsetMathHull::plaintext(Buffer const &, odocstream & os,
                        OutputParams const &) const
 {
        if (0 && display()) {
@@ -1440,11 +1445,8 @@ int InsetMathHull::plaintext(Buffer const &, lyx::odocstream & os,
                //metrics();
                return tpain.textheight();
        } else {
-               std::ostringstream oss;
-               WriteStream wi(oss, false, true);
+               WriteStream wi(os, false, true);
                wi << cell(0);
-               // FIXME UNICODE
-               os << lyx::from_utf8(oss.str());
                return wi.line();
        }
 }
@@ -1453,7 +1455,8 @@ int InsetMathHull::plaintext(Buffer const &, lyx::odocstream & os,
 int InsetMathHull::docbook(Buffer const & buf, ostream & os,
                          OutputParams const & runparams) const
 {
-       MathMLStream ms(os);
+       odocstringstream oss;
+       MathMLStream ms(oss);
        int res = 0;
        string name;
        if (getType() == hullSimple)
@@ -1466,7 +1469,7 @@ int InsetMathHull::docbook(Buffer const & buf, ostream & os,
                bname += " id=\"" + sgml::cleanID(buf, runparams, label(0)) + "\"";
        ms << MTag(bname.c_str());
 
-       ostringstream ls;
+       odocstringstream ls;
        if (runparams.flavor == OutputParams::XML) {
                ms << MTag("alt role=\"tex\" ");
                // Workaround for db2latex: db2latex always includes equations with
@@ -1474,7 +1477,7 @@ int InsetMathHull::docbook(Buffer const & buf, ostream & os,
                // so we strip LyX' math environment
                WriteStream wi(ls, false, false);
                InsetMathGrid::write(wi);
-               ms << subst(subst(ls.str(), "&", "&amp;"), "<", "&lt;");
+               ms << subst(subst(lyx::to_utf8(ls.str()), "&", "&amp;"), "<", "&lt;");
                ms << ETag("alt");
                ms << MTag("math");
                InsetMathGrid::mathmlize(ms);
@@ -1482,7 +1485,7 @@ int InsetMathHull::docbook(Buffer const & buf, ostream & os,
        } else {
                ms << MTag("alt role=\"tex\"");
                res = latex(buf, ls, runparams);
-               ms << subst(subst(ls.str(), "&", "&amp;"), "<", "&lt;");
+               ms << subst(subst(lyx::to_utf8(ls.str()), "&", "&amp;"), "<", "&lt;");
                ms << ETag("alt");
        }
 
@@ -1498,11 +1501,12 @@ int InsetMathHull::docbook(Buffer const & buf, ostream & os,
                ms << "\">";
 
        ms << ETag(name.c_str());
+       os << lyx::to_utf8(oss.str());
        return ms.line() + res;
 }
 
 
-int InsetMathHull::textString(Buffer const & buf, lyx::odocstream & os,
+int InsetMathHull::textString(Buffer const & buf, odocstream & os,
                       OutputParams const & op) const
 {
        return plaintext(buf, os, op);
index 37ed78429df07bd4c4bf398ee7d1124d2df9d87e..7f32029a269b8904d872ba85868409b41219c9bf 100644 (file)
@@ -79,7 +79,7 @@ void InsetMathMBox::write(WriteStream & ws) const
 }
 
 
-int InsetMathMBox::latex(Buffer const & buf, std::ostream & os,
+int InsetMathMBox::latex(Buffer const & buf, odocstream & os,
                        OutputParams const & runparams) const
 {
        os << "\\mbox{\n";
index 305d88fd186204b91f91b44abecf7755fc2d61b9..339ee668d9b2d53c8bc1ffdce7d25b0e6f4c7379 100644 (file)
@@ -36,7 +36,7 @@ public:
        ///
        void write(WriteStream & os) const;
        ///
-       int latex(Buffer const &, std::ostream & os,
+       int latex(Buffer const &, lyx::odocstream & os,
                        OutputParams const & runparams) const;
        ///
        LyXText * getText(int) const;
index ccda9eb5493c75088c5be0a1e756a9098a8d1206..6951c248a43e44fbb556606edec2c10d278981a7 100644 (file)
@@ -62,6 +62,7 @@
 
 using lyx::CoordCache;
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::Point;
 
 using lyx::cap::copySelection;
@@ -208,13 +209,15 @@ bool InsetMathNest::idxLast(LCursor & cur) const
 
 void InsetMathNest::dump() const
 {
-       WriteStream os(lyxerr);
+       lyx::odocstringstream oss;
+       WriteStream os(oss);
        os << "---------------------------------------------\n";
        write(os);
        os << "\n";
        for (idx_type i = 0, n = nargs(); i != n; ++i)
                os << cell(i) << "\n";
        os << "---------------------------------------------\n";
+       lyxerr << lyx::to_utf8(oss.str());
 }
 
 
@@ -348,7 +351,7 @@ void InsetMathNest::normalize(NormalStream & os) const
 }
 
 
-int InsetMathNest::latex(Buffer const &, std::ostream & os,
+int InsetMathNest::latex(Buffer const &, odocstream & os,
                        OutputParams const & runparams) const
 {
        WriteStream wi(os, runparams.moving_arg, true);
index f00db9781325bfb641ef74cd98631ce51627d1e7..4810bf16ce3984e8a517ca286df6279335c092f1 100644 (file)
@@ -93,7 +93,7 @@ public:
        /// writes [, name(), and args in []
        void normalize(NormalStream & os) const;
        ///
-       int latex(Buffer const &, std::ostream & os,
+       int latex(Buffer const &, lyx::odocstream & os,
                        OutputParams const & runparams) const;
 
 protected:
index 6b94f12ec0175f956090949f1879918091c5ca1c..1b995587b1ad37d2caf4f57b39b46a167f5f54b4 100644 (file)
@@ -29,6 +29,8 @@
 
 #include <boost/assert.hpp>
 
+using lyx::odocstream;
+
 using std::abs;
 using std::endl;
 using std::min;
@@ -106,17 +108,21 @@ void MathArray::erase(size_type pos1, size_type pos2)
 
 void MathArray::dump2() const
 {
-       NormalStream ns(lyxerr);
+       lyx::odocstringstream os;
+       NormalStream ns(os);
        for (const_iterator it = begin(); it != end(); ++it)
                ns << *it << ' ';
+       lyxerr << lyx::to_utf8(os.str());
 }
 
 
 void MathArray::dump() const
 {
-       NormalStream ns(lyxerr);
+       lyx::odocstringstream os;
+       NormalStream ns(os);
        for (const_iterator it = begin(); it != end(); ++it)
                ns << '<' << *it << '>';
+       lyxerr << lyx::to_utf8(os.str());
 }
 
 
@@ -444,3 +450,20 @@ int MathArray::yo(BufferView & bv) const
 {
        return bv.coordCache().getArrays().y(this);
 }
+
+
+std::ostream & operator<<(std::ostream & os, MathArray const & ar)
+{
+       lyx::odocstringstream oss;
+       NormalStream ns(oss);
+       ns << ar;
+       return os << lyx::to_utf8(oss.str());
+}
+
+
+odocstream & operator<<(odocstream & os, MathArray const & ar)
+{
+       NormalStream ns(os);
+       ns << ar;
+       return os;
+}
index eb0441106acc0be336afcc44b214322d6453d7d1..9b679ad211aaec81d2dc3d2b020498309bb769e1 100644 (file)
 #ifndef MATH_DATA_H
 #define MATH_DATA_H
 
-#include <iosfwd>
 #include <vector>
 
 #include "MathAtom.h"
 #include "dimension.h"
 
+#include "support/docstream.h"
+
 class BufferView;
 class LaTeXFeatures;
 class ReplaceData;
@@ -157,6 +158,8 @@ private:
 
 ///
 std::ostream & operator<<(std::ostream & os, MathArray const & ar);
+///
+lyx::odocstream & operator<<(lyx::odocstream & os, MathArray const & ar);
 
 
 #endif
index 41fba8c55b4599a376c492ae81f94ed31fd41ee0..0a35bd979951f3435d1f9b40ca8fc084ad6ea37d 100644 (file)
@@ -40,6 +40,9 @@
 #include <algorithm>
 #include <sstream>
 
+using lyx::docstring;
+using lyx::odocstream;
+using lyx::odocstringstream;
 using lyx::support::cmd_ret;
 using lyx::support::getVectorFromString;
 using lyx::support::libFileSearch;
@@ -54,19 +57,10 @@ using std::find_if;
 using std::auto_ptr;
 using std::istringstream;
 using std::ostream;
-using std::ostringstream;
 using std::swap;
 using std::vector;
 
 
-ostream & operator<<(ostream & os, MathArray const & ar)
-{
-       NormalStream ns(os);
-       ns << ar;
-       return os;
-}
-
-
 // define a function for tests
 typedef bool TestItemFunc(MathAtom const &);
 
@@ -1053,12 +1047,13 @@ namespace {
                return string::npos;
        }
 
-       MathArray pipeThroughMaxima(string const &, MathArray const & ar)
+       MathArray pipeThroughMaxima(docstring const &, MathArray const & ar)
        {
-               ostringstream os;
+               lyx::odocstringstream os;
                MaximaStream ms(os);
                ms << ar;
-               string expr = os.str();
+               // FIXME UNICODE Is utf8 encoding correct?
+               string expr = lyx::to_utf8(os.str());
                string const header = "simpsum:true;";
 
                string out;
@@ -1147,7 +1142,7 @@ namespace {
        }
 
 
-       MathArray pipeThroughMaple(string const & extra, MathArray const & ar)
+       MathArray pipeThroughMaple(docstring const & extra, MathArray const & ar)
        {
                string header = "readlib(latex):\n";
 
@@ -1178,12 +1173,13 @@ namespace {
                //      " := subs((\\'_\\' = \\'`\\_`\\',eval(`latex/latex/symbol`)): ";
 
                string trailer = "quit;";
-               ostringstream os;
+               lyx::odocstringstream os;
                MapleStream ms(os);
                ms << ar;
-               string expr = os.str();
+               // FIXME UNICODE Is utf8 encoding correct?
+               string expr = lyx::to_utf8(os.str());
                lyxerr << "ar: '" << ar << "'\n"
-                      << "ms: '" << os.str() << "'" << endl;
+                      << "ms: '" << expr << "'" << endl;
 
                for (int i = 0; i < 100; ++i) { // at most 100 attempts
                        // try to fix missing '*' the hard way by using mint
@@ -1212,7 +1208,8 @@ namespace {
                        expr.insert(pos, 1, '*');
                }
 
-               string full = "latex(" +  extra + '(' + expr + "));";
+               // FIXME UNICODE Is utf8 encoding correct?
+               string full = "latex(" + lyx::to_utf8(extra) + '(' + expr + "));";
                string out = captureOutput("maple -q", header + full + trailer);
 
                // change \_ into _
@@ -1224,12 +1221,13 @@ namespace {
        }
 
 
-       MathArray pipeThroughOctave(string const &, MathArray const & ar)
+       MathArray pipeThroughOctave(docstring const &, MathArray const & ar)
        {
-               ostringstream os;
+               lyx::odocstringstream os;
                OctaveStream vs(os);
                vs << ar;
-               string expr = os.str();
+               // FIXME UNICODE Is utf8 encoding correct?
+               string expr = lyx::to_utf8(os.str());
                string out;
 
                lyxerr << "pipe: ar: '" << ar << "'\n"
@@ -1341,12 +1339,13 @@ namespace {
        }
 
 
-       MathArray pipeThroughMathematica(string const &, MathArray const & ar)
+       MathArray pipeThroughMathematica(docstring const &, MathArray const & ar)
        {
-               ostringstream os;
+               lyx::odocstringstream os;
                MathematicaStream ms(os);
                ms << ar;
-               string const expr = os.str();
+               // FIXME UNICODE Is utf8 encoding correct?
+               string const expr = lyx::to_utf8(os.str());
                string out;
 
                lyxerr << "expr: '" << expr << "'" << endl;
@@ -1378,7 +1377,7 @@ namespace {
 }
 
 
-MathArray pipeThroughExtern(string const & lang, string const & extra,
+MathArray pipeThroughExtern(string const & lang, docstring const & extra,
        MathArray const & ar)
 {
        if (lang == "octave")
@@ -1394,12 +1393,13 @@ MathArray pipeThroughExtern(string const & lang, string const & extra,
                return pipeThroughMathematica(extra, ar);
 
        // create normalized expression
-       ostringstream os;
+       lyx::odocstringstream os;
        NormalStream ns(os);
        os << '[' << extra << ' ';
        ns << ar;
        os << ']';
-       string data = os.str();
+       // FIXME UNICODE Is utf8 encoding correct?
+       string data = lyx::to_utf8(os.str());
 
        // search external script
        string file = libFileSearch("mathed", "extern_" + lang);
index 33c710a170ead7d55c8fa028ca80768f6e113af7..1c623a8f6fa3207ea67077b538df74260d75e2de 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef MATH_EXTERN_H
 #define MATH_EXTERN_H
 
-#include <string>
+#include "support/docstring.h"
 
 
 class NormalStream;
@@ -35,7 +35,7 @@ void octave(MathArray const &, OctaveStream &);
 bool extractNumber(MathArray const & ar, int & i);
 bool extractNumber(MathArray const & ar, double & i);
 
-MathArray pipeThroughExtern(std::string const & lang, std::string const & extra,
+MathArray pipeThroughExtern(std::string const & lang, lyx::docstring const & extra,
        MathArray const & ar);
 
 #endif
index c519b4c39c9af07b440c416472555b6fb1197995..d320e81d9fad93e21cb5e2693e885edfb7e9d327 100644 (file)
@@ -18,7 +18,7 @@
 
 using std::strlen;
 
-using std::ostream;
+using lyx::odocstream;
 
 
 namespace {
@@ -31,13 +31,13 @@ namespace {
 }
 
 
-WriteStream::WriteStream(ostream & os, bool fragile, bool latex)
+WriteStream::WriteStream(odocstream & os, bool fragile, bool latex)
        : os_(os), fragile_(fragile), firstitem_(false), latex_(latex),
          pendingspace_(false), line_(0)
 {}
 
 
-WriteStream::WriteStream(ostream & os)
+WriteStream::WriteStream(odocstream & os)
        : os_(os), fragile_(false), firstitem_(false), latex_(false),
          pendingspace_(false), line_(0)
 {}
@@ -120,7 +120,7 @@ WriteStream & operator<<(WriteStream & ws, unsigned int i)
 //////////////////////////////////////////////////////////////////////
 
 
-MathMLStream::MathMLStream(ostream & os)
+MathMLStream::MathMLStream(odocstream & os)
        : os_(os), tab_(0), line_(0), lastchar_(0)
 {}
 
index ab4bef8f5b639c75a956f7d887a2f14939d033b8..0b967d9706c8be13cea539fdc9262fb58c806724 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "metricsinfo.h"
 
-#include <iosfwd>
+#include "support/docstream.h"
 
 class MathArray;
 class InsetMath;
@@ -32,9 +32,9 @@ class MathAtom;
 class WriteStream {
 public:
        ///
-       WriteStream(std::ostream & os, bool fragile, bool latex);
+       WriteStream(lyx::odocstream & os, bool fragile, bool latex);
        ///
-       explicit WriteStream(std::ostream & os);
+       explicit WriteStream(lyx::odocstream & os);
        ///
        ~WriteStream();
        ///
@@ -44,7 +44,7 @@ public:
        ///
        bool latex() const { return latex_; }
        ///
-       std::ostream & os() { return os_; }
+       lyx::odocstream & os() { return os_; }
        ///
        bool & firstitem() { return firstitem_; }
        ///
@@ -55,7 +55,7 @@ public:
        bool pendingSpace() const { return pendingspace_; }
 private:
        ///
-       std::ostream & os_;
+       lyx::odocstream & os_;
        /// do we have to write \\protect sometimes
        bool fragile_;
        /// are we at the beginning of an MathArray?
@@ -106,11 +106,11 @@ public:
 class MathMLStream {
 public:
        ///
-       explicit MathMLStream(std::ostream & os);
+       explicit MathMLStream(lyx::odocstream & os);
        ///
        void cr();
        ///
-       std::ostream & os() { return os_; }
+       lyx::odocstream & os() { return os_; }
        ///
        int line() const { return line_; }
        ///
@@ -119,7 +119,7 @@ public:
        friend MathMLStream & operator<<(MathMLStream &, char const *);
 private:
        ///
-       std::ostream & os_;
+       lyx::odocstream & os_;
        ///
        int tab_;
        ///
@@ -150,12 +150,12 @@ MathMLStream & operator<<(MathMLStream &, ETag const &);
 class NormalStream {
 public:
        ///
-       explicit NormalStream(std::ostream & os) : os_(os) {}
+       explicit NormalStream(lyx::odocstream & os) : os_(os) {}
        ///
-       std::ostream & os() { return os_; }
+       lyx::odocstream & os() { return os_; }
 private:
        ///
-       std::ostream & os_;
+       lyx::odocstream & os_;
 };
 
 ///
@@ -178,12 +178,12 @@ NormalStream & operator<<(NormalStream &, int);
 class MapleStream {
 public:
        ///
-       explicit MapleStream(std::ostream & os) : os_(os) {}
+       explicit MapleStream(lyx::odocstream & os) : os_(os) {}
        ///
-       std::ostream & os() { return os_; }
+       lyx::odocstream & os() { return os_; }
 private:
        ///
-       std::ostream & os_;
+       lyx::odocstream & os_;
 };
 
 
@@ -207,12 +207,12 @@ MapleStream & operator<<(MapleStream &, int);
 class MaximaStream {
 public:
        ///
-       explicit MaximaStream(std::ostream & os) : os_(os) {}
+       explicit MaximaStream(lyx::odocstream & os) : os_(os) {}
        ///
-       std::ostream & os() { return os_; }
+       lyx::odocstream & os() { return os_; }
 private:
        ///
-       std::ostream & os_;
+       lyx::odocstream & os_;
 };
 
 
@@ -236,12 +236,12 @@ MaximaStream & operator<<(MaximaStream &, int);
 class MathematicaStream {
 public:
        ///
-       explicit MathematicaStream(std::ostream & os) : os_(os) {}
+       explicit MathematicaStream(lyx::odocstream & os) : os_(os) {}
        ///
-       std::ostream & os() { return os_; }
+       lyx::odocstream & os() { return os_; }
 private:
        ///
-       std::ostream & os_;
+       lyx::odocstream & os_;
 };
 
 
@@ -265,12 +265,12 @@ MathematicaStream & operator<<(MathematicaStream &, int);
 class OctaveStream {
 public:
        ///
-       explicit OctaveStream(std::ostream & os) : os_(os) {}
+       explicit OctaveStream(lyx::odocstream & os) : os_(os) {}
        ///
-       std::ostream & os() { return os_; }
+       lyx::odocstream & os() { return os_; }
 private:
        ///
-       std::ostream & os_;
+       lyx::odocstream & os_;
 };
 
 ///
index b546e76720d74e8317c7f90681a1fed9108d8e45..b133375411767a99a7500ee556fe888ec048cedc 100644 (file)
@@ -183,9 +183,11 @@ void MathMacroTemplate::read(Buffer const &, LyXLex & lex)
 
 void MathMacroTemplate::write(Buffer const &, std::ostream & os) const
 {
-       WriteStream wi(os, false, false);
-       os << "FormulaMacro\n";
+       lyx::odocstringstream oss;
+       WriteStream wi(oss, false, false);
+       oss << "FormulaMacro\n";
        write(wi);
+       os << lyx::to_utf8(oss.str());
 }
 
 
index 21af399570d454d640046e20b3487cb7cad74e1e..ef7c4dc58442f7836e860212b3ae75e8ecf02914 100644 (file)
@@ -12,7 +12,6 @@
 
 #include "MathStream.h"
 #include "MathMLStream.h"
-#include "support/std_ostream.h"
 
 using std::string;
 
@@ -26,41 +25,47 @@ WriteStream & operator<<(WriteStream & ws, string const & s)
 
 NormalStream & operator<<(NormalStream & ns, string const & s)
 {
-       ns.os() << s;
+       // FIXME UNICODE
+       ns.os() << lyx::from_utf8(s);
        return ns;
 }
 
 
 MapleStream & operator<<(MapleStream & ms, string const & s)
 {
-       ms.os() << s;
+       // FIXME UNICODE
+       ms.os() << lyx::from_utf8(s);
        return ms;
 }
 
 
 MaximaStream & operator<<(MaximaStream & ms, string const & s)
 {
-       ms.os() << s;
+       // FIXME UNICODE
+       ms.os() << lyx::from_utf8(s);
        return ms;
 }
 
 
 MathematicaStream & operator<<(MathematicaStream & ms, string const & s)
 {
-       ms.os() << s;
+       // FIXME UNICODE
+       ms.os() << lyx::from_utf8(s);
        return ms;
 }
 
 
 MathMLStream & operator<<(MathMLStream & ms, string const & s)
 {
-       ms.os() << s;
+       // FIXME UNICODE
+       ms.os() << lyx::from_utf8(s);
        return ms;
 }
 
 
 OctaveStream & operator<<(OctaveStream & os, string const & s)
 {
-       os.os() << s;
+       // FIXME UNICODE
+       os.os() << lyx::from_utf8(s);
        return os;
 }
index 983c3c76379f56587a5d83dc16448a58f0043794..23ad7351b88fa130943e922fb97ca378f2ec7029 100644 (file)
@@ -671,10 +671,11 @@ void augmentFont(LyXFont & font, string const & name)
 
 string asString(MathArray const & ar)
 {
-       std::ostringstream os;
+       lyx::odocstringstream os;
        WriteStream ws(os);
        ws << ar;
-       return os.str();
+       // FIXME UNICODE
+       return lyx::to_utf8(os.str());
 }
 
 
@@ -686,17 +687,19 @@ void asArray(docstring const & str, MathArray & ar)
 
 string asString(InsetMath const & inset)
 {
-       std::ostringstream os;
+       lyx::odocstringstream os;
        WriteStream ws(os);
        inset.write(ws);
-       return os.str();
+       // FIXME UNICODE
+       return lyx::to_utf8(os.str());
 }
 
 
 string asString(MathAtom const & at)
 {
-       std::ostringstream os;
+       lyx::odocstringstream os;
        WriteStream ws(os);
        at->write(ws);
-       return os.str();
+       // FIXME UNICODE
+       return lyx::to_utf8(os.str());
 }
index 79180784e8430561612a2ee6e261ee3fb0c0d43a..089a41f5c33eda38f28a59bf78449a35ce404326 100644 (file)
 #include "support/std_ostream.h"
 
 
+using lyx::char_type;
+
+
 TextPainter::TextPainter(int xmax, int ymax)
        : xmax_(xmax), ymax_(ymax), data_(xmax_ * (ymax_ + 1), ' ')
 {}
 
 
-char & TextPainter::at(int x, int y)
+char_type & TextPainter::at(int x, int y)
 {
        return data_[y * xmax_ + x];
 }
 
 
-char TextPainter::at(int x, int y) const
+char_type TextPainter::at(int x, int y) const
 {
        return data_[y * xmax_ + x];
 }
 
 
-void TextPainter::draw(int x, int y, char const * str)
+void TextPainter::draw(int x, int y, char_type const * str)
 {
        //cerr << "drawing string '" << str << "' at " << x << ',' << y << endl;
        for (int i = 0; *str && x + i < xmax_; ++i, ++str)
@@ -40,21 +43,21 @@ void TextPainter::draw(int x, int y, char const * str)
 }
 
 
-void TextPainter::horizontalLine(int x, int y, int n, char c)
+void TextPainter::horizontalLine(int x, int y, int n, char_type c)
 {
        for (int i = 0; i < n && i + x < xmax_; ++i)
                at(x + i, y) = c;
 }
 
 
-void TextPainter::verticalLine(int x, int y, int n, char c)
+void TextPainter::verticalLine(int x, int y, int n, char_type c)
 {
        for (int i = 0; i < n && i + y < ymax_; ++i)
                at(x, y + i) = c;
 }
 
 
-void TextPainter::draw(int x, int y, char c)
+void TextPainter::draw(int x, int y, char_type c)
 {
        //cerr << "drawing char '" << c << "' at " << x << ',' << y << endl;
        at(x, y) = c;
index 261500d55007137181dacdf0cce3c7fb65ef156d..3f25496b1a52819dc25a5ef7448829d1bb4a3846 100644 (file)
@@ -32,25 +32,25 @@ class TextPainter {
                ///
                TextPainter(int xmax, int ymax);
                ///
-               void draw(int x, int y, char const * str);
+               void draw(int x, int y, lyx::char_type const * str);
                ///
-               void draw(int x, int y, char c);
+               void draw(int x, int y, lyx::char_type c);
                ///
                void show(lyx::odocstream & os, int offset = 0) const;
                ///
                int textheight() const { return ymax_; }
                ///
-               void horizontalLine(int x, int y, int len, char c = '-');
+               void horizontalLine(int x, int y, int len, lyx::char_type c = '-');
                ///
-               void verticalLine(int x, int y, int len, char c = '|');
+               void verticalLine(int x, int y, int len, lyx::char_type c = '|');
 
        private:
                ///
-               typedef std::vector<char> data_type;
+               typedef std::vector<lyx::char_type> data_type;
                ///
-               char at(int x, int y) const;
+               lyx::char_type at(int x, int y) const;
                ///
-               char & at(int x, int y);
+               lyx::char_type & at(int x, int y);
 
                /// xsize of the painter area
                int xmax_;
index 24662e52f2c564dc3d4e70a94585891e7dacc3b8..0cde7bef10d2fc287709e367001901f57feffcd8 100644 (file)
@@ -33,7 +33,7 @@
 using lyx::support::subst;
 
 using std::endl;
-using std::ostream;
+using lyx::odocstream;
 using std::string;
 
 
@@ -43,14 +43,14 @@ ParagraphList::const_iterator
 TeXEnvironment(Buffer const & buf,
               ParagraphList const & paragraphs,
               ParagraphList::const_iterator pit,
-              ostream & os, TexRow & texrow,
+              odocstream & os, TexRow & texrow,
               OutputParams const & runparams);
 
 ParagraphList::const_iterator
 TeXOnePar(Buffer const & buf,
          ParagraphList const & paragraphs,
          ParagraphList::const_iterator pit,
-         ostream & os, TexRow & texrow,
+         odocstream & os, TexRow & texrow,
          OutputParams const & runparams,
          string const & everypar = string());
 
@@ -59,7 +59,7 @@ ParagraphList::const_iterator
 TeXDeeper(Buffer const & buf,
          ParagraphList const & paragraphs,
          ParagraphList::const_iterator pit,
-         ostream & os, TexRow & texrow,
+         odocstream & os, TexRow & texrow,
          OutputParams const & runparams)
 {
        lyxerr[Debug::LATEX] << "TeXDeeper...     " << &*pit << endl;
@@ -82,14 +82,14 @@ TeXDeeper(Buffer const & buf,
 
 
 int latexOptArgInsets(Buffer const & buf, Paragraph const & par,
-                     ostream & os, OutputParams const & runparams, int number);
+                     odocstream & os, OutputParams const & runparams, int number);
 
 
 ParagraphList::const_iterator
 TeXEnvironment(Buffer const & buf,
               ParagraphList const & paragraphs,
               ParagraphList::const_iterator pit,
-              ostream & os, TexRow & texrow,
+              odocstream & os, TexRow & texrow,
               OutputParams const & runparams)
 {
        lyxerr[Debug::LATEX] << "TeXEnvironment...     " << &*pit << endl;
@@ -108,16 +108,20 @@ TeXEnvironment(Buffer const & buf,
 
                if (!lyxrc.language_command_end.empty() &&
                    previous_language->babel() != doc_language->babel()) {
-                       os << subst(lyxrc.language_command_end, "$$lang",
-                                   previous_language->babel())
+                       os << lyx::from_ascii(subst(
+                               lyxrc.language_command_end,
+                               "$$lang",
+                               previous_language->babel()))
                           << endl;
                        texrow.newline();
                }
 
                if (lyxrc.language_command_end.empty() ||
                    language->babel() != doc_language->babel()) {
-                       os << subst(lyxrc.language_command_begin, "$$lang",
-                                   language->babel())
+                       os << lyx::from_ascii(subst(
+                               lyxrc.language_command_begin,
+                               "$$lang",
+                               language->babel()))
                           << endl;
                        texrow.newline();
                }
@@ -125,14 +129,15 @@ TeXEnvironment(Buffer const & buf,
 
        bool leftindent_open = false;
        if (!pit->params().leftIndent().zero()) {
-               os << "\\begin{LyXParagraphLeftIndent}{" <<
-                       pit->params().leftIndent().asLatexString() << "}\n";
+               os << "\\begin{LyXParagraphLeftIndent}{"
+                  << lyx::from_ascii(pit->params().leftIndent().asLatexString())
+                  << "}\n";
                texrow.newline();
                leftindent_open = true;
        }
 
        if (style->isEnvironment()) {
-               os << "\\begin{" << style->latexname() << '}';
+               os << "\\begin{" << lyx::from_ascii(style->latexname()) << '}';
                if (style->optionalargs > 0) {
                        int ret = latexOptArgInsets(buf, *pit, os, runparams,
                                                    style->optionalargs);
@@ -142,13 +147,15 @@ TeXEnvironment(Buffer const & buf,
                        }
                }
                if (style->latextype == LATEX_LIST_ENVIRONMENT) {
-                       os << "{" << pit->params().labelWidthString() << "}\n";
+                       // FIXME UNICODE
+                       os << '{'
+                          << lyx::from_utf8(pit->params().labelWidthString())
+                          << "}\n";
                } else if (style->labeltype == LABEL_BIBLIO) {
                        // ale970405
-                       // FIXME UNICODE
-                       os << '{' << lyx::to_utf8(bibitemWidest(buf)) << "}\n";
+                       os << '{' << bibitemWidest(buf) << "}\n";
                } else
-                       os << style->latexparam() << '\n';
+                       os << lyx::from_ascii(style->latexparam()) << '\n';
                texrow.newline();
        }
        ParagraphList::const_iterator par = pit;
@@ -190,7 +197,7 @@ TeXEnvironment(Buffer const & buf,
                 && par->params().leftIndent() == pit->params().leftIndent());
 
        if (style->isEnvironment()) {
-               os << "\\end{" << style->latexname() << "}\n";
+               os << "\\end{" << lyx::from_ascii(style->latexname()) << "}\n";
                texrow.newline();
        }
 
@@ -206,7 +213,7 @@ TeXEnvironment(Buffer const & buf,
 
 
 int latexOptArgInsets(Buffer const & buf, Paragraph const & par,
-                     ostream & os, OutputParams const & runparams, int number)
+                     odocstream & os, OutputParams const & runparams, int number)
 {
        int lines = 0;
 
@@ -228,7 +235,7 @@ ParagraphList::const_iterator
 TeXOnePar(Buffer const & buf,
          ParagraphList const & paragraphs,
          ParagraphList::const_iterator pit,
-         ostream & os, TexRow & texrow,
+         odocstream & os, TexRow & texrow,
          OutputParams const & runparams_in,
          string const & everypar)
 {
@@ -266,8 +273,9 @@ TeXOnePar(Buffer const & buf,
                if (!lyxrc.language_command_end.empty() &&
                    previous_language->babel() != doc_language->babel())
                {
-                       os << subst(lyxrc.language_command_end, "$$lang",
-                                   previous_language->babel())
+                       os << lyx::from_ascii(subst(lyxrc.language_command_end,
+                               "$$lang",
+                               previous_language->babel()))
                           << endl;
                        texrow.newline();
                }
@@ -275,8 +283,10 @@ TeXOnePar(Buffer const & buf,
                if (lyxrc.language_command_end.empty() ||
                    language->babel() != doc_language->babel())
                {
-                       os << subst(lyxrc.language_command_begin, "$$lang",
-                                   language->babel())
+                       os << lyx::from_ascii(subst(
+                               lyxrc.language_command_begin,
+                               "$$lang",
+                               language->babel()))
                           << endl;
                        texrow.newline();
                }
@@ -285,7 +295,7 @@ TeXOnePar(Buffer const & buf,
        if (bparams.inputenc == "auto" &&
            language->encoding() != previous_language->encoding()) {
                os << "\\inputencoding{"
-                  << language->encoding()->latexName()
+                  << lyx::from_ascii(language->encoding()->latexName())
                   << "}\n";
                texrow.newline();
        }
@@ -302,7 +312,8 @@ TeXOnePar(Buffer const & buf,
                        && (pit == paragraphs.begin()
                            || !boost::prior(pit)->hasSameLayout(*pit)))
                {
-                       os << pit->params().spacing().writeEnvirBegin() << '\n';
+                       os << lyx::from_ascii(pit->params().spacing().writeEnvirBegin())
+                           << '\n';
                        texrow.newline();
                }
 
@@ -319,7 +330,7 @@ TeXOnePar(Buffer const & buf,
 
        switch (style->latextype) {
        case LATEX_COMMAND:
-               os << '\\' << style->latexname();
+               os << '\\' << lyx::from_ascii(style->latexname());
 
                // Separate handling of optional argument inset.
                if (style->optionalargs > 0) {
@@ -331,7 +342,7 @@ TeXOnePar(Buffer const & buf,
                        }
                }
                else
-                       os << style->latexparam();
+                       os << lyx::from_ascii(style->latexparam());
                break;
        case LATEX_ITEM_ENVIRONMENT:
        case LATEX_LIST_ENVIRONMENT:
@@ -344,7 +355,8 @@ TeXOnePar(Buffer const & buf,
                break;
        }
 
-       os << everypar;
+       // FIXME UNICODE
+       os << lyx::from_utf8(everypar);
        bool need_par = pit->simpleTeXOnePar(buf, bparams,
                                             outerFont(std::distance(paragraphs.begin(), pit), paragraphs),
                                             os, texrow, runparams);
@@ -374,7 +386,7 @@ TeXOnePar(Buffer const & buf,
            && !is_command) {
                if (!need_par)
                        os << '{';
-               os << "\\" << font.latexSize() << " \\par}";
+               os << "\\" << lyx::from_ascii(font.latexSize()) << " \\par}";
        } else if (need_par) {
                os << "\\par}";
        } else if (is_command)
@@ -421,7 +433,8 @@ TeXOnePar(Buffer const & buf,
                        && (boost::next(pit) == paragraphs.end()
                            || !boost::next(pit)->hasSameLayout(*pit)))
                {
-                       os << pit->params().spacing().writeEnvirEnd() << '\n';
+                       os << lyx::from_ascii(pit->params().spacing().writeEnvirEnd())
+                          << '\n';
                        texrow.newline();
                }
        }
@@ -433,14 +446,16 @@ TeXOnePar(Buffer const & buf,
                // float.
 
                if (lyxrc.language_command_end.empty())
-                       os << subst(lyxrc.language_command_begin,
-                                   "$$lang",
-                                   doc_language->babel())
+                       os << lyx::from_ascii(subst(
+                               lyxrc.language_command_begin,
+                               "$$lang",
+                               doc_language->babel()))
                           << endl;
                else
-                       os << subst(lyxrc.language_command_end,
-                                   "$$lang",
-                                   language->babel())
+                       os << lyx::from_ascii(subst(
+                               lyxrc.language_command_end,
+                               "$$lang",
+                               language->babel()))
                           << endl;
                texrow.newline();
        }
@@ -465,7 +480,7 @@ TeXOnePar(Buffer const & buf,
 // LaTeX all paragraphs
 void latexParagraphs(Buffer const & buf,
                     ParagraphList const & paragraphs,
-                    ostream & os,
+                    odocstream & os,
                     TexRow & texrow,
                     OutputParams const & runparams,
                     string const & everypar)
@@ -506,18 +521,18 @@ void latexParagraphs(Buffer const & buf,
                                        was_title = true;
                                        if (tclass.titletype() == TITLE_ENVIRONMENT) {
                                                os << "\\begin{"
-                                                   << tclass.titlename()
+                                                   << lyx::from_ascii(tclass.titlename())
                                                    << "}\n";
                                                texrow.newline();
                                        }
                                }
                        } else if (was_title && !already_title) {
                                if (tclass.titletype() == TITLE_ENVIRONMENT) {
-                                       os << "\\end{" << tclass.titlename()
+                                       os << "\\end{" << lyx::from_ascii(tclass.titlename())
                                            << "}\n";
                                }
                                else {
-                                       os << "\\" << tclass.titlename()
+                                       os << "\\" << lyx::from_ascii(tclass.titlename())
                                            << "\n";
                                }
                                texrow.newline();
@@ -547,11 +562,11 @@ void latexParagraphs(Buffer const & buf,
        // It might be that we only have a title in this document
        if (was_title && !already_title) {
                if (tclass.titletype() == TITLE_ENVIRONMENT) {
-                       os << "\\end{" << tclass.titlename()
+                       os << "\\end{" << lyx::from_ascii(tclass.titlename())
                            << "}\n";
                }
                else {
-                       os << "\\" << tclass.titlename()
+                       os << "\\" << lyx::from_ascii(tclass.titlename())
                            << "\n";
                                }
                texrow.newline();
index f2a47b0de31e4ca81e261b1646b0bd4f5698af44..05e2572d0784516415f77fd240145e38a4af81f2 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "ParagraphList_fwd.h"
 
-#include <string>
+#include "support/docstream.h"
 
 class Buffer;
 class OutputParams;
@@ -24,7 +24,7 @@ class TexRow;
 
 void latexParagraphs(Buffer const & buf,
                     ParagraphList const & paragraphs,
-                    std::ostream & ofs,
+                    lyx::odocstream & ofs,
                     TexRow & texrow,
                     OutputParams const &,
                     std::string const & everypar = std::string());
index e95e838932e4acefacfcb0516fdffc80281a23a9..038ea5d539a3bfd8e232f95c33b8f2ee7df5dab1 100644 (file)
@@ -55,6 +55,7 @@
 #include <sstream>
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::pos_type;
 using lyx::char_type;
 
@@ -743,7 +744,7 @@ string const corrected_env(string const & suffix, string const & env,
 
 // This could go to ParagraphParameters if we want to
 int Paragraph::startTeXParParams(BufferParams const & bparams,
-                                ostream & os, bool moving_arg) const
+                                odocstream & os, bool moving_arg) const
 {
        int column = 0;
 
@@ -780,7 +781,7 @@ int Paragraph::startTeXParParams(BufferParams const & bparams,
                        output = corrected_env("\\begin", "flushleft", ownerCode());
                else
                        output = corrected_env("\\begin", "flushright", ownerCode());
-               os << output;
+               os << lyx::from_ascii(output);
                column += output.size();
                break;
        } case LYX_ALIGN_RIGHT: {
@@ -789,13 +790,13 @@ int Paragraph::startTeXParParams(BufferParams const & bparams,
                        output = corrected_env("\\begin", "flushright", ownerCode());
                else
                        output = corrected_env("\\begin", "flushleft", ownerCode());
-               os << output;
+               os << lyx::from_ascii(output);
                column += output.size();
                break;
        } case LYX_ALIGN_CENTER: {
                string output;
                output = corrected_env("\\begin", "center", ownerCode());
-               os << output;
+               os << lyx::from_ascii(output);
                column += output.size();
                break;
        }
@@ -807,7 +808,7 @@ int Paragraph::startTeXParParams(BufferParams const & bparams,
 
 // This could go to ParagraphParameters if we want to
 int Paragraph::endTeXParParams(BufferParams const & bparams,
-                              ostream & os, bool moving_arg) const
+                              odocstream & os, bool moving_arg) const
 {
        int column = 0;
 
@@ -839,7 +840,7 @@ int Paragraph::endTeXParParams(BufferParams const & bparams,
                        output = corrected_env("\\par\\end", "flushleft", ownerCode());
                else
                        output = corrected_env("\\par\\end", "flushright", ownerCode());
-               os << output;
+               os << lyx::from_ascii(output);
                column += output.size();
                break;
        } case LYX_ALIGN_RIGHT: {
@@ -848,13 +849,13 @@ int Paragraph::endTeXParParams(BufferParams const & bparams,
                        output = corrected_env("\\par\\end", "flushright", ownerCode());
                else
                        output = corrected_env("\\par\\end", "flushleft", ownerCode());
-               os << output;
+               os << lyx::from_ascii(output);
                column += output.size();
                break;
        } case LYX_ALIGN_CENTER: {
                string output;
                output = corrected_env("\\par\\end", "center", ownerCode());
-               os << output;
+               os << lyx::from_ascii(output);
                column += output.size();
                break;
        }
@@ -868,7 +869,7 @@ int Paragraph::endTeXParParams(BufferParams const & bparams,
 bool Paragraph::simpleTeXOnePar(Buffer const & buf,
                                BufferParams const & bparams,
                                LyXFont const & outerfont,
-                               ostream & os, TexRow & texrow,
+                               odocstream & os, TexRow & texrow,
                                OutputParams const & runparams) const
 {
        lyxerr[Debug::LATEX] << "SimpleTeXOnePar...     " << this << endl;
@@ -1178,6 +1179,8 @@ pos_type Paragraph::getFirstWord(Buffer const & buf, ostream & os, OutputParams
                                break;
                        bool ws;
                        string str;
+                       // FIXME UNICODE
+                       // sgml::escapeChar takes a char, not lyx::char_type
                        boost::tie(ws, str) = sgml::escapeChar(c);
 
                        os << str;
@@ -1241,6 +1244,8 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
                        value_type c = getChar(i);
                        bool ws;
                        string str;
+                       // FIXME UNICODE
+                       // sgml::escapeChar takes a char, not lyx::char_type
                        boost::tie(ws, str) = sgml::escapeChar(c);
 
                        if (style->pass_thru)
index aad01e8d048912fe7376e3c38f31c1354b1f9d8e..92aa012dd7e27839d445d70b07342cc5bcbad101 100644 (file)
@@ -24,9 +24,6 @@
 
 #include "insets/insetbase.h" // only for InsetBase::Code
 
-#include "support/types.h"
-
-#include <string>
 
 class Buffer;
 class BufferParams;
@@ -126,15 +123,15 @@ public:
        void validate(LaTeXFeatures &) const;
 
        ///
-       int startTeXParParams(BufferParams const &, std::ostream &, bool) const;
+       int startTeXParParams(BufferParams const &, lyx::odocstream &, bool) const;
 
        ///
-       int endTeXParParams(BufferParams const &, std::ostream &, bool) const;
+       int endTeXParParams(BufferParams const &, lyx::odocstream &, bool) const;
 
 
        ///
        bool simpleTeXOnePar(Buffer const &, BufferParams const &,
-                            LyXFont const & outerfont, std::ostream &,
+                            LyXFont const & outerfont, lyx::odocstream &,
                             TexRow & texrow, OutputParams const &) const;
 
        /// Can we drop the standard paragraph wrapper?
index 8796129d436017045b5479272b21cf2a089380aa..51bbd4ffa42830c0ac57c1fcce589a320965a631 100644 (file)
 
 #include <boost/next_prior.hpp>
 
+using lyx::docstring;
+using lyx::odocstream;
 using lyx::pos_type;
 
 using std::endl;
 using std::upper_bound;
 using std::lower_bound;
 using std::string;
-using std::ostream;
 
 
 // Initialization of the counter for the paragraph id's,
@@ -45,15 +46,15 @@ namespace {
 
 struct special_phrase {
        string phrase;
-       string macro;
+       docstring macro;
        bool builtin;
 };
 
-special_phrase special_phrases[] = {
-       { "LyX", "\\LyX{}", false },
-       { "TeX", "\\TeX{}", true },
-       { "LaTeX2e", "\\LaTeXe{}", true },
-       { "LaTeX", "\\LaTeX{}", true },
+special_phrase const special_phrases[] = {
+       { "LyX", lyx::from_ascii("\\LyX{}"), false },
+       { "TeX", lyx::from_ascii("\\TeX{}"), true },
+       { "LaTeX2e", lyx::from_ascii("\\LaTeXe{}"), true },
+       { "LaTeX", lyx::from_ascii("\\LaTeX{}"), true },
 };
 
 size_t const phrases_nr = sizeof(special_phrases)/sizeof(special_phrase);
@@ -346,7 +347,7 @@ int Paragraph::Pimpl::erase(pos_type start, pos_type end)
 }
 
 
-void Paragraph::Pimpl::simpleTeXBlanks(ostream & os, TexRow & texrow,
+void Paragraph::Pimpl::simpleTeXBlanks(odocstream & os, TexRow & texrow,
                                       pos_type const i,
                                       unsigned int & column,
                                       LyXFont const & font,
@@ -410,7 +411,7 @@ bool Paragraph::Pimpl::isTextAt(string const & str, pos_type pos) const
 
 void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
                                             BufferParams const & bparams,
-                                            ostream & os,
+                                            odocstream & os,
                                             TexRow & texrow,
                                             OutputParams const & runparams,
                                             LyXFont & font,
@@ -427,13 +428,9 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
        if (style.pass_thru) {
                if (c != Paragraph::META_INSET) {
                        if (c != '\0')
-                               os << c;
-               } else {
-                       lyx::odocstringstream oss;
-                       owner_->getInset(i)->plaintext(buf, oss, runparams);
-                       // FIXME UNICODE
-                       os << lyx::to_utf8(oss.str());
-               }
+                               os.put(c);
+               } else
+                       owner_->getInset(i)->plaintext(buf, os, runparams);
                return;
        }
 
@@ -491,7 +488,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
                }
 
                bool close = false;
-               ostream::pos_type const len = os.tellp();
+               odocstream::pos_type const len = os.tellp();
 
                if ((inset->lyxCode() == InsetBase::GRAPHICS_CODE
                     || inset->lyxCode() == InsetBase::MATH_CODE
index 0187490187b3aaad3f97a01ae9b49396f2fd211b..a1d223e5d88702d9c487cda89e206b0acb828488 100644 (file)
@@ -126,14 +126,14 @@ public:
        FontList fontlist;
 
        ///
-       void simpleTeXBlanks(std::ostream &, TexRow & texrow,
+       void simpleTeXBlanks(lyx::odocstream &, TexRow & texrow,
                             lyx::pos_type const i,
                             unsigned int & column,
                             LyXFont const & font,
                             LyXLayout const & style);
        ///
        void simpleTeXSpecialChars(Buffer const &, BufferParams const &,
-                                  std::ostream &, TexRow & texrow,
+                                  lyx::odocstream &, TexRow & texrow,
                                   OutputParams const &,
                                   LyXFont & font, LyXFont & running_font,
                                   LyXFont & basefont,
index 204d5fd4040e94b5bcd6114b0bb85a7a1770e5c3..16a055426f80406df83159a39a761103fb698391 100644 (file)
@@ -210,6 +210,10 @@ void RowPainter::paintHebrewComposeChar(pos_type & vpos, LyXFont const & font)
                        if (isPrintableNonspace(c)) {
                                int const width2 =
                                        text_.singleWidth(par_, i, c, text_.getFont(par_, i));
+                               // FIXME UNICODE
+                               // This does not work anymore, and non-ascii
+                               // characters in source files are forbidden
+                               // anyway.
                                // dalet / resh
                                dx = (c == 'ø' || c == 'ã')
                                        ? width2 - width
index 578eb85f3941160965c663a025e021009914f59d..0036da8753450fe25a3c43883aea04b32ed9c303 100644 (file)
@@ -622,13 +622,15 @@ string const rsplit(string const & a, string & piece, char delim)
 
 // This function escapes 8-bit characters and other problematic
 // characters that cause problems in latex labels.
-string const escape(string const & lab)
+docstring const escape(docstring const & lab)
 {
-       char hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
+       lyx::char_type hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
                              '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
-       string enc;
-       for (string::size_type i = 0; i < lab.length(); ++i) {
-               unsigned char c= lab[i];
+       docstring enc;
+       for (docstring::size_type i = 0; i < lab.length(); ++i) {
+               lyx::char_type c= lab[i];
+               // FIXME We must change the following algorithm for UCS4
+               // chars, but that will be a file format change.
                if (c >= 128 || c == '=' || c == '%') {
                        enc += '=';
                        enc += hexdigit[c>>4];
index 2f61aaa8f4b1ed8b743c5af5e8b582c028e21372..00016c3932c32e3259ab48a646ea985834d04404 100644 (file)
@@ -201,7 +201,7 @@ std::string const split(std::string const & a, char delim);
 std::string const rsplit(std::string const & a, std::string & piece, char delim);
 
 /// Escapes non ASCII chars
-std::string const escape(std::string const & lab);
+lyx::docstring const escape(lyx::docstring const & lab);
 
 /// gives a vector of stringparts which have the delimiter delim
 std::vector<std::string> const getVectorFromString(std::string const & str,
index 8779aeee8d1b9507cbe2a60db3e27add1169bc84..374e5d25be3559e9357634f6c63c68b068948c20 100644 (file)
@@ -64,7 +64,7 @@ iconv_convert(iconv_t * cd,
 
        char ICONV_CONST * inbuf = const_cast<char ICONV_CONST *>(reinterpret_cast<char const *>(buf));
        size_t inbytesleft = buflen * sizeof(InType);
-       size_t const outsize = 1000;
+       size_t const outsize = 10000;
        static char out[outsize];
        char * outbuf = out;
        size_t outbytesleft = outsize;
index bb28318de32bba4404cc46029793065e9159755d..9a25921ee9d830e51983133d31ca4cea9b26ccc2 100644 (file)
@@ -38,6 +38,7 @@
 #include <sstream>
 
 using lyx::docstring;
+using lyx::odocstream;
 using lyx::support::ltrim;
 using lyx::support::prefixIs;
 using lyx::support::rtrim;
@@ -1827,7 +1828,7 @@ bool LyXTabular::isPartOfMultiColumn(row_type row, col_type column) const
 }
 
 
-int LyXTabular::TeXTopHLine(ostream & os, row_type row) const
+int LyXTabular::TeXTopHLine(odocstream & os, row_type row) const
 {
        // FIXME: assert or return 0 as in TeXBottomHLine()?
        BOOST_ASSERT(row != npos);
@@ -1863,7 +1864,7 @@ int LyXTabular::TeXTopHLine(ostream & os, row_type row) const
 }
 
 
-int LyXTabular::TeXBottomHLine(ostream & os, row_type row) const
+int LyXTabular::TeXBottomHLine(odocstream & os, row_type row) const
 {
        // FIXME: return 0 or assert as in TeXTopHLine()?
        if (row == npos || row >= rows_)
@@ -1899,7 +1900,7 @@ int LyXTabular::TeXBottomHLine(ostream & os, row_type row) const
 }
 
 
-int LyXTabular::TeXCellPreamble(ostream & os, idx_type cell) const
+int LyXTabular::TeXCellPreamble(odocstream & os, idx_type cell) const
 {
        int ret = 0;
 
@@ -1910,7 +1911,8 @@ int LyXTabular::TeXCellPreamble(ostream & os, idx_type cell) const
        if (isMultiColumn(cell)) {
                os << "\\multicolumn{" << cells_in_multicolumn(cell) << "}{";
                if (!cellinfo_of_cell(cell).align_special.empty()) {
-                       os << cellinfo_of_cell(cell).align_special << "}{";
+                       os << lyx::from_ascii(cellinfo_of_cell(cell).align_special)
+                          << "}{";
                } else {
                        if (leftLine(cell) &&
                                (isFirstCellInRow(cell) ||
@@ -1932,7 +1934,7 @@ int LyXTabular::TeXCellPreamble(ostream & os, idx_type cell) const
                                        break;
                                }
                                os << '{'
-                                  << getPWidth(cell).asLatexString()
+                                  << lyx::from_ascii(getPWidth(cell).asLatexString())
                                   << '}';
                        } else {
                                switch (getAlignment(cell)) {
@@ -1968,7 +1970,8 @@ int LyXTabular::TeXCellPreamble(ostream & os, idx_type cell) const
                        os << 'b';
                        break;
                }
-               os << "]{" << getPWidth(cell).asLatexString() << "}{";
+               os << "]{" << lyx::from_ascii(getPWidth(cell).asLatexString())
+                  << "}{";
        } else if (getUsebox(cell) == BOX_MINIPAGE) {
                os << "\\begin{minipage}[";
                switch (getVAlignment(cell)) {
@@ -1982,14 +1985,15 @@ int LyXTabular::TeXCellPreamble(ostream & os, idx_type cell) const
                        os << 'b';
                        break;
                }
-               os << "]{" << getPWidth(cell).asLatexString() << "}\n";
+               os << "]{" << lyx::from_ascii(getPWidth(cell).asLatexString())
+                  << "}\n";
                ++ret;
        }
        return ret;
 }
 
 
-int LyXTabular::TeXCellPostamble(ostream & os, idx_type cell) const
+int LyXTabular::TeXCellPostamble(odocstream & os, idx_type cell) const
 {
        int ret = 0;
 
@@ -2011,7 +2015,7 @@ int LyXTabular::TeXCellPostamble(ostream & os, idx_type cell) const
 }
 
 
-int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const & buf,
+int LyXTabular::TeXLongtableHeaderFooter(odocstream & os, Buffer const & buf,
                                         OutputParams const & runparams) const
 {
        if (!is_long_tabular)
@@ -2111,7 +2115,7 @@ bool LyXTabular::isValidRow(row_type row) const
 }
 
 
-int LyXTabular::TeXRow(ostream & os, row_type i, Buffer const & buf,
+int LyXTabular::TeXRow(odocstream & os, row_type i, Buffer const & buf,
                       OutputParams const & runparams) const
 {
        idx_type cell = getCellNumber(i, 0);
@@ -2124,10 +2128,12 @@ int LyXTabular::TeXRow(ostream & os, row_type i, Buffer const & buf,
        } else if(!row_info[i].top_space.zero()) {
                if (use_booktabs)
                        os << "\\addlinespace["
-                          << row_info[i].top_space.asLatexString() << "]\n";
+                          << lyx::from_ascii(row_info[i].top_space.asLatexString())
+                          << "]\n";
                else {
                        os << "\\noalign{\\vskip"
-                          << row_info[i].top_space.asLatexString() << "}\n";
+                          << lyx::from_ascii(row_info[i].top_space.asLatexString())
+                          << "}\n";
                }
                ++ret;
        }
@@ -2165,7 +2171,9 @@ int LyXTabular::TeXRow(ostream & os, row_type i, Buffer const & buf,
        } else if (!row_info[i].bottom_space.zero()) {
                if (use_booktabs)
                        os << "\\addlinespace";
-               os << '[' << row_info[i].bottom_space.asLatexString() << ']';
+               os << '['
+                  << lyx::from_ascii(row_info[i].bottom_space.asLatexString())
+                  << ']';
        }
        os << '\n';
        ++ret;
@@ -2178,11 +2186,11 @@ int LyXTabular::TeXRow(ostream & os, row_type i, Buffer const & buf,
        } else if (!row_info[i].interline_space.zero()) {
                if (use_booktabs)
                        os << "\\addlinespace["
-                          << row_info[i].interline_space.asLatexString()
+                          << lyx::from_ascii(row_info[i].interline_space.asLatexString())
                           << "]\n";
                else
                        os << "\\noalign{\\vskip"
-                          << row_info[i].interline_space.asLatexString()
+                          << lyx::from_ascii(row_info[i].interline_space.asLatexString())
                           << "}\n";
                ++ret;
        }
@@ -2190,7 +2198,7 @@ int LyXTabular::TeXRow(ostream & os, row_type i, Buffer const & buf,
 }
 
 
-int LyXTabular::latex(Buffer const & buf, ostream & os,
+int LyXTabular::latex(Buffer const & buf, odocstream & os,
                      OutputParams const & runparams) const
 {
        int ret = 0;
@@ -2209,7 +2217,7 @@ int LyXTabular::latex(Buffer const & buf, ostream & os,
                os << "\\begin{tabular}{";
        for (col_type i = 0; i < columns_; ++i) {
                if (!column_info[i].align_special.empty()) {
-                       os << column_info[i].align_special;
+                       os << lyx::from_ascii(column_info[i].align_special);
                } else {
                        if (!use_booktabs && column_info[i].left_line)
                                os << '|';
@@ -2243,7 +2251,7 @@ int LyXTabular::latex(Buffer const & buf, ostream & os,
                                        break;
                        }
                                os << '{'
-                                  << column_info[i].p_width.asLatexString()
+                                  << lyx::from_ascii(column_info[i].p_width.asLatexString())
                                   << '}';
                        } else {
                                switch (column_info[i].alignment) {
index b650db8717efdc2aa0e1eddc0a28aaa177dbe8df..b1be68f7ff04e6fef9fc7d3dd426a056faef5bfd 100644 (file)
@@ -310,7 +310,7 @@ public:
        ///
        void read(Buffer const &, LyXLex &);
        ///
-       int latex(Buffer const &, std::ostream &,
+       int latex(Buffer const &, lyx::odocstream &,
                  OutputParams const &) const;
        //
        int docbook(Buffer const & buf, std::ostream & os,
@@ -587,20 +587,20 @@ public:
        ///
        // helper function for Latex returns number of newlines
        ///
-       int TeXTopHLine(std::ostream &, row_type row) const;
+       int TeXTopHLine(lyx::odocstream &, row_type row) const;
        ///
-       int TeXBottomHLine(std::ostream &, row_type row) const;
+       int TeXBottomHLine(lyx::odocstream &, row_type row) const;
        ///
-       int TeXCellPreamble(std::ostream &, idx_type cell) const;
+       int TeXCellPreamble(lyx::odocstream &, idx_type cell) const;
        ///
-       int TeXCellPostamble(std::ostream &, idx_type cell) const;
+       int TeXCellPostamble(lyx::odocstream &, idx_type cell) const;
        ///
-       int TeXLongtableHeaderFooter(std::ostream &, Buffer const & buf,
+       int TeXLongtableHeaderFooter(lyx::odocstream &, Buffer const & buf,
                                     OutputParams const &) const;
        ///
        bool isValidRow(row_type const row) const;
        ///
-       int TeXRow(std::ostream &, row_type const row, Buffer const & buf,
+       int TeXRow(lyx::odocstream &, row_type const row, Buffer const & buf,
                   OutputParams const &) const;
        ///
        // helper function for ASCII returns number of newlines