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;
40 MathCasesInset::MathCasesInset(row_type n)
41 : MathGridInset(2, n, 'c', "ll")
45 auto_ptr<InsetBase> MathCasesInset::doClone() const
47 return auto_ptr<InsetBase>(new MathCasesInset(*this));
51 void MathCasesInset::metrics(MetricsInfo & mi, Dimension & dim) const
53 MathGridInset::metrics(mi);
59 void MathCasesInset::draw(PainterInfo & pi, int x, int y) const
61 mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 6, dim_.height(), "{");
62 MathGridInset::drawWithMargin(pi, x, y, 8, 0);
63 setPosCache(pi, x, y);
67 void MathCasesInset::doDispatch(LCursor & cur, FuncRequest & cmd)
69 //lyxerr << "*** MathCasesInset: request: " << cmd << endl;
71 case LFUN_TABULAR_FEATURE: {
73 docstring const & s = cmd.argument();
74 if (s == "add-vline-left" || s == "add-vline-right") {
80 MathGridInset::doDispatch(cur, cmd);
85 bool MathCasesInset::getStatus(LCursor & cur, FuncRequest const & cmd,
86 FuncStatus & flag) const
89 case LFUN_TABULAR_FEATURE: {
90 docstring const & s = cmd.argument();
91 if (s == "add-vline-left" || s == "add-vline-right") {
94 N_("No vertical grid lines in '%1$s'"), lyx::to_utf8(s)));
99 return MathGridInset::getStatus(cur, cmd, flag);
104 void MathCasesInset::write(WriteStream & os) const
108 os << "\\begin{cases}\n";
109 MathGridInset::write(os);
112 os << "\\end{cases}";
116 void MathCasesInset::normalize(NormalStream & os) const
119 MathGridInset::normalize(os);
124 void MathCasesInset::maple(MapleStream & os) const
127 MathGridInset::maple(os);
132 void MathCasesInset::infoize(std::ostream & os) const
138 void MathCasesInset::validate(LaTeXFeatures & features) const
140 features.require("amsmath");
141 MathGridInset::validate(features);