3 * \file InsetMathFrac.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Alejandro Aguilar Sierra
11 * Full author contact details are available in file CREDITS.
17 #include "InsetMathNest.h"
23 class InsetMathFracBase : public InsetMathNest {
26 explicit InsetMathFracBase(idx_type ncells = 2);
28 bool idxUpDown(Cursor &, bool up) const;
30 bool idxBackward(Cursor &) const { return false; }
32 bool idxForward(Cursor &) const { return false; }
37 /// Fraction like objects (frac, binom)
38 class InsetMathFrac : public InsetMathFracBase {
51 explicit InsetMathFrac(Kind kind = FRAC, idx_type ncells = 2);
53 bool idxForward(Cursor &) const;
55 bool idxBackward(Cursor &) const;
57 void metrics(MetricsInfo & mi, Dimension & dim) const;
59 void draw(PainterInfo &, int x, int y) const;
61 void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
63 void drawT(TextPainter &, int x, int y) const;
64 /// identifies FracInsets
65 InsetMathFrac * asFracInset();
66 /// identifies FracInsets
67 InsetMathFrac const * asFracInset() const;
69 docstring name() const;
71 bool extraBraces() const;
74 void write(WriteStream & os) const;
76 void maple(MapleStream &) const;
78 void mathematica(MathematicaStream &) const;
80 void octave(OctaveStream &) const;
82 void mathmlize(MathStream &) const;
84 void validate(LaTeXFeatures & features) const;
86 Inset * clone() const;
93 class InsetMathDFrac : public InsetMathFrac {
98 void metrics(MetricsInfo & mi, Dimension & dim) const;
100 void draw(PainterInfo &, int x, int y) const;
102 docstring name() const;
104 void mathmlize(MathStream &) const;
106 void validate(LaTeXFeatures & features) const;
108 Inset * clone() const;
113 class InsetMathTFrac : public InsetMathFrac {
118 void metrics(MetricsInfo & mi, Dimension & dim) const;
120 void draw(PainterInfo &, int x, int y) const;
122 docstring name() const;
124 void mathmlize(MathStream &) const;
126 void validate(LaTeXFeatures & features) const;
128 Inset * clone() const;
133 class InsetMathCFrac : public InsetMathFrac {
138 void metrics(MetricsInfo & mi, Dimension & dim) const;
140 void draw(PainterInfo &, int x, int y) const;
142 docstring name() const;
144 void mathmlize(MathStream &) const;
146 void validate(LaTeXFeatures & features) const;
148 Inset * clone() const;
152 /// Binom like objects
153 class InsetMathBinom : public InsetMathFracBase {
164 explicit InsetMathBinom(Kind kind = BINOM);
166 void write(WriteStream & os) const;
168 void normalize(NormalStream &) const;
170 void metrics(MetricsInfo & mi, Dimension & dim) const;
172 void draw(PainterInfo &, int x, int y) const;
173 /// draw decorations.
174 void drawDecoration(PainterInfo & pi, int x, int y) const
175 { drawMarkers2(pi, x, y); }
177 bool extraBraces() const;
179 void validate(LaTeXFeatures & features) const;
181 Inset * clone() const;
183 int dw(int height) const;
190 class InsetMathDBinom : public InsetMathFracBase {
195 void metrics(MetricsInfo & mi, Dimension & dim) const;
197 void draw(PainterInfo &, int x, int y) const;
199 docstring name() const;
201 void mathmlize(MathStream &) const;
203 void validate(LaTeXFeatures & features) const;
205 Inset * clone() const;
207 int dw(int height) const;
212 class InsetMathTBinom : public InsetMathFracBase {
217 void metrics(MetricsInfo & mi, Dimension & dim) const;
219 void draw(PainterInfo &, int x, int y) const;
221 docstring name() const;
223 void mathmlize(MathStream &) const;
225 void validate(LaTeXFeatures & features) const;
227 Inset * clone() const;
229 int dw(int height) const;