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 {
135 explicit InsetMathBinom(bool choose = false);
137 void write(WriteStream & os) const;
139 void normalize(NormalStream &) const;
141 void metrics(MetricsInfo & mi, Dimension & dim) const;
143 void draw(PainterInfo &, int x, int y) const;
144 /// draw decorations.
145 void drawDecoration(PainterInfo & pi, int x, int y) const
146 { drawMarkers2(pi, x, y); }
148 bool extraBraces() const;
150 Inset * clone() const;
152 int dw(int height) const;
159 class InsetMathDBinom : public InsetMathFracBase {
164 void metrics(MetricsInfo & mi, Dimension & dim) const;
166 void draw(PainterInfo &, int x, int y) const;
168 docstring name() const;
170 void mathmlize(MathStream &) const;
172 void validate(LaTeXFeatures & features) const;
174 Inset * clone() const;
176 int dw(int height) const;
181 class InsetMathTBinom : public InsetMathFracBase {
186 void metrics(MetricsInfo & mi, Dimension & dim) const;
188 void draw(PainterInfo &, int x, int y) const;
190 docstring name() const;
192 void mathmlize(MathStream &) const;
194 void validate(LaTeXFeatures & features) const;
196 Inset * clone() const;
198 int dw(int height) const;