]> git.lyx.org Git - lyx.git/blob - src/mathed/math_exintinset.C
23758c6ee7bb67f6e5bcf26c847ce3383570063f
[lyx.git] / src / mathed / math_exintinset.C
1 #include "math_exintinset.h"
2 #include "math_support.h"
3 #include "math_mathmlstream.h"
4 #include "math_symbolinset.h"
5 #include "debug.h"
6
7
8 MathExIntInset::MathExIntInset(string const & name)
9         : MathNestInset(2), symbol_(name), scripts_(new MathScriptInset)
10 {}
11
12
13 MathInset * MathExIntInset::clone() const
14 {
15         return new MathExIntInset(*this);
16 }
17
18
19 void MathExIntInset::scripts(MathAtom const & at)
20 {
21         scripts_ = at;
22 }
23
24
25 MathAtom & MathExIntInset::scripts()
26 {
27         return scripts_;
28 }
29
30
31 void MathExIntInset::symbol(string const & symbol)
32 {
33         symbol_ = symbol;
34 }
35
36
37 bool MathExIntInset::hasScripts() const
38 {
39         // take empty upper bound as "no scripts"
40         return !scripts_->asScriptInset()->up().data_.empty();
41 }
42
43
44
45 void MathExIntInset::normalize(NormalStream & os) const
46 {
47         os << '[' << symbol_.c_str() << ' ' << cell(0) << ' ' << cell(1);
48         if (hasScripts())
49                 os << ' ' << scripts_.nucleus();
50         os << ']';
51 }
52
53
54 void MathExIntInset::metrics(MathMetricsInfo const &) const
55 {
56         lyxerr << "should not happen\n";
57 }
58
59
60 void MathExIntInset::draw(Painter &, int, int) const
61 {  
62         lyxerr << "should not happen\n";
63 }
64
65
66 void MathExIntInset::maplize(MapleStream & os) const
67 {
68         os << symbol_.c_str() << '(';
69         if (cell(0).size())
70                 os << cell(0);
71         else 
72                 os << '1';
73         os << ',' << cell(1);
74         if (hasScripts()) {
75                 MathScriptInset * p = scripts_->asScriptInset();
76                 os << '=' << p->down().data_ << ".." << p->up().data_;
77         }
78         os << ')';
79 }
80
81
82 void MathExIntInset::mathmlize(MathMLStream & os) const
83 {
84         MathSymbolInset * sym = new MathSymbolInset(symbol_.c_str());
85         if (hasScripts())
86                 scripts_->asScriptInset()->mathmlize(sym, os);
87         else 
88                 sym->mathmlize(os);
89         delete sym;
90         os << cell(0) << "<mo> &InvisibleTimes; </mo>"
91            << MTag("mrow") << "<mo> &DifferentialD; </mo>"
92            << cell(1) << ETag("mrow");
93 }
94
95
96 void MathExIntInset::write(WriteStream &) const
97 {
98         lyxerr << "should not happen\n";
99 }
100