2008-09-04 22:24:07 +00:00
|
|
|
/**
|
|
|
|
* \file InsetMathEnsureMath.cpp
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pönitz
|
2008-09-04 22:24:07 +00:00
|
|
|
* \author Enrico Forestieri
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "InsetMathEnsureMath.h"
|
|
|
|
|
2009-12-31 03:50:12 +00:00
|
|
|
#include "MathStream.h"
|
2009-12-31 15:46:39 +00:00
|
|
|
#include "MathData.h"
|
2008-09-04 22:24:07 +00:00
|
|
|
|
|
|
|
#include <ostream>
|
|
|
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2009-11-08 11:45:46 +00:00
|
|
|
InsetMathEnsureMath::InsetMathEnsureMath(Buffer * buf)
|
|
|
|
: InsetMathNest(buf, 1)
|
2008-09-04 22:24:07 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
Inset * InsetMathEnsureMath::clone() const
|
|
|
|
{
|
|
|
|
return new InsetMathEnsureMath(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsetMathEnsureMath::metrics(MetricsInfo & mi, Dimension & dim) const
|
|
|
|
{
|
|
|
|
FontSetChanger dummy(mi.base, "mathnormal");
|
|
|
|
cell(0).metrics(mi, dim);
|
|
|
|
metricsMarkers(dim);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsetMathEnsureMath::draw(PainterInfo & pi, int x, int y) const
|
|
|
|
{
|
|
|
|
FontSetChanger dummy(pi.base, "mathnormal");
|
|
|
|
cell(0).draw(pi, x, y);
|
|
|
|
drawMarkers(pi, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsetMathEnsureMath::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
|
|
|
|
{
|
|
|
|
cell(0).metricsT(mi, dim);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsetMathEnsureMath::drawT(TextPainter & pain, int x, int y) const
|
|
|
|
{
|
|
|
|
cell(0).drawT(pain, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsetMathEnsureMath::write(WriteStream & os) const
|
|
|
|
{
|
|
|
|
ModeSpecifier specifier(os, MATH_MODE);
|
|
|
|
os << "\\ensuremath{" << cell(0) << "}";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-31 15:46:39 +00:00
|
|
|
void InsetMathEnsureMath::mathmlize(MathStream & os) const
|
2009-12-26 15:01:03 +00:00
|
|
|
{
|
2009-12-31 15:46:39 +00:00
|
|
|
os << cell(0);
|
2009-12-26 15:01:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-04 22:24:07 +00:00
|
|
|
void InsetMathEnsureMath::infoize(odocstream & os) const
|
|
|
|
{
|
|
|
|
os << "EnsureMath";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|