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.
8 * Full author contact details are available in file CREDITS.
13 #include "math_tabularinset.h"
14 #include "math_data.h"
15 #include "math_mathmlstream.h"
16 #include "math_streamstr.h"
25 MathTabularInset::MathTabularInset(string const & name, int m, int n)
26 : MathGridInset(m, n), name_(name)
30 MathTabularInset::MathTabularInset(string const & name, int m, int n,
31 char valign, string const & halign)
32 : MathGridInset(m, n, valign, halign), name_(name)
36 MathTabularInset::MathTabularInset(string const & name, char valign,
37 string const & halign)
38 : MathGridInset(valign, halign), name_(name)
42 auto_ptr<InsetBase> MathTabularInset::doClone() const
44 return auto_ptr<InsetBase>(new MathTabularInset(*this));
48 void MathTabularInset::metrics(MetricsInfo & mi, Dimension & /*dim*/) const
50 FontSetChanger dummy(mi.base, "textnormal");
51 return MathGridInset::metrics(mi);
55 void MathTabularInset::draw(PainterInfo & pi, int x, int y) const
57 FontSetChanger dummy(pi.base, "textnormal");
58 MathGridInset::draw(pi, x, y);
62 void MathTabularInset::write(WriteStream & os) const
66 os << "\\begin{" << name_ << '}';
68 if (v_align_ == 't' || v_align_ == 'b')
69 os << '[' << char(v_align_) << ']';
70 os << '{' << halign() << "}\n";
72 MathGridInset::write(os);
76 os << "\\end{" << name_ << '}';
77 // adding a \n here is bad if the tabular is the last item
82 void MathTabularInset::normalize(NormalStream & os) const
84 os << '[' << name_ << ' ';
85 MathGridInset::normalize(os);
90 void MathTabularInset::maple(MapleStream & os) const
93 MathGridInset::maple(os);