]> git.lyx.org Git - lyx.git/blob - src/mathed/math_parboxinset.C
IU of clone() and getLabelList()
[lyx.git] / src / mathed / math_parboxinset.C
1
2 #include "math_parboxinset.h"
3 #include "math_mathmlstream.h"
4 #include "math_streamstr.h"
5 #include "lyxlength.h"
6 #include "debug.h"
7
8
9 MathParboxInset::MathParboxInset()
10         : lyx_width_(0), tex_width_("0mm"), position_('c')
11 {
12         lyxerr << "constructing MathParboxInset\n";
13 }
14
15
16 InsetBase * MathParboxInset::clone() const
17 {
18         return new MathParboxInset(*this);
19 }
20
21
22 void MathParboxInset::setPosition(string const & p)
23 {
24         position_ = p.size() > 0 ? p[0] : 'c';
25 }
26
27
28 void MathParboxInset::setWidth(string const & w)
29 {
30         tex_width_ = w;
31         lyx_width_ = LyXLength(w).inBP();
32         lyxerr << "setting " << w << " to " << lyx_width_ << " pixel\n";
33 }
34
35
36 void MathParboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
37 {
38         FontSetChanger dummy1(mi.base, "textnormal");
39         WidthChanger dummy2(mi.base, lyx_width_);
40         MathTextInset::metrics(mi, dim_);
41         metricsMarkers();
42         dim = dim_;
43 }
44
45
46 void MathParboxInset::draw(PainterInfo & pi, int x, int y) const
47 {
48         FontSetChanger dummy(pi.base, "textnormal");
49         MathTextInset::draw(pi, x + 1, y);
50         drawMarkers(pi, x, y);
51 }
52
53
54 void MathParboxInset::write(WriteStream & os) const
55 {
56         os << "\\parbox";
57         if (position_ != 'c')
58                 os << '[' << position_ << ']';
59         os << '{' << tex_width_ << "}{" << cell(0) << '}';
60 }
61
62
63 void MathParboxInset::infoize(std::ostream & os) const
64 {
65         os << "Box: Parbox " << tex_width_;
66 }