2 * \file math_mboxinset.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "math_mboxinset.h"
14 #include "math_data.h"
15 #include "math_mathmlstream.h"
17 #include "BufferView.h"
19 #include "bufferparams.h"
21 #include "metricsinfo.h"
22 #include "paragraph.h"
28 MathMBoxInset::MathMBoxInset(BufferView & bv)
29 : text_(&bv, true), bv_(&bv)
31 text_.paragraphs().push_back(Paragraph());
32 text_.paragraphs().back().
33 layout(bv.buffer()->params().getLyXTextClass().defaultLayout());
34 text_.redoParagraph(text_.paragraphs().begin());
38 auto_ptr<InsetBase> MathMBoxInset::clone() const
40 return auto_ptr<InsetBase>(new MathMBoxInset(*this));
44 void MathMBoxInset::metrics(MetricsInfo & mi, Dimension & dim) const
46 text_.metrics(mi, dim);
52 void MathMBoxInset::draw(PainterInfo & pi, int x, int y) const
54 text_.draw(pi, x + 1, y);
55 drawMarkers(pi, x, y);
59 void MathMBoxInset::write(WriteStream & os) const
62 text_.write(*bv_->buffer(), os.os());
67 void MathMBoxInset::priv_dispatch(LCursor & cur, FuncRequest const & cmd)
69 text_.dispatch(cur, cmd);
73 LyXText * MathMBoxInset::getText(int) const
79 void MathMBoxInset::getCursorPos(CursorSlice const & cur, int & x, int & y) const
81 x = text_.cursorX(cur);
82 //y = text_.cursorY(cur);