]> git.lyx.org Git - lyx.git/blob - src/mathed/math_casesinset.C
bug + spped fixes + small stuff
[lyx.git] / src / mathed / math_casesinset.C
1 /**
2  * \file math_casesinset.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_casesinset.h"
14 #include "math_data.h"
15 #include "math_mathmlstream.h"
16 #include "math_support.h"
17 #include "LaTeXFeatures.h"
18 #include "support/std_ostream.h"
19
20 using std::auto_ptr;
21
22
23 MathCasesInset::MathCasesInset(row_type n)
24         : MathGridInset(2, n, 'c', "ll")
25 {}
26
27
28 auto_ptr<InsetBase> MathCasesInset::clone() const
29 {
30         return auto_ptr<InsetBase>(new MathCasesInset(*this));
31 }
32
33
34 void MathCasesInset::metrics(MetricsInfo & mi, Dimension & dim) const
35 {
36         MathGridInset::metrics(mi);
37         dim_.wid += 8;
38         dim = dim_;
39 }
40
41
42 void MathCasesInset::draw(PainterInfo & pain, int x, int y) const
43 {
44         mathed_draw_deco(pain, x + 1, y - dim_.ascent(), 6, dim_.height(), "{");
45         MathGridInset::draw(pain, x + 8, y);
46 }
47
48
49 void MathCasesInset::write(WriteStream & os) const
50 {
51         if (os.fragile())
52                 os << "\\protect";
53         os << "\\begin{cases}\n";
54         MathGridInset::write(os);
55         if (os.fragile())
56                 os << "\\protect";
57         os << "\\end{cases}";
58 }
59
60
61 void MathCasesInset::normalize(NormalStream & os) const
62 {
63         os << "[cases ";
64         MathGridInset::normalize(os);
65         os << ']';
66 }
67
68
69 void MathCasesInset::maple(MapleStream & os) const
70 {
71         os << "cases(";
72         MathGridInset::maple(os);
73         os << ')';
74 }
75
76
77 void MathCasesInset::infoize(std::ostream & os) const
78 {
79         os << "Cases ";
80 }
81
82
83 void MathCasesInset::validate(LaTeXFeatures & features) const
84 {
85         features.require("amsmath");
86         MathGridInset::validate(features);
87 }