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 "output_latex.h"
23 #include "paragraph.h"
30 MathMBoxInset::MathMBoxInset(BufferView & bv)
31 : text_(&bv), bv_(&bv)
33 text_.paragraphs().clear();
34 text_.paragraphs().push_back(Paragraph());
35 text_.paragraphs().back().
36 layout(bv.buffer()->params().getLyXTextClass().defaultLayout());
37 text_.redoParagraph(0);
41 auto_ptr<InsetBase> MathMBoxInset::clone() const
43 return auto_ptr<InsetBase>(new MathMBoxInset(*this));
47 void MathMBoxInset::metrics(MetricsInfo & mi, Dimension & dim) const
49 text_.metrics(mi, dim);
55 void MathMBoxInset::draw(PainterInfo & pi, int x, int y) const
57 text_.draw(pi, x + 1, y - text_.ascent());
58 drawMarkers(pi, x, y);
62 void MathMBoxInset::write(WriteStream & os) const
65 text_.write(*bv_->buffer(), os.os());
70 int MathMBoxInset::latex(Buffer const & buf, std::ostream & os,
71 OutputParams const & runparams) const
75 latexParagraphs(buf, text_.paragraphs(), os, texrow, runparams);
81 void MathMBoxInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
83 text_.dispatch(cur, cmd);
87 LyXText * MathMBoxInset::getText(int) const
93 void MathMBoxInset::getCursorPos(CursorSlice const & cur, int & x, int & y) const
95 x = text_.cursorX(cur);
96 y = text_.cursorY(cur);