* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Uwe Stöhr
+ * \author Uwe Stöhr
*
* Full author contact details are available in file CREDITS.
*/
#include "InsetMathCancel.h"
-#include "LaTeXFeatures.h"
#include "MathStream.h"
+#include "LaTeXFeatures.h"
+#include "MetricsInfo.h"
+
#include "frontends/Painter.h"
#include <ostream>
void InsetMathCancel::metrics(MetricsInfo & mi, Dimension & dim) const
{
+ Changer dummy = mi.base.changeEnsureMath();
cell(0).metrics(mi, dim);
- metricsMarkers(dim);
}
void InsetMathCancel::draw(PainterInfo & pi, int x, int y) const
{
+ Changer dummy = pi.base.changeEnsureMath();
// We first draw the text and then an arrow
ColorCode const origcol = pi.base.font.color();
- cell(0).draw(pi, x + 1, y);
+ cell(0).draw(pi, x, y);
Dimension const dim = dimension(*pi.base.bv);
+ int const t = pi.base.solidLineThickness();
/*
* y1 \ /
int const y2 = y + dim.des;
if (kind_ == cancel)
- pi.pain.line(x2, y1, x1, y2, origcol);
+ pi.pain.line(x2, y1, x1, y2, origcol, pi.pain.line_solid, t);
else if (kind_ == bcancel)
- pi.pain.line(x2, y2, x1, y1, origcol);
+ pi.pain.line(x2, y2, x1, y1, origcol, pi.pain.line_solid, t);
else if (kind_ == xcancel) {
- pi.pain.line(x2, y1, x1, y2, origcol);
- pi.pain.line(x2, y2, x1, y1, origcol);
+ pi.pain.line(x2, y1, x1, y2, origcol, pi.pain.line_solid, t);
+ pi.pain.line(x2, y2, x1, y1, origcol, pi.pain.line_solid, t);
}
-
- drawMarkers(pi, x, y);
}
-void InsetMathCancel::write(WriteStream & os) const
+void InsetMathCancel::write(TeXMathStream & os) const
{
MathEnsurer ensurer(os);
switch (kind_) {
}
}
+
+// unfortunately, we do not have many options here, so we have to treat
+// them all the same way.
+void InsetMathCancel::htmlize(HtmlStream & os) const
+{
+ os << MTag("span", "style='text-decoration: line-through;'")
+ << cell(0)
+ << ETag("span");
+}
+
+
+void InsetMathCancel::mathmlize(MathMLStream & ms) const
+{
+ switch (kind_) {
+ case cancel:
+ ms << MTag("menclose", "notation='updiagonalstrike'")
+ << cell(0)
+ << ETag("menclose");
+ break;
+ case bcancel:
+ ms << MTag("menclose", "notation='downdiagonalstrike'")
+ << cell(0)
+ << ETag("menclose");
+ break;
+ case xcancel:
+ ms << MTag("menclose", "notation='updiagonalstrike'")
+ << MTag("menclose", "notation='downdiagonalstrike'")
+ << cell(0)
+ << ETag("menclose")
+ << ETag("menclose");
+ break;
+ }
+}
+
+
void InsetMathCancel::validate(LaTeXFeatures & features) const
{
InsetMathNest::validate(features);