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