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 MathDecorationInset * p = new MathDecorationInset(deco_, GetStyle());
29 p->setData(it.Copy());
35 MathDecorationInset::draw(Painter & pain, int x, int y)
37 MathParInset::draw(pain, x + (width - dw_) / 2, y);
38 mathed_draw_deco(pain, x, y + dy_, width, dh_, deco_);
43 MathDecorationInset::Metrics()
45 int h = 2 * mathed_char_height(LM_TC_VAR, size(), 'I',
47 MathParInset::Metrics();
65 void MathDecorationInset::Write(ostream & os, bool fragile)
67 latexkeys const * l = lm_get_key_by_id(deco_, LM_TK_WIDE);
69 (strcmp(l->name, "overbrace") == 0 ||
70 strcmp(l->name, "underbrace") == 0 ||
71 strcmp(l->name, "overleftarrow") == 0 ||
72 strcmp(l->name, "overrightarrow") == 0))
74 os << '\\' << l->name << '{';
75 MathParInset::Write(os, fragile);