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"
17 #include "MathStream.h"
19 #include "MetricsInfo.h"
21 #include "support/lstrings.h"
27 InsetMathTabular::InsetMathTabular(Buffer * buf, docstring const & name, int m,
29 : InsetMathGrid(buf, m, n), name_(name)
33 InsetMathTabular::InsetMathTabular(Buffer * buf, docstring const & name, int m,
34 int n, char valign, docstring const & halign)
35 : InsetMathGrid(buf, m, n, valign, halign), name_(name)
40 Inset * InsetMathTabular::clone() const
42 return new InsetMathTabular(*this);
46 void InsetMathTabular::metrics(MetricsInfo & mi, Dimension & dim) const
48 Changer dummy = mi.base.changeFontSet("textnormal");
49 InsetMathGrid::metrics(mi, dim);
53 void InsetMathTabular::draw(PainterInfo & pi, int x, int y) const
55 Changer dummy = pi.base.changeFontSet("textnormal");
56 InsetMathGrid::draw(pi, x, y);
60 void InsetMathTabular::write(WriteStream & os) const
62 ModeSpecifier specifier(os, TEXT_MODE);
66 os << "\\begin{" << name_ << '}';
67 bool open = os.startOuterRow();
69 char const v = verticalAlignment();
70 if (v == 't' || v == 'b')
71 os << '[' << v << ']';
72 os << '{' << horizontalAlignments() << "}\n";
74 InsetMathGrid::write(os);
78 os << "\\end{" << name_ << '}';
81 // adding a \n here is bad if the tabular is the last item
86 void InsetMathTabular::infoize(odocstream & os) const
88 docstring name = name_;
89 name[0] = support::uppercase(name[0]);
94 void InsetMathTabular::normalize(NormalStream & os) const
96 os << '[' << name_ << ' ';
97 InsetMathGrid::normalize(os);
102 void InsetMathTabular::maple(MapleStream & os) const
105 InsetMathGrid::maple(os);