2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file math_numberinset.C
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
2002-06-18 15:44:30 +00:00
|
|
|
|
|
2003-08-19 13:00:56 +00:00
|
|
|
|
#include <config.h>
|
2002-06-18 15:44:30 +00:00
|
|
|
|
|
|
|
|
|
#include "math_numberinset.h"
|
|
|
|
|
#include "math_mathmlstream.h"
|
|
|
|
|
#include "math_streamstr.h"
|
|
|
|
|
#include "math_support.h"
|
|
|
|
|
|
2006-08-13 22:54:59 +00:00
|
|
|
|
using lyx::docstring;
|
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
|
using std::string;
|
2003-07-25 17:11:25 +00:00
|
|
|
|
using std::auto_ptr;
|
|
|
|
|
|
2002-06-18 15:44:30 +00:00
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathNumber::InsetMathNumber(string const & s)
|
2002-06-18 15:44:30 +00:00
|
|
|
|
: str_(s)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
auto_ptr<InsetBase> InsetMathNumber::doClone() const
|
2002-06-18 15:44:30 +00:00
|
|
|
|
{
|
2006-09-16 18:11:38 +00:00
|
|
|
|
return auto_ptr<InsetBase>(new InsetMathNumber(*this));
|
2002-06-18 15:44:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathNumber::metrics(MetricsInfo & mi, Dimension & dim) const
|
2002-06-18 15:44:30 +00:00
|
|
|
|
{
|
2003-05-28 13:22:36 +00:00
|
|
|
|
mathed_string_dim(mi.base.font, str_, dim);
|
2002-06-18 15:44:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathNumber::draw(PainterInfo & pi, int x, int y) const
|
2002-06-18 15:44:30 +00:00
|
|
|
|
{
|
2006-08-13 22:54:59 +00:00
|
|
|
|
docstring const dstr(str_.begin(), str_.end());
|
|
|
|
|
pi.draw(x, y, dstr);
|
2002-06-18 15:44:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathNumber::normalize(NormalStream & os) const
|
2002-06-18 15:44:30 +00:00
|
|
|
|
{
|
2002-11-27 10:30:28 +00:00
|
|
|
|
os << "[number " << str_ << ']';
|
2002-06-18 15:44:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathNumber::maple(MapleStream & os) const
|
2002-06-18 15:44:30 +00:00
|
|
|
|
{
|
|
|
|
|
os << str_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathNumber::mathematica(MathematicaStream & os) const
|
2006-09-02 01:57:36 +00:00
|
|
|
|
{
|
|
|
|
|
os << str_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathNumber::octave(OctaveStream & os) const
|
2002-06-18 15:44:30 +00:00
|
|
|
|
{
|
|
|
|
|
os << str_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathNumber::mathmlize(MathMLStream & os) const
|
2002-06-18 15:44:30 +00:00
|
|
|
|
{
|
|
|
|
|
os << "<mi> " << str_ << " </mi>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathNumber::write(WriteStream & os) const
|
2002-06-18 15:44:30 +00:00
|
|
|
|
{
|
|
|
|
|
os << str_;
|
|
|
|
|
}
|