2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file math_splitinset.C
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2001-09-05 12:57:13 +00:00
|
|
|
|
#include "math_splitinset.h"
|
2003-09-07 21:25:37 +00:00
|
|
|
|
#include "math_data.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-10-06 15:43:21 +00:00
|
|
|
|
|
|
|
|
|
using std::string;
|
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';
|
2004-08-14 14:03:42 +00:00
|
|
|
|
if (name_ == "alignedat")
|
|
|
|
|
return (col & 1) ? 'l' : 'r';
|
2002-02-15 14:50:40 +00:00
|
|
|
|
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
|
|
|
|
}
|