3 #include "math_decorationinset.h"
5 #include "mathed/support.h"
6 #include "math_parser.h"
9 bool MathDecorationInset::GetLimits() const
11 return deco == LM_underbrace || deco == LM_overbrace;
15 MathDecorationInset::MathDecorationInset(int d, short st)
16 : MathParInset(st, "", LM_OT_DECO), deco(d)
18 upper = (deco!= LM_underline && deco!= LM_underbrace);
22 MathedInset * MathDecorationInset::Clone()
24 MathDecorationInset * p = new MathDecorationInset(deco, GetStyle());
26 p->SetData(it.Copy());
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', ascent, descent);
43 MathParInset::Metrics();
61 void MathDecorationInset::Write(ostream & os, bool fragile)
63 latexkeys * l = lm_get_key_by_id(deco, LM_TK_WIDE);
65 (strcmp(l->name, "overbrace") == 0 ||
66 strcmp(l->name, "underbrace") == 0 ||
67 strcmp(l->name, "overleftarrow") == 0 ||
68 strcmp(l->name, "overrightarrow") == 0))
70 os << '\\' << l->name << '{';
71 MathParInset::Write(os, fragile);