]> git.lyx.org Git - lyx.git/blob - src/mathed/math_splitinset.C
Standardise the header blurb in mathed.
[lyx.git] / src / mathed / math_splitinset.C
1 /**
2  * \file math_splitinset.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_splitinset.h"
14 #include "math_mathmlstream.h"
15 #include "math_streamstr.h"
16
17 using std::auto_ptr;
18
19
20 MathSplitInset::MathSplitInset(string const & name)
21         : MathGridInset(1, 1), name_(name)
22 {
23         setDefaults();
24 }
25
26
27 auto_ptr<InsetBase> MathSplitInset::clone() const
28 {
29         return auto_ptr<InsetBase>(new MathSplitInset(*this));
30 }
31
32
33 char MathSplitInset::defaultColAlign(col_type col)
34 {
35         if (name_ == "split")
36                 return 'l';
37         if (name_ == "gathered")
38                 return 'c';
39         if (name_ == "aligned")
40                 return (col & 1) ? 'l' : 'r';
41         return 'l';
42 }
43
44
45 void MathSplitInset::write(WriteStream & ws) const
46 {
47         if (ws.fragile())
48                 ws << "\\protect";
49         ws << "\\begin{" << name_ << '}';
50         MathGridInset::write(ws);
51         if (ws.fragile())
52                 ws << "\\protect";
53         ws << "\\end{" << name_ << "}\n";
54 }