2004-08-13 15:06:46 +00:00
|
|
|
|
/**
|
2007-04-25 03:01:35 +00:00
|
|
|
|
* \file InsetMathBoxed.cpp
|
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"
|
2007-04-25 16:11:45 +00:00
|
|
|
|
#include "MathArray.h"
|
2006-10-22 10:15:23 +00:00
|
|
|
|
#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-11-28 15:15:49 +00:00
|
|
|
|
bool 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
|
2006-11-28 15:15:49 +00:00
|
|
|
|
if (dim_ == dim)
|
|
|
|
|
return false;
|
2004-08-13 15:06:46 +00:00
|
|
|
|
dim_ = dim;
|
2006-11-28 15:15:49 +00:00
|
|
|
|
return true;
|
2004-08-13 15:06:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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
|