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 "support/lstrings.h"
23 InsetMathTabular::InsetMathTabular(docstring const & name, int m, int n)
24 : InsetMathGrid(m, n), name_(name)
28 InsetMathTabular::InsetMathTabular(docstring const & name, int m, int n,
29 char valign, docstring const & halign)
30 : InsetMathGrid(m, n, valign, halign), name_(name)
35 Inset * InsetMathTabular::clone() const
37 return new InsetMathTabular(*this);
41 void InsetMathTabular::metrics(MetricsInfo & mi, Dimension & dim) const
43 FontSetChanger dummy(mi.base, "textnormal");
44 InsetMathGrid::metrics(mi, dim);
49 Dimension const InsetMathTabular::dimension(BufferView const & bv) const
51 Dimension dim = InsetMathGrid::dimension(bv);
57 void InsetMathTabular::draw(PainterInfo & pi, int x, int y) const
59 FontSetChanger dummy(pi.base, "textnormal");
60 InsetMathGrid::drawWithMargin(pi, x, y, 4, 2);
64 void InsetMathTabular::write(WriteStream & os) const
68 os << "\\begin{" << name_ << '}';
70 char const v = verticalAlignment();
71 if (v == 't' || v == 'b')
72 os << '[' << v << ']';
73 os << '{' << horizontalAlignments() << "}\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);