]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathDots.cpp
Fix bug #8782.
[lyx.git] / src / mathed / InsetMathDots.cpp
index c9233927c3309894221d07450169e3be5451980a..b44d391512492ef9f5451381336a3ae36e4f2bd7 100644 (file)
 #include "MetricsInfo.h"
 
 #include "frontends/FontMetrics.h"
-
+#include "support/lassert.h"
 
 namespace lyx {
 
 InsetMathDots::InsetMathDots(latexkeys const * key)
-       : key_(key)
+       : dh_(0), key_(key)
 {}
 
 
@@ -81,8 +81,51 @@ docstring InsetMathDots::name() const
 void InsetMathDots::validate(LaTeXFeatures & features) const
 {
        if (!key_->requires.empty())
-               features.require(to_utf8(key_->requires));
+               features.require(key_->requires);
+}
+
+
+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