X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathEnsureMath.cpp;h=8bd685c5a0c6181290d2261da91b7634439f5d81;hb=a68e5b777487b495feeefa53700834ecec6ec196;hp=81806673665b32ef86e6d31fba3b4c883812fc9a;hpb=8fde2a6fa762cfc72539d38460b9dd5c9e4d2e92;p=lyx.git diff --git a/src/mathed/InsetMathEnsureMath.cpp b/src/mathed/InsetMathEnsureMath.cpp index 8180667366..8bd685c5a0 100644 --- a/src/mathed/InsetMathEnsureMath.cpp +++ b/src/mathed/InsetMathEnsureMath.cpp @@ -3,7 +3,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author André Pönitz + * \author André Pönitz * \author Enrico Forestieri * * Full author contact details are available in file CREDITS. @@ -13,16 +13,20 @@ #include "InsetMathEnsureMath.h" -#include "MathStream.h" #include "MathData.h" +#include "MathStream.h" +#include "MathSupport.h" + +#include "LaTeXFeatures.h" +#include "MetricsInfo.h" #include namespace lyx { -InsetMathEnsureMath::InsetMathEnsureMath() - : InsetMathNest(1) +InsetMathEnsureMath::InsetMathEnsureMath(Buffer * buf) + : InsetMathNest(buf, 1) {} @@ -34,17 +38,15 @@ Inset * InsetMathEnsureMath::clone() const void InsetMathEnsureMath::metrics(MetricsInfo & mi, Dimension & dim) const { - FontSetChanger dummy(mi.base, "mathnormal"); + Changer dummy = mi.base.changeEnsureMath(); cell(0).metrics(mi, dim); - metricsMarkers(dim); } void InsetMathEnsureMath::draw(PainterInfo & pi, int x, int y) const { - FontSetChanger dummy(pi.base, "mathnormal"); + Changer dummy = pi.base.changeEnsureMath(); cell(0).draw(pi, x, y); - drawMarkers(pi, x, y); } @@ -67,10 +69,41 @@ void InsetMathEnsureMath::write(WriteStream & os) const } +void InsetMathEnsureMath::mathmlize(MathStream & os) const +{ + SetMode mathmode(os, false); + os << MTag("mstyle", "class='math'") + << cell(0) + << ETag("mstyle"); +} + + +void InsetMathEnsureMath::htmlize(HtmlStream & os) const +{ + SetHTMLMode mathmode(os, false); + os << MTag("span", "class='math'") + << cell(0) + << ETag("span"); +} + + void InsetMathEnsureMath::infoize(odocstream & os) const { os << "EnsureMath"; } +void InsetMathEnsureMath::validate(LaTeXFeatures & features) const +{ + // FIXME XHTML + // It'd be better to be able to get this from an InsetLayout, but at present + // InsetLayouts do not seem really to work for things that aren't InsetTexts. + if (features.runparams().math_flavor == OutputParams::MathAsMathML) + features.addCSSSnippet("mstyle.math { font-style: italic; }"); + else if (features.runparams().math_flavor == OutputParams::MathAsHTML) + features.addCSSSnippet("span.mathbox { font-style: italic; }"); + + InsetMathNest::validate(features); +} + } // namespace lyx