7 #include "math_decorationinset.h"
8 #include "mathed/support.h"
9 #include "math_parser.h"
10 #include "support/LOstream.h"
11 #include "support/lstrings.h"
17 MathDecorationInset::MathDecorationInset(int d)
18 : MathInset("", LM_OT_DECO, 1), deco_(d)
20 upper_ = deco_ != LM_underline && deco_ != LM_underbrace;
24 bool MathDecorationInset::GetLimits() const
26 return deco_ == LM_underbrace || deco_ == LM_overbrace;
30 MathInset * MathDecorationInset::clone() const
32 return new MathDecorationInset(*this);
36 void MathDecorationInset::draw(Painter & pain, int x, int y)
38 xcell(0).draw(pain, x, y);
39 mathed_draw_deco(pain, x, y + 10, width_, 10, deco_);
43 void MathDecorationInset::Metrics(MathStyles st)
45 int const h = 2 * mathed_char_height(LM_TC_VAR, size(), 'I',
48 width_ = xcell(0).width();
49 ascent_ = xcell(0).ascent();
50 descent_ = xcell(0).descent();
72 void MathDecorationInset::Write(ostream & os, bool fragile) const
74 latexkeys const * l = lm_get_key_by_id(deco_, LM_TK_WIDE);
76 (compare(l->name, "overbrace") == 0 ||
77 compare(l->name, "underbrace") == 0 ||
78 compare(l->name, "overleftarrow") == 0 ||
79 compare(l->name, "overrightarrow") == 0))
81 os << '\\' << l->name << '{';
82 cell(0).Write(os, fragile);