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)
20 MathInset * MathDecorationInset::clone() const
22 return new MathDecorationInset(*this);
26 bool MathDecorationInset::upper() const
28 return key_->id != LM_underline && key_->id != LM_underbrace;
32 bool MathDecorationInset::protect() const
35 key_->name == "overbrace" ||
36 key_->name == "underbrace" ||
37 key_->name == "overleftarrow" ||
38 key_->name == "overrightarrow";
42 void MathDecorationInset::metrics(MathStyles st) const
46 width_ = xcell(0).width();
47 ascent_ = xcell(0).ascent();
48 descent_ = xcell(0).descent();
50 dh_ = 5; //mathed_char_height(LM_TC_VAR, size(), 'I', ascent_, descent_);
60 if (key_->id == LM_not) {
68 void MathDecorationInset::draw(Painter & pain, int x, int y) const
72 xcell(0).draw(pain, x, y);
73 mathed_draw_deco(pain, x, y + dy_, width_, dh_, key_);
77 void MathDecorationInset::write(ostream & os, bool fragile) const
79 string name = key_->name;
80 if (fragile && protect())
84 if (key_->id == LM_not)
89 cell(0).write(os, fragile);
91 if (key_->id != LM_not)
96 void MathDecorationInset::writeNormal(ostream & os) const
98 os << "[" << key_->name << " ";
99 cell(0).writeNormal(os);