2 * \file InsetMathCases.C
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 "InsetMathCases.h"
15 #include "MathMLStream.h"
16 #include "MathSupport.h"
17 #include "FuncStatus.h"
18 #include "LaTeXFeatures.h"
19 #include "support/std_ostream.h"
21 #include "funcrequest.h"
25 #include "support/lstrings.h"
30 using support::bformat;
41 InsetMathCases::InsetMathCases(row_type n)
42 : InsetMathGrid(2, n, 'c', "ll")
46 auto_ptr<InsetBase> InsetMathCases::doClone() const
48 return auto_ptr<InsetBase>(new InsetMathCases(*this));
52 void InsetMathCases::metrics(MetricsInfo & mi, Dimension & dim) const
54 InsetMathGrid::metrics(mi);
60 void InsetMathCases::draw(PainterInfo & pi, int x, int y) const
62 mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 6, dim_.height(), "{");
63 InsetMathGrid::drawWithMargin(pi, x, y, 8, 0);
64 setPosCache(pi, x, y);
68 void InsetMathCases::doDispatch(LCursor & cur, FuncRequest & cmd)
70 //lyxerr << "*** InsetMathCases: request: " << cmd << endl;
72 case LFUN_TABULAR_FEATURE: {
74 docstring const & s = cmd.argument();
75 if (s == "add-vline-left" || s == "add-vline-right") {
81 InsetMathGrid::doDispatch(cur, cmd);
86 bool InsetMathCases::getStatus(LCursor & cur, FuncRequest const & cmd,
87 FuncStatus & flag) const
90 case LFUN_TABULAR_FEATURE: {
91 docstring const & s = cmd.argument();
92 if (s == "add-vline-left" || s == "add-vline-right") {
95 from_utf8(N_("No vertical grid lines in '%1$s'")),
101 return InsetMathGrid::getStatus(cur, cmd, flag);
106 void InsetMathCases::write(WriteStream & os) const
110 os << "\\begin{cases}\n";
111 InsetMathGrid::write(os);
114 os << "\\end{cases}";
118 void InsetMathCases::normalize(NormalStream & os) const
121 InsetMathGrid::normalize(os);
126 void InsetMathCases::maple(MapleStream & os) const
129 InsetMathGrid::maple(os);
134 void InsetMathCases::infoize(std::ostream & os) const
140 void InsetMathCases::validate(LaTeXFeatures & features) const
142 features.require("amsmath");
143 InsetMathGrid::validate(features);