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;
35 InsetMathCases::InsetMathCases(row_type n)
36 : InsetMathGrid(2, n, 'c', from_ascii("ll"))
40 Inset * InsetMathCases::clone() const
42 return new InsetMathCases(*this);
46 bool InsetMathCases::metrics(MetricsInfo & mi, Dimension & dim) const
49 InsetMathGrid::metrics(mi);
59 void InsetMathCases::draw(PainterInfo & pi, int x, int y) const
61 mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 6, dim_.height(), from_ascii("{"));
62 InsetMathGrid::drawWithMargin(pi, x, y, 8, 0);
63 setPosCache(pi, x, y);
67 void InsetMathCases::doDispatch(Cursor & cur, FuncRequest & cmd)
69 //lyxerr << "*** InsetMathCases: 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 InsetMathGrid::doDispatch(cur, cmd);
85 bool InsetMathCases::getStatus(Cursor & 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 from_utf8(N_("No vertical grid lines in 'cases': feature %1$s")),
100 return InsetMathGrid::getStatus(cur, cmd, flag);
105 void InsetMathCases::write(WriteStream & os) const
109 os << "\\begin{cases}\n";
110 InsetMathGrid::write(os);
113 os << "\\end{cases}";
117 void InsetMathCases::normalize(NormalStream & os) const
120 InsetMathGrid::normalize(os);
125 void InsetMathCases::maple(MapleStream & os) const
128 InsetMathGrid::maple(os);
133 void InsetMathCases::infoize(odocstream & os) const
139 void InsetMathCases::validate(LaTeXFeatures & features) const
141 features.require("amsmath");
142 InsetMathGrid::validate(features);