]> git.lyx.org Git - lyx.git/blob - src/mathed/math_arrayinset.C
use stream-like syntax for LaTeX output
[lyx.git] / src / mathed / math_arrayinset.C
1 #ifdef __GNUG__
2 #pragma implementation
3 #endif
4
5 #include "math_arrayinset.h"
6 #include "support/LOstream.h"
7
8
9 MathArrayInset::MathArrayInset(int m, int n)
10         : MathGridInset(m, n)
11 {}
12
13
14 MathArrayInset::MathArrayInset(int m, int n, char valign, string const & halign)
15         : MathGridInset(m, n, valign, halign)
16 {}
17
18
19 MathInset * MathArrayInset::clone() const
20 {
21         return new MathArrayInset(*this);
22 }
23
24
25 void MathArrayInset::write(MathWriteInfo & os) const
26 {
27         if (os.fragile)
28                 os << "\\protect";
29         os << "\\begin{array}";
30
31         if (v_align_ == 't' || v_align_ == 'b') 
32                 os << '[' << char(v_align_) << ']';
33
34         os << '{';
35         for (col_type col = 0; col < ncols(); ++col)
36                 os << colinfo_[col].align_;
37         os << "}\n";
38
39         MathGridInset::write(os);
40
41         if (os.fragile)
42                 os << "\\protect";
43         os << "\\end{array}\n";
44 }
45
46
47 void MathArrayInset::metrics(MathMetricsInfo const & st) const
48 {
49         MathMetricsInfo m = st;
50         if (m.size == LM_ST_DISPLAY)
51                 m.size = LM_ST_TEXT;
52         MathGridInset::metrics(m);
53 }
54