7 #include "math_decorationinset.h"
9 #include "mathed/support.h"
10 #include "math_parser.h"
11 #include "support/LOstream.h"
12 #include "support/lstrings.h"
18 MathDecorationInset::MathDecorationInset(int d, short st)
19 : MathParInset(st, "", LM_OT_DECO), deco_(d)
21 upper_ = (deco_ != LM_underline && deco_ != LM_underbrace);
25 bool MathDecorationInset::GetLimits() const
27 return deco_ == LM_underbrace || deco_ == LM_overbrace;
31 MathedInset * MathDecorationInset::Clone()
33 return new MathDecorationInset(*this);
38 MathDecorationInset::draw(Painter & pain, int x, int y)
40 MathParInset::draw(pain, x + (width - dw_) / 2, y);
41 mathed_draw_deco(pain, x, y + dy_, width, dh_, deco_);
46 MathDecorationInset::Metrics()
48 int const h = 2 * mathed_char_height(LM_TC_VAR, size(), 'I',
50 MathParInset::Metrics();
68 void MathDecorationInset::Write(ostream & os, bool fragile)
70 latexkeys const * l = lm_get_key_by_id(deco_, LM_TK_WIDE);
72 (compare(l->name, "overbrace") == 0 ||
73 compare(l->name, "underbrace") == 0 ||
74 compare(l->name, "overleftarrow") == 0 ||
75 compare(l->name, "overrightarrow") == 0))
77 os << '\\' << l->name << '{';
78 MathParInset::Write(os, fragile);