2 * \file math_splitinset.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_splitinset.h"
14 #include "math_data.h"
15 #include "math_mathmlstream.h"
16 #include "math_streamstr.h"
18 #include "funcrequest.h"
19 #include "FuncStatus.h"
22 #include "support/lstrings.h"
23 #include "support/std_ostream.h"
26 using lyx::support::bformat;
31 MathSplitInset::MathSplitInset(string const & name)
32 : MathGridInset(1, 1), name_(name)
38 auto_ptr<InsetBase> MathSplitInset::doClone() const
40 return auto_ptr<InsetBase>(new MathSplitInset(*this));
44 char MathSplitInset::defaultColAlign(col_type col)
48 if (name_ == "gathered")
50 if (name_ == "aligned")
51 return (col & 1) ? 'l' : 'r';
52 if (name_ == "alignedat")
53 return (col & 1) ? 'l' : 'r';
58 void MathSplitInset::draw(PainterInfo & pi, int x, int y) const
60 MathGridInset::draw(pi, x, y);
61 setPosCache(pi, x, y);
65 bool MathSplitInset::getStatus(LCursor & cur, FuncRequest const & cmd,
66 FuncStatus & flag) const
69 case LFUN_TABULAR_FEATURE: {
70 string const s = cmd.argument;
71 if (s == "add-vline-left" || s == "add-vline-right") {
73 N_("Can't add vertical grid lines in '%1$s'"),
78 return MathGridInset::getStatus(cur, cmd, flag);
81 return MathGridInset::getStatus(cur, cmd, flag);
86 void MathSplitInset::write(WriteStream & ws) const
90 ws << "\\begin{" << name_ << '}';
91 MathGridInset::write(ws);
94 ws << "\\end{" << name_ << "}\n";
98 void MathSplitInset::infoize(std::ostream & os) const
101 name[0] = lyx::support::uppercase(name[0]);