3 #include "math_decorationinset.h"
5 #include "mathed/support.h"
6 #include "math_parser.h"
7 #include "support/LOstream.h"
12 MathDecorationInset::MathDecorationInset(int d, short st)
13 : MathParInset(st, "", LM_OT_DECO), deco_(d)
15 upper_ = (deco_ != LM_underline && deco_ != LM_underbrace);
19 bool MathDecorationInset::GetLimits() const
21 return deco_ == LM_underbrace || deco_ == LM_overbrace;
25 MathedInset * MathDecorationInset::Clone()
27 return new MathDecorationInset(*this);
32 MathDecorationInset::draw(Painter & pain, int x, int y)
34 MathParInset::draw(pain, x + (width - dw_) / 2, y);
35 mathed_draw_deco(pain, x, y + dy_, width, dh_, deco_);
40 MathDecorationInset::Metrics()
42 int h = 2 * mathed_char_height(LM_TC_VAR, size(), 'I',
44 MathParInset::Metrics();
62 void MathDecorationInset::Write(ostream & os, bool fragile)
64 latexkeys const * l = lm_get_key_by_id(deco_, LM_TK_WIDE);
66 (strcmp(l->name, "overbrace") == 0 ||
67 strcmp(l->name, "underbrace") == 0 ||
68 strcmp(l->name, "overleftarrow") == 0 ||
69 strcmp(l->name, "overrightarrow") == 0))
71 os << '\\' << l->name << '{';
72 MathParInset::Write(os, fragile);