2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
2006-09-17 09:14:18 +00:00
|
|
|
|
* \file InsetMathUnknown.C
|
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.
|
|
|
|
|
*
|
|
|
|
|
* \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>
|
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
|
#include "InsetMathUnknown.h"
|
|
|
|
|
#include "MathSupport.h"
|
|
|
|
|
#include "MathAtom.h"
|
|
|
|
|
#include "MathMLStream.h"
|
|
|
|
|
#include "MathStream.h"
|
2001-11-09 10:44:24 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
|
using std::string;
|
2003-07-25 17:11:25 +00:00
|
|
|
|
using std::auto_ptr;
|
2006-10-21 11:15:37 +00:00
|
|
|
|
using std::vector;
|
2003-07-25 17:11:25 +00:00
|
|
|
|
|
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
|
|
|
|
{
|
2006-10-17 14:46:45 +00:00
|
|
|
|
// FIXME UNICODE
|
2006-10-21 11:15:37 +00:00
|
|
|
|
vector<char_type> n(name_.begin(), name_.end());
|
|
|
|
|
mathed_string_dim(mi.base.font, n, 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
|
|
|
|
{
|
2006-10-17 14:46:45 +00:00
|
|
|
|
// FIXME UNICODE
|
2002-05-30 07:09:54 +00:00
|
|
|
|
if (black_)
|
2006-10-21 00:16:43 +00:00
|
|
|
|
drawStrBlack(pi, x, y, from_utf8(name_));
|
2002-05-30 07:09:54 +00:00
|
|
|
|
else
|
2006-10-21 00:16:43 +00:00
|
|
|
|
drawStrRed(pi, x, y, from_utf8(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
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|