5 #include "math_decorationinset.h"
6 #include "mathed/support.h"
7 #include "math_parser.h"
8 #include "support/LOstream.h"
14 MathDecorationInset::MathDecorationInset(latexkeys const * key)
15 : MathNestInset(1), key_(key)
17 upper_ = key_->id != LM_underline && key_->id != LM_underbrace;
21 MathInset * MathDecorationInset::clone() const
23 return new MathDecorationInset(*this);
28 void MathDecorationInset::metrics(MathStyles st) const
32 width_ = xcell(0).width();
33 ascent_ = xcell(0).ascent();
34 descent_ = xcell(0).descent();
36 dh_ = 5; //mathed_char_height(LM_TC_VAR, size(), 'I', ascent_, descent_);
46 if (key_->id == LM_not) {
54 void MathDecorationInset::draw(Painter & pain, int x, int y) const
58 xcell(0).draw(pain, x, y);
59 mathed_draw_deco(pain, x, y + dy_, width_, dh_, key_);
63 void MathDecorationInset::write(ostream & os, bool fragile) const
65 string name = key_->name;
67 (name == "overbrace" ||
68 name == "underbrace" ||
69 name == "overleftarrow" ||
70 name == "overrightarrow"))
74 if (key_->id == LM_not)
79 cell(0).write(os, fragile);
81 if (key_->id != LM_not)
85 void MathDecorationInset::writeNormal(ostream & os) const
87 os << "[" << key_->name << " ";
88 cell(0).writeNormal(os);