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"
18 #include "support/lstrings.h"
19 #include "support/std_ostream.h"
28 MathTabularInset::MathTabularInset(string const & name, int m, int n)
29 : MathGridInset(m, n), name_(name)
33 MathTabularInset::MathTabularInset(string const & name, int m, int n,
34 char valign, string const & halign)
35 : MathGridInset(m, n, valign, halign), name_(name)
39 MathTabularInset::MathTabularInset(string const & name, char valign,
40 string const & halign)
41 : MathGridInset(valign, halign), name_(name)
45 auto_ptr<InsetBase> MathTabularInset::doClone() const
47 return auto_ptr<InsetBase>(new MathTabularInset(*this));
51 void MathTabularInset::metrics(MetricsInfo & mi, Dimension & /*dim*/) const
53 FontSetChanger dummy(mi.base, "textnormal");
54 return MathGridInset::metrics(mi);
58 void MathTabularInset::draw(PainterInfo & pi, int x, int y) const
60 FontSetChanger dummy(pi.base, "textnormal");
61 MathGridInset::draw(pi, x, y);
65 void MathTabularInset::write(WriteStream & os) const
69 os << "\\begin{" << name_ << '}';
71 if (v_align_ == 't' || v_align_ == 'b')
72 os << '[' << char(v_align_) << ']';
73 os << '{' << halign() << "}\n";
75 MathGridInset::write(os);
79 os << "\\end{" << name_ << '}';
80 // adding a \n here is bad if the tabular is the last item
85 void MathTabularInset::infoize(std::ostream & os) const
88 name[0] = lyx::support::uppercase(name[0]);
93 void MathTabularInset::normalize(NormalStream & os) const
95 os << '[' << name_ << ' ';
96 MathGridInset::normalize(os);
101 void MathTabularInset::maple(MapleStream & os) const
104 MathGridInset::maple(os);