#include "support/docstream.h"
#include "support/gettext.h"
#include "support/lstrings.h"
-
#include "support/lassert.h"
#include <sstream>
++col;
continue;
}
- os.pushRowEntry(entry);
+ Changer dummy = os.changeRowEntry(entry);
if (cellinfo_[idx].multi_ == CELL_BEGIN_OF_MULTICOLUMN) {
size_t s = col + 1;
while (s < ncols() &&
os << '}';
os << eocString(col + nccols - 1, lastcol);
col += nccols;
- os.popRowEntry();
}
eol = eolString(row, os.fragile(), os.latex(), last_eoln);
os << eol;
#include "frontends/Painter.h"
#include "frontends/Selection.h"
-#include "support/lassert.h"
#include "support/debug.h"
+#include "support/docstream.h"
#include "support/gettext.h"
+#include "support/lassert.h"
#include "support/lstrings.h"
#include "support/textutils.h"
-#include "support/docstream.h"
#include <algorithm>
#include <sstream>
docstring const latex_name = name();
os << '\\' << latex_name;
for (size_t i = 0; i < nargs(); ++i) {
- os.pushRowEntry(TexRow::mathEntry(id(),i));
+ Changer dummy = os.changeRowEntry(TexRow::mathEntry(id(),i));
os << '{' << cell(i) << '}';
- os.popRowEntry();
}
if (nargs() == 0)
os.pendingSpace(true);
runparams.dryrun ? WriteStream::wsDryrun : WriteStream::wsDefault,
runparams.encoding);
wi.canBreakLine(os.canBreakLine());
- if (runparams.lastid != -1) {
- wi.pushRowEntry(os.texrow().textEntry(runparams.lastid,
- runparams.lastpos));
- write(wi);
- wi.popRowEntry();
- } else
- write(wi);
+ Changer dummy = wi.changeRowEntry(os.texrow().textEntry(runparams.lastid,
+ runparams.lastpos));
+ write(wi);
// Reset parbreak status after a math inset.
os.lastChar(0);
os.canBreakLine(wi.canBreakLine());
#include "MathData.h"
#include "MathExtern.h"
-#include "support/textutils.h"
#include "support/docstring.h"
+#include "support/RefChanger.h"
+#include "support/textutils.h"
#include <algorithm>
#include <cstring>
WriteStream::WriteStream(otexrowstream & os, bool fragile, bool latex,
OutputType output, Encoding const * encoding)
- : 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)
-{}
+ : WriteStream(os)
+{
+ fragile_ = fragile;
+ latex_ = latex;
+ output_ = output;
+ encoding_ = encoding;
+}
WriteStream::WriteStream(otexrowstream & os)
: os_(os), fragile_(false), firstitem_(false), latex_(false),
output_(wsDefault), pendingspace_(false), pendingbrace_(false),
textmode_(false), locked_(0), ascii_(0), canbreakline_(true),
- line_(0), encoding_(0)
+ line_(0), encoding_(0), row_entry_(TexRow::row_none)
{}
}
-void WriteStream::pushRowEntry(TexRow::RowEntry entry)
-{
- outer_row_entries_.push_back(entry);
-}
-
-
-void WriteStream::popRowEntry()
+Changer WriteStream::changeRowEntry(TexRow::RowEntry entry)
{
- if (!outer_row_entries_.empty())
- outer_row_entries_.pop_back();
+ return make_change(row_entry_, entry);
}
bool WriteStream::startOuterRow()
{
- size_t n = outer_row_entries_.size();
- if (n > 0)
- return texrow().start(outer_row_entries_[n - 1]);
- else
+ if (TexRow::isNone(row_entry_))
return false;
+ return texrow().start(row_entry_);
}
#ifndef MATH_MATHMLSTREAM_H
#define MATH_MATHMLSTREAM_H
-#include "support/strfwd.h"
-
#include "InsetMath.h"
#include "texstream.h"
+#include "support/Changer.h"
+#include "support/strfwd.h"
+
namespace lyx {
/// LaTeX encoding
Encoding const * encoding() const { return encoding_; }
- /// maintains a stack of texrow informations about outer math insets.
- /// push an entry
- void pushRowEntry(TexRow::RowEntry entry);
- /// pop an entry
- void popRowEntry();
+ /// Temporarily change the TexRow information about the outer row entry.
+ Changer changeRowEntry(TexRow::RowEntry entry);
/// TexRow::starts the innermost outer math inset
/// returns true if the outer row entry will appear at this line
bool startOuterRow();
int line_;
///
Encoding const * encoding_;
- ///
- std::vector<TexRow::RowEntry> outer_row_entries_;
+ /// Row entry we are in
+ TexRow::RowEntry row_entry_;
};
///