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(Buffer * buf, docstring const & name, int m,
27 : InsetMathGrid(buf, m, n), name_(name)
31 InsetMathTabular::InsetMathTabular(Buffer * buf, docstring const & name, int m,
32 int n, char valign, docstring const & halign)
33 : InsetMathGrid(buf, m, n, valign, halign), name_(name)
38 Inset * InsetMathTabular::clone() const
40 return new InsetMathTabular(*this);
44 void InsetMathTabular::metrics(MetricsInfo & mi, Dimension & dim) const
46 FontSetChanger dummy(mi.base, "textnormal");
47 InsetMathGrid::metrics(mi, dim);
52 Dimension const InsetMathTabular::dimension(BufferView const & bv) const
54 Dimension dim = InsetMathGrid::dimension(bv);
60 void InsetMathTabular::draw(PainterInfo & pi, int x, int y) const
62 FontSetChanger dummy(pi.base, "textnormal");
63 InsetMathGrid::drawWithMargin(pi, x, y, 4, 2);
67 void InsetMathTabular::write(WriteStream & os) const
69 ModeSpecifier specifier(os, TEXT_MODE);
73 os << "\\begin{" << name_ << '}';
74 bool open = os.startOuterRow();
76 char const v = verticalAlignment();
77 if (v == 't' || v == 'b')
78 os << '[' << v << ']';
79 os << '{' << horizontalAlignments() << "}\n";
81 InsetMathGrid::write(os);
85 os << "\\end{" << name_ << '}';
88 // adding a \n here is bad if the tabular is the last item
93 void InsetMathTabular::infoize(odocstream & os) const
95 docstring name = name_;
96 name[0] = support::uppercase(name[0]);
101 void InsetMathTabular::normalize(NormalStream & os) const
103 os << '[' << name_ << ' ';
104 InsetMathGrid::normalize(os);
109 void InsetMathTabular::maple(MapleStream & os) const
112 InsetMathGrid::maple(os);