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_mathmlstream.h"
15 #include "math_streamstr.h"
22 MathParboxInset::MathParboxInset()
23 : lyx_width_(0), tex_width_("0mm"), position_('c')
25 lyxerr << "constructing MathParboxInset" << endl;
29 auto_ptr<InsetBase> MathParboxInset::clone() const
31 return auto_ptr<InsetBase>(new MathParboxInset(*this));
35 void MathParboxInset::setPosition(string const & p)
37 position_ = p.size() > 0 ? p[0] : 'c';
41 void MathParboxInset::setWidth(string const & w)
44 lyx_width_ = LyXLength(w).inBP();
45 lyxerr << "setting " << w << " to " << lyx_width_ << " pixel" << endl;
49 void MathParboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
51 FontSetChanger dummy1(mi.base, "textnormal");
52 WidthChanger dummy2(mi.base, lyx_width_);
53 MathTextInset::metrics(mi, dim_);
59 void MathParboxInset::draw(PainterInfo & pi, int x, int y) const
61 FontSetChanger dummy(pi.base, "textnormal");
62 MathTextInset::draw(pi, x + 1, y);
63 drawMarkers(pi, x, y);
67 void MathParboxInset::write(WriteStream & os) const
71 os << '[' << position_ << ']';
72 os << '{' << tex_width_ << "}{" << cell(0) << '}';
76 void MathParboxInset::infoize(std::ostream & os) const
78 os << "Box: Parbox " << tex_width_;