2 * \file math_parboxinset.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_parboxinset.h"
14 #include "math_data.h"
15 #include "math_mathmlstream.h"
16 #include "math_streamstr.h"
25 MathParboxInset::MathParboxInset()
26 : lyx_width_(0), tex_width_("0mm"), position_('c')
28 lyxerr << "constructing MathParboxInset" << endl;
32 auto_ptr<InsetBase> MathParboxInset::clone() const
34 return auto_ptr<InsetBase>(new MathParboxInset(*this));
38 void MathParboxInset::setPosition(string const & p)
40 position_ = p.size() > 0 ? p[0] : 'c';
44 void MathParboxInset::setWidth(string const & w)
47 lyx_width_ = LyXLength(w).inBP();
48 lyxerr << "setting " << w << " to " << lyx_width_ << " pixel" << endl;
52 void MathParboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
54 FontSetChanger dummy1(mi.base, "textnormal");
55 WidthChanger dummy2(mi.base, lyx_width_);
56 MathTextInset::metrics(mi, dim_);
62 void MathParboxInset::draw(PainterInfo & pi, int x, int y) const
64 FontSetChanger dummy(pi.base, "textnormal");
65 MathTextInset::draw(pi, x + 1, y);
66 drawMarkers(pi, x, y);
70 void MathParboxInset::write(WriteStream & os) const
74 os << '[' << position_ << ']';
75 os << '{' << tex_width_ << "}{" << cell(0) << '}';
79 void MathParboxInset::infoize(std::ostream & os) const
81 os << "Box: Parbox " << tex_width_;