]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathDots.cpp
Remove unneccessary uses of dynamic_cast from the code.
[lyx.git] / src / mathed / InsetMathDots.cpp
index 8052f1a82030b1f3511d7972440fc38850d06657..147e7627e48e9fc7791bb9cf66ad8470ab93c69b 100644 (file)
@@ -20,7 +20,7 @@
 #include "MetricsInfo.h"
 
 #include "frontends/FontMetrics.h"
-
+#include "support/lassert.h"
 
 namespace lyx {
 
@@ -48,7 +48,7 @@ void InsetMathDots::metrics(MetricsInfo & mi, Dimension & dim) const
                dim.wid = (dim.wid / 2) + 1;
                dh_ = dim.asc;
        }
-       else if (key_->name == "ddots")
+       else if (key_->name == "ddots" || key_->name == "adots" || key_->name == "iddots")
                dh_ = dim.asc;
 }
 
@@ -56,11 +56,15 @@ void InsetMathDots::metrics(MetricsInfo & mi, Dimension & dim) const
 void InsetMathDots::draw(PainterInfo & pain, int x, int y) const
 {
        Dimension const dim = dimension(*pain.base.bv);
+       if (key_->name == "adots" || key_->name == "iddots")
+               --y;
        mathed_draw_deco(pain, x + 2, y - dh_, dim.width() - 2, dim.ascent(),
-               key_->name);
-       if (key_->name == "vdots" || key_->name == "ddots")
+                       key_->name);
+       if (key_->name == "vdots" || key_->name == "ddots" || key_->name == "adots" || key_->name == "iddots")
                ++x;
-       if (key_->name != "vdots")
+       if (key_->name == "adots" || key_->name == "iddots")
+               ++y;
+       else if (key_->name != "vdots")
                --y;
        mathed_draw_deco(pain, x + 2, y - dh_, dim.width() - 2, dim.ascent(),
                key_->name);
@@ -81,4 +85,47 @@ void InsetMathDots::validate(LaTeXFeatures & features) const
 }
 
 
+void InsetMathDots::mathmlize(MathStream & os) const
+{
+       // which symbols we support is decided by what is listed in
+       // lib/symbols as generating a dots inset
+       docstring const & n = key_->name;
+       std::string ent;
+       if (n == "dots" || n == "dotsc" || n == "dotso" || n == "ldots")
+               ent = "…";
+       else if (n == "adots" || n == "iddots")
+               ent = "⋰";
+       else if (n == "cdots" || n == "dotsb" || n == "dotsi" || n == "dotsm")
+               ent = "⋯";
+       else if (n == "ddots")
+               ent = "⋱";
+       else if (n == "vdots")
+               ent = "⋮";
+       else
+               LASSERT(false, ent = "…");
+       os << MTag("mi") << from_ascii(ent) << ETag("mi");
+}
+
+
+void InsetMathDots::htmlize(HtmlStream & os) const
+{
+       // which symbols we support is decided by what is listed in
+       // lib/symbols as generating a dots inset
+       docstring const & n = key_->name;
+       std::string ent;
+       if (n == "dots" || n == "dotsc" || n == "dotso" || n == "ldots")
+               ent = "&#x02026;";
+       else if (n == "adots" || n == "iddots")
+               ent = "&#x022F0;";
+       else if (n == "cdots" || n == "dotsb" || n == "dotsi" || n == "dotsm")
+               ent = "&#x022EF;";
+       else if (n == "ddots")
+               ent = "&#x022F1;";
+       else if (n == "vdots")
+               ent = "&#x022EE;";
+       else
+               LASSERT(false, ent = "#x02026;");
+       os << from_ascii(ent);
+}
+
 } // namespace lyx