]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathDots.cpp
Merge branch 'master' into biblatex2
[lyx.git] / src / mathed / InsetMathDots.cpp
index d1b18fa9b4e929759e3daaccd0a71eaa57e33af6..8c4bd8374b3f35b84cdf06d44f23436c39278ed7 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "InsetMathDots.h"
 
+#include "Dimension.h"
 #include "LaTeXFeatures.h"
 #include "MathStream.h"
 #include "MathSupport.h"
@@ -25,7 +26,7 @@
 namespace lyx {
 
 InsetMathDots::InsetMathDots(latexkeys const * key)
-       : key_(key)
+       : dh_(0), key_(key)
 {}
 
 
@@ -53,12 +54,12 @@ void InsetMathDots::metrics(MetricsInfo & mi, Dimension & dim) const
 }
 
 
-void InsetMathDots::draw(PainterInfo & pain, int x, int y) const
+void InsetMathDots::draw(PainterInfo & pi, int x, int y) const
 {
-       Dimension const dim = dimension(*pain.base.bv);
+       Dimension const dim = dimension(*pi.base.bv);
        if (key_->name == "adots" || key_->name == "iddots")
                --y;
-       mathed_draw_deco(pain, x + 2, y - dh_, dim.width() - 2, dim.ascent(),
+       mathed_draw_deco(pi, x + 2, y - dh_, dim.width() - 2, dim.ascent(),
                        key_->name);
        if (key_->name == "vdots" || key_->name == "ddots" || key_->name == "adots" || key_->name == "iddots")
                ++x;
@@ -66,9 +67,8 @@ void InsetMathDots::draw(PainterInfo & pain, int x, int y) const
                ++y;
        else if (key_->name != "vdots")
                --y;
-       mathed_draw_deco(pain, x + 2, y - dh_, dim.width() - 2, dim.ascent(),
+       mathed_draw_deco(pi, x + 2, y - dh_, dim.width() - 2, dim.ascent(),
                key_->name);
-       setPosCache(pain, x, y);
 }
 
 
@@ -81,11 +81,11 @@ docstring InsetMathDots::name() const
 void InsetMathDots::validate(LaTeXFeatures & features) const
 {
        if (!key_->requires.empty())
-               features.require(to_utf8(key_->requires));
+               features.require(key_->requires);
 }
 
 
-docstring InsetMathDots::mathmlize(MathStream & os) 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
@@ -93,20 +93,39 @@ docstring InsetMathDots::mathmlize(MathStream & os) const
        std::string ent;
        if (n == "dots" || n == "dotsc" || n == "dotso" || n == "ldots")
                ent = "…";
-       else if (n == "adots")
+       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 == "iddots")
-               ent = "⋰";
        else if (n == "vdots")
                ent = "⋮";
        else
                LASSERT(false, ent = "…");
        os << MTag("mi") << from_ascii(ent) << ETag("mi");
-       return docstring();
+}
+
+
+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