2001-12-05 08:04:20 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2001-11-09 14:48:57 +00:00
|
|
|
#include "math_exintinset.h"
|
|
|
|
#include "math_support.h"
|
|
|
|
#include "math_mathmlstream.h"
|
2001-12-05 08:04:20 +00:00
|
|
|
#include "math_streamstr.h"
|
2001-11-09 14:48:57 +00:00
|
|
|
#include "math_symbolinset.h"
|
2001-11-13 16:27:06 +00:00
|
|
|
#include "debug.h"
|
2001-11-09 14:48:57 +00:00
|
|
|
|
2002-05-22 01:16:37 +00:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
2001-12-18 03:16:46 +00:00
|
|
|
|
2001-12-05 08:04:20 +00:00
|
|
|
using std::endl;
|
|
|
|
|
2001-11-09 14:48:57 +00:00
|
|
|
|
2001-11-12 14:37:43 +00:00
|
|
|
MathExIntInset::MathExIntInset(string const & name)
|
2001-11-15 14:14:37 +00:00
|
|
|
: MathNestInset(4), symbol_(name)
|
2001-11-09 14:48:57 +00:00
|
|
|
{}
|
|
|
|
|
2001-11-15 14:14:37 +00:00
|
|
|
// 0 - core
|
|
|
|
// 1 - diff
|
|
|
|
// 2 - lower
|
|
|
|
// 3 - upper
|
|
|
|
|
2001-11-09 14:48:57 +00:00
|
|
|
|
|
|
|
MathInset * MathExIntInset::clone() const
|
|
|
|
{
|
|
|
|
return new MathExIntInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-12 14:37:43 +00:00
|
|
|
void MathExIntInset::symbol(string const & symbol)
|
|
|
|
{
|
|
|
|
symbol_ = symbol;
|
2001-11-09 14:48:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-09 16:27:44 +00:00
|
|
|
bool MathExIntInset::hasScripts() const
|
|
|
|
{
|
2001-11-15 09:51:57 +00:00
|
|
|
// take empty upper bound as "no scripts"
|
2001-11-15 14:14:37 +00:00
|
|
|
return !cell(3).empty();
|
2001-11-09 16:27:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-11-09 14:48:57 +00:00
|
|
|
void MathExIntInset::normalize(NormalStream & os) const
|
|
|
|
{
|
2002-03-21 17:42:56 +00:00
|
|
|
os << '[' << symbol_ << ' ' << cell(0) << ' ' << cell(1) << ' '
|
2001-11-15 14:14:37 +00:00
|
|
|
<< cell(2) << ' ' << cell(3) << ']';
|
2001-11-09 14:48:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
void MathExIntInset::metrics(MathMetricsInfo &) const
|
2001-11-09 14:48:57 +00:00
|
|
|
{
|
2001-12-05 08:04:20 +00:00
|
|
|
lyxerr << "should not happen" << endl;
|
2001-11-09 14:48:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
void MathExIntInset::draw(MathPainterInfo &, int, int) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2001-12-05 08:04:20 +00:00
|
|
|
lyxerr << "should not happen" << endl;
|
2001-11-09 14:48:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathExIntInset::maplize(MapleStream & os) const
|
|
|
|
{
|
2001-12-05 08:04:20 +00:00
|
|
|
os << symbol_ << '(';
|
2001-11-13 18:33:48 +00:00
|
|
|
if (cell(0).size())
|
|
|
|
os << cell(0);
|
2002-03-21 17:42:56 +00:00
|
|
|
else
|
2001-11-12 13:09:26 +00:00
|
|
|
os << '1';
|
2001-11-13 18:33:48 +00:00
|
|
|
os << ',' << cell(1);
|
2001-11-15 14:14:37 +00:00
|
|
|
if (hasScripts())
|
|
|
|
os << '=' << cell(2) << ".." << cell(3);
|
2001-11-09 16:27:44 +00:00
|
|
|
os << ')';
|
2001-11-09 14:48:57 +00:00
|
|
|
}
|
|
|
|
|
2002-07-30 17:51:19 +00:00
|
|
|
|
2002-07-01 11:17:14 +00:00
|
|
|
void MathExIntInset::mathematicize(MathematicaStream & os) const
|
|
|
|
{
|
|
|
|
if ( symbol_ == "int" )
|
|
|
|
os << "Integrate[";
|
|
|
|
else
|
|
|
|
if (symbol_ == "sum")
|
|
|
|
os << "Sum[";
|
|
|
|
else
|
|
|
|
os << symbol_ << '[';
|
|
|
|
|
|
|
|
if (cell(0).size())
|
|
|
|
os << cell(0) << ',';
|
|
|
|
else
|
|
|
|
os << '1' << ',';
|
|
|
|
if (hasScripts())
|
|
|
|
os << '{' << cell(1) << ',' << cell(2) << ',' << cell(3) << "}]";
|
|
|
|
else
|
|
|
|
os << cell(1) << ']';
|
|
|
|
}
|
|
|
|
|
2001-11-09 16:27:44 +00:00
|
|
|
|
2001-11-09 14:48:57 +00:00
|
|
|
void MathExIntInset::mathmlize(MathMLStream & os) const
|
|
|
|
{
|
2001-12-18 03:16:46 +00:00
|
|
|
boost::scoped_ptr<MathSymbolInset> sym(new MathSymbolInset(symbol_));
|
2001-11-15 14:14:37 +00:00
|
|
|
//if (hasScripts())
|
|
|
|
// mathmlize(sym, os);
|
2002-03-21 17:42:56 +00:00
|
|
|
//else
|
2001-11-12 14:37:43 +00:00
|
|
|
sym->mathmlize(os);
|
2001-11-13 18:33:48 +00:00
|
|
|
os << cell(0) << "<mo> ⁢ </mo>"
|
2001-11-09 18:02:20 +00:00
|
|
|
<< MTag("mrow") << "<mo> ⅆ </mo>"
|
2001-11-13 18:33:48 +00:00
|
|
|
<< cell(1) << ETag("mrow");
|
2001-11-09 14:48:57 +00:00
|
|
|
}
|
2001-11-09 16:27:44 +00:00
|
|
|
|
|
|
|
|
2001-11-12 14:37:43 +00:00
|
|
|
void MathExIntInset::write(WriteStream &) const
|
2001-11-09 16:27:44 +00:00
|
|
|
{
|
2001-12-05 08:04:20 +00:00
|
|
|
lyxerr << "should not happen" << endl;
|
2001-11-09 16:27:44 +00:00
|
|
|
}
|