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 "MathStream.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;
39 InsetMathCases::InsetMathCases(row_type n)
40 : InsetMathGrid(2, n, 'c', from_ascii("ll"))
44 auto_ptr<InsetBase> InsetMathCases::doClone() const
46 return auto_ptr<InsetBase>(new InsetMathCases(*this));
50 void InsetMathCases::metrics(MetricsInfo & mi, Dimension & dim) const
52 InsetMathGrid::metrics(mi);
58 void InsetMathCases::draw(PainterInfo & pi, int x, int y) const
60 mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 6, dim_.height(), from_ascii("{"));
61 InsetMathGrid::drawWithMargin(pi, x, y, 8, 0);
62 setPosCache(pi, x, y);
66 void InsetMathCases::doDispatch(LCursor & cur, FuncRequest & cmd)
68 //lyxerr << "*** InsetMathCases: request: " << cmd << endl;
70 case LFUN_TABULAR_FEATURE: {
72 docstring const & s = cmd.argument();
73 if (s == "add-vline-left" || s == "add-vline-right") {
79 InsetMathGrid::doDispatch(cur, cmd);
84 bool InsetMathCases::getStatus(LCursor & cur, FuncRequest const & cmd,
85 FuncStatus & flag) const
88 case LFUN_TABULAR_FEATURE: {
89 docstring const & s = cmd.argument();
90 if (s == "add-vline-left" || s == "add-vline-right") {
93 from_utf8(N_("No vertical grid lines in '%1$s'")),
99 return InsetMathGrid::getStatus(cur, cmd, flag);
104 void InsetMathCases::write(WriteStream & os) const
108 os << "\\begin{cases}\n";
109 InsetMathGrid::write(os);
112 os << "\\end{cases}";
116 void InsetMathCases::normalize(NormalStream & os) const
119 InsetMathGrid::normalize(os);
124 void InsetMathCases::maple(MapleStream & os) const
127 InsetMathGrid::maple(os);
132 void InsetMathCases::infoize(odocstream & os) const
138 void InsetMathCases::validate(LaTeXFeatures & features) const
140 features.require("amsmath");
141 InsetMathGrid::validate(features);