2003-08-19 13:00:56 +00:00
|
|
|
/**
|
2007-04-25 03:01:35 +00:00
|
|
|
* \file InsetMathComment.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.
|
|
|
|
*/
|
|
|
|
|
2002-08-14 15:13:07 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
#include "InsetMathComment.h"
|
2007-11-06 21:45:24 +00:00
|
|
|
|
2007-04-26 16:05:57 +00:00
|
|
|
#include "MathData.h"
|
2006-10-22 10:15:23 +00:00
|
|
|
#include "MathStream.h"
|
2006-09-17 09:14:18 +00:00
|
|
|
#include "MathSupport.h"
|
2007-11-06 21:45:24 +00:00
|
|
|
|
2008-05-06 10:36:32 +00:00
|
|
|
#include <ostream>
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2009-11-08 11:45:46 +00:00
|
|
|
InsetMathComment::InsetMathComment(Buffer * buf)
|
|
|
|
: InsetMathNest(buf, 1)
|
2002-08-14 15:13:07 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
2015-08-23 09:47:37 +00:00
|
|
|
InsetMathComment::InsetMathComment(MathData const & ar)
|
|
|
|
: InsetMathNest(const_cast<Buffer *>(ar.buffer()), 1)
|
|
|
|
{
|
|
|
|
cell(0) = ar;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-08 11:45:46 +00:00
|
|
|
InsetMathComment::InsetMathComment(Buffer * buf, docstring const & str)
|
|
|
|
: InsetMathNest(buf, 1)
|
2002-08-14 15:13:07 +00:00
|
|
|
{
|
2006-10-17 14:46:45 +00:00
|
|
|
// FIXME UNICODE
|
2006-10-22 10:15:23 +00:00
|
|
|
asArray(str, cell(0));
|
2002-08-14 15:13:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-30 18:03:17 +00:00
|
|
|
Inset * InsetMathComment::clone() const
|
2002-08-14 15:13:07 +00:00
|
|
|
{
|
2007-08-30 18:03:17 +00:00
|
|
|
return new InsetMathComment(*this);
|
2002-08-14 15:13:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-21 20:39:47 +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);
|
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
|
|
|
{
|
2017-01-06 08:52:10 +00:00
|
|
|
cell(0).draw(pi, x, y);
|
2002-08-14 15:13:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-26 19:04:36 +00:00
|
|
|
void InsetMathComment::write(TeXMathStream & 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
|
|
|
|
|
|
|
|
2020-12-26 19:02:46 +00:00
|
|
|
void InsetMathComment::mathmlize(MathMLStream & ms) const
|
2002-08-14 15:13:07 +00:00
|
|
|
{
|
2019-05-09 23:52:07 +00:00
|
|
|
ms << MTag("comment") << cell(0) << ETag("comment");
|
2002-08-14 15:13:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-30 17:24:22 +00:00
|
|
|
void InsetMathComment::htmlize(HtmlStream & os) const
|
|
|
|
{
|
2010-06-09 17:02:55 +00:00
|
|
|
os << "<!-- " << cell(0) << " -->";
|
2010-03-30 17:24:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-22 10:15:23 +00:00
|
|
|
void InsetMathComment::infoize(odocstream & os) const
|
2002-08-14 15:13:07 +00:00
|
|
|
{
|
|
|
|
os << "Comment";
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|