2 * \file InsetMathMBox.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 "InsetMathMBox.h"
15 #include "MathMLStream.h"
17 #include "BufferView.h"
19 #include "bufferparams.h"
22 #include "metricsinfo.h"
23 #include "output_latex.h"
24 #include "outputparams.h"
25 #include "paragraph.h"
32 InsetMathMBox::InsetMathMBox(BufferView & bv)
33 : text_(&bv), bv_(&bv)
35 text_.paragraphs().clear();
36 text_.paragraphs().push_back(Paragraph());
37 text_.paragraphs().back().
38 layout(bv.buffer()->params().getLyXTextClass().defaultLayout());
39 text_.redoParagraph(0);
43 auto_ptr<InsetBase> InsetMathMBox::doClone() const
45 return auto_ptr<InsetBase>(new InsetMathMBox(*this));
49 void InsetMathMBox::metrics(MetricsInfo & mi, Dimension & dim) const
51 text_.metrics(mi, dim);
57 void InsetMathMBox::draw(PainterInfo & pi, int x, int y) const
59 text_.draw(pi, x + 1, y);
60 drawMarkers(pi, x, y);
64 void InsetMathMBox::write(WriteStream & ws) const
69 OutputParams runparams;
70 latexParagraphs(*bv_->buffer(), text_.paragraphs(),
71 ws.os(), texrow, runparams);
72 ws.addlines(texrow.rows());
76 text_.write(*bv_->buffer(), ws.os());
82 int InsetMathMBox::latex(Buffer const & buf, odocstream & os,
83 OutputParams const & runparams) const
87 latexParagraphs(buf, text_.paragraphs(), os, texrow, runparams);
93 void InsetMathMBox::doDispatch(LCursor & cur, FuncRequest & cmd)
95 text_.dispatch(cur, cmd);
99 LyXText * InsetMathMBox::getText(int) const
105 void InsetMathMBox::cursorPos(BufferView const & bv,
106 CursorSlice const & sl, bool boundary, int & x, int & y) const
108 x = text_.cursorX(sl, boundary);
109 y = text_.cursorY(sl, boundary);
113 void InsetMathMBox::drawSelection(PainterInfo & pi, int x, int y) const
115 text_.drawSelection(pi, x, y);