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"
25 InsetMathTabular::InsetMathTabular(docstring const & name, int m, int n)
26 : InsetMathGrid(m, n), name_(name)
30 InsetMathTabular::InsetMathTabular(docstring const & name, int m, int n,
31 char valign, docstring const & halign)
32 : InsetMathGrid(m, n, valign, halign), name_(name)
37 Inset * InsetMathTabular::clone() const
39 return new InsetMathTabular(*this);
43 void InsetMathTabular::metrics(MetricsInfo & mi, Dimension & dim) const
45 FontSetChanger dummy(mi.base, "textnormal");
46 InsetMathGrid::metrics(mi, dim);
51 Dimension const InsetMathTabular::dimension(BufferView const & bv) const
53 Dimension dim = InsetMathGrid::dimension(bv);
59 void InsetMathTabular::draw(PainterInfo & pi, int x, int y) const
61 FontSetChanger dummy(pi.base, "textnormal");
62 InsetMathGrid::drawWithMargin(pi, x, y, 4, 2);
66 void InsetMathTabular::write(WriteStream & os) const
68 ModeSpecifier specifier(os, TEXT_MODE);
72 os << "\\begin{" << name_ << '}';
74 char const v = verticalAlignment();
75 if (v == 't' || v == 'b')
76 os << '[' << v << ']';
77 os << '{' << horizontalAlignments() << "}\n";
79 InsetMathGrid::write(os);
83 os << "\\end{" << name_ << '}';
84 // adding a \n here is bad if the tabular is the last item
89 void InsetMathTabular::infoize(odocstream & os) const
91 docstring name = name_;
92 name[0] = support::uppercase(name[0]);
97 void InsetMathTabular::normalize(NormalStream & os) const
99 os << '[' << name_ << ' ';
100 InsetMathGrid::normalize(os);
105 void InsetMathTabular::maple(MapleStream & os) const
108 InsetMathGrid::maple(os);