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