2 * \file InsetMathTabular.cpp
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"
26 InsetMathTabular::InsetMathTabular(docstring const & name, int m, int n)
27 : InsetMathGrid(m, n), name_(name)
31 InsetMathTabular::InsetMathTabular(docstring const & name, int m, int n,
32 char valign, docstring const & halign)
33 : InsetMathGrid(m, n, valign, halign), name_(name)
37 InsetMathTabular::InsetMathTabular(docstring const & name, char valign,
38 docstring const & halign)
39 : InsetMathGrid(valign, halign), name_(name)
43 Inset * InsetMathTabular::clone() const
45 return new InsetMathTabular(*this);
49 void InsetMathTabular::metrics(MetricsInfo & mi, Dimension & dim) const
51 FontSetChanger dummy(mi.base, "textnormal");
52 InsetMathGrid::metrics(mi, dim);
58 void InsetMathTabular::draw(PainterInfo & pi, int x, int y) const
60 FontSetChanger dummy(pi.base, "textnormal");
61 InsetMathGrid::drawWithMargin(pi, x, y, 4, 2);
65 void InsetMathTabular::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 InsetMathGrid::write(os);
79 os << "\\end{" << name_ << '}';
80 // adding a \n here is bad if the tabular is the last item
85 void InsetMathTabular::infoize(odocstream & os) const
87 docstring name = name_;
88 name[0] = support::uppercase(name[0]);
93 void InsetMathTabular::normalize(NormalStream & os) const
95 os << '[' << name_ << ' ';
96 InsetMathGrid::normalize(os);
101 void InsetMathTabular::maple(MapleStream & os) const
104 InsetMathGrid::maple(os);