5 #include "math_decorationinset.h"
6 #include "mathed/support.h"
7 #include "math_parser.h"
8 #include "support/LOstream.h"
14 MathDecorationInset::MathDecorationInset(string const & name, int d)
15 : MathInset(1, name), deco_(d)
17 upper_ = deco_ != LM_underline && deco_ != LM_underbrace;
21 MathInset * MathDecorationInset::clone() const
23 return new MathDecorationInset(*this);
28 void MathDecorationInset::Metrics(MathStyles st, int, int)
32 width_ = xcell(0).width();
33 ascent_ = xcell(0).ascent();
34 descent_ = xcell(0).descent();
36 dh_ = 5; //mathed_char_height(LM_TC_VAR, size(), 'I', ascent_, descent_);
46 if (deco_ == LM_not) {
54 void MathDecorationInset::draw(Painter & pain, int x, int y)
58 xcell(0).draw(pain, x, y);
59 mathed_draw_deco(pain, x, y + dy_, width_, dh_, deco_);
63 void MathDecorationInset::Write(ostream & os, bool fragile) const
66 (name_ == "overbrace" ||
67 name_ == "underbrace" ||
68 name_ == "overleftarrow" ||
69 name_ == "overrightarrow"))
78 cell(0).Write(os, fragile);
84 void MathDecorationInset::WriteNormal(ostream & os) const
86 os << "[" << name_ << " ";
87 cell(0).WriteNormal(os);