3 #include "math_decorationinset.h"
5 #include "mathed/support.h"
6 #include "math_parser.h"
7 #include "support/LOstream.h"
12 bool MathDecorationInset::GetLimits() const
14 return deco == LM_underbrace || deco == LM_overbrace;
18 MathDecorationInset::MathDecorationInset(int d, short st)
19 : MathParInset(st, "", LM_OT_DECO), deco(d)
21 upper = (deco!= LM_underline && deco!= LM_underbrace);
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', ascent, descent);
46 MathParInset::Metrics();
64 void MathDecorationInset::Write(ostream & os, bool fragile)
66 latexkeys * l = lm_get_key_by_id(deco, LM_TK_WIDE);
68 (strcmp(l->name, "overbrace") == 0 ||
69 strcmp(l->name, "underbrace") == 0 ||
70 strcmp(l->name, "overleftarrow") == 0 ||
71 strcmp(l->name, "overrightarrow") == 0))
73 os << '\\' << l->name << '{';
74 MathParInset::Write(os, fragile);