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;
131 /// Binom like objects
132 class InsetMathBinom : public InsetMathFracBase {
143 explicit InsetMathBinom(Kind kind = BINOM);
145 void write(WriteStream & os) const;
147 void normalize(NormalStream &) const;
149 void metrics(MetricsInfo & mi, Dimension & dim) const;
151 void draw(PainterInfo &, int x, int y) const;
152 /// draw decorations.
153 void drawDecoration(PainterInfo & pi, int x, int y) const
154 { drawMarkers2(pi, x, y); }
156 bool extraBraces() const;
158 void validate(LaTeXFeatures & features) const;
160 Inset * clone() const;
162 int dw(int height) const;
169 class InsetMathDBinom : public InsetMathFracBase {
174 void metrics(MetricsInfo & mi, Dimension & dim) const;
176 void draw(PainterInfo &, int x, int y) const;
178 docstring name() const;
180 void mathmlize(MathStream &) const;
182 void validate(LaTeXFeatures & features) const;
184 Inset * clone() const;
186 int dw(int height) const;
191 class InsetMathTBinom : public InsetMathFracBase {
196 void metrics(MetricsInfo & mi, Dimension & dim) const;
198 void draw(PainterInfo &, int x, int y) const;
200 docstring name() const;
202 void mathmlize(MathStream &) const;
204 void validate(LaTeXFeatures & features) const;
206 Inset * clone() const;
208 int dw(int height) const;