2004-08-13 15:06:46 +00:00
|
|
|
|
/**
|
2006-09-17 09:14:18 +00:00
|
|
|
|
* \file InsetMathBoxed.C
|
2004-08-13 15:06:46 +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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
|
#include "InsetMathBoxed.h"
|
|
|
|
|
#include "MathData.h"
|
2006-10-22 10:15:23 +00:00
|
|
|
|
#include "MathStream.h"
|
2006-09-17 09:14:18 +00:00
|
|
|
|
#include "MathParser.h"
|
|
|
|
|
#include "MathStream.h"
|
2004-08-13 15:06:46 +00:00
|
|
|
|
#include "LaTeXFeatures.h"
|
|
|
|
|
#include "LColor.h"
|
|
|
|
|
|
|
|
|
|
#include "support/std_ostream.h"
|
|
|
|
|
#include "frontends/Painter.h"
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2004-08-13 15:06:46 +00:00
|
|
|
|
using std::auto_ptr;
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathBoxed::InsetMathBoxed()
|
|
|
|
|
: InsetMathNest(1)
|
2004-08-13 15:06:46 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
auto_ptr<InsetBase> InsetMathBoxed::doClone() const
|
2004-08-13 15:06:46 +00:00
|
|
|
|
{
|
2006-09-16 18:11:38 +00:00
|
|
|
|
return auto_ptr<InsetBase>(new InsetMathBoxed(*this));
|
2004-08-13 15:06:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathBoxed::metrics(MetricsInfo & mi, Dimension & dim) const
|
2004-08-13 15:06:46 +00:00
|
|
|
|
{
|
|
|
|
|
cell(0).metrics(mi, dim);
|
|
|
|
|
metricsMarkers2(dim, 3); // 1 pixel space, 1 frame, 1 space
|
|
|
|
|
dim_ = dim;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathBoxed::draw(PainterInfo & pi, int x, int y) const
|
2004-08-13 15:06:46 +00:00
|
|
|
|
{
|
|
|
|
|
pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
|
|
|
|
|
dim_.width() - 2, dim_.height() - 2, LColor::foreground);
|
|
|
|
|
cell(0).draw(pi, x + 3, y);
|
|
|
|
|
setPosCache(pi, x, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathBoxed::write(WriteStream & os) const
|
2004-08-13 15:06:46 +00:00
|
|
|
|
{
|
|
|
|
|
os << "\\boxed{" << cell(0) << '}';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathBoxed::normalize(NormalStream & os) const
|
2004-08-13 15:06:46 +00:00
|
|
|
|
{
|
|
|
|
|
os << "[boxed " << cell(0) << ']';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-22 10:15:23 +00:00
|
|
|
|
void InsetMathBoxed::infoize(odocstream & os) const
|
2004-08-13 15:06:46 +00:00
|
|
|
|
{
|
|
|
|
|
os << "Boxed: ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathBoxed::validate(LaTeXFeatures & features) const
|
2004-08-13 15:06:46 +00:00
|
|
|
|
{
|
|
|
|
|
features.require("amsmath");
|
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|