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