]> git.lyx.org Git - features.git/commitdiff
Rationalise includes
authorGuillaume Munch <gm@lyx.org>
Sun, 19 Jun 2016 02:39:38 +0000 (03:39 +0100)
committerGuillaume Munch <gm@lyx.org>
Mon, 4 Jul 2016 00:42:17 +0000 (02:42 +0200)
Modifying TexRow.h or texstream.h no longer triggers the recompilation of the
complete source tree.

69 files changed:
src/Buffer.cpp
src/Buffer.h
src/BufferParams.cpp
src/Changes.cpp
src/Changes.h
src/Compare.cpp
src/Converter.h
src/Cursor.cpp
src/Font.cpp
src/Format.cpp
src/LaTeXFonts.cpp
src/PDFOptions.cpp
src/Paragraph.cpp
src/TexRow.cpp
src/TexRow.h
src/frontends/qt4/FindAndReplace.cpp
src/frontends/qt4/GuiViewSource.cpp
src/frontends/qt4/GuiViewSource.h
src/graphics/PreviewLoader.cpp
src/graphics/epstools.cpp
src/insets/ExternalSupport.cpp
src/insets/ExternalSupport.h
src/insets/InsetArgument.cpp
src/insets/InsetBibtex.cpp
src/insets/InsetBox.cpp
src/insets/InsetCaption.cpp
src/insets/InsetCitation.cpp
src/insets/InsetCommand.cpp
src/insets/InsetExternal.cpp
src/insets/InsetFloat.cpp
src/insets/InsetFloatList.cpp
src/insets/InsetGraphics.cpp
src/insets/InsetHyperlink.cpp
src/insets/InsetIPA.cpp
src/insets/InsetIPAMacro.cpp
src/insets/InsetInclude.cpp
src/insets/InsetIndex.cpp
src/insets/InsetLine.cpp
src/insets/InsetListings.cpp
src/insets/InsetNewline.cpp
src/insets/InsetNewpage.cpp
src/insets/InsetNomencl.cpp
src/insets/InsetPhantom.cpp
src/insets/InsetPreview.cpp
src/insets/InsetQuotes.cpp
src/insets/InsetRef.cpp
src/insets/InsetSeparator.cpp
src/insets/InsetSpace.cpp
src/insets/InsetSpecialChar.cpp
src/insets/InsetTabular.cpp
src/insets/InsetText.cpp
src/insets/InsetVSpace.cpp
src/insets/InsetWrap.cpp
src/lyxfind.cpp
src/mathed/InsetMath.cpp
src/mathed/InsetMath.h
src/mathed/InsetMathGrid.cpp
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathNest.cpp
src/mathed/MacroTable.cpp
src/mathed/MathFactory.cpp
src/mathed/MathMacroTemplate.cpp
src/mathed/MathStream.cpp
src/mathed/MathStream.h
src/mathed/MathSupport.cpp
src/output_latex.cpp
src/tex2lyx/dummy_impl.cpp
src/texstream.cpp
src/texstream.h

index 08f31484fe09e157821cbc0903c7487d0997b99a..a64e4b68eafcdc969deebbf4382e0bc40eee9b43 100644 (file)
@@ -57,6 +57,7 @@
 #include "PDFOptions.h"
 #include "SpellChecker.h"
 #include "sgml.h"
+#include "texstream.h"
 #include "TexRow.h"
 #include "Text.h"
 #include "TextClass.h"
@@ -1684,7 +1685,7 @@ bool Buffer::makeLaTeXFile(FileName const & fname,
        ErrorList & errorList = d->errorLists["Export"];
        errorList.clear();
        bool failed_export = false;
-       otexstream os(ofs, d->texrow);
+       otexstream os(ofs);
 
        // make sure we are ready to export
        // this needs to be done before we validate
@@ -1694,7 +1695,6 @@ bool Buffer::makeLaTeXFile(FileName const & fname,
        updateMacroInstances(OutputUpdate);
 
        try {
-               os.texrow().reset();
                writeLaTeXSource(os, original_path, runparams, output);
        }
        catch (EncodingException const & e) {
@@ -1725,6 +1725,8 @@ bool Buffer::makeLaTeXFile(FileName const & fname,
                lyx_exit(1);
        }
 
+       d->texrow = move(os.texrow());
+
        ofs.close();
        if (ofs.fail()) {
                failed_export = true;
@@ -3715,14 +3717,13 @@ unique_ptr<TexRow> Buffer::getSourceCode(odocstream & os, string const & format,
                        LaTeXFeatures features(*this, params(), runparams);
                        params().validate(features);
                        runparams.use_polyglossia = features.usePolyglossia();
-                       texrow = make_unique<TexRow>();
-                       texrow->newline();
-                       texrow->newline();
                        // latex or literate
-                       otexstream ots(os, *texrow);
-
+                       otexstream ots(os);
+                       // output above
+                       ots.texrow().newlines(2);
                        // the real stuff
                        latexParagraphs(*this, text(), ots, runparams);
+                       texrow = ots.releaseTexRow();
                        texrow->finalize();
 
                        // Restore the parenthood
@@ -3758,13 +3759,13 @@ unique_ptr<TexRow> Buffer::getSourceCode(odocstream & os, string const & format,
                                writeDocBookSource(os, absFileName(), runparams, output);
                } else {
                        // latex or literate
-                       texrow = make_unique<TexRow>();
-                       texrow->newline();
-                       texrow->newline();
-                       otexstream ots(os, *texrow);
+                       otexstream ots(os);
+                       // output above
+                       ots.texrow().newlines(2);
                        if (master)
                                runparams.is_child = true;
                        writeLaTeXSource(ots, string(), runparams, output);
+                       texrow = ots.releaseTexRow();
                        texrow->finalize();
                }
        }
index 7acf1f30428790a587f746b60869c09f72c9e3e9..477a8ac8adb55419abb3f89f4c40a5be068e9849 100644 (file)
@@ -13,7 +13,6 @@
 #define BUFFER_H
 
 #include "OutputEnums.h"
-#include "OutputParams.h"
 
 #include "support/unique_ptr.h"
 #include "support/strfwd.h"
@@ -51,6 +50,7 @@ class MacroData;
 class MacroNameSet;
 class MacroSet;
 class OutputParams;
+class otexstream;
 class Paragraph;
 class ParConstIterator;
 class ParIterator;
@@ -325,13 +325,13 @@ public:
            method with a string stream if the output is supposed to go to a
            file. \code
            ofdocstream ofs;
-           otexstream os(ofs, texrow);
+           otexstream os(ofs);
            ofs.open("test.tex");
            writeLaTeXSource(os, ...);
            ofs.close();
            \endcode is NOT equivalent to \code
            odocstringstream oss;
-           otexstream os(oss, texrow);
+           otexstream os(oss);
            writeLaTeXSource(os, ...);
            ofdocstream ofs;
            ofs.open("test.tex");
index d2218e073db8bab912634fb4eddc83013c6c5407..7af439705a88be4115afa8e269916cd3d9cd594d 100644 (file)
@@ -38,6 +38,7 @@
 #include "LyXRC.h"
 #include "OutputParams.h"
 #include "Spacing.h"
+#include "texstream.h"
 #include "TexRow.h"
 #include "VSpace.h"
 #include "PDFOptions.h"
index 1626f50f393bbb8c0cb6a8e0d82a6769ec73b80c..0d464d8fa26912b47e2dd74c78f2e0c70394366c 100644 (file)
@@ -22,6 +22,7 @@
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 #include "Paragraph.h"
+#include "texstream.h"
 #include "TocBackend.h"
 
 #include "support/debug.h"
index 96383967b96f89fb44b7db096e1804f8c091183c..ea6e4b393155af0ebb5ef3212d4310f1cc168b92 100644 (file)
@@ -21,8 +21,6 @@
 #include "support/types.h"
 #include "support/lyxtime.h"
 
-#include "texstream.h"
-
 #include <vector>
 
 
@@ -32,9 +30,11 @@ class AuthorList;
 class Buffer;
 class DocIterator;
 class OutputParams;
+class otexstream;
 class PainterInfo;
 class FontInfo;
 
+
 class Change {
 public:
        /// the type of change
index 68570b85b5fcee49befc572ec5accf9b3e7bd109..b2f64390f062b37a889431c2a7c23278cf0e5e2b 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "insets/InsetText.h"
 
+#include "support/docstream.h"
 #include "support/lassert.h"
 #include "support/lyxalgo.h"
 #include "support/qstring_helpers.h"
index 9a72d8c708c9c68602650083446671ee0cb88954..082b2d358a97ba821c2f25f5f3a8a4708e71a258 100644 (file)
@@ -29,7 +29,6 @@ class Buffer;
 class ErrorList;
 class Format;
 class Formats;
-class OutputParams;
 
 
 ///
index 2894f9d71f2242cca56fc6a2b915642c819144d3..8d5c63b55e67c182dc658536df9d3914d28805b6 100644 (file)
@@ -31,6 +31,7 @@
 #include "Paragraph.h"
 #include "ParIterator.h"
 #include "Row.h"
+#include "texstream.h"
 #include "Text.h"
 #include "TextMetrics.h"
 #include "TocBackend.h"
@@ -1566,8 +1567,7 @@ void Cursor::normalize()
                        << pos() << ' ' << lastpos() <<  " in idx: " << idx()
                       << " in atom: '";
                odocstringstream os;
-               TexRow texrow(false);
-               otexrowstream ots(os,texrow);
+               otexrowstream ots(os, false);
                WriteStream wi(ots, false, true, WriteStream::wsDefault);
                inset().asInsetMath()->write(wi);
                lyxerr << to_utf8(os.str()) << endl;
index f0814a3a3eb94103dbb8dd202a87595a3da88475..0ca4080db3e52da5a0ccc94424e2035314a6252c 100644 (file)
@@ -25,6 +25,7 @@
 #include "LyXRC.h"
 #include "output_latex.h"
 #include "OutputParams.h"
+#include "texstream.h"
 
 #include "support/lassert.h"
 #include "support/convert.h"
index eba00b95dfd3190a69eceac619c2d1cb93a9afd3..503bfc58ab70833f4453ec7b0d9f36a2a12702c1 100644 (file)
@@ -23,6 +23,7 @@
 #include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/mutex.h"
+#include "support/docstream.h"
 #include "support/os.h"
 #include "support/PathChanger.h"
 #include "support/Systemcall.h"
index 676179f5a5f7fa436e1ee808d54e92049ab761a8..bc4151cb2502cb16c7888b0d0c71dc8db10cb955 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "support/convert.h"
 #include "support/debug.h"
+#include "support/docstream.h"
 #include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/gettext.h"
index 6734beaafa78468d2c4fee5f9da6a2f23c2c886b..77763bef3a378494d12d45fd061b0fdd7ece2b11 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "Encoding.h"
 #include "Lexer.h"
+#include "texstream.h"
 
 #include "support/convert.h"
 #include "support/debug.h"
index c29ca4cb930110e780b8011b19ef7fea4d77a246..507702f90d2a4b4ff769874874fed51587ec5a8f 100644 (file)
@@ -40,6 +40,7 @@
 #include "ParagraphParameters.h"
 #include "SpellChecker.h"
 #include "sgml.h"
+#include "texstream.h"
 #include "TextClass.h"
 #include "TexRow.h"
 #include "Text.h"
@@ -1377,13 +1378,12 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const
                BufferParams const & bp = features.runparams().is_child
                        ? buf.masterParams() : buf.params();
                Font f;
-               TexRow texrow;
                // Using a string stream here circumvents the encoding
                // switching machinery of odocstream. Therefore the
                // output is wrong if this paragraph contains content
                // that needs to switch encoding.
                odocstringstream ods;
-               otexstream os(ods, texrow);
+               otexstream os(ods, false);
                if (is_command) {
                        os << '\\' << from_ascii(layout_->latexname());
                        // we have to provide all the optional arguments here, even though
index 21be0b8e30f69f1eed42ea4273cad5d514746918..4e23cf7641b8834dbefae7a03e2c6553f1247bd6 100644 (file)
@@ -53,7 +53,7 @@ void TexRow::RowEntryList::forceAddEntry(RowEntry const & entry)
 }
 
 
-TexRow::TextEntry TexRow::RowEntryList::getTextEntry() const
+TextEntry TexRow::RowEntryList::getTextEntry() const
 {
        if (text_entry_ < size())
                return operator[](text_entry_).text;
@@ -61,7 +61,7 @@ TexRow::TextEntry TexRow::RowEntryList::getTextEntry() const
 }
 
 
-TexRow::RowEntry TexRow::RowEntryList::entry() const
+RowEntry TexRow::RowEntryList::entry() const
 {
        if (0 < size())
                return operator[](0);
@@ -77,8 +77,8 @@ void TexRow::RowEntryList::append(RowEntryList const & row)
 }
 
 
-TexRow::TextEntry const TexRow::text_none = { -1, 0 };
-TexRow::RowEntry const TexRow::row_none = { false, { TexRow::text_none } };
+TextEntry const TexRow::text_none = { -1, 0 };
+RowEntry const TexRow::row_none = { false, { TexRow::text_none } };
 
 
 bool TexRow::isNone(TextEntry const & t)
@@ -101,7 +101,7 @@ void TexRow::reset(bool enable)
 }
 
 
-TexRow::RowEntry TexRow::textEntry(int id, int pos)
+RowEntry TexRow::textEntry(int id, int pos)
 {
        RowEntry entry;
        entry.is_math = false;
@@ -111,7 +111,7 @@ TexRow::RowEntry TexRow::textEntry(int id, int pos)
 }
 
 
-TexRow::RowEntry TexRow::mathEntry(uid_type id, idx_type cell)
+RowEntry TexRow::mathEntry(uid_type id, idx_type cell)
 {
        RowEntry entry;
        entry.is_math = true;
@@ -121,8 +121,8 @@ TexRow::RowEntry TexRow::mathEntry(uid_type id, idx_type cell)
 }
 
 
-bool operator==(TexRow::RowEntry const & entry1,
-                               TexRow::RowEntry const & entry2)
+bool operator==(RowEntry const & entry1,
+                               RowEntry const & entry2)
 {
        return entry1.is_math == entry2.is_math
                && (entry1.is_math
@@ -216,7 +216,7 @@ bool TexRow::getIdFromRow(int row, int & id, int & pos) const
 }
 
 
-TexRow::RowEntry TexRow::rowEntryFromCursorSlice(CursorSlice const & slice)
+RowEntry TexRow::rowEntryFromCursorSlice(CursorSlice const & slice)
 {
        RowEntry entry;
        InsetMath * insetMath = slice.asInsetMath();
@@ -408,7 +408,7 @@ std::pair<int,int> TexRow::rowFromDocIterator(DocIterator const & dit) const
                // matches either at a deeper level, or at the same level but not
                // before.
                for (size_t i = best_slice; i < n; ++i) {
-                       TexRow::RowEntry entry_i = rowEntryFromCursorSlice(dit[i]);
+                       RowEntry entry_i = rowEntryFromCursorSlice(dit[i]);
                        if (sameParOrInsetMath(*it, entry_i)) {
                                if (comparePos(*it, entry_i) >= 0
                                        && (i > best_slice
index c072ec18ab42e95489af0495f8261cea8cd767aa..9e41b0ab06fa20b7e20df41079c982bf878d41dd 100644 (file)
@@ -46,26 +46,27 @@ typedef void const * uid_type;
 typedef size_t idx_type;
 
 
+/// an individual par id/pos <=> row mapping
+struct TextEntry { int id; int pos; };
+
+/// an individual math id/cell <=> row mapping
+struct MathEntry { uid_type id; idx_type cell; };
+
+/// a container for passing entries around
+struct RowEntry {
+       bool is_math;// true iff the union is a math
+       union {
+               struct TextEntry text;
+               struct MathEntry math;
+       };
+};
+
+
 /// Represents the correspondence between paragraphs and the generated
 /// LaTeX file
 
 class TexRow {
 public:
-       /// an individual par id/pos <=> row mapping
-       struct TextEntry { int id; int pos; };
-
-       /// an individual math id/cell <=> row mapping
-       struct MathEntry { uid_type id; idx_type cell; };
-
-       /// a container for passing entries around
-       struct RowEntry {
-               bool is_math;// true iff the union is a math
-               union {
-                       struct TextEntry text;
-                       struct MathEntry math;
-               };
-       };
-
        // For each row we store a list of one special TextEntry and several
        // RowEntries. (The order is important.)  We only want one text entry
        // because we do not want to store every position in the lyx file. On the
@@ -205,7 +206,7 @@ private:
        bool enabled_;
 };
 
-bool operator==(TexRow::RowEntry const &, TexRow::RowEntry const &);
+bool operator==(RowEntry const &, RowEntry const &);
 
 LyXErr & operator<<(LyXErr &, TexRow &);
 
index ac7084a55b68b7369d0c40b2671cb0e4a76e2ea7..4411074de74749456528c8a19a860a9205cbee01 100644 (file)
@@ -33,6 +33,7 @@
 #include "frontends/alert.h"
 
 #include "support/debug.h"
+#include "support/docstream.h"
 #include "support/filetools.h"
 #include "support/FileName.h"
 #include "support/gettext.h"
index 46dd35884eadc7e9d05dac8ff64caafa350ea0dd..4be43e259e640bde856ad32111de113cc46ec4bc 100644 (file)
@@ -22,6 +22,7 @@
 #include "Cursor.h"
 #include "Format.h"
 #include "Paragraph.h"
+#include "TexRow.h"
 
 #include "support/debug.h"
 #include "support/lassert.h"
index 428da050118e4333f296badd695e00062cbaae1d..dbe36c7ec744d9dfe82f5f2bf4d500daf9acb4ff 100644 (file)
 
 #include "Buffer.h"
 #include "DockView.h"
-#include "TexRow.h"
 
 #include <QDockWidget>
 #include <QString>
 #include <QTimer>
 
+
 class QTextDocument;
 
+
 namespace lyx {
+
+class TexRow;
+
+
 namespace frontend {
 
 class GuiViewSource;
 class LaTeXHighlighter;
 
+
 class ViewSourceWidget : public QWidget, public Ui::ViewSourceUi
 {
        Q_OBJECT
index bc174daa81f902b3c70bbb93131eaae38818edb7..1f78d77c7f13e51a4ccfd3b2db20ba7ba36701f8 100644 (file)
@@ -25,6 +25,7 @@
 #include "output.h"
 #include "OutputParams.h"
 #include "TexRow.h"
+#include "texstream.h"
 
 #include "frontends/Application.h" // hexName
 
@@ -625,8 +626,7 @@ void PreviewLoader::Impl::startLoading(bool wait)
                return;
        }
 
-       TexRow texrow;
-       otexstream os(of, texrow);
+       otexstream os(of);
        OutputParams runparams(&enc);
        LaTeXFeatures features(buffer_, buffer_.params(), runparams);
 
index 17aedfcb0ab7d04ddd0b0a9f423b9c5fcc074294..2fd67dcf8a8b095a7374c56338ea3e6513bd7301 100644 (file)
@@ -26,6 +26,7 @@
 #include "Format.h"
 
 #include "support/debug.h"
+#include "support/docstream.h"
 #include "support/filetools.h"
 #include "support/FileName.h"
 #include "support/regex.h"
index 7ea6d566fda73911d930f81646e9e77f7d024365..f208a953d3b441b6554f98dc3fb3f4364450e26d 100644 (file)
@@ -22,6 +22,7 @@
 #include "Exporter.h"
 #include "Format.h"
 #include "Mover.h"
+#include "texstream.h"
 
 #include "frontends/alert.h"
 
index 1000735fb9208cdaf3fedf11848152c6687fb08f..cd42572137d55ce4f0ccf4029c6537183ee870b1 100644 (file)
 #ifndef EXTERNALSUPPORT_H
 #define EXTERNALSUPPORT_H
 
-#include "texstream.h"
+#include <string>
+
 
 namespace lyx {
 
 class Buffer;
 class ExportData;
 class InsetExternalParams;
+class otexstream;
 
 namespace external {
 
index b65257af978295346dee8a39cd2258a51e1b2392..da807d201a40af30e34192970e0c9c2c1c87be24 100644 (file)
@@ -24,6 +24,8 @@
 #include "Lexer.h"
 #include "OutputParams.h"
 #include "ParIterator.h"
+#include "TexRow.h"
+#include "texstream.h"
 
 #include "support/convert.h"
 #include "support/debug.h"
@@ -268,9 +270,8 @@ void InsetArgument::latexArgument(otexstream & os,
                OutputParams const & runparams_in, docstring const & ldelim,
                docstring const & rdelim, docstring const & presetarg) const
 {
-       TexRow texrow;
        odocstringstream ss;
-       otexstream ots(ss, texrow);
+       otexstream ots(ss);
        OutputParams runparams = runparams_in;
        if (!pass_thru_chars_.empty())
                runparams.pass_thru_chars += pass_thru_chars_;
@@ -281,6 +282,7 @@ void InsetArgument::latexArgument(otexstream & os,
                str = presetarg + sep + str;
        if (ldelim != "{" && support::contains(str, rdelim))
                str = '{' + str + '}';
+       // TODO: append texrow information
        os << ldelim << str << rdelim;
 }
 
index e3202ec5d35285d8eff70b2934f2c1c14bcf7940..13c91b0739e6b5a25cb5b853bd6b6991fbf76cd4 100644 (file)
@@ -27,6 +27,7 @@
 #include "output_xhtml.h"
 #include "OutputParams.h"
 #include "PDFOptions.h"
+#include "texstream.h"
 #include "TextClass.h"
 
 #include "frontends/alert.h"
index ea18afa0d9f2d369f7f10f2dc58565f050f2c878..28d79c08de85cea8355bde442e0fa9230fcff9b9 100644 (file)
@@ -27,6 +27,8 @@
 #include "Lexer.h"
 #include "MetricsInfo.h"
 #include "output_xhtml.h"
+#include "TexRow.h"
+#include "texstream.h"
 #include "TextClass.h"
 
 #include "support/debug.h"
index 05b7dc7766b2b79d0167c286b5989d0dbeebda0f..613249b6b25c28472c2134cbaf795e6ccc58153d 100644 (file)
@@ -32,6 +32,8 @@
 #include "OutputParams.h"
 #include "Paragraph.h"
 #include "ParIterator.h"
+#include "TexRow.h"
+#include "texstream.h"
 #include "TextClass.h"
 #include "TextMetrics.h"
 #include "TocBackend.h"
index 2b9033f42dfc64c362ed5864c00480b1fc0734f0..13fddd7802217c2f6015ee5c87bf2625a5bdfeb9 100644 (file)
@@ -24,6 +24,7 @@
 #include "LaTeXFeatures.h"
 #include "output_xhtml.h"
 #include "ParIterator.h"
+#include "texstream.h"
 #include "TocBackend.h"
 
 #include "support/debug.h"
index fcda3cd2b984175a7cf24169adffb322c2a74095..879d9a35e06c56ead351199a55b8f67bdc787310 100644 (file)
@@ -21,6 +21,7 @@
 #include "FuncStatus.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
+#include "texstream.h"
 
 #include "insets/InsetBox.h"
 #include "insets/InsetBranch.h"
index 5a7a07a8e3ba1af988d4c9a8b5f24986cd4fcab4..1a1974804122a265b2f812c8d9ddb47ca67c437f 100644 (file)
@@ -30,6 +30,7 @@
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 #include "output_latex.h"
+#include "texstream.h"
 #include "TocBackend.h"
 
 #include "frontends/alert.h"
@@ -560,9 +561,8 @@ static bool isPreviewWanted(InsetExternalParams const & params)
 
 static docstring latexString(InsetExternal const & inset)
 {
-       TexRow texrow;
        odocstringstream ods;
-       otexstream os(ods, texrow);
+       otexstream os(ods, false);
        // We don't need to set runparams.encoding since it is not used by
        // latex().
        OutputParams runparams(0);
@@ -730,8 +730,7 @@ int InsetExternal::plaintext(odocstringstream & os,
        if (runparams.for_tooltip)
                return 0;
 
-       TexRow texrow;
-       otexstream ots(os, texrow);
+       otexstream ots(os, false);
        ots << '\n'; // output external material on a new line
        external::writeExternal(params_, "Ascii", buffer(), ots,
                                *(runparams.exportdata), false,
@@ -743,9 +742,8 @@ int InsetExternal::plaintext(odocstringstream & os,
 int InsetExternal::docbook(odocstream & os,
                           OutputParams const & runparams) const
 {
-       TexRow texrow;
        odocstringstream ods;
-       otexstream ots(ods, texrow);
+       otexstream ots(ods, false);
        external::writeExternal(params_, "DocBook", buffer(), ots,
                                *(runparams.exportdata), false,
                                runparams.dryrun || runparams.inComment);
index ae1bf63816325f575032fd1574dfa42f64c80cb2..8d35c646cc5d582360e8d9ac47cbd60b3380cd00 100644 (file)
@@ -29,6 +29,8 @@
 #include "Lexer.h"
 #include "output_xhtml.h"
 #include "ParIterator.h"
+#include "TexRow.h"
+#include "texstream.h"
 #include "TextClass.h"
 
 #include "support/debug.h"
@@ -493,9 +495,8 @@ bool InsetFloat::allowsCaptionVariation(std::string const & newtype) const
 
 docstring InsetFloat::getCaption(OutputParams const & runparams) const
 {
-       TexRow texrow(false);
        odocstringstream ods;
-       otexstream os(ods, texrow);
+       otexstream os(ods, false);
        getCaption(os, runparams);
        return ods.str();
 }
@@ -514,15 +515,14 @@ void InsetFloat::getCaption(otexstream & os,
        ins->getArgs(os, runparams);
 
        os << '[';
-       TexRow texrow;
        odocstringstream ods;
-       otexstream oss(ods, texrow);
+       otexstream oss(ods);
        ins->getArgument(oss, runparams);
        docstring arg = ods.str();
        // Protect ']'
        if (arg.find(']') != docstring::npos)
                arg = '{' + arg + '}';
-       os.append(arg, texrow);
+       os.append(arg, move(oss.texrow()));
        os << ']';
 }
 
index 6deb46ce2d1cff77a86285692994f69a0d0fe8a0..2d9c33d5039ac5c7ae6ba3abaa0f4a270e2deb11 100644 (file)
@@ -26,6 +26,7 @@
 #include "Lexer.h"
 #include "Paragraph.h"
 #include "output_xhtml.h"
+#include "texstream.h"
 #include "TextClass.h"
 #include "TocBackend.h"
 
index dc617fb1773cfc34ae1454c19ee9806244faa0d8..85f1a07c42b59d61a9a0b863043d64da672208b6 100644 (file)
@@ -68,6 +68,7 @@ TODO
 #include "OutputParams.h"
 #include "output_xhtml.h"
 #include "sgml.h"
+#include "texstream.h"
 #include "TocBackend.h"
 
 #include "frontends/alert.h"
index 54f1f2c765338b9b4c5b97d45e11a73a83da7f0e..8b3433c944b0b105afb84800cc1245b470df561e 100644 (file)
@@ -22,6 +22,7 @@
 #include "LaTeXFeatures.h"
 #include "OutputParams.h"
 #include "output_xhtml.h"
+#include "texstream.h"
 
 #include "support/docstream.h"
 #include "support/FileName.h"
index 1da5a24299c2fbc1d106dbbe0e9e144f4093d6cc..387635831537a4c8b97bfec17f6e1addc1259809 100644 (file)
@@ -22,6 +22,7 @@
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 #include "RenderPreview.h"
+#include "texstream.h"
 
 #include "frontends/Painter.h"
 
@@ -120,9 +121,8 @@ void InsetIPA::addPreview(DocIterator const & inset_pos,
 
 void InsetIPA::preparePreview(DocIterator const & pos) const  
 {
-       TexRow texrow;
-       odocstringstream str;  
-       otexstream os(str, texrow);
+       odocstringstream str;
+       otexstream os(str, false);
        OutputParams runparams(&pos.buffer()->params().encoding());
        latex(os, runparams);
        docstring const snippet = str.str();
index fd96a19e746e6a6d93b331a3da92c4e94fcc3aa4..0d7a41b0fb1f325aeb479a77435fccde5933f1e0 100644 (file)
@@ -23,6 +23,7 @@
 #include "Lexer.h"
 #include "MetricsInfo.h"
 #include "output_xhtml.h"
+#include "texstream.h"
 
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
index 1031f3a557ac66f92c9b6f08048123f2b424d147..47c9a613436cb262818da8d226178b8c81b408c4 100644 (file)
@@ -36,6 +36,7 @@
 #include "output_plaintext.h"
 #include "output_xhtml.h"
 #include "OutputParams.h"
+#include "texstream.h"
 #include "TextClass.h"
 #include "TocBackend.h"
 
@@ -1085,9 +1086,8 @@ bool preview_wanted(InsetCommandParams const & params, Buffer const & buffer)
 
 docstring latexString(InsetInclude const & inset)
 {
-       TexRow texrow;
        odocstringstream ods;
-       otexstream os(ods, texrow);
+       otexstream os(ods, false);
        // We don't need to set runparams.encoding since this will be done
        // by latex() anyway.
        OutputParams runparams(0);
index aff40805d4c360002b2093bb1797d6bdece57e77..5c8a9dd78f77a1a615c28a8c441fa4fd9a0087ba 100644 (file)
@@ -28,6 +28,7 @@
 #include "output_latex.h"
 #include "output_xhtml.h"
 #include "sgml.h"
+#include "texstream.h"
 #include "TextClass.h"
 #include "TocBackend.h"
 
@@ -74,9 +75,8 @@ void InsetIndex::latex(otexstream & os, OutputParams const & runparams_in) const
        }
 
        // get contents of InsetText as LaTeX and plaintext
-       TexRow texrow;
        odocstringstream ourlatex;
-       otexstream ots(ourlatex, texrow);
+       otexstream ots(ourlatex);
        InsetText::latex(ots, runparams);
        odocstringstream ourplain;
        InsetText::plaintext(ourplain, runparams);
index 087dba7df2cc8a8fa429d4aaae2f4fec39d2f7dd..73ce5401698bf377a1399ca80074dc18644aee00 100644 (file)
@@ -25,6 +25,7 @@
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 #include "output_xhtml.h"
+#include "texstream.h"
 #include "Text.h"
 
 #include "frontends/FontMetrics.h"
index 91125d8895796518c3fb89f179f56eb525f1bf62..e4b8c7f1eef81d86f710b3203403afe96ea536b2 100644 (file)
@@ -30,6 +30,7 @@
 #include "output_xhtml.h"
 #include "OutputParams.h"
 #include "TextClass.h"
+#include "texstream.h"
 
 #include "support/debug.h"
 #include "support/docstream.h"
@@ -395,9 +396,8 @@ docstring InsetListings::getCaption(OutputParams const & runparams) const
        if (ins == 0)
                return docstring();
 
-       TexRow texrow;
        odocstringstream ods;
-       otexstream os(ods, texrow);
+       otexstream os(ods, false);
        ins->getArgs(os, runparams);
        ins->getArgument(os, runparams);
 
index 99cbf14470cccc343fea6c84824315d1000a2139..411da120eb60120df773d8f9771209d2d57d0c1e 100644 (file)
@@ -21,6 +21,7 @@
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 #include "output_xhtml.h"
+#include "texstream.h"
 
 #include "frontends/Application.h"
 #include "frontends/FontMetrics.h"
index 418bf8b3614e6f4b6d61fe486c1bed9df3efec68..b369ce1b7e7d915f66aa675fd4f88e056219eac9 100644 (file)
@@ -20,6 +20,7 @@
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 #include "output_xhtml.h"
+#include "texstream.h"
 #include "Text.h"
 #include "TextMetrics.h"
 
index f75ef15cd5eb6f5b612489d3d03c8c8eb171ec1a..2595b14a6992b35f04797aae1888718bbc58b53d 100644 (file)
@@ -31,6 +31,7 @@
 #include "OutputParams.h"
 #include "output_xhtml.h"
 #include "sgml.h"
+#include "texstream.h"
 #include "TocBackend.h"
 
 #include "frontends/FontMetrics.h"
index c6efe9a9c93416ddce6259b38d22ac5d73357819..8fb9d949c74cb5ac08216b211f50bbf6f048d6d8 100644 (file)
@@ -28,6 +28,7 @@
 #include "Lexer.h"
 #include "MetricsInfo.h"
 #include "OutputParams.h"
+#include "texstream.h"
 #include "TextClass.h"
 
 #include "support/docstream.h"
index 757774117533ce090ac40595c78baf102ebd0df7..53cfb23266f5b0f442f3382dbddb0edb9cb70b04 100644 (file)
@@ -19,6 +19,7 @@
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 #include "RenderPreview.h"
+#include "texstream.h"
 
 #include "frontends/Painter.h"
 
@@ -81,9 +82,8 @@ void InsetPreview::addPreview(DocIterator const & inset_pos,
 
 void InsetPreview::preparePreview(DocIterator const & pos) const
 {
-       TexRow texrow;
        odocstringstream str;
-       otexstream os(str, texrow);
+       otexstream os(str, false);
        OutputParams runparams(&pos.buffer()->params().encoding());
        latex(os, runparams);
 
index ba5a127564e0c5eb17d6e5d91ad6bcfc40fcfd0a..84e004bb42cb63eb2a5404380354391bd0e3bb8d 100644 (file)
@@ -24,6 +24,7 @@
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 #include "output_xhtml.h"
+#include "texstream.h"
 
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
index 7731ad82422571b8ea3f3fd2c939395570beb6cb..146a85dd492ed2740eda08852e9b2577d3b75547 100644 (file)
@@ -23,6 +23,7 @@
 #include "output_xhtml.h"
 #include "ParIterator.h"
 #include "sgml.h"
+#include "texstream.h"
 #include "TocBackend.h"
 
 #include "support/debug.h"
index 27aeb7c62b6240eb922147777331520c23c30aef..9beda1d0cf80befe67db10ea2a4650e10d22a7f1 100644 (file)
@@ -20,6 +20,7 @@
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 #include "output_xhtml.h"
+#include "texstream.h"
 
 #include "frontends/Application.h"
 #include "frontends/FontMetrics.h"
index 6ab6f9a8d75766055b64657f699e164bd54c912e..7d76f3f62ea0a4dfb2c0bb9fec2c4bbb667ff892 100644 (file)
@@ -27,6 +27,7 @@
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 #include "output_xhtml.h"
+#include "texstream.h"
 
 #include "support/debug.h"
 #include "support/docstream.h"
index 8671d2b7d01ba16dcfe29002e7885b2e5b35818a..3d32f406ea1bc812ac8553c303e8eeb6000c22af 100644 (file)
@@ -20,6 +20,7 @@
 #include "Lexer.h"
 #include "MetricsInfo.h"
 #include "output_xhtml.h"
+#include "texstream.h"
 
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
index 7804232d4df43f008690f2e6fe583a2b1b54dcb0..0834f1a68fa13384e88c4b72e37ecb07e21b1283 100644 (file)
@@ -45,6 +45,8 @@
 #include "Paragraph.h"
 #include "ParagraphParameters.h"
 #include "ParIterator.h"
+#include "TexRow.h"
+#include "texstream.h"
 #include "TextClass.h"
 #include "TextMetrics.h"
 
@@ -2685,8 +2687,7 @@ void Tabular::TeXRow(otexstream & os, row_type row,
 void Tabular::latex(otexstream & os, OutputParams const & runparams) const
 {
        bool const is_tabular_star = !tabular_width.zero();
-       TexRow::RowEntry pos = TexRow::textEntry(runparams.lastid,
-                                                                                        runparams.lastpos);
+       RowEntry pos = TexRow::textEntry(runparams.lastid, runparams.lastpos);
 
        //+---------------------------------------------------------------------
        //+                      first the opening preamble                    +
index 99b1381f93d9961914dfd163d4c58ab0bd247bb7..b67f6b494802bee53430d9d29db8686d0ea30b0b 100644 (file)
@@ -48,6 +48,7 @@
 #include "Row.h"
 #include "sgml.h"
 #include "TexRow.h"
+#include "texstream.h"
 #include "TextClass.h"
 #include "Text.h"
 #include "TextMetrics.h"
index 7edbebf3b4e8eaac03b9b11d05f0112bd89589ce..461933cb564ef785084ac55a7f3b78a1346557cd 100644 (file)
@@ -24,6 +24,7 @@
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 #include "output_xhtml.h"
+#include "texstream.h"
 #include "Text.h"
 
 #include "support/debug.h"
index 00223ad532d8667c52b6c24fbd7e015358bcf183..c8c0ef82f53608c6e7290af3d2737ca3b5673c3c 100644 (file)
@@ -27,6 +27,7 @@
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "output_xhtml.h"
+#include "texstream.h"
 #include "TextClass.h"
 
 #include "support/debug.h"
index 69a9b80883c37eaeb7bc14084484fa94e2b6920d..cc8d1cf12ff07abb9c6b74cf476a117862e6ecc5 100644 (file)
@@ -727,9 +727,8 @@ private:
 static docstring buffer_to_latex(Buffer & buffer)
 {
        OutputParams runparams(&buffer.params().encoding());
-       TexRow texrow(false);
        odocstringstream ods;
-       otexstream os(ods, texrow);
+       otexstream os(ods, false);
        runparams.nice = true;
        runparams.flavor = OutputParams::LATEX;
        runparams.linelen = 80; //lyxrc.plaintext_linelen;
@@ -1048,9 +1047,8 @@ docstring latexifyFromCursor(DocIterator const & cur, int len)
        Buffer const & buf = *cur.buffer();
        LBUFERR(buf.params().isLatex());
 
-       TexRow texrow(false);
        odocstringstream ods;
-       otexstream os(ods, texrow);
+       otexstream os(ods, false);
        OutputParams runparams(&buf.params().encoding());
        runparams.nice = false;
        runparams.flavor = OutputParams::LATEX;
@@ -1395,9 +1393,8 @@ static void findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, M
                LYXERR(Debug::FIND, "After pasteParagraphList() cur=" << cur << endl);
                sel_len = repl_buffer.paragraphs().begin()->size();
        } else if (cur.inMathed()) {
-               TexRow texrow(false);
                odocstringstream ods;
-               otexstream os(ods, texrow);
+               otexstream os(ods, false);
                OutputParams runparams(&repl_buffer.params().encoding());
                runparams.nice = false;
                runparams.flavor = OutputParams::LATEX;
index f71febc06de2a97dc386db267739e903c07dd30b..87952f5679ab613c61e1820c1372c870ce9d3b7b 100644 (file)
@@ -53,8 +53,7 @@ void InsetMath::dump() const
 {
        lyxerr << "---------------------------------------------" << endl;
        odocstringstream os;
-       TexRow texrow(false);
-       otexrowstream ots(os,texrow);
+       otexrowstream ots(os, false);
        WriteStream wi(ots, false, true, WriteStream::wsDefault);
        write(wi);
        lyxerr << to_utf8(os.str());
@@ -158,8 +157,7 @@ HullType InsetMath::getType() const
 ostream & operator<<(ostream & os, MathAtom const & at)
 {
        odocstringstream oss;
-       TexRow texrow(false);
-       otexrowstream ots(oss,texrow);
+       otexrowstream ots(oss, false);
        WriteStream wi(ots, false, false, WriteStream::wsDefault);
        at->write(wi);
        return os << to_utf8(oss.str());
@@ -168,8 +166,7 @@ ostream & operator<<(ostream & os, MathAtom const & at)
 
 odocstream & operator<<(odocstream & os, MathAtom const & at)
 {
-       TexRow texrow(false);
-       otexrowstream ots(os,texrow);
+       otexrowstream ots(os, false);
        WriteStream wi(ots, false, false, WriteStream::wsDefault);
        at->write(wi);
        return os;
index 088fce6c2be97a281bf32112be25ebf8fbf1cffb..3bab681df85f675a16289929dfb0ede7d7422135 100644 (file)
@@ -17,8 +17,6 @@
 
 #include "insets/Inset.h"
 
-#include "TexRow.h"
-
 
 namespace lyx {
 
@@ -93,6 +91,9 @@ class TextPainter;
 class TextMetricsInfo;
 class ReplaceData;
 
+/// Type of unique identifiers for math insets (used in TexRow)
+typedef void const * uid_type;
+
 
 class InsetMath : public Inset {
 public:
index 1c830c1ffb79c89c1ee331ff8fbfbaa92ce72d48..f2d88a2bdfc21fde7de083f496eb47d71aeed90b 100644 (file)
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "BufferView.h"
-#include "CutAndPaste.h"
-#include "FuncStatus.h"
 #include "Cursor.h"
+#include "CutAndPaste.h"
 #include "FuncRequest.h"
+#include "FuncStatus.h"
+#include "TexRow.h"
 
 #include "frontends/Clipboard.h"
 #include "frontends/Painter.h"
@@ -1268,8 +1269,8 @@ void InsetMathGrid::write(WriteStream & os,
                for (col_type col = beg_col; col < end_col;) {
                        int nccols = 1;
                        idx_type const idx = index(row, col);
-                       TexRow::RowEntry entry = os.texrow().mathEntry(id(),idx);
-                       os.texrow().startMath(id(),idx);
+                       RowEntry entry = TexRow::mathEntry(id(),idx);
+                       os.texrow().start(entry);
                        if (col >= lastcol) {
                                ++col;
                                continue;
index 88a4c1d3288214aec7045d4f338ae994718bed92..5dffc3d6055045185f2772213ef6ae34a7316932 100644 (file)
@@ -43,6 +43,7 @@
 #include "Paragraph.h"
 #include "ParIterator.h"
 #include "sgml.h"
+#include "TexRow.h"
 #include "TextClass.h"
 #include "TextPainter.h"
 #include "TocBackend.h"
@@ -614,8 +615,7 @@ void InsetMathHull::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
                InsetMathGrid::metricsT(mi, dim);
        } else {
                odocstringstream os;
-               TexRow texrow(false);
-               otexrowstream ots(os,texrow);
+               otexrowstream ots(os, false);
                WriteStream wi(ots, false, true, WriteStream::wsDefault);
                write(wi);
                dim.wid = os.str().size();
@@ -631,8 +631,7 @@ void InsetMathHull::drawT(TextPainter & pain, int x, int y) const
                InsetMathGrid::drawT(pain, x, y);
        } else {
                odocstringstream os;
-               TexRow texrow(false);
-               otexrowstream ots(os,texrow);
+               otexrowstream ots(os, false);
                WriteStream wi(ots, false, true, WriteStream::wsDefault);
                write(wi);
                pain.draw(x, y, os.str().c_str());
@@ -651,8 +650,7 @@ static docstring latexString(InsetMathHull const & inset)
        static Encoding const * encoding = 0;
        if (inset.isBufferValid())
                encoding = &(inset.buffer().params().encoding());
-       TexRow texrow(false);
-       otexrowstream ots(ls,texrow);
+       otexrowstream ots(ls, false);
        WriteStream wi(ots, false, true, WriteStream::wsPreview, encoding);
        inset.write(wi);
        return ls.str();
@@ -2182,8 +2180,7 @@ bool InsetMathHull::searchForward(BufferView * bv, string const & str,
 void InsetMathHull::write(ostream & os) const
 {
        odocstringstream oss;
-       TexRow texrow(false);
-       otexrowstream ots(oss,texrow);
+       otexrowstream ots(oss, false);
        WriteStream wi(ots, false, false, WriteStream::wsDefault);
        oss << "Formula ";
        write(wi);
@@ -2226,8 +2223,7 @@ int InsetMathHull::plaintext(odocstringstream & os,
        }
 
        odocstringstream oss;
-       TexRow texrow(false);
-       otexrowstream ots(oss,texrow);
+       otexrowstream ots(oss, false);
        Encoding const * const enc = encodings.fromLyXName("utf8");
        WriteStream wi(ots, false, true, WriteStream::wsDefault, enc);
 
@@ -2269,8 +2265,7 @@ int InsetMathHull::docbook(odocstream & os, OutputParams const & runparams) cons
        ++ms.tab(); ms.cr(); ms.os() << '<' << bname << '>';
 
        odocstringstream ls;
-       TexRow texrow;
-       otexstream ols(ls, texrow);
+       otexstream ols(ls);
        if (runparams.flavor == OutputParams::XML) {
                ms << MTag("alt role='tex' ");
                // Workaround for db2latex: db2latex always includes equations with
@@ -2288,7 +2283,7 @@ int InsetMathHull::docbook(odocstream & os, OutputParams const & runparams) cons
        } else {
                ms << MTag("alt role='tex'");
                latex(ols, runparams);
-               res = texrow.rows();
+               res = ols.texrow().rows();
                ms << from_utf8(subst(subst(to_utf8(ls.str()), "&", "&amp;"), "<", "&lt;"));
                ms << ETag("alt");
        }
@@ -2537,8 +2532,7 @@ docstring InsetMathHull::xhtml(XHTMLStream & xs, OutputParams const & op) const
                // Unfortunately, we cannot use latexString() because we do not want
                // $...$ or whatever.
                odocstringstream ls;
-               TexRow texrow(false);
-               otexrowstream ots(ls,texrow);
+               otexrowstream ots(ls, false);
                WriteStream wi(ots, false, true, WriteStream::wsPreview);
                ModeSpecifier specifier(wi, MATH_MODE);
                mathAsLatex(wi);
index 87b7f42d293946424d76d5102d85c675b9b9239c..223e31afc2c5e27064fcf5379031b54b91ad09f9 100644 (file)
@@ -52,6 +52,7 @@
 #include "LyXRC.h"
 #include "MetricsInfo.h"
 #include "OutputParams.h"
+#include "TexRow.h"
 #include "Text.h"
 
 #include "frontends/Application.h"
@@ -251,8 +252,7 @@ bool InsetMathNest::idxLast(Cursor & cur) const
 void InsetMathNest::dump() const
 {
        odocstringstream oss;
-       TexRow texrow(false);
-       otexrowstream ots(oss,texrow);
+       otexrowstream ots(oss, false);
        WriteStream os(ots);
        os << "---------------------------------------------\n";
        write(os);
@@ -407,8 +407,8 @@ void InsetMathNest::latex(otexstream & os, OutputParams const & runparams) const
                        runparams.dryrun ? WriteStream::wsDryrun : WriteStream::wsDefault,
                        runparams.encoding);
        wi.canBreakLine(os.canBreakLine());
-       Changer dummy = wi.changeRowEntry(os.texrow().textEntry(runparams.lastid,
-                                                               runparams.lastpos));
+       Changer dummy = wi.changeRowEntry(TexRow::textEntry(runparams.lastid,
+                                                           runparams.lastpos));
        write(wi);
        // Reset parbreak status after a math inset.
        os.lastChar(0);
index 9ff4bfef7480ee7b8f3a42a74d825cde59bf90e2..5f43fa79942d1fc9508fa7c2fbaac7d8cbf13102 100644 (file)
@@ -200,8 +200,7 @@ int MacroData::write(odocstream & os, bool overwriteRedefinition) const
        // output template
        MathMacroTemplate const & tmpl =
                static_cast<MathMacroTemplate const &>(*inset);
-       TexRow texrow(false);
-       otexrowstream ots(os,texrow);
+       otexrowstream ots(os, false);
        WriteStream wi(ots, false, true, WriteStream::wsDefault);
        return tmpl.write(wi, overwriteRedefinition);
 }
index 82f885b3132229ece9d951df40448113c6ccc46b..f7c21e805ee5a0bb8ab784cb71982f2c04129f59 100644 (file)
@@ -73,6 +73,7 @@
 #include "LyX.h" // use_gui
 #include "OutputParams.h"
 
+
 using namespace std;
 using namespace lyx::support;
 
@@ -669,9 +670,8 @@ bool createInsetMath_fromDialogStr(docstring const & str, MathData & ar)
                InsetSpaceParams isp(true);
                InsetSpace::string2params(to_utf8(str), isp);
                InsetSpace is(isp);
-               TexRow texrow;
                odocstringstream ods;
-               otexstream os(ods, texrow);
+               otexstream os(ods, false);
                Encoding const * const ascii = encodings.fromLyXName("ascii");
                OutputParams op(ascii);
                is.latex(os, op);
index 5c7ae707131a1095bc4d1478f67af5453e779580..31250e29df547156c91d650e72659e832fe95ad9 100644 (file)
@@ -1172,8 +1172,7 @@ void MathMacroTemplate::read(Lexer & lex)
 void MathMacroTemplate::write(ostream & os) const
 {
        odocstringstream oss;
-       TexRow texrow(false);
-       otexrowstream ots(oss,texrow);
+       otexrowstream ots(oss, false);
        WriteStream wi(ots, false, false, WriteStream::wsDefault);
        oss << "FormulaMacro\n";
        write(wi);
index c1c0830f5a9be2a52803d7b30976894948f82d1c..eb567ff19b109db8494f1f01906766a5380a4caf 100644 (file)
@@ -16,6 +16,8 @@
 #include "MathData.h"
 #include "MathExtern.h"
 
+#include "TexRow.h"
+
 #include "support/docstring.h"
 #include "support/RefChanger.h"
 #include "support/textutils.h"
@@ -128,7 +130,8 @@ WriteStream::WriteStream(otexrowstream & os, bool fragile, bool latex,
        : os_(os), fragile_(fragile), firstitem_(false), latex_(latex),
          output_(output), pendingspace_(false), pendingbrace_(false),
          textmode_(false), locked_(0), ascii_(0), canbreakline_(true),
-         line_(0), encoding_(encoding), row_entry_(TexRow::row_none)
+         line_(0), encoding_(encoding),
+         row_entry_(make_unique<RowEntry>(TexRow::row_none))
 {}
 
 
@@ -177,17 +180,17 @@ void WriteStream::asciiOnly(bool ascii)
 }
 
 
-Changer WriteStream::changeRowEntry(TexRow::RowEntry entry)
+Changer WriteStream::changeRowEntry(RowEntry entry)
 {
-       return make_change(row_entry_, entry);
+       return make_change(*row_entry_, entry);
 }
 
 
 bool WriteStream::startOuterRow()
 {
-       if (TexRow::isNone(row_entry_))
+       if (TexRow::isNone(*row_entry_))
                return false;
-       return texrow().start(row_entry_);
+       return texrow().start(*row_entry_);
 }
 
 
index a9465cc4945ec10ce838fb1ebdaffbaffdc1d509..d1cfb9406840a2ea7dadfca64a3b5baf4236fe5e 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "support/Changer.h"
 #include "support/strfwd.h"
+#include "support/unique_ptr.h"
 
 
 namespace lyx {
@@ -25,6 +26,7 @@ class Encoding;
 class InsetMath;
 class MathAtom;
 class MathData;
+class RowEntry;
 
 //
 // LaTeX/LyX
@@ -88,7 +90,7 @@ public:
        Encoding const * encoding() const { return encoding_; }
 
        /// Temporarily change the TexRow information about the outer row entry.
-       Changer changeRowEntry(TexRow::RowEntry entry);
+       Changer changeRowEntry(RowEntry entry);
        /// TexRow::starts the innermost outer math inset
        /// returns true if the outer row entry will appear at this line
        bool startOuterRow();
@@ -120,7 +122,8 @@ private:
        ///
        Encoding const * encoding_;
        /// Row entry we are in
-       TexRow::RowEntry row_entry_;
+       /// (it is a pointer to allow forward-declaration)
+       unique_ptr<RowEntry> row_entry_;
 };
 
 ///
index e18a351c82543e46d4a1cfa28226f5607d4f85fa..42f737654d354f1a4ee2c54e2cdc504497c918c0 100644 (file)
@@ -919,8 +919,7 @@ bool isAlphaSymbol(MathAtom const & at)
 docstring asString(MathData const & ar)
 {
        odocstringstream os;
-       TexRow texrow(false);
-       otexrowstream ots(os,texrow);
+       otexrowstream ots(os, false);
        WriteStream ws(ots);
        ws << ar;
        return os.str();
@@ -938,8 +937,7 @@ void asArray(docstring const & str, MathData & ar, Parse::flags pf)
 docstring asString(InsetMath const & inset)
 {
        odocstringstream os;
-       TexRow texrow(false);
-       otexrowstream ots(os,texrow);
+       otexrowstream ots(os, false);
        WriteStream ws(ots);
        inset.write(ws);
        return os.str();
@@ -949,8 +947,7 @@ docstring asString(InsetMath const & inset)
 docstring asString(MathAtom const & at)
 {
        odocstringstream os;
-       TexRow texrow(false);
-       otexrowstream ots(os,texrow);
+       otexrowstream ots(os, false);
        WriteStream ws(ots);
        at->write(ws);
        return os.str();
index 5d385e5e09929b54bed248091641bd30007a3b67..370b7a0842e75d010b10d11e9c9358e9831e165b 100644 (file)
@@ -23,6 +23,7 @@
 #include "OutputParams.h"
 #include "Paragraph.h"
 #include "ParagraphParameters.h"
+#include "texstream.h"
 #include "TextClass.h"
 
 #include "insets/InsetBibitem.h"
index 7807a7d2d8a3b965a6be678099d4235550c5b714..770966391459e499e84474abd4d7f76301c6aafc 100644 (file)
@@ -47,19 +47,6 @@ namespace Alert {
 }
 
 
-//
-// Dummy TexRow support (needed by docstream)
-//
-
-
-void TexRow::newline()
-{}
-
-
-void TexRow::newlines(int)
-{}
-
-
 //
 // Dummy LyXRC support
 //
index 16f8dfbe68dee11acfa0a76fbf5e829d2f15ab6e..f748f8a4d27687c232b9e9ff4b8bcaf2767112f9 100644 (file)
@@ -11,6 +11,9 @@
 #include <config.h>
 
 #include "texstream.h"
+
+#include "TexRow.h"
+
 #include "support/lstrings.h"
 #include "support/unicode.h"
 
@@ -30,10 +33,26 @@ using lyx::support::split;
 namespace lyx {
 
 
-void otexrowstream::append(docstring const & str, TexRow const & texrow)
+otexrowstream::otexrowstream(odocstream & os, bool enable)
+       : os_(os), texrow_(make_unique<TexRow>(enable))
+{}
+
+
+otexrowstream::~otexrowstream() = default;
+
+
+unique_ptr<TexRow> && otexrowstream::releaseTexRow()
+{
+       auto p = make_unique<TexRow>();
+       swap(texrow_, p);
+       return move(p);
+}
+
+
+void otexrowstream::append(docstring const & str, TexRow texrow)
 {
        os_ << str;
-       texrow_.append(texrow);
+       texrow_->append(move(texrow));
 }
 
 
@@ -41,7 +60,7 @@ void otexrowstream::put(char_type const & c)
 {
        os_.put(c);
        if (c == '\n')
-               texrow_.newline();
+               texrow_->newline();
 }
 
 
index c81bbf9a84891ad2832d5cae85f63c26936a234c..f6f421133541fa3f65cbac16733b4695c553059a 100644 (file)
 #ifndef LYX_TEXSTREAM_H
 #define LYX_TEXSTREAM_H
 
-#include "TexRow.h"
 #include "support/docstream.h"
+#include "support/unique_ptr.h"
 
 namespace lyx {
 
+class TexRow;
+
+
+// declared below
+class otexstringstream;
+
 /** Wrapper class for odocstream.
     This class is used to automatically count the lines of the exported latex
     code.
@@ -25,21 +31,24 @@ namespace lyx {
 class otexrowstream {
 public:
        ///
-       otexrowstream(odocstream & os, TexRow & texrow)
-               : os_(os), texrow_(texrow) {}
+       explicit otexrowstream(odocstream & os, bool enable = true);
+       /// defaulted
+       ~otexrowstream();
        ///
        odocstream & os() { return os_; }
        ///
-       TexRow & texrow() { return texrow_; }
+       TexRow & texrow() { return *texrow_; }
+       ///
+       unique_ptr<TexRow> && releaseTexRow();
        ///
        void put(char_type const & c);
        ///
-       void append(docstring const &, TexRow const &);
+       void append(docstring const & str, TexRow texrow);
 private:
        ///
        odocstream & os_;
        ///
-       TexRow & texrow_;
+       unique_ptr<TexRow> texrow_;
 };
 
 ///
@@ -70,8 +79,8 @@ otexrowstream & operator<<(otexrowstream & ots, Type value);
 class otexstream : public otexrowstream {
 public:
        ///
-       otexstream(odocstream & os, TexRow & texrow)
-               : otexrowstream(os, texrow), canbreakline_(false),
+       explicit otexstream(odocstream & os, bool enable = true)
+               : otexrowstream(os, enable), canbreakline_(false),
                  protectspace_(false), parbreak_(true), lastchar_(0) {}
        ///
        void put(char_type const & c);
@@ -135,6 +144,7 @@ otexstream & operator<<(otexstream &, char);
 template <typename Type>
 otexstream & operator<<(otexstream & ots, Type value);
 
+
 }
 
 #endif