2 * \file math_fboxinset.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_fboxinset.h"
14 #include "math_support.h"
15 #include "math_mathmlstream.h"
16 #include "math_streamstr.h"
17 #include "math_parser.h"
18 #include "frontends/Painter.h"
23 MathFboxInset::MathFboxInset(latexkeys const * key)
24 : MathNestInset(1), key_(key)
28 auto_ptr<InsetBase> MathFboxInset::clone() const
30 return auto_ptr<InsetBase>(new MathFboxInset(*this));
34 MathInset::mode_type MathFboxInset::currentMode() const
36 if (key_->name == "fbox")
42 void MathFboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
44 if (key_->name == "fbox") {
45 FontSetChanger dummy(mi.base, "textnormal");
46 cell(0).metrics(mi, dim_);
48 cell(0).metrics(mi, dim_);
50 metricsMarkers(5); // 5 pixels margin
55 void MathFboxInset::draw(PainterInfo & pi, int x, int y) const
57 pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
58 dim_.width() - 2, dim_.height() - 2, LColor::foreground);
59 if (key_->name == "fbox") {
60 FontSetChanger dummy(pi.base, "textnormal");
61 cell(0).draw(pi, x + 5, y);
63 cell(0).draw(pi, x + 5, y);
68 void MathFboxInset::write(WriteStream & os) const
70 os << '\\' << key_->name << '{' << cell(0) << '}';
74 void MathFboxInset::normalize(NormalStream & os) const
76 os << '[' << key_->name << ' ' << cell(0) << ']';