]> git.lyx.org Git - features.git/blob - src/mathed/math_braceinset.C
Strip 320 #includes from the files in src.
[features.git] / src / mathed / math_braceinset.C
1 /**
2  * \file math_braceinset.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_braceinset.h"
14 #include "math_support.h"
15 #include "math_mathmlstream.h"
16 #include "support/LOstream.h"
17
18 using std::max;
19 using std::auto_ptr;
20
21
22 MathBraceInset::MathBraceInset()
23         : MathNestInset(1)
24 {}
25
26
27 MathBraceInset::MathBraceInset(MathArray const & ar)
28         : MathNestInset(1)
29 {
30         cell(0) = ar;
31 }
32
33
34 auto_ptr<InsetBase> MathBraceInset::clone() const
35 {
36         return auto_ptr<InsetBase>(new MathBraceInset(*this));
37 }
38
39
40 void MathBraceInset::metrics(MetricsInfo & mi, Dimension & dim) const
41 {
42         cell(0).metrics(mi);
43         Dimension t;
44         mathed_char_dim(mi.base.font, '{', t);
45         wid_ = t.wid;
46         dim_.asc = max(cell(0).ascent(), t.asc);
47         dim_.des = max(cell(0).descent(), t.des);
48         dim_.wid = cell(0).width() + 2 * wid_;
49         dim = dim_;
50 }
51
52
53 void MathBraceInset::draw(PainterInfo & pi, int x, int y) const
54 {
55         LyXFont font = pi.base.font;
56         font.setColor(LColor::latex);
57         drawChar(pi, font, x, y, '{');
58         cell(0).draw(pi, x + wid_, y);
59         drawChar(pi, font, x + dim_.width() - wid_, y, '}');
60 }
61
62
63 void MathBraceInset::write(WriteStream & os) const
64 {
65         os << '{' << cell(0) << '}';
66 }
67
68
69 void MathBraceInset::normalize(NormalStream & os) const
70 {
71         os << "[block " << cell(0) << ']';
72 }
73
74
75 void MathBraceInset::maple(MapleStream & os) const
76 {
77         os << cell(0);
78 }
79
80
81 void MathBraceInset::octave(OctaveStream & os) const
82 {
83         os << cell(0);
84 }
85
86
87 void MathBraceInset::mathmlize(MathMLStream & os) const
88 {
89         os << MTag("mrow") << cell(0) << ETag("mrow");
90 }
91
92
93 void MathBraceInset::mathematica(MathematicaStream & os) const
94 {
95         os << cell(0);
96 }
97
98
99 void MathBraceInset::infoize(std::ostream & os) const
100 {
101         os << "Nested Block: ";
102 }