]> git.lyx.org Git - lyx.git/blob - src/mathed/math_exintinset.C
4fce6e180de03f38fab9f3bd7a28c2347fb0d3fd
[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)
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         return scripts_.hasNucleus();
40 }
41
42
43
44 void MathExIntInset::normalize(NormalStream & os) const
45 {
46         os << '[' << symbol_.c_str() << ' ' << cell(0) << ' ' << cell(1);
47         if (hasScripts())
48                 os << scripts_.nucleus();
49         os << ']';
50 }
51
52
53 void MathExIntInset::metrics(MathMetricsInfo const &) const
54 {
55         lyxerr << "should not happen\n";
56 }
57
58
59 void MathExIntInset::draw(Painter &, int, int) const
60 {  
61         lyxerr << "should not happen\n";
62 }
63
64
65 void MathExIntInset::maplize(MapleStream & os) const
66 {
67         os << symbol_.c_str() << '(';
68         if (cell(0).size())
69                 os << cell(0);
70         else 
71                 os << '1';
72         os << ',' << cell(1);
73         if (hasScripts()) {
74                 MathScriptInset * p = scripts_->asScriptInset();
75                 os << '=' << p->down().data_ << ".." << p->up().data_;
76         }
77         os << ')';
78 }
79
80
81 void MathExIntInset::mathmlize(MathMLStream & os) const
82 {
83         MathSymbolInset * sym = new MathSymbolInset(symbol_.c_str());
84         if (hasScripts())
85                 scripts_->asScriptInset()->mathmlize(sym, os);
86         else 
87                 sym->mathmlize(os);
88         delete sym;
89         os << cell(0) << "<mo> &InvisibleTimes; </mo>"
90            << MTag("mrow") << "<mo> &DifferentialD; </mo>"
91            << cell(1) << ETag("mrow");
92 }
93
94
95 void MathExIntInset::write(WriteStream &) const
96 {
97         lyxerr << "should not happen\n";
98 }
99