]> git.lyx.org Git - lyx.git/blob - src/mathed/math_frameboxinset.C
Strip out redundant #includes
[lyx.git] / src / mathed / math_frameboxinset.C
1 /**
2  * \file math_frameboxinset.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_frameboxinset.h"
14 #include "math_support.h"
15 #include "math_mathmlstream.h"
16 #include "frontends/Painter.h"
17
18 using std::auto_ptr;
19
20
21 MathFrameboxInset::MathFrameboxInset()
22         : MathNestInset(3)
23 {}
24
25
26 auto_ptr<InsetBase> MathFrameboxInset::clone() const
27 {
28         return auto_ptr<InsetBase>(new MathFrameboxInset(*this));
29 }
30
31
32 void MathFrameboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
33 {
34         FontSetChanger dummy(mi.base, "textnormal");
35         w_ = mathed_char_width(mi.base.font, '[');
36         MathNestInset::metrics(mi);
37         dim_  = cell(0).dim();
38         dim_ += cell(1).dim();
39         dim_ += cell(2).dim();
40         metricsMarkers();
41         dim = dim_;
42 }
43
44
45 void MathFrameboxInset::draw(PainterInfo & pi, int x, int y) const
46 {
47         FontSetChanger dummy(pi.base, "textnormal");
48         pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
49                 dim_.width() - 2, dim_.height() - 2, LColor::foreground);
50         x += 5;
51
52         drawStrBlack(pi, x, y, "[");
53         x += w_;
54         cell(0).draw(pi, x, y);
55         x += cell(0).width();
56         drawStrBlack(pi, x, y, "]");
57         x += w_ + 4;
58
59         drawStrBlack(pi, x, y, "[");
60         x += w_;
61         cell(1).draw(pi, x, y);
62         x += cell(1).width();
63         drawStrBlack(pi, x, y, "]");
64         x += w_ + 4;
65
66         cell(2).draw(pi, x, y);
67 }
68
69
70 void MathFrameboxInset::write(WriteStream & os) const
71 {
72         os << "\\framebox";
73         os << '[' << cell(0) << ']';
74         if (cell(1).size())
75                 os << '[' << cell(1) << ']';
76         os << '{' << cell(2) << '}';
77 }
78
79
80 void MathFrameboxInset::normalize(NormalStream & os) const
81 {
82         os << "[framebox " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';
83 }