2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
2006-09-17 09:14:18 +00:00
|
|
|
|
* \file InsetMathComment.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.
|
|
|
|
|
*/
|
|
|
|
|
|
2002-08-14 15:13:07 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
|
#include "InsetMathComment.h"
|
|
|
|
|
#include "MathData.h"
|
|
|
|
|
#include "MathMLStream.h"
|
|
|
|
|
#include "MathSupport.h"
|
2003-09-05 17:23:11 +00:00
|
|
|
|
#include "support/std_ostream.h"
|
2002-08-14 15:13:07 +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;
|
|
|
|
|
|
2002-08-14 15:13:07 +00:00
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathComment::InsetMathComment()
|
|
|
|
|
: InsetMathNest(1)
|
2002-08-14 15:13:07 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathComment::InsetMathComment(string const & str)
|
|
|
|
|
: InsetMathNest(1)
|
2002-08-14 15:13:07 +00:00
|
|
|
|
{
|
2006-10-17 14:46:45 +00:00
|
|
|
|
// FIXME UNICODE
|
|
|
|
|
asArray(lyx::from_utf8(str), cell(0));
|
2002-08-14 15:13:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
auto_ptr<InsetBase> InsetMathComment::doClone() const
|
2002-08-14 15:13:07 +00:00
|
|
|
|
{
|
2006-09-16 18:11:38 +00:00
|
|
|
|
return auto_ptr<InsetBase>(new InsetMathComment(*this));
|
2002-08-14 15:13:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathComment::metrics(MetricsInfo & mi, Dimension & dim) const
|
2002-08-14 15:13:07 +00:00
|
|
|
|
{
|
2004-04-06 19:25:39 +00:00
|
|
|
|
cell(0).metrics(mi, dim);
|
|
|
|
|
metricsMarkers(dim);
|
|
|
|
|
dim_ = dim;
|
2002-08-14 15:13:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathComment::draw(PainterInfo & pi, int x, int y) const
|
2002-08-14 15:13:07 +00:00
|
|
|
|
{
|
|
|
|
|
cell(0).draw(pi, x + 1, y);
|
|
|
|
|
drawMarkers(pi, x, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathComment::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
|
2002-08-14 15:13:07 +00:00
|
|
|
|
{
|
2003-05-28 13:22:36 +00:00
|
|
|
|
cell(0).metricsT(mi, dim);
|
2002-08-14 15:13:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathComment::drawT(TextPainter & pain, int x, int y) const
|
2002-08-14 15:13:07 +00:00
|
|
|
|
{
|
|
|
|
|
cell(0).drawT(pain, x, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathComment::write(WriteStream & os) const
|
2002-08-14 15:13:07 +00:00
|
|
|
|
{
|
|
|
|
|
os << '%' << cell(0) << "\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathComment::maple(MapleStream & os) const
|
2002-08-26 06:17:54 +00:00
|
|
|
|
{
|
|
|
|
|
os << '#' << cell(0) << "\n";
|
|
|
|
|
}
|
2002-08-14 15:13:07 +00:00
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathComment::mathematica(MathematicaStream &) const
|
2002-08-14 15:13:07 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathComment::octave(OctaveStream &) const
|
2002-08-14 15:13:07 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathComment::mathmlize(MathMLStream & os) const
|
2002-08-14 15:13:07 +00:00
|
|
|
|
{
|
|
|
|
|
os << MTag("comment") << cell(0) << cell(1) << ETag("comment");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathComment::infoize(std::ostream & os) const
|
2002-08-14 15:13:07 +00:00
|
|
|
|
{
|
|
|
|
|
os << "Comment";
|
|
|
|
|
}
|