2 * \file InsetMathTabular.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 "InsetMathTabular.h"
15 #include "MathStream.h"
16 #include "MathStream.h"
18 #include "support/lstrings.h"
19 #include "support/std_ostream.h"
31 InsetMathTabular::InsetMathTabular(docstring const & name, int m, int n)
32 : InsetMathGrid(m, n), name_(name)
36 InsetMathTabular::InsetMathTabular(docstring const & name, int m, int n,
37 char valign, docstring const & halign)
38 : InsetMathGrid(m, n, valign, halign), name_(name)
42 InsetMathTabular::InsetMathTabular(docstring const & name, char valign,
43 docstring const & halign)
44 : InsetMathGrid(valign, halign), name_(name)
48 auto_ptr<InsetBase> InsetMathTabular::doClone() const
50 return auto_ptr<InsetBase>(new InsetMathTabular(*this));
54 void InsetMathTabular::metrics(MetricsInfo & mi, Dimension & dim) const
56 FontSetChanger dummy(mi.base, "textnormal");
57 InsetMathGrid::metrics(mi, dim);
63 void InsetMathTabular::draw(PainterInfo & pi, int x, int y) const
65 FontSetChanger dummy(pi.base, "textnormal");
66 InsetMathGrid::drawWithMargin(pi, x, y, 4, 2);
70 void InsetMathTabular::write(WriteStream & os) const
74 os << "\\begin{" << name_ << '}';
76 if (v_align_ == 't' || v_align_ == 'b')
77 os << '[' << char(v_align_) << ']';
78 os << '{' << halign() << "}\n";
80 InsetMathGrid::write(os);
84 os << "\\end{" << name_ << '}';
85 // adding a \n here is bad if the tabular is the last item
90 void InsetMathTabular::infoize(odocstream & os) const
92 docstring name = name_;
93 name[0] = support::uppercase(name[0]);
98 void InsetMathTabular::normalize(NormalStream & os) const
100 os << '[' << name_ << ' ';
101 InsetMathGrid::normalize(os);
106 void InsetMathTabular::maple(MapleStream & os) const
109 InsetMathGrid::maple(os);