2003-08-19 13:00:56 +00:00
|
|
|
/**
|
2007-04-25 03:01:35 +00:00
|
|
|
* \file InsetMathNumber.cpp
|
2003-08-19 13:00:56 +00:00
|
|
|
* 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
|
2003-08-19 13:00:56 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
#include "InsetMathNumber.h"
|
2006-10-22 10:15:23 +00:00
|
|
|
#include "MathStream.h"
|
2006-09-17 09:14:18 +00:00
|
|
|
#include "MathStream.h"
|
|
|
|
#include "MathSupport.h"
|
2002-06-18 15:44:30 +00:00
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2006-08-13 22:54:59 +00:00
|
|
|
|
2008-03-15 00:22:54 +00:00
|
|
|
namespace lyx {
|
2002-06-18 15:44:30 +00:00
|
|
|
|
2006-10-22 10:15:23 +00:00
|
|
|
InsetMathNumber::InsetMathNumber(docstring const & s)
|
2002-06-18 15:44:30 +00:00
|
|
|
: str_(s)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2007-08-30 18:03:17 +00:00
|
|
|
Inset * InsetMathNumber::clone() const
|
2002-06-18 15:44:30 +00:00
|
|
|
{
|
2007-08-30 18:03:17 +00:00
|
|
|
return new InsetMathNumber(*this);
|
2002-06-18 15:44:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-21 20:39:47 +00:00
|
|
|
void InsetMathNumber::metrics(MetricsInfo & mi, Dimension & dim) const
|
2002-06-18 15:44:30 +00:00
|
|
|
{
|
2006-10-22 10:15:23 +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-10-22 10:15:23 +00:00
|
|
|
pi.draw(x, y, str_);
|
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_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-31 15:46:39 +00:00
|
|
|
void InsetMathNumber::mathmlize(MathStream & os) const
|
2002-06-18 15:44:30 +00:00
|
|
|
{
|
2011-04-01 22:34:40 +00:00
|
|
|
os << "<mn>" << str_ << "</mn>";
|
2002-06-18 15:44:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-30 01:23:10 +00:00
|
|
|
void InsetMathNumber::htmlize(HtmlStream & os) const
|
|
|
|
{
|
|
|
|
os << str_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
void InsetMathNumber::write(WriteStream & os) const
|
2002-06-18 15:44:30 +00:00
|
|
|
{
|
|
|
|
os << str_;
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|