#include "BufferView.h"
#include "buffer.h"
#include "bufferparams.h"
+#include "cursor.h"
#include "debug.h"
#include "metricsinfo.h"
+#include "output_latex.h"
+#include "outputparams.h"
#include "paragraph.h"
+#include "texrow.h"
using std::auto_ptr;
using std::endl;
}
-auto_ptr<InsetBase> MathMBoxInset::clone() const
+auto_ptr<InsetBase> MathMBoxInset::doClone() const
{
return auto_ptr<InsetBase>(new MathMBoxInset(*this));
}
}
-void MathMBoxInset::write(WriteStream & os) const
+void MathMBoxInset::write(WriteStream & ws) const
+{
+ if (ws.latex()) {
+ ws << "\\mbox{\n";
+ TexRow texrow;
+ OutputParams runparams;
+ latexParagraphs(*bv_->buffer(), text_.paragraphs(),
+ ws.os(), texrow, runparams);
+ ws.addlines(texrow.rows());
+ ws << "}";
+ } else {
+ ws << "\\mbox{\n";
+ text_.write(*bv_->buffer(), ws.os());
+ ws << "}";
+ }
+}
+
+
+int MathMBoxInset::latex(Buffer const & buf, std::ostream & os,
+ OutputParams const & runparams) const
{
os << "\\mbox{\n";
- text_.write(*bv_->buffer(), os.os());
+ TexRow texrow;
+ latexParagraphs(buf, text_.paragraphs(), os, texrow, runparams);
os << "}";
+ return texrow.rows();
}
-void MathMBoxInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
+void MathMBoxInset::doDispatch(LCursor & cur, FuncRequest & cmd)
{
text_.dispatch(cur, cmd);
}
}
-void MathMBoxInset::getCursorPos(CursorSlice const & cur, int & x, int & y) const
+void MathMBoxInset::getCursorPos(CursorSlice const & sl, int & x, int & y) const
{
- x = text_.cursorX(cur);
- //y = text_.cursorY(cur);
- y = 100;
+ x = text_.cursorX(sl);
+ y = text_.cursorY(sl);
}
+
+
+void MathMBoxInset::drawSelection(PainterInfo & pi, int x, int y) const
+{
+ text_.drawSelection(pi, x, y);
+}
+