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"
28 using lyx::support::bformat;
39 MathCasesInset::MathCasesInset(row_type n)
40 : MathGridInset(2, n, 'c', "ll")
44 auto_ptr<InsetBase> MathCasesInset::doClone() const
46 return auto_ptr<InsetBase>(new MathCasesInset(*this));
50 void MathCasesInset::metrics(MetricsInfo & mi, Dimension & dim) const
52 MathGridInset::metrics(mi);
58 void MathCasesInset::draw(PainterInfo & pi, int x, int y) const
60 mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 6, dim_.height(), "{");
61 MathGridInset::drawWithMargin(pi, x, y, 8, 0);
62 setPosCache(pi, x, y);
66 void MathCasesInset::doDispatch(LCursor & cur, FuncRequest & cmd)
68 //lyxerr << "*** MathCasesInset: request: " << cmd << endl;
70 case LFUN_TABULAR_FEATURE: {
72 string const s = cmd.argument;
73 if (s == "add-vline-left" || s == "add-vline-right") {
79 MathGridInset::doDispatch(cur, cmd);
84 bool MathCasesInset::getStatus(LCursor & cur, FuncRequest const & cmd,
85 FuncStatus & flag) const
88 case LFUN_TABULAR_FEATURE: {
89 string const s = cmd.argument;
90 if (s == "add-vline-left" || s == "add-vline-right") {
93 N_("No vertical grid lines in '%1$s'"), s));
98 return MathGridInset::getStatus(cur, cmd, flag);
103 void MathCasesInset::write(WriteStream & os) const
107 os << "\\begin{cases}\n";
108 MathGridInset::write(os);
111 os << "\\end{cases}";
115 void MathCasesInset::normalize(NormalStream & os) const
118 MathGridInset::normalize(os);
123 void MathCasesInset::maple(MapleStream & os) const
126 MathGridInset::maple(os);
131 void MathCasesInset::infoize(std::ostream & os) const
137 void MathCasesInset::validate(LaTeXFeatures & features) const
139 features.require("amsmath");
140 MathGridInset::validate(features);