3 #include "math_fboxinset.h"
4 #include "math_support.h"
5 #include "math_mathmlstream.h"
6 #include "math_streamstr.h"
7 #include "math_parser.h"
8 #include "frontends/Painter.h"
13 MathFboxInset::MathFboxInset(latexkeys const * key)
14 : MathNestInset(1), key_(key)
18 auto_ptr<InsetBase> MathFboxInset::clone() const
20 return auto_ptr<InsetBase>(new MathFboxInset(*this));
24 MathInset::mode_type MathFboxInset::currentMode() const
26 if (key_->name == "fbox")
32 void MathFboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
34 if (key_->name == "fbox") {
35 FontSetChanger dummy(mi.base, "textnormal");
36 cell(0).metrics(mi, dim_);
38 cell(0).metrics(mi, dim_);
40 metricsMarkers(5); // 5 pixels margin
45 void MathFboxInset::draw(PainterInfo & pi, int x, int y) const
47 pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
48 dim_.width() - 2, dim_.height() - 2, LColor::foreground);
49 if (key_->name == "fbox") {
50 FontSetChanger dummy(pi.base, "textnormal");
51 cell(0).draw(pi, x + 5, y);
53 cell(0).draw(pi, x + 5, y);
58 void MathFboxInset::write(WriteStream & os) const
60 os << '\\' << key_->name << '{' << cell(0) << '}';
64 void MathFboxInset::normalize(NormalStream & os) const
66 os << '[' << key_->name << ' ' << cell(0) << ']';