]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathExInt.cpp
g-brief loads babel internally. So don't load it ourselves.
[lyx.git] / src / mathed / InsetMathExInt.cpp
index 5277b6cde818253302213b17e17a1fc9f9e3d95f..03f516dd8370e5ee4a69c14f34461afbce755e09 100644 (file)
@@ -11,9 +11,9 @@
 #include <config.h>
 
 #include "InsetMathExInt.h"
+
+#include "LaTeXFeatures.h"
 #include "MathData.h"
-#include "MathExtern.h"
-#include "MathStream.h"
 #include "MathStream.h"
 #include "InsetMathSymbol.h"
 
@@ -75,7 +75,7 @@ void InsetMathExInt::draw(PainterInfo &, int, int) const
 void InsetMathExInt::maple(MapleStream & os) const
 {
        os << symbol_ << '(';
-       if (cell(0).size())
+       if (!cell(0).empty())
                os << cell(0);
        else
                os << '1';
@@ -93,7 +93,7 @@ void InsetMathExInt::maxima(MaximaStream & os) const
        else
                os << symbol_ << '(';
 
-       if (cell(0).size())
+       if (!cell(0).empty())
                os << cell(0) << ',';
        else
                os << '1' << ',';
@@ -112,7 +112,7 @@ void InsetMathExInt::mathematica(MathematicaStream & os) const
        else
                os << symbol_ << '[';
 
-       if (cell(0).size())
+       if (!cell(0).empty())
                os << cell(0) << ',';
        else
                os << '1' << ',';
@@ -123,7 +123,7 @@ void InsetMathExInt::mathematica(MathematicaStream & os) const
 }
 
 
-docstring InsetMathExInt::mathmlize(MathStream & os) const
+void InsetMathExInt::mathmlize(MathMLStream & ms) const
 {
        // At the moment, we are not extracting sums and the like for MathML.
        // If we should decide to do so later, then we'll need to re-merge
@@ -133,36 +133,62 @@ docstring InsetMathExInt::mathmlize(MathStream & os) const
        bool const lower = !cell(2).empty();
        bool const upper = !cell(3).empty();
        if (lower && upper)
-               os << MTag("msubsup");
+               ms << MTag("msubsup");
        else if (lower)
-               os << MTag("msub");
+               ms << MTag("msub");
        else if (upper)
-               os << MTag("msup");
-       os << MTag("mrow");
-       sym.mathmlize(os);
-       os << ETag("mrow");
+               ms << MTag("msup");
+       ms << MTag("mrow");
+       sym.mathmlize(ms);
+       ms << ETag("mrow");
        if (lower)
-               os << MTag("mrow") << cell(2) << ETag("mrow");
+               ms << cell(2);
        if (upper)
-               os << MTag("mrow") << cell(3) << ETag("mrow");
+               ms << cell(3);
        if (lower && upper)
-               os << ETag("msubsup");
+               ms << ETag("msubsup");
        else if (lower)
-               os << ETag("msub");
+               ms << ETag("msub");
        else if (upper)
-               os << ETag("msup");
-       docstring rv = lyx::mathmlize(cell(0), os);
-       os << "<mo> &InvisibleTimes; </mo>"
-          << MTag("mrow") << "<mo> &DifferentialD; </mo>"
-          << cell(1) << ETag("mrow");
-       return rv;
+               ms << ETag("msup");
+       ms << cell(0)
+          << MTagInline("mo") << "&#8290;" << ETagInline("mo") // &InvisibleTimes;
+          << MTag("mrow")
+          << MTagInline("mo") << "&#8518;" << ETagInline("mo") // &DifferentialD;
+          << cell(1)
+          << ETag("mrow");
 }
 
 
-void InsetMathExInt::write(WriteStream &) const
+void InsetMathExInt::htmlize(HtmlStream & os) const
 {
-       LYXERR0("should not happen");
+       // At the moment, we are not extracting sums and the like for HTML.
+       // So right now this only handles integrals.
+       InsetMathSymbol sym(symbol_);
+       bool const lower = !cell(2).empty();
+       bool const upper = !cell(3).empty();
+
+       os << MTag("span", "class='integral'")
+          << MTag("span", "class='intsym'");
+       sym.htmlize(os, false);
+       os << ETag("span");
+
+       if (lower && upper) {
+               os << MTag("span", "class='limits'")
+                  << MTag("span") << cell(2) << ETag("span")
+                        << MTag("span") << cell(3) << ETag("span")
+                        << ETag("span");
+       } else if (lower)
+               os << MTag("sub", "class='limit'") << cell(2) << ETag("sub");
+       else if (upper)
+               os << MTag("sup", "class='limit'") << cell(3) << ETag("sup");
+       os << cell(0) << "<b>d</b>" << cell(1) << ETag("span");
 }
 
 
+void InsetMathExInt::write(TeXMathStream &) const
+{
+       LYXERR0("should not happen");
+}
+
 } // namespace lyx