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"
18 #include "support/std_ostream.h"
19 #include "frontends/Painter.h"
24 InsetMathBoxed::InsetMathBoxed()
29 Inset * InsetMathBoxed::clone() const
31 return new InsetMathBoxed(*this);
35 void InsetMathBoxed::metrics(MetricsInfo & mi, Dimension & dim) const
37 cell(0).metrics(mi, dim);
38 metricsMarkers2(dim, 3); // 1 pixel space, 1 frame, 1 space
39 // Cache the inset dimension.
44 void InsetMathBoxed::draw(PainterInfo & pi, int x, int y) const
46 Dimension const dim = dimension(*pi.base.bv);
47 pi.pain.rectangle(x + 1, y - dim.ascent() + 1,
48 dim.width() - 2, dim.height() - 2, Color_foreground);
49 cell(0).draw(pi, x + 3, y);
50 setPosCache(pi, x, y);
54 void InsetMathBoxed::write(WriteStream & os) const
56 os << "\\boxed{" << cell(0) << '}';
60 void InsetMathBoxed::normalize(NormalStream & os) const
62 os << "[boxed " << cell(0) << ']';
66 void InsetMathBoxed::infoize(odocstream & os) const
72 void InsetMathBoxed::validate(LaTeXFeatures & features) const
74 features.require("amsmath");