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
10 * Full author contact details are available in file CREDITS.
16 #include "InsetMathNest.h"
22 class InsetMathFracBase : public InsetMathNest {
25 explicit InsetMathFracBase(idx_type ncells = 2);
27 bool idxUpDown(Cursor &, bool up) const;
29 bool idxBackward(Cursor &) const { return false; }
31 bool idxForward(Cursor &) const { return false; }
36 /// Fraction like objects (frac, binom)
37 class InsetMathFrac : public InsetMathFracBase {
50 explicit InsetMathFrac(Kind kind = FRAC, idx_type ncells = 2);
52 bool idxForward(Cursor &) const;
54 bool idxBackward(Cursor &) const;
56 void metrics(MetricsInfo & mi, Dimension & dim) const;
58 void draw(PainterInfo &, int x, int y) const;
60 void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
62 void drawT(TextPainter &, int x, int y) const;
63 /// identifies FracInsets
64 InsetMathFrac * asFracInset();
65 /// identifies FracInsets
66 InsetMathFrac const * asFracInset() const;
68 docstring name() const;
70 bool extraBraces() const;
73 void write(WriteStream & os) const;
75 void maple(MapleStream &) const;
77 void mathematica(MathematicaStream &) const;
79 void octave(OctaveStream &) const;
81 void mathmlize(MathStream &) const;
83 void validate(LaTeXFeatures & features) const;
85 Inset * clone() const;
92 class InsetMathDFrac : public InsetMathFrac {
97 void metrics(MetricsInfo & mi, Dimension & dim) const;
99 void draw(PainterInfo &, int x, int y) const;
101 docstring name() const;
103 void mathmlize(MathStream &) const;
105 void validate(LaTeXFeatures & features) const;
107 Inset * clone() const;
112 class InsetMathTFrac : public InsetMathFrac {
117 void metrics(MetricsInfo & mi, Dimension & dim) const;
119 void draw(PainterInfo &, int x, int y) const;
121 docstring name() const;
123 void mathmlize(MathStream &) const;
125 void validate(LaTeXFeatures & features) const;
127 Inset * clone() const;
132 class InsetMathCFrac : public InsetMathFrac {
137 void metrics(MetricsInfo & mi, Dimension & dim) const;
139 void draw(PainterInfo &, int x, int y) const;
141 docstring name() const;
143 void mathmlize(MathStream &) const;
145 void validate(LaTeXFeatures & features) const;
147 Inset * clone() const;
151 /// Binom like objects
152 class InsetMathBinom : public InsetMathFracBase {
163 explicit InsetMathBinom(Kind kind = BINOM);
165 void write(WriteStream & os) const;
167 void normalize(NormalStream &) const;
169 void metrics(MetricsInfo & mi, Dimension & dim) const;
171 void draw(PainterInfo &, int x, int y) const;
172 /// draw decorations.
173 void drawDecoration(PainterInfo & pi, int x, int y) const
174 { drawMarkers2(pi, x, y); }
176 bool extraBraces() const;
178 void validate(LaTeXFeatures & features) const;
180 Inset * clone() const;
182 int dw(int height) const;
189 class InsetMathDBinom : public InsetMathFracBase {
194 void metrics(MetricsInfo & mi, Dimension & dim) const;
196 void draw(PainterInfo &, int x, int y) const;
198 docstring name() const;
200 void mathmlize(MathStream &) const;
202 void validate(LaTeXFeatures & features) const;
204 Inset * clone() const;
206 int dw(int height) const;
211 class InsetMathTBinom : public InsetMathFracBase {
216 void metrics(MetricsInfo & mi, Dimension & dim) const;
218 void draw(PainterInfo &, int x, int y) const;
220 docstring name() const;
222 void mathmlize(MathStream &) const;
224 void validate(LaTeXFeatures & features) const;
226 Inset * clone() const;
228 int dw(int height) const;