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 "LaTeXFeatures.h"
17 #include "MathStream.h"
18 #include "MetricsInfo.h"
20 #include "frontends/Painter.h"
27 InsetMathBoxed::InsetMathBoxed()
32 Inset * InsetMathBoxed::clone() const
34 return new InsetMathBoxed(*this);
38 void InsetMathBoxed::metrics(MetricsInfo & mi, Dimension & dim) const
40 cell(0).metrics(mi, dim);
41 metricsMarkers2(dim, 3); // 1 pixel space, 1 frame, 1 space
42 // Cache the inset dimension.
47 void InsetMathBoxed::draw(PainterInfo & pi, int x, int y) const
49 Dimension const dim = dimension(*pi.base.bv);
50 pi.pain.rectangle(x + 1, y - dim.ascent() + 1,
51 dim.width() - 2, dim.height() - 2, Color_foreground);
52 cell(0).draw(pi, x + 3, y);
53 setPosCache(pi, x, y);
57 void InsetMathBoxed::write(WriteStream & os) const
59 os << "\\boxed{" << cell(0) << '}';
63 void InsetMathBoxed::normalize(NormalStream & os) const
65 os << "[boxed " << cell(0) << ']';
69 void InsetMathBoxed::infoize(odocstream & os) const
75 void InsetMathBoxed::validate(LaTeXFeatures & features) const
77 features.require("amsmath");