2 #include "math_parboxinset.h"
3 #include "math_mathmlstream.h"
4 #include "math_streamstr.h"
9 MathParboxInset::MathParboxInset()
10 : MathNestInset(1), lyx_width_(0), tex_width_("0mm"),
13 lyxerr << "constructing MathParboxInset\n";
17 MathInset * MathParboxInset::clone() const
19 return new MathParboxInset(*this);
23 void MathParboxInset::setPosition(string const & p)
25 position_ = p.size() > 0 ? p[0] : 'c';
29 void MathParboxInset::setWidth(string const & w)
32 lyx_width_ = LyXLength(w).inBP();
33 lyxerr << "setting " << w << " to " << lyx_width_ << " pixel\n";
37 void MathParboxInset::metrics(MathMetricsInfo & mi) const
39 MathFontSetChanger dummy1(mi.base, "textnormal");
40 MathWidthChanger dummy2(mi.base, lyx_width_);
42 ascent_ = xcell(0).ascent();
43 descent_ = xcell(0).descent() + 1;
44 width_ = xcell(0).width() + 2;
48 void MathParboxInset::draw(MathPainterInfo & pi, int x, int y) const
50 MathFontSetChanger dummy1(pi.base, "textnormal");
51 MathWidthChanger dummy2(pi.base, lyx_width_);
52 xcell(0).draw(pi, x + 1, y);
53 drawMarkers(pi, x, y);
57 void MathParboxInset::write(WriteStream & os) const
61 os << '[' << position_ << ']';
62 os << '{' << tex_width_ << "}{" << cell(0) << '}';
66 void MathParboxInset::infoize(std::ostream & os) const
68 os << "Box: Parbox " << tex_width_ << ' ';