2001-11-09 14:48:57 +00:00
|
|
|
#include "math_exintinset.h"
|
|
|
|
#include "math_support.h"
|
|
|
|
#include "math_mathmlstream.h"
|
|
|
|
#include "math_symbolinset.h"
|
2001-11-13 16:27:06 +00:00
|
|
|
#include "debug.h"
|
2001-11-09 14:48:57 +00:00
|
|
|
|
|
|
|
|
2001-11-12 14:37:43 +00:00
|
|
|
MathExIntInset::MathExIntInset(string const & name)
|
|
|
|
: symbol_(name)
|
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::index(MathArray const & ar)
|
2001-11-09 14:48:57 +00:00
|
|
|
{
|
2001-11-12 14:37:43 +00:00
|
|
|
index_ = ar;
|
2001-11-09 16:27:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathExIntInset::core(MathArray const & ar)
|
|
|
|
{
|
|
|
|
core_ = ar;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathExIntInset::scripts(MathAtom const & at)
|
|
|
|
{
|
|
|
|
scripts_ = at;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-12 14:37:43 +00:00
|
|
|
MathAtom & MathExIntInset::scripts()
|
2001-11-09 16:27:44 +00:00
|
|
|
{
|
2001-11-12 14:37:43 +00:00
|
|
|
return scripts_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
{
|
|
|
|
return scripts_.hasNucleus();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-11-09 14:48:57 +00:00
|
|
|
void MathExIntInset::normalize(NormalStream & os) const
|
|
|
|
{
|
2001-11-12 14:37:43 +00:00
|
|
|
os << '[' << symbol_.c_str() << ' ';
|
2001-11-09 16:27:44 +00:00
|
|
|
if (hasScripts())
|
|
|
|
os << scripts_.nucleus();
|
|
|
|
else
|
|
|
|
os << "{}";
|
2001-11-12 14:37:43 +00:00
|
|
|
os << ' ' << core_ << ' ' << index_ << ']';
|
2001-11-09 14:48:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathExIntInset::metrics(MathMetricsInfo const &) const
|
|
|
|
{
|
|
|
|
lyxerr << "should not happen\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathExIntInset::draw(Painter &, int, int) const
|
|
|
|
{
|
|
|
|
lyxerr << "should not happen\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathExIntInset::maplize(MapleStream & os) const
|
|
|
|
{
|
2001-11-12 14:37:43 +00:00
|
|
|
os << symbol_.c_str() << '(';
|
2001-11-12 13:09:26 +00:00
|
|
|
if (core_.size())
|
|
|
|
os << core_;
|
|
|
|
else
|
|
|
|
os << '1';
|
2001-11-12 14:37:43 +00:00
|
|
|
os << ',' << index_;
|
2001-11-09 16:27:44 +00:00
|
|
|
if (hasScripts()) {
|
|
|
|
MathScriptInset * p = scripts_->asScriptInset();
|
|
|
|
os << '=' << p->down().data_ << ".." << p->up().data_;
|
|
|
|
}
|
|
|
|
os << ')';
|
2001-11-09 14:48:57 +00:00
|
|
|
}
|
|
|
|
|
2001-11-09 16:27:44 +00:00
|
|
|
|
2001-11-09 14:48:57 +00:00
|
|
|
void MathExIntInset::mathmlize(MathMLStream & os) const
|
|
|
|
{
|
2001-11-12 14:37:43 +00:00
|
|
|
MathSymbolInset * sym = new MathSymbolInset(symbol_.c_str());
|
2001-11-09 18:02:20 +00:00
|
|
|
if (hasScripts())
|
2001-11-12 14:37:43 +00:00
|
|
|
scripts_->asScriptInset()->mathmlize(sym, os);
|
2001-11-09 18:02:20 +00:00
|
|
|
else
|
2001-11-12 14:37:43 +00:00
|
|
|
sym->mathmlize(os);
|
|
|
|
delete sym;
|
2001-11-09 18:02:20 +00:00
|
|
|
os << core_ << "<mo> ⁢ </mo>"
|
|
|
|
<< MTag("mrow") << "<mo> ⅆ </mo>"
|
2001-11-12 14:37:43 +00:00
|
|
|
<< index_ << 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-11-12 14:37:43 +00:00
|
|
|
lyxerr << "should not happen\n";
|
2001-11-09 16:27:44 +00:00
|
|
|
}
|
|
|
|
|