]> git.lyx.org Git - lyx.git/blob - src/mathed/math_casesinset.C
get rid of broken_header.h and some unneeded tests
[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::doClone() 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 & pi, int x, int y) const
43 {
44         mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 6, dim_.height(), "{");
45         MathGridInset::draw(pi, x + 8, y);
46         setPosCache(pi, x, y);
47 }
48
49
50 void MathCasesInset::write(WriteStream & os) const
51 {
52         if (os.fragile())
53                 os << "\\protect";
54         os << "\\begin{cases}\n";
55         MathGridInset::write(os);
56         if (os.fragile())
57                 os << "\\protect";
58         os << "\\end{cases}";
59 }
60
61
62 void MathCasesInset::normalize(NormalStream & os) const
63 {
64         os << "[cases ";
65         MathGridInset::normalize(os);
66         os << ']';
67 }
68
69
70 void MathCasesInset::maple(MapleStream & os) const
71 {
72         os << "cases(";
73         MathGridInset::maple(os);
74         os << ')';
75 }
76
77
78 void MathCasesInset::infoize(std::ostream & os) const
79 {
80         os << "Cases ";
81 }
82
83
84 void MathCasesInset::validate(LaTeXFeatures & features) const
85 {
86         features.require("amsmath");
87         MathGridInset::validate(features);
88 }