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