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)
|
2001-11-15 09:51:57 +00:00
|
|
|
: MathNestInset(2), symbol_(name), scripts_(new MathScriptInset)
|
2001-11-09 14:48:57 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
MathInset * MathExIntInset::clone() const
|
|
|
|
{
|
|
|
|
return new MathExIntInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-09 16:27:44 +00:00
|
|
|
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
|
|
|
|
{
|
2001-11-15 09:51:57 +00:00
|
|
|
// take empty upper bound as "no scripts"
|
|
|
|
return !scripts_->asScriptInset()->up().data_.empty();
|
2001-11-09 16:27:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-11-09 14:48:57 +00:00
|
|
|
void MathExIntInset::normalize(NormalStream & os) const
|
|
|
|
{
|
2001-11-13 18:33:48 +00:00
|
|
|
os << '[' << symbol_.c_str() << ' ' << cell(0) << ' ' << cell(1);
|
2001-11-09 16:27:44 +00:00
|
|
|
if (hasScripts())
|
2001-11-15 09:51:57 +00:00
|
|
|
os << ' ' << scripts_.nucleus();
|
2001-11-13 18:33:48 +00:00
|
|
|
os << ']';
|
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-13 18:33:48 +00:00
|
|
|
if (cell(0).size())
|
|
|
|
os << cell(0);
|
2001-11-12 13:09:26 +00:00
|
|
|
else
|
|
|
|
os << '1';
|
2001-11-13 18:33:48 +00:00
|
|
|
os << ',' << cell(1);
|
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-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-11-12 14:37:43 +00:00
|
|
|
lyxerr << "should not happen\n";
|
2001-11-09 16:27:44 +00:00
|
|
|
}
|
|
|
|
|