]> git.lyx.org Git - lyx.git/blob - src/mathed/math_makeboxinset.C
Strip out redundant #includes
[lyx.git] / src / mathed / math_makeboxinset.C
1 /**
2  * \file math_makeboxinset.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Ling Li
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "math_makeboxinset.h"
14 #include "math_support.h"
15 #include "math_mathmlstream.h"
16
17 using std::auto_ptr;
18
19
20 MathMakeboxInset::MathMakeboxInset()
21         : MathNestInset(3)
22 {}
23
24
25 auto_ptr<InsetBase> MathMakeboxInset::clone() const
26 {
27         return auto_ptr<InsetBase>(new MathMakeboxInset(*this));
28 }
29
30
31 void MathMakeboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
32 {
33         FontSetChanger dummy(mi.base, "textnormal");
34         w_ = mathed_char_width(mi.base.font, '[');
35         MathNestInset::metrics(mi);
36         dim_   = cell(0).dim();
37         dim_  += cell(1).dim();
38         dim_  += cell(2).dim();
39         dim_.wid += 4 * w_ + 4;
40         metricsMarkers();
41         dim = dim_;
42 }
43
44
45 void MathMakeboxInset::draw(PainterInfo & pi, int x, int y) const
46 {
47         FontSetChanger dummy(pi.base, "textnormal");
48         drawMarkers(pi, x, y);
49
50         drawStrBlack(pi, x, y, "[");
51         x += w_;
52         cell(0).draw(pi, x, y);
53         x += cell(0).width();
54         drawStrBlack(pi, x, y, "]");
55         x += w_ + 2;
56
57         drawStrBlack(pi, x, y, "[");
58         x += w_;
59         cell(1).draw(pi, x, y);
60         x += cell(1).width();
61         drawStrBlack(pi, x, y, "]");
62         x += w_ + 2;
63
64         cell(2).draw(pi, x, y);
65 }
66
67
68 void MathMakeboxInset::write(WriteStream & os) const
69 {
70         os << "\\makebox";
71         os << '[' << cell(0) << ']';
72         if (cell(1).size())
73                 os << '[' << cell(1) << ']';
74         os << '{' << cell(2) << '}';
75 }
76
77
78 void MathMakeboxInset::normalize(NormalStream & os) const
79 {
80         os << "[makebox " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';
81 }