2 #ifndef MATH_SCRIPTINSET_H
3 #define MATH_SCRIPTINSET_H
5 #include "math_nestinset.h"
11 /** Inset for super- and subscripts
15 class MathScriptInset : public MathNestInset {
20 explicit MathScriptInset(bool up);
22 MathInset * clone() const;
24 void write(MathWriteInfo & os) const;
26 void writeNormal(ostream & os) const;
28 void metrics(MathMetricsInfo const & st) const;
30 void draw(Painter &, int x, int y) const;
33 void write(MathInset const *, MathWriteInfo & os) const;
35 void writeNormal(MathInset const *, ostream & os) const;
37 void metrics(MathInset const * nucleus, MathMetricsInfo const & st) const;
39 void draw(MathInset const * nucleus, Painter &, int x, int y) const;
41 int ascent(MathInset const * nucleus) const;
43 int descent(MathInset const * nucleus) const;
45 int width(MathInset const * nucleus) const;
48 bool idxLeft(MathInset::idx_type &, MathInset::pos_type &) const;
50 bool idxRight(MathInset::idx_type &, MathInset::pos_type &) const;
53 MathScriptInset const * asScriptInset() const;
55 MathScriptInset * asScriptInset();
58 void limits(int lim) { limits_ = lim; }
60 int limits() const { return limits_; }
62 bool hasLimits(MathInset const * nucleus) const;
63 /// true if we have an "inner" position
64 MathXArray const & up() const;
66 MathXArray const & down() const;
67 /// returns superscript
71 /// do we have a superscript?
73 /// do we have a subscript?
75 /// do we have a script?
76 bool has(bool up) const;
78 void removeScript(bool up);
80 void removeEmptyScripts();
85 /// returns x offset for main part
86 int dxx(MathInset const * nuc) const;
87 /// returns width of nucleus if any
88 int nwid(MathInset const * nuc) const;
90 /// returns y offset for superscript
91 int dy0(MathInset const * nuc) const;
92 /// returns y offset for subscript
93 int dy1(MathInset const * nuc) const;
94 /// returns x offset for superscript
95 int dx0(MathInset const * nuc) const;
96 /// returns x offset for subscript
97 int dx1(MathInset const * nuc) const;
98 /// returns ascent of nucleus if any
99 int nasc(MathInset const * nuc) const;
100 /// returns descent of nucleus if any
101 int ndes(MathInset const * nuc) const;
103 /// possible subscript (index 0) and superscript (index 1)
108 mutable MathMetricsInfo mi_;