4 #include "math_tabularinset.h"
5 #include "math_parser.h"
6 #include "math_mathmlstream.h"
7 #include "metricsinfo.h"
8 #include "math_streamstr.h"
14 using std::istringstream;
16 using std::istream_iterator;
19 MathTabularInset::MathTabularInset(string const & name, int m, int n)
20 : MathGridInset(m, n), name_(name)
24 MathTabularInset::MathTabularInset(string const & name, int m, int n,
25 char valign, string const & halign)
26 : MathGridInset(m, n, valign, halign), name_(name)
30 MathTabularInset::MathTabularInset(string const & name, char valign,
31 string const & halign)
32 : MathGridInset(valign, halign), name_(name)
36 MathInset * MathTabularInset::clone() const
38 return new MathTabularInset(*this);
42 void MathTabularInset::metrics(MetricsInfo & mi, Dimension & dim) const
44 FontSetChanger dummy(mi.base, "textnormal");
45 return MathGridInset::metrics(mi);
49 void MathTabularInset::draw(PainterInfo & pi, int x, int y) const
51 FontSetChanger dummy(pi.base, "textnormal");
52 MathGridInset::draw(pi, x, y);
56 void MathTabularInset::write(WriteStream & os) const
60 os << "\\begin{" << name_ << '}';
62 if (v_align_ == 't' || v_align_ == 'b')
63 os << '[' << char(v_align_) << ']';
64 os << '{' << halign() << "}\n";
66 MathGridInset::write(os);
70 os << "\\end{" << name_ << '}';
71 // adding a \n here is bad if the tabular is the last item
76 void MathTabularInset::normalize(NormalStream & os) const
78 os << '[' << name_ << ' ';
79 MathGridInset::normalize(os);
84 void MathTabularInset::maple(MapleStream & os) const
87 MathGridInset::maple(os);