2001-09-05 12:57:13 +00:00
|
|
|
#include "math_splitinset.h"
|
2001-11-08 12:06:56 +00:00
|
|
|
#include "math_mathmlstream.h"
|
2002-02-15 14:50:40 +00:00
|
|
|
#include "math_streamstr.h"
|
2001-09-05 12:57:13 +00:00
|
|
|
|
2003-07-25 17:11:25 +00:00
|
|
|
using std::auto_ptr;
|
|
|
|
|
2001-09-05 12:57:13 +00:00
|
|
|
|
2002-02-15 14:50:40 +00:00
|
|
|
MathSplitInset::MathSplitInset(string const & name)
|
|
|
|
: MathGridInset(1, 1), name_(name)
|
2001-09-05 12:57:13 +00:00
|
|
|
{
|
|
|
|
setDefaults();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-07-25 17:11:25 +00:00
|
|
|
auto_ptr<InsetBase> MathSplitInset::clone() const
|
2001-09-05 12:57:13 +00:00
|
|
|
{
|
2003-07-25 17:11:25 +00:00
|
|
|
return auto_ptr<InsetBase>(new MathSplitInset(*this));
|
2001-09-05 12:57:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-15 14:50:40 +00:00
|
|
|
char MathSplitInset::defaultColAlign(col_type col)
|
|
|
|
{
|
|
|
|
if (name_ == "split")
|
|
|
|
return 'l';
|
|
|
|
if (name_ == "gathered")
|
|
|
|
return 'c';
|
|
|
|
if (name_ == "aligned")
|
|
|
|
return (col & 1) ? 'l' : 'r';
|
|
|
|
return 'l';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-12-03 16:24:50 +00:00
|
|
|
void MathSplitInset::write(WriteStream & ws) const
|
2001-09-05 12:57:13 +00:00
|
|
|
{
|
2001-12-03 16:24:50 +00:00
|
|
|
if (ws.fragile())
|
|
|
|
ws << "\\protect";
|
2002-11-27 10:30:28 +00:00
|
|
|
ws << "\\begin{" << name_ << '}';
|
2001-12-03 16:24:50 +00:00
|
|
|
MathGridInset::write(ws);
|
|
|
|
if (ws.fragile())
|
|
|
|
ws << "\\protect";
|
2002-02-15 14:50:40 +00:00
|
|
|
ws << "\\end{" << name_ << "}\n";
|
2001-09-05 12:57:13 +00:00
|
|
|
}
|