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"
16 #include "MathStream.h"
18 #include "MetricsInfo.h"
20 #include "support/lstrings.h"
26 InsetMathTabular::InsetMathTabular(Buffer * buf, docstring const & name, int m,
28 : InsetMathGrid(buf, m, n), name_(name)
32 InsetMathTabular::InsetMathTabular(Buffer * buf, docstring const & name, int m,
33 int n, char valign, docstring const & halign)
34 : InsetMathGrid(buf, m, n, valign, halign), name_(name)
39 Inset * InsetMathTabular::clone() const
41 return new InsetMathTabular(*this);
45 void InsetMathTabular::metrics(MetricsInfo & mi, Dimension & dim) const
47 Changer dummy = mi.base.changeFontSet("textnormal");
48 InsetMathGrid::metrics(mi, dim);
52 void InsetMathTabular::draw(PainterInfo & pi, int x, int y) const
54 Changer dummy = pi.base.changeFontSet("textnormal");
55 InsetMathGrid::draw(pi, x, y);
59 void InsetMathTabular::write(TeXMathStream & os) const
61 ModeSpecifier specifier(os, TEXT_MODE);
65 os << "\\begin{" << name_ << '}';
66 bool open = os.startOuterRow();
68 char const v = verticalAlignment();
69 if (v == 't' || v == 'b')
70 os << '[' << v << ']';
71 os << '{' << horizontalAlignments() << "}\n";
73 InsetMathGrid::write(os);
77 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);