2 * \file InsetMathCases.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 "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 bool InsetMathCases::metrics(MetricsInfo & mi, Dimension & dim) const
53 InsetMathGrid::metrics(mi);
63 void InsetMathCases::draw(PainterInfo & pi, int x, int y) const
65 mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 6, dim_.height(), from_ascii("{"));
66 InsetMathGrid::drawWithMargin(pi, x, y, 8, 0);
67 setPosCache(pi, x, y);
71 void InsetMathCases::doDispatch(LCursor & cur, FuncRequest & cmd)
73 //lyxerr << "*** InsetMathCases: request: " << cmd << endl;
75 case LFUN_TABULAR_FEATURE: {
77 docstring const & s = cmd.argument();
78 if (s == "add-vline-left" || s == "add-vline-right") {
84 InsetMathGrid::doDispatch(cur, cmd);
89 bool InsetMathCases::getStatus(LCursor & cur, FuncRequest const & cmd,
90 FuncStatus & flag) const
93 case LFUN_TABULAR_FEATURE: {
94 docstring const & s = cmd.argument();
95 if (s == "add-vline-left" || s == "add-vline-right") {
98 from_utf8(N_("No vertical grid lines in '%1$s'")),
104 return InsetMathGrid::getStatus(cur, cmd, flag);
109 void InsetMathCases::write(WriteStream & os) const
113 os << "\\begin{cases}\n";
114 InsetMathGrid::write(os);
117 os << "\\end{cases}";
121 void InsetMathCases::normalize(NormalStream & os) const
124 InsetMathGrid::normalize(os);
129 void InsetMathCases::maple(MapleStream & os) const
132 InsetMathGrid::maple(os);
137 void InsetMathCases::infoize(odocstream & os) const
143 void InsetMathCases::validate(LaTeXFeatures & features) const
145 features.require("amsmath");
146 InsetMathGrid::validate(features);