]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathDots.cpp
Fix CSS
[lyx.git] / src / mathed / InsetMathDots.cpp
index d13cdd902f87e724656ce7c57265077586930157..63c54c950e03d96603eac45bbe4f8caca1af9b77 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "InsetMathDots.h"
 
+#include "Dimension.h"
 #include "LaTeXFeatures.h"
 #include "MathStream.h"
 #include "MathSupport.h"
@@ -37,18 +38,13 @@ Inset * InsetMathDots::clone() const
 
 void InsetMathDots::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       dim = theFontMetrics(mi.base.font).dimension('M');
+       dim = theFontMetrics(mi.base.font).dimension('X');
        dh_ = 0;
        if (key_->name == "cdots" || key_->name == "dotsb"
                        || key_->name == "dotsm" || key_->name == "dotsi")
                dh_ = dim.asc / 2;
-       else if (key_->name == "dotsc")
-               dh_ = dim.asc / 4;
-       else if (key_->name == "vdots") {
-               dim.wid = (dim.wid / 2) + 1;
-               dh_ = dim.asc;
-       }
-       else if (key_->name == "ddots" || key_->name == "adots" || key_->name == "iddots")
+       else if (key_->name == "ddots" || key_->name == "adots"
+                       || key_->name == "iddots" || key_->name == "vdots")
                dh_ = dim.asc;
 }
 
@@ -58,17 +54,10 @@ void InsetMathDots::draw(PainterInfo & pi, int x, int y) const
        Dimension const dim = dimension(*pi.base.bv);
        if (key_->name == "adots" || key_->name == "iddots")
                --y;
-       mathed_draw_deco(pi, x + 2, y - dh_, dim.width() - 2, dim.ascent(),
+       else if (key_->name == "vdots")
+               x += (dim.width() - 2) / 2;
+       mathed_draw_deco(pi, x + 1, y - dh_, dim.width() - 2, dim.ascent(),
                        key_->name);
-       if (key_->name == "vdots" || key_->name == "ddots" || key_->name == "adots" || key_->name == "iddots")
-               ++x;
-       if (key_->name == "adots" || key_->name == "iddots")
-               ++y;
-       else if (key_->name != "vdots")
-               --y;
-       mathed_draw_deco(pi, x + 2, y - dh_, dim.width() - 2, dim.ascent(),
-               key_->name);
-       setPosCache(pi, x, y);
 }
 
 
@@ -80,30 +69,43 @@ docstring InsetMathDots::name() const
 
 void InsetMathDots::validate(LaTeXFeatures & features) const
 {
-       if (!key_->requires.empty())
-               features.require(key_->requires);
+       if (!key_->required.empty())
+               features.require(key_->required);
 }
 
 
-void InsetMathDots::mathmlize(MathStream & os) const
+void InsetMathDots::mathmlize(MathMLStream & ms) 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");
+       if (ms.xmlMode()) {
+               if (n == "dots" || n == "dotsc" || n == "dotso" || n == "ldots")
+                       ent = "&#x2026;";
+               else if (n == "adots" || n == "iddots")
+                       ent = "&#x22F0;";
+               else if (n == "cdots" || n == "dotsb" || n == "dotsi" || n == "dotsm")
+                       ent = "&#x22EF;";
+               else if (n == "ddots")
+                       ent = "&#x22F1;";
+               else if (n == "vdots")
+                       ent = "&#x22EE;";
+               else LASSERT(false, ent = "&#x2026;");
+       } else {
+               if (n == "dots" || n == "dotsc" || n == "dotso" || n == "ldots")
+                       ent = "&hellip;";
+               else if (n == "adots" || n == "iddots")
+                       ent = "&utdot;";
+               else if (n == "cdots" || n == "dotsb" || n == "dotsi" || n == "dotsm")
+                       ent = "&ctdot;";
+               else if (n == "ddots")
+                       ent = "&dtdot;";
+               else if (n == "vdots")
+                       ent = "&vellip;";
+               else LASSERT(false, ent = "&hellip;");
+       }
+       ms << MTagInline("mi") << from_ascii(ent) << ETagInline("mi");
 }