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.
|
|
|
|
*
|
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.
|
|
|
|
*/
|
|
|
|
|
2001-12-05 08:04:20 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
#include "InsetMathUnknown.h"
|
2016-06-04 08:41:13 +00:00
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
#include "MathSupport.h"
|
|
|
|
#include "MathAtom.h"
|
2006-10-22 10:15:23 +00:00
|
|
|
#include "MathStream.h"
|
2016-06-04 08:41:13 +00:00
|
|
|
|
|
|
|
#include "MetricsInfo.h"
|
2001-11-09 10:44:24 +00:00
|
|
|
|
2008-03-04 14:49:24 +00:00
|
|
|
#include "frontends/Painter.h"
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2008-03-04 14:49:24 +00:00
|
|
|
InsetMathUnknown::InsetMathUnknown(docstring const & nm,
|
|
|
|
docstring const & selection, bool final, bool black)
|
2015-10-10 19:04:28 +00:00
|
|
|
: name_(nm), final_(final), black_(black), kerning_(0),
|
|
|
|
selection_(selection)
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-21 20:39:47 +00:00
|
|
|
void InsetMathUnknown::metrics(MetricsInfo & mi, Dimension & dim) const
|
2002-05-30 07:09:54 +00:00
|
|
|
{
|
2012-05-03 14:28:28 +00:00
|
|
|
metricsStrRedBlack(mi, dim, name_);
|
2007-03-23 18:55:50 +00:00
|
|
|
docstring::const_reverse_iterator rit = name_.rbegin();
|
|
|
|
kerning_ = mathed_char_kerning(mi.base.font, *rit);
|
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_);
|
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
|
|
|
|
2010-07-29 15:48:01 +00:00
|
|
|
void InsetMathUnknown::mathmlize(MathStream &) const
|
2001-11-09 10:44:24 +00:00
|
|
|
{
|
2010-07-29 15:48:01 +00:00
|
|
|
throw MathExportException();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsetMathUnknown::htmlize(HtmlStream &) const
|
|
|
|
{
|
|
|
|
throw MathExportException();
|
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
|