]> git.lyx.org Git - lyx.git/blob - src/mathed/math_tabularinset.C
Strip out redundant #includes
[lyx.git] / src / mathed / math_tabularinset.C
1 /**
2  * \file math_tabularinset.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_tabularinset.h"
14 #include "math_mathmlstream.h"
15 #include "math_streamstr.h"
16
17 #include <iterator>
18
19 using std::vector;
20 using std::istringstream;
21 using std::getline;
22 using std::istream_iterator;
23 using std::auto_ptr;
24
25
26 MathTabularInset::MathTabularInset(string const & name, int m, int n)
27         : MathGridInset(m, n), name_(name)
28 {}
29
30
31 MathTabularInset::MathTabularInset(string const & name, int m, int n,
32                 char valign, string const & halign)
33         : MathGridInset(m, n, valign, halign), name_(name)
34 {}
35
36
37 MathTabularInset::MathTabularInset(string const & name, char valign,
38                 string const & halign)
39         : MathGridInset(valign, halign), name_(name)
40 {}
41
42
43 auto_ptr<InsetBase> MathTabularInset::clone() const
44 {
45         return auto_ptr<InsetBase>(new MathTabularInset(*this));
46 }
47
48
49 void MathTabularInset::metrics(MetricsInfo & mi, Dimension & /*dim*/) const
50 {
51         FontSetChanger dummy(mi.base, "textnormal");
52         return MathGridInset::metrics(mi);
53 }
54
55
56 void MathTabularInset::draw(PainterInfo & pi, int x, int y) const
57 {
58         FontSetChanger dummy(pi.base, "textnormal");
59         MathGridInset::draw(pi, x, y);
60 }
61
62
63 void MathTabularInset::write(WriteStream & os) const
64 {
65         if (os.fragile())
66                 os << "\\protect";
67         os << "\\begin{" << name_ << '}';
68
69         if (v_align_ == 't' || v_align_ == 'b')
70                 os << '[' << char(v_align_) << ']';
71         os << '{' << halign() << "}\n";
72
73         MathGridInset::write(os);
74
75         if (os.fragile())
76                 os << "\\protect";
77         os << "\\end{" << name_ << '}';
78         // adding a \n here is bad if the tabular is the last item
79         // in an \eqnarray...
80 }
81
82
83 void MathTabularInset::normalize(NormalStream & os) const
84 {
85         os << '[' << name_ << ' ';
86         MathGridInset::normalize(os);
87         os << ']';
88 }
89
90
91 void MathTabularInset::maple(MapleStream & os) const
92 {
93         os << "array(";
94         MathGridInset::maple(os);
95         os << ')';
96 }