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 "MathExtern.h"
16 #include "MathStream.h"
17 #include "MathStream.h"
18 #include "InsetMathSymbol.h"
20 #include "support/debug.h"
21 #include "support/docstring.h"
26 InsetMathExInt::InsetMathExInt(Buffer * buf, docstring const & name)
27 : InsetMathNest(buf, 4), symbol_(name)
36 Inset * InsetMathExInt::clone() const
38 return new InsetMathExInt(*this);
42 void InsetMathExInt::symbol(docstring const & symbol)
48 bool InsetMathExInt::hasScripts() const
50 // take empty upper bound as "no scripts"
51 return !cell(3).empty();
56 void InsetMathExInt::normalize(NormalStream & os) const
58 os << '[' << symbol_ << ' ' << cell(0) << ' ' << cell(1) << ' '
59 << cell(2) << ' ' << cell(3) << ']';
63 void InsetMathExInt::metrics(MetricsInfo &, Dimension &) const
65 LYXERR0("should not happen");
69 void InsetMathExInt::draw(PainterInfo &, int, int) const
71 LYXERR0("should not happen");
75 void InsetMathExInt::maple(MapleStream & os) const
84 os << '=' << cell(2) << ".." << cell(3);
89 void InsetMathExInt::maxima(MaximaStream & os) const
101 os << cell(1) << ',' << cell(2) << ',' << cell(3) << ')';
103 os << cell(1) << ')';
106 void InsetMathExInt::mathematica(MathematicaStream & os) const
108 if (symbol_ == "int")
110 else if (symbol_ == "sum")
113 os << symbol_ << '[';
116 os << cell(0) << ',';
120 os << '{' << cell(1) << ',' << cell(2) << ',' << cell(3) << "}]";
122 os << cell(1) << ']';
126 docstring InsetMathExInt::mathmlize(MathStream & os) const
128 // At the moment, we are not extracting sums and the like for MathML.
129 // If we should decide to do so later, then we'll need to re-merge
130 // r32566 and r32568.
131 // So right now this only handles integrals.
132 InsetMathSymbol sym(symbol_);
133 bool const lower = !cell(2).empty();
134 bool const upper = !cell(3).empty();
136 os << MTag("msubsup");
145 os << MTag("mrow") << cell(2) << ETag("mrow");
147 os << MTag("mrow") << cell(3) << ETag("mrow");
149 os << ETag("msubsup");
154 docstring rv = lyx::mathmlize(cell(0), os);
155 os << "<mo> ⁢ </mo>"
156 << MTag("mrow") << "<mo> ⅆ </mo>"
157 << cell(1) << ETag("mrow");
162 void InsetMathExInt::write(WriteStream &) const
164 LYXERR0("should not happen");