X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathDots.cpp;h=44490cb0d27496348cb155ec5599f0b985cd246c;hb=d9082639080b9de993742bd352f92e5183058cf5;hp=b44d391512492ef9f5451381336a3ae36e4f2bd7;hpb=8a047a411235fcf5ba48f075e0a23a7cf1e3e8bb;p=lyx.git diff --git a/src/mathed/InsetMathDots.cpp b/src/mathed/InsetMathDots.cpp index b44d391512..44490cb0d2 100644 --- a/src/mathed/InsetMathDots.cpp +++ b/src/mathed/InsetMathDots.cpp @@ -13,6 +13,7 @@ #include "InsetMathDots.h" +#include "Dimension.h" #include "LaTeXFeatures.h" #include "MathStream.h" #include "MathSupport.h" @@ -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); } @@ -80,30 +80,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 = "…"; + 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 = "…"); + } else { + 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 = "…"); + } + ms << MTag("mi") << from_ascii(ent) << ETag("mi"); }