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 & ms) 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 ms << MTag("msubsup");
146 ms << MTag("mrow") << cell(2) << ETag("mrow");
148 ms << MTag("mrow") << cell(3) << ETag("mrow");
150 ms << ETag("msubsup");
156 << "<" << from_ascii(ms.namespacedTag("mo")) << "> "
157 << " ⁢ "
158 << "</" << from_ascii(ms.namespacedTag("mo")) << ">"
160 << "<" << from_ascii(ms.namespacedTag("mo")) << "> "
161 << " ⅆ "
162 << "</" << from_ascii(ms.namespacedTag("mo")) << ">"
168 void InsetMathExInt::htmlize(HtmlStream & os) const
170 // At the moment, we are not extracting sums and the like for HTML.
171 // So right now this only handles integrals.
172 InsetMathSymbol sym(symbol_);
173 bool const lower = !cell(2).empty();
174 bool const upper = !cell(3).empty();
176 os << MTag("span", "class='integral'")
177 << MTag("span", "class='intsym'");
178 sym.htmlize(os, false);
181 if (lower && upper) {
182 os << MTag("span", "class='limits'")
183 << MTag("span") << cell(2) << ETag("span")
184 << MTag("span") << cell(3) << ETag("span")
187 os << MTag("sub", "class='limit'") << cell(2) << ETag("sub");
189 os << MTag("sup", "class='limit'") << cell(3) << ETag("sup");
190 os << cell(0) << "<b>d</b>" << cell(1) << ETag("span");
194 void InsetMathExInt::write(WriteStream &) const
196 LYXERR0("should not happen");