2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file math_unknowninset.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.
|
|
|
|
|
*/
|
|
|
|
|
|
2001-12-05 08:04:20 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2001-11-09 10:44:24 +00:00
|
|
|
|
#include "math_unknowninset.h"
|
|
|
|
|
#include "math_support.h"
|
2003-06-02 10:03:27 +00:00
|
|
|
|
#include "math_atom.h"
|
2001-11-09 10:44:24 +00:00
|
|
|
|
#include "math_mathmlstream.h"
|
2001-12-05 08:04:20 +00:00
|
|
|
|
#include "math_streamstr.h"
|
2001-11-09 10:44:24 +00:00
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
|
using std::string;
|
2003-07-25 17:11:25 +00:00
|
|
|
|
using std::auto_ptr;
|
|
|
|
|
|
2001-11-09 10:44:24 +00:00
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathUnknown::InsetMathUnknown(string const & nm, bool final, bool black)
|
2002-10-24 12:17:58 +00:00
|
|
|
|
: name_(nm), final_(final), black_(black)
|
2001-11-09 10:44:24 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
auto_ptr<InsetBase> InsetMathUnknown::doClone() const
|
2001-11-09 10:44:24 +00:00
|
|
|
|
{
|
2006-09-16 18:11:38 +00:00
|
|
|
|
return auto_ptr<InsetBase>(new InsetMathUnknown(*this));
|
2001-11-09 10:44:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
string InsetMathUnknown::name() const
|
2001-11-09 10:44:24 +00:00
|
|
|
|
{
|
|
|
|
|
return name_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathUnknown::setName(string const & name)
|
2001-11-09 10:44:24 +00:00
|
|
|
|
{
|
2002-08-01 15:53:46 +00:00
|
|
|
|
name_ = name;
|
2001-11-09 10:44:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathUnknown::normalize(NormalStream & os) const
|
2001-11-09 10:44:24 +00:00
|
|
|
|
{
|
2002-02-01 17:01:30 +00:00
|
|
|
|
os << "[unknown " << name_ << ']';
|
2001-11-09 10:44:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathUnknown::metrics(MetricsInfo & mi, Dimension & dim) const
|
2002-05-30 07:09:54 +00:00
|
|
|
|
{
|
2003-05-28 13:22:36 +00:00
|
|
|
|
mathed_string_dim(mi.base.font, name_, dim);
|
2004-02-03 11:21:08 +00:00
|
|
|
|
dim_ = dim;
|
2002-05-30 07:09:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathUnknown::draw(PainterInfo & pi, int x, int y) const
|
2002-05-30 07:09:54 +00:00
|
|
|
|
{
|
|
|
|
|
if (black_)
|
|
|
|
|
drawStrBlack(pi, x, y, name_);
|
|
|
|
|
else
|
|
|
|
|
drawStrRed(pi, x, y, name_);
|
2004-08-13 22:39:39 +00:00
|
|
|
|
setPosCache(pi, x, y);
|
2002-05-30 07:09:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathUnknown::finalize()
|
2001-11-09 10:44:24 +00:00
|
|
|
|
{
|
2002-05-30 07:09:54 +00:00
|
|
|
|
final_ = true;
|
2001-11-09 10:44:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
bool InsetMathUnknown::final() const
|
2002-03-21 17:42:56 +00:00
|
|
|
|
{
|
2002-05-30 07:09:54 +00:00
|
|
|
|
return final_;
|
2001-11-09 10:44:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathUnknown::maple(MapleStream & os) const
|
2001-11-09 10:44:24 +00:00
|
|
|
|
{
|
2001-12-05 08:04:20 +00:00
|
|
|
|
os << name_;
|
2001-11-09 10:44:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-04-13 13:54:58 +00:00
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathUnknown::mathematica(MathematicaStream & os) const
|
2002-07-01 11:17:14 +00:00
|
|
|
|
{
|
|
|
|
|
os << name_;
|
|
|
|
|
}
|
|
|
|
|
|
2001-11-09 10:44:24 +00:00
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathUnknown::mathmlize(MathMLStream & os) const
|
2001-11-09 10:44:24 +00:00
|
|
|
|
{
|
2001-12-05 08:04:20 +00:00
|
|
|
|
os << MTag("mi") << name_ << ETag("mi");
|
2001-11-09 10:44:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathUnknown::octave(OctaveStream & os) const
|
2001-11-09 10:44:24 +00:00
|
|
|
|
{
|
2001-12-05 08:04:20 +00:00
|
|
|
|
os << name_;
|
2001-11-09 10:44:24 +00:00
|
|
|
|
}
|