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