2 * \file InsetMathBoxed.cpp
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 "InsetMathBoxed.h"
15 #include "MathStream.h"
16 #include "LaTeXFeatures.h"
19 #include "support/std_ostream.h"
20 #include "frontends/Painter.h"
25 InsetMathBoxed::InsetMathBoxed()
30 Inset * InsetMathBoxed::clone() const
32 return new InsetMathBoxed(*this);
36 void InsetMathBoxed::metrics(MetricsInfo & mi, Dimension & dim) const
38 cell(0).metrics(mi, dim);
39 metricsMarkers2(dim, 3); // 1 pixel space, 1 frame, 1 space
40 // Cache the inset dimension.
45 void InsetMathBoxed::draw(PainterInfo & pi, int x, int y) const
47 Dimension const dim = dimension(*pi.base.bv);
48 pi.pain.rectangle(x + 1, y - dim.ascent() + 1,
49 dim.width() - 2, dim.height() - 2, Color::foreground);
50 cell(0).draw(pi, x + 3, y);
51 setPosCache(pi, x, y);
55 void InsetMathBoxed::write(WriteStream & os) const
57 os << "\\boxed{" << cell(0) << '}';
61 void InsetMathBoxed::normalize(NormalStream & os) const
63 os << "[boxed " << cell(0) << ']';
67 void InsetMathBoxed::infoize(odocstream & os) const
73 void InsetMathBoxed::validate(LaTeXFeatures & features) const
75 features.require("amsmath");