]> git.lyx.org Git - lyx.git/blob - src/mathed/math_parboxinset.C
Strip out redundant #includes
[lyx.git] / src / mathed / math_parboxinset.C
1 /**
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.
5  *
6  * \author André Pönitz
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "math_parboxinset.h"
14 #include "math_mathmlstream.h"
15 #include "math_streamstr.h"
16 #include "debug.h"
17
18 using std::auto_ptr;
19 using std::endl;
20
21
22 MathParboxInset::MathParboxInset()
23         : lyx_width_(0), tex_width_("0mm"), position_('c')
24 {
25         lyxerr << "constructing MathParboxInset" << endl;
26 }
27
28
29 auto_ptr<InsetBase> MathParboxInset::clone() const
30 {
31         return auto_ptr<InsetBase>(new MathParboxInset(*this));
32 }
33
34
35 void MathParboxInset::setPosition(string const & p)
36 {
37         position_ = p.size() > 0 ? p[0] : 'c';
38 }
39
40
41 void MathParboxInset::setWidth(string const & w)
42 {
43         tex_width_ = w;
44         lyx_width_ = LyXLength(w).inBP();
45         lyxerr << "setting " << w << " to " << lyx_width_ << " pixel" << endl;
46 }
47
48
49 void MathParboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
50 {
51         FontSetChanger dummy1(mi.base, "textnormal");
52         WidthChanger dummy2(mi.base, lyx_width_);
53         MathTextInset::metrics(mi, dim_);
54         metricsMarkers();
55         dim = dim_;
56 }
57
58
59 void MathParboxInset::draw(PainterInfo & pi, int x, int y) const
60 {
61         FontSetChanger dummy(pi.base, "textnormal");
62         MathTextInset::draw(pi, x + 1, y);
63         drawMarkers(pi, x, y);
64 }
65
66
67 void MathParboxInset::write(WriteStream & os) const
68 {
69         os << "\\parbox";
70         if (position_ != 'c')
71                 os << '[' << position_ << ']';
72         os << '{' << tex_width_ << "}{" << cell(0) << '}';
73 }
74
75
76 void MathParboxInset::infoize(std::ostream & os) const
77 {
78         os << "Box: Parbox " << tex_width_;
79 }