]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathOverset.cpp
Remove unneccessary uses of dynamic_cast from the code.
[lyx.git] / src / mathed / InsetMathOverset.cpp
index 5d8edefef82ee45a64be6e585c7a38ae462ddf67..cf7d6d3feb28669036a297976a08c16f981b8a5f 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author André Pönitz
+ * \author André Pönitz
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -73,14 +73,8 @@ bool InsetMathOverset::idxLast(Cursor & cur) const
 
 void InsetMathOverset::write(WriteStream & os) const
 {
-       bool brace = os.pendingBrace();
-       os.pendingBrace(false);
-       if (os.latex() && os.textMode()) {
-               os << "\\ensuremath{";
-               os.textMode(false);
-       }
+       MathEnsurer ensurer(os);
        os << "\\overset{" << cell(0) << "}{" << cell(1) << '}';
-       os.pendingBrace(brace);
 }
 
 
@@ -90,9 +84,32 @@ void InsetMathOverset::normalize(NormalStream & os) const
 }
 
 
+void InsetMathOverset::mathmlize(MathStream & ms) const
+{
+       ms << "<mover accent='false'>" << cell(1) << cell(0) << "</mover>";
+}
+
+
+void InsetMathOverset::htmlize(HtmlStream & os) const
+{
+       os << MTag("span", "class='overset'")
+                << MTag("span", "class='top'") << cell(0) << ETag("span")
+                << MTag("span") << cell(1) << ETag("span")
+                << ETag("span");
+}
+
+
 void InsetMathOverset::validate(LaTeXFeatures & features) const
 {
-       features.require("amsmath");
+       if (features.runparams().isLaTeX())
+               features.require("amsmath");
+       else if (features.runparams().math_flavor == OutputParams::MathAsHTML)
+               features.addPreambleSnippet("<style type=\"text/css\">\n"
+                       "span.overset{display: inline-block; vertical-align: bottom; text-align:center;}\n"
+                       "span.overset span {display: block;}\n"
+                       "span.top{font-size: 66%;}\n"
+                       "</style>");
+
        InsetMathNest::validate(features);
 }