2 * \file math_boxedinset.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "math_boxedinset.h"
14 #include "math_data.h"
15 #include "math_mathmlstream.h"
16 #include "math_parser.h"
17 #include "math_streamstr.h"
18 #include "LaTeXFeatures.h"
21 #include "support/std_ostream.h"
22 #include "frontends/Painter.h"
27 MathBoxedInset::MathBoxedInset()
32 auto_ptr<InsetBase> MathBoxedInset::clone() const
34 return auto_ptr<InsetBase>(new MathBoxedInset(*this));
38 void MathBoxedInset::metrics(MetricsInfo & mi, Dimension & dim) const
40 cell(0).metrics(mi, dim);
41 metricsMarkers2(dim, 3); // 1 pixel space, 1 frame, 1 space
46 void MathBoxedInset::draw(PainterInfo & pi, int x, int y) const
48 pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
49 dim_.width() - 2, dim_.height() - 2, LColor::foreground);
50 cell(0).draw(pi, x + 3, y);
51 setPosCache(pi, x, y);
55 void MathBoxedInset::write(WriteStream & os) const
57 os << "\\boxed{" << cell(0) << '}';
61 void MathBoxedInset::normalize(NormalStream & os) const
63 os << "[boxed " << cell(0) << ']';
67 void MathBoxedInset::infoize(std::ostream & os) const
73 void MathBoxedInset::validate(LaTeXFeatures & features) const
75 features.require("amsmath");