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"
23 MathTabularInset::MathTabularInset(string const & name, int m, int n)
24 : MathGridInset(m, n), name_(name)
28 MathTabularInset::MathTabularInset(string const & name, int m, int n,
29 char valign, string const & halign)
30 : MathGridInset(m, n, valign, halign), name_(name)
34 MathTabularInset::MathTabularInset(string const & name, char valign,
35 string const & halign)
36 : MathGridInset(valign, halign), name_(name)
40 auto_ptr<InsetBase> MathTabularInset::clone() const
42 return auto_ptr<InsetBase>(new MathTabularInset(*this));
46 void MathTabularInset::metrics(MetricsInfo & mi, Dimension & /*dim*/) const
48 FontSetChanger dummy(mi.base, "textnormal");
49 return MathGridInset::metrics(mi);
53 void MathTabularInset::draw(PainterInfo & pi, int x, int y) const
55 FontSetChanger dummy(pi.base, "textnormal");
56 MathGridInset::draw(pi, x, y);
60 void MathTabularInset::write(WriteStream & os) const
64 os << "\\begin{" << name_ << '}';
66 if (v_align_ == 't' || v_align_ == 'b')
67 os << '[' << char(v_align_) << ']';
68 os << '{' << halign() << "}\n";
70 MathGridInset::write(os);
74 os << "\\end{" << name_ << '}';
75 // adding a \n here is bad if the tabular is the last item
80 void MathTabularInset::normalize(NormalStream & os) const
82 os << '[' << name_ << ' ';
83 MathGridInset::normalize(os);
88 void MathTabularInset::maple(MapleStream & os) const
91 MathGridInset::maple(os);