2 * \file math_casesinset.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 "math_casesinset.h"
14 #include "math_data.h"
15 #include "math_mathmlstream.h"
16 #include "math_support.h"
17 #include "FuncStatus.h"
18 #include "LaTeXFeatures.h"
19 #include "support/std_ostream.h"
21 #include "funcrequest.h"
25 #include "support/lstrings.h"
29 using lyx::support::bformat;
35 using std::istringstream;
41 MathCasesInset::MathCasesInset(row_type n)
42 : MathGridInset(2, n, 'c', "ll")
46 auto_ptr<InsetBase> MathCasesInset::doClone() const
48 return auto_ptr<InsetBase>(new MathCasesInset(*this));
52 void MathCasesInset::metrics(MetricsInfo & mi, Dimension & dim) const
54 MathGridInset::metrics(mi);
60 void MathCasesInset::draw(PainterInfo & pi, int x, int y) const
62 mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 6, dim_.height(), "{");
63 MathGridInset::draw(pi, x + 8, y);
64 setPosCache(pi, x, y);
68 void MathCasesInset::doDispatch(LCursor & cur, FuncRequest & cmd)
70 //lyxerr << "*** MathCasesInset: request: " << cmd << endl;
72 case LFUN_TABULAR_FEATURE: {
74 istringstream is(cmd.argument);
77 if (s == "add-vline-left" || s == "add-vline-right") {
83 MathGridInset::doDispatch(cur, cmd);
88 bool MathCasesInset::getStatus(LCursor & cur, FuncRequest const & cmd,
89 FuncStatus & flag) const
92 case LFUN_TABULAR_FEATURE: {
93 istringstream is(cmd.argument);
96 if (s == "add-vline-left" || s == "add-vline-right") {
99 N_("No vertical grid lines in '%1$s'"), s));
104 return MathGridInset::getStatus(cur, cmd, flag);
109 void MathCasesInset::write(WriteStream & os) const
113 os << "\\begin{cases}\n";
114 MathGridInset::write(os);
117 os << "\\end{cases}";
121 void MathCasesInset::normalize(NormalStream & os) const
124 MathGridInset::normalize(os);
129 void MathCasesInset::maple(MapleStream & os) const
132 MathGridInset::maple(os);
137 void MathCasesInset::infoize(std::ostream & os) const
143 void MathCasesInset::validate(LaTeXFeatures & features) const
145 features.require("amsmath");
146 MathGridInset::validate(features);