2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file math_casesinset.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.
|
|
|
|
|
*/
|
2001-12-18 03:16:46 +00:00
|
|
|
|
|
2003-08-19 13:00:56 +00:00
|
|
|
|
#include <config.h>
|
2001-11-12 16:45:09 +00:00
|
|
|
|
|
|
|
|
|
#include "math_casesinset.h"
|
2003-09-07 21:25:37 +00:00
|
|
|
|
#include "math_data.h"
|
2001-11-12 16:45:09 +00:00
|
|
|
|
#include "math_mathmlstream.h"
|
|
|
|
|
#include "math_support.h"
|
2003-03-06 08:10:50 +00:00
|
|
|
|
#include "LaTeXFeatures.h"
|
2003-09-05 17:23:11 +00:00
|
|
|
|
#include "support/std_ostream.h"
|
2001-11-12 16:45:09 +00:00
|
|
|
|
|
2003-07-25 17:11:25 +00:00
|
|
|
|
using std::auto_ptr;
|
|
|
|
|
|
2001-11-12 16:45:09 +00:00
|
|
|
|
|
|
|
|
|
MathCasesInset::MathCasesInset(row_type n)
|
|
|
|
|
: MathGridInset(2, n, 'c', "ll")
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2004-11-23 23:04:52 +00:00
|
|
|
|
auto_ptr<InsetBase> MathCasesInset::doClone() const
|
2001-11-12 16:45:09 +00:00
|
|
|
|
{
|
2003-07-25 17:11:25 +00:00
|
|
|
|
return auto_ptr<InsetBase>(new MathCasesInset(*this));
|
2001-11-12 16:45:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-06-02 10:03:27 +00:00
|
|
|
|
void MathCasesInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
2001-11-12 16:45:09 +00:00
|
|
|
|
{
|
|
|
|
|
MathGridInset::metrics(mi);
|
2003-05-27 13:55:03 +00:00
|
|
|
|
dim_.wid += 8;
|
2003-06-02 10:03:27 +00:00
|
|
|
|
dim = dim_;
|
2001-11-12 16:45:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-04-07 16:54:15 +00:00
|
|
|
|
void MathCasesInset::draw(PainterInfo & pi, int x, int y) const
|
2002-03-21 17:42:56 +00:00
|
|
|
|
{
|
2004-04-07 16:54:15 +00:00
|
|
|
|
mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 6, dim_.height(), "{");
|
|
|
|
|
MathGridInset::draw(pi, x + 8, y);
|
|
|
|
|
setPosCache(pi, x, y);
|
2001-11-12 16:45:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MathCasesInset::write(WriteStream & os) const
|
|
|
|
|
{
|
2001-12-03 16:24:50 +00:00
|
|
|
|
if (os.fragile())
|
2001-11-12 16:45:09 +00:00
|
|
|
|
os << "\\protect";
|
2002-03-19 16:55:58 +00:00
|
|
|
|
os << "\\begin{cases}\n";
|
2001-11-12 16:45:09 +00:00
|
|
|
|
MathGridInset::write(os);
|
2001-12-03 16:24:50 +00:00
|
|
|
|
if (os.fragile())
|
2001-11-12 16:45:09 +00:00
|
|
|
|
os << "\\protect";
|
2002-03-18 13:05:52 +00:00
|
|
|
|
os << "\\end{cases}";
|
2001-11-12 16:45:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MathCasesInset::normalize(NormalStream & os) const
|
|
|
|
|
{
|
|
|
|
|
os << "[cases ";
|
|
|
|
|
MathGridInset::normalize(os);
|
2002-11-27 10:30:28 +00:00
|
|
|
|
os << ']';
|
2001-11-12 16:45:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-02-14 14:30:09 +00:00
|
|
|
|
void MathCasesInset::maple(MapleStream & os) const
|
2001-11-12 16:45:09 +00:00
|
|
|
|
{
|
|
|
|
|
os << "cases(";
|
2003-02-14 14:30:09 +00:00
|
|
|
|
MathGridInset::maple(os);
|
2002-11-27 10:30:28 +00:00
|
|
|
|
os << ')';
|
2001-11-12 16:45:09 +00:00
|
|
|
|
}
|
2002-07-08 16:20:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MathCasesInset::infoize(std::ostream & os) const
|
|
|
|
|
{
|
|
|
|
|
os << "Cases ";
|
|
|
|
|
}
|
2003-03-06 08:10:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MathCasesInset::validate(LaTeXFeatures & features) const
|
|
|
|
|
{
|
|
|
|
|
features.require("amsmath");
|
|
|
|
|
MathGridInset::validate(features);
|
|
|
|
|
}
|