]> git.lyx.org Git - lyx.git/blob - src/mathed/math_casesinset.C
fix #1073
[lyx.git] / src / mathed / math_casesinset.C
1 #include <config.h>
2
3
4 #include "math_casesinset.h"
5 #include "math_parser.h"
6 #include "math_mathmlstream.h"
7 #include "math_support.h"
8 #include "LaTeXFeatures.h"
9 #include "support/LOstream.h"
10
11
12 MathCasesInset::MathCasesInset(row_type n)
13         : MathGridInset(2, n, 'c', "ll")
14 {}
15
16
17 MathInset * MathCasesInset::clone() const
18 {
19         return new MathCasesInset(*this);
20 }
21
22
23 void MathCasesInset::metrics(MetricsInfo & mi) const
24 {
25         MathGridInset::metrics(mi);
26         dim_.w += 8;
27 }
28
29
30 void MathCasesInset::draw(PainterInfo & pain, int x, int y) const
31 {
32         mathed_draw_deco(pain, x + 1, y - ascent(), 6, height(), "{");
33         MathGridInset::draw(pain, x + 8, y);
34 }
35
36
37 void MathCasesInset::write(WriteStream & os) const
38 {
39         if (os.fragile())
40                 os << "\\protect";
41         os << "\\begin{cases}\n";
42         MathGridInset::write(os);
43         if (os.fragile())
44                 os << "\\protect";
45         os << "\\end{cases}";
46 }
47
48
49 void MathCasesInset::normalize(NormalStream & os) const
50 {
51         os << "[cases ";
52         MathGridInset::normalize(os);
53         os << ']';
54 }
55
56
57 void MathCasesInset::maple(MapleStream & os) const
58 {
59         os << "cases(";
60         MathGridInset::maple(os);
61         os << ')';
62 }
63
64
65 void MathCasesInset::infoize(std::ostream & os) const
66 {
67         os << "Cases ";
68 }
69
70
71 void MathCasesInset::validate(LaTeXFeatures & features) const
72 {
73         features.require("amsmath");
74         MathGridInset::validate(features);
75 }