]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathBrace.C
Avoid processing empty lines when reading the symbols file
[lyx.git] / src / mathed / InsetMathBrace.C
1 /**
2  * \file InsetMathBrace.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 "InsetMathBrace.h"
14 #include "MathData.h"
15 #include "MathStream.h"
16 #include "MathSupport.h"
17 #include "LColor.h"
18 #include "support/std_ostream.h"
19 #include "frontends/Painter.h"
20
21
22 namespace lyx {
23
24 using std::max;
25 using std::auto_ptr;
26
27
28 InsetMathBrace::InsetMathBrace()
29         : InsetMathNest(1)
30 {}
31
32
33 InsetMathBrace::InsetMathBrace(MathArray const & ar)
34         : InsetMathNest(1)
35 {
36         cell(0) = ar;
37 }
38
39
40 auto_ptr<InsetBase> InsetMathBrace::doClone() const
41 {
42         return auto_ptr<InsetBase>(new InsetMathBrace(*this));
43 }
44
45
46 void InsetMathBrace::metrics(MetricsInfo & mi, Dimension & dim) const
47 {
48         cell(0).metrics(mi);
49         Dimension t;
50         mathed_char_dim(mi.base.font, '{', t);
51         dim.asc = max(cell(0).ascent(), t.asc);
52         dim.des = max(cell(0).descent(), t.des);
53         dim.wid = cell(0).width() + 2 * t.wid;
54         metricsMarkers(dim);
55         dim_ = dim;
56 }
57
58
59 void InsetMathBrace::draw(PainterInfo & pi, int x, int y) const
60 {
61         LyXFont font = pi.base.font;
62         font.setColor(LColor::latex);
63         Dimension t;
64         mathed_char_dim(font, '{', t);
65         pi.pain.text(x, y, '{', font);
66         cell(0).draw(pi, x + t.wid, y);
67         pi.pain.text(x + t.wid + cell(0).width(), y, '}', font);
68         drawMarkers(pi, x, y);
69 }
70
71
72 void InsetMathBrace::write(WriteStream & os) const
73 {
74         os << '{' << cell(0) << '}';
75 }
76
77
78 void InsetMathBrace::normalize(NormalStream & os) const
79 {
80         os << "[block " << cell(0) << ']';
81 }
82
83
84 void InsetMathBrace::maple(MapleStream & os) const
85 {
86         os << cell(0);
87 }
88
89
90 void InsetMathBrace::octave(OctaveStream & os) const
91 {
92         os << cell(0);
93 }
94
95
96 void InsetMathBrace::mathmlize(MathStream & os) const
97 {
98         os << MTag("mrow") << cell(0) << ETag("mrow");
99 }
100
101
102 void InsetMathBrace::mathematica(MathematicaStream & os) const
103 {
104         os << cell(0);
105 }
106
107
108 void InsetMathBrace::infoize(odocstream & os) const
109 {
110         os << "Nested Block: ";
111 }
112
113
114 } // namespace lyx