2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
2007-04-25 03:01:35 +00:00
|
|
|
|
* \file InsetMathUnknown.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.
|
|
|
|
|
*
|
|
|
|
|
* \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"
|
2006-10-22 10:15:23 +00:00
|
|
|
|
#include "MathStream.h"
|
2006-09-17 09:14:18 +00:00
|
|
|
|
#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-10-22 10:15:23 +00:00
|
|
|
|
InsetMathUnknown::InsetMathUnknown(docstring 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
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
auto_ptr<Inset> InsetMathUnknown::doClone() const
|
2001-11-09 10:44:24 +00:00
|
|
|
|
{
|
2007-04-29 13:39:47 +00:00
|
|
|
|
return auto_ptr<Inset>(new InsetMathUnknown(*this));
|
2001-11-09 10:44:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-22 10:15:23 +00:00
|
|
|
|
docstring InsetMathUnknown::name() const
|
2001-11-09 10:44:24 +00:00
|
|
|
|
{
|
|
|
|
|
return name_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-22 10:15:23 +00:00
|
|
|
|
void InsetMathUnknown::setName(docstring 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-11-28 15:15:49 +00:00
|
|
|
|
bool InsetMathUnknown::metrics(MetricsInfo & mi, Dimension & dim) const
|
2002-05-30 07:09:54 +00:00
|
|
|
|
{
|
2006-10-22 10:15:23 +00:00
|
|
|
|
mathed_string_dim(mi.base.font, name_, dim);
|
2007-03-23 18:55:50 +00:00
|
|
|
|
docstring::const_reverse_iterator rit = name_.rbegin();
|
|
|
|
|
kerning_ = mathed_char_kerning(mi.base.font, *rit);
|
2006-11-28 15:15:49 +00:00
|
|
|
|
if (dim_ == dim)
|
|
|
|
|
return false;
|
2004-02-03 11:21:08 +00:00
|
|
|
|
dim_ = dim;
|
2006-11-28 15:15:49 +00:00
|
|
|
|
return true;
|
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_)
|
2006-10-22 10:15:23 +00:00
|
|
|
|
drawStrBlack(pi, x, y, name_);
|
2002-05-30 07:09:54 +00:00
|
|
|
|
else
|
2006-10-22 10:15:23 +00:00
|
|
|
|
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-10-22 10:15:23 +00:00
|
|
|
|
void InsetMathUnknown::mathmlize(MathStream & 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
|