2 * \file InsetMathExInt.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "InsetMathExInt.h"
15 #include "LaTeXFeatures.h"
17 #include "MathStream.h"
18 #include "MathStream.h"
19 #include "InsetMathSymbol.h"
21 #include "support/debug.h"
22 #include "support/docstring.h"
27 InsetMathExInt::InsetMathExInt(Buffer * buf, docstring const & name)
28 : InsetMathNest(buf, 4), symbol_(name)
37 Inset * InsetMathExInt::clone() const
39 return new InsetMathExInt(*this);
43 void InsetMathExInt::symbol(docstring const & symbol)
49 bool InsetMathExInt::hasScripts() const
51 // take empty upper bound as "no scripts"
52 return !cell(3).empty();
57 void InsetMathExInt::normalize(NormalStream & os) const
59 os << '[' << symbol_ << ' ' << cell(0) << ' ' << cell(1) << ' '
60 << cell(2) << ' ' << cell(3) << ']';
64 void InsetMathExInt::metrics(MetricsInfo &, Dimension &) const
66 LYXERR0("should not happen");
70 void InsetMathExInt::draw(PainterInfo &, int, int) const
72 LYXERR0("should not happen");
76 void InsetMathExInt::maple(MapleStream & os) const
85 os << '=' << cell(2) << ".." << cell(3);
90 void InsetMathExInt::maxima(MaximaStream & os) const
102 os << cell(1) << ',' << cell(2) << ',' << cell(3) << ')';
104 os << cell(1) << ')';
107 void InsetMathExInt::mathematica(MathematicaStream & os) const
109 if (symbol_ == "int")
111 else if (symbol_ == "sum")
114 os << symbol_ << '[';
116 if (!cell(0).empty())
117 os << cell(0) << ',';
121 os << '{' << cell(1) << ',' << cell(2) << ',' << cell(3) << "}]";
123 os << cell(1) << ']';
127 void InsetMathExInt::mathmlize(MathStream & os) const
129 // At the moment, we are not extracting sums and the like for MathML.
130 // If we should decide to do so later, then we'll need to re-merge
131 // r32566 and r32568.
132 // So right now this only handles integrals.
133 InsetMathSymbol sym(symbol_);
134 bool const lower = !cell(2).empty();
135 bool const upper = !cell(3).empty();
137 os << MTag("msubsup");
146 os << MTag("mrow") << cell(2) << ETag("mrow");
148 os << MTag("mrow") << cell(3) << ETag("mrow");
150 os << ETag("msubsup");
155 os << cell(0) << "<mo> ⁢ </mo>"
156 << MTag("mrow") << "<mo> ⅆ </mo>"
157 << cell(1) << ETag("mrow");
161 void InsetMathExInt::htmlize(HtmlStream & os) const
163 // At the moment, we are not extracting sums and the like for HTML.
164 // So right now this only handles integrals.
165 InsetMathSymbol sym(symbol_);
166 bool const lower = !cell(2).empty();
167 bool const upper = !cell(3).empty();
169 os << MTag("span", "class='integral'")
170 << MTag("span", "class='intsym'");
171 sym.htmlize(os, false);
174 if (lower && upper) {
175 os << MTag("span", "class='limits'")
176 << MTag("span") << cell(2) << ETag("span")
177 << MTag("span") << cell(3) << ETag("span")
180 os << MTag("sub", "class='limit'") << cell(2) << ETag("sub");
182 os << MTag("sup", "class='limit'") << cell(3) << ETag("sup");
183 os << cell(0) << "<b>d</b>" << cell(1) << ETag("span");
187 void InsetMathExInt::write(WriteStream &) const
189 LYXERR0("should not happen");