]> git.lyx.org Git - lyx.git/blob - src/mathed/math_splitinset.C
oh well
[lyx.git] / src / mathed / math_splitinset.C
1 #ifdef __GNUG__
2 #pragma implementation
3 #endif
4
5 #include "math_splitinset.h"
6 #include "math_mathmlstream.h"
7 #include "math_streamstr.h"
8
9
10 MathSplitInset::MathSplitInset(string const & name)
11         : MathGridInset(1, 1), name_(name)
12 {
13         setDefaults();
14 }
15
16
17 MathInset * MathSplitInset::clone() const
18 {
19         return new MathSplitInset(*this);
20 }
21
22
23 char MathSplitInset::defaultColAlign(col_type col)
24 {
25         if (name_ == "split")
26                 return 'l';
27         if (name_ == "gathered")
28                 return 'c';
29         if (name_ == "aligned")
30                 return (col & 1) ? 'l' : 'r';
31         return 'l';
32 }
33
34
35 void MathSplitInset::write(WriteStream & ws) const
36 {
37         if (ws.fragile())
38                 ws << "\\protect";
39         ws << "\\begin{" << name_ << "}";
40         MathGridInset::write(ws);
41         if (ws.fragile())
42                 ws << "\\protect";
43         ws << "\\end{" << name_ << "}\n";
44 }