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;
20 MathTabularInset::MathTabularInset(string const & name, int m, int n)
21 : MathGridInset(m, n), name_(name)
25 MathTabularInset::MathTabularInset(string const & name, int m, int n,
26 char valign, string const & halign)
27 : MathGridInset(m, n, valign, halign), name_(name)
31 MathTabularInset::MathTabularInset(string const & name, char valign,
32 string const & halign)
33 : MathGridInset(valign, halign), name_(name)
37 auto_ptr<InsetBase> MathTabularInset::clone() const
39 return auto_ptr<InsetBase>(new MathTabularInset(*this));
43 void MathTabularInset::metrics(MetricsInfo & mi, Dimension & /*dim*/) const
45 FontSetChanger dummy(mi.base, "textnormal");
46 return MathGridInset::metrics(mi);
50 void MathTabularInset::draw(PainterInfo & pi, int x, int y) const
52 FontSetChanger dummy(pi.base, "textnormal");
53 MathGridInset::draw(pi, x, y);
57 void MathTabularInset::write(WriteStream & os) const
61 os << "\\begin{" << name_ << '}';
63 if (v_align_ == 't' || v_align_ == 'b')
64 os << '[' << char(v_align_) << ']';
65 os << '{' << halign() << "}\n";
67 MathGridInset::write(os);
71 os << "\\end{" << name_ << '}';
72 // adding a \n here is bad if the tabular is the last item
77 void MathTabularInset::normalize(NormalStream & os) const
79 os << '[' << name_ << ' ';
80 MathGridInset::normalize(os);
85 void MathTabularInset::maple(MapleStream & os) const
88 MathGridInset::maple(os);