]> git.lyx.org Git - lyx.git/blob - src/mathed/math_exintinset.C
Strip out redundant #includes
[lyx.git] / src / mathed / math_exintinset.C
1 /**
2  * \file math_exintinset.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author André Pönitz
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "math_exintinset.h"
14 #include "math_mathmlstream.h"
15 #include "math_streamstr.h"
16 #include "math_symbolinset.h"
17 #include "debug.h"
18
19
20 using std::auto_ptr;
21 using std::endl;
22
23
24 MathExIntInset::MathExIntInset(string const & name)
25         : MathNestInset(4), symbol_(name)
26 {}
27
28 // 0 - core
29 // 1 - diff
30 // 2 - lower
31 // 3 - upper
32
33
34 auto_ptr<InsetBase> MathExIntInset::clone() const
35 {
36         return auto_ptr<InsetBase>(new MathExIntInset(*this));
37 }
38
39
40 void MathExIntInset::symbol(string const & symbol)
41 {
42         symbol_ = symbol;
43 }
44
45
46 bool MathExIntInset::hasScripts() const
47 {
48         // take empty upper bound as "no scripts"
49         return !cell(3).empty();
50 }
51
52
53
54 void MathExIntInset::normalize(NormalStream & os) const
55 {
56         os << '[' << symbol_ << ' ' << cell(0) << ' ' << cell(1) << ' '
57            << cell(2) << ' ' << cell(3) << ']';
58 }
59
60
61 void MathExIntInset::metrics(MetricsInfo &, Dimension &) const
62 {
63         lyxerr << "should not happen" << endl;
64 }
65
66
67 void MathExIntInset::draw(PainterInfo &, int, int) const
68 {
69         lyxerr << "should not happen" << endl;
70 }
71
72
73 void MathExIntInset::maple(MapleStream & os) const
74 {
75         os << symbol_ << '(';
76         if (cell(0).size())
77                 os << cell(0);
78         else
79                 os << '1';
80         os << ',' << cell(1);
81         if (hasScripts())
82                 os << '=' << cell(2) << ".." << cell(3);
83         os << ')';
84 }
85
86
87 void MathExIntInset::maxima(MaximaStream & os) const
88 {
89         if ( symbol_ == "int" )
90                 os << "integrate(";
91         else
92                 os << symbol_ << '(';
93
94         if (cell(0).size())
95                 os << cell(0) << ',';
96         else
97                 os << '1' << ',';
98         if (hasScripts())
99                 os << cell(1) << ',' << cell(2) << ',' << cell(3) << ')';
100         else
101                 os << cell(1) << ')';
102 }
103
104 void MathExIntInset::mathematica(MathematicaStream & os) const
105 {
106         if ( symbol_ == "int" )
107                 os << "Integrate[";
108         else if (symbol_ == "sum")
109                 os << "Sum[";
110         else
111                 os << symbol_ << '[';
112
113         if (cell(0).size())
114                 os << cell(0) << ',';
115         else
116                 os << '1' << ',';
117         if (hasScripts())
118                 os << '{' << cell(1) << ',' << cell(2) << ',' << cell(3) << "}]";
119         else
120                 os << cell(1) << ']';
121 }
122
123
124 void MathExIntInset::mathmlize(MathMLStream & os) const
125 {
126         boost::scoped_ptr<MathSymbolInset> sym(new MathSymbolInset(symbol_));
127         //if (hasScripts())
128         //      mathmlize(sym, os);
129         //else
130                 sym->mathmlize(os);
131         os << cell(0) << "<mo> &InvisibleTimes; </mo>"
132            << MTag("mrow") << "<mo> &DifferentialD; </mo>"
133            << cell(1) << ETag("mrow");
134 }
135
136
137 void MathExIntInset::write(WriteStream &) const
138 {
139         lyxerr << "should not happen" << endl;
140 }