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 InsetMathFracBase(Buffer * buf, 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; }
34 InsetMathFracBase * asFracBaseInset() { return this; }
36 InsetMathFracBase const * asFracBaseInset() const { return this; }
41 /// Fraction like objects (frac, binom)
42 class InsetMathFrac : public InsetMathFracBase {
59 explicit InsetMathFrac(Buffer * buf, Kind kind = FRAC, idx_type ncells = 2);
61 bool idxForward(Cursor &) const;
63 bool idxBackward(Cursor &) const;
65 MathClass mathClass() const;
67 void metrics(MetricsInfo & mi, Dimension & dim) const;
69 void draw(PainterInfo &, int x, int y) const;
71 void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
73 void drawT(TextPainter &, int x, int y) const;
74 /// identifies FracInsets
75 InsetMathFrac * asFracInset();
76 /// identifies FracInsets
77 InsetMathFrac const * asFracInset() const;
79 docstring name() const;
81 bool extraBraces() const;
83 void write(WriteStream & os) const;
85 void maple(MapleStream &) const;
87 void mathematica(MathematicaStream &) const;
89 void octave(OctaveStream &) const;
91 void mathmlize(MathStream &) const;
93 void htmlize(HtmlStream &) const;
95 void validate(LaTeXFeatures & features) const;
97 Inset * clone() const;
104 /// Binom like objects
105 class InsetMathBinom : public InsetMathFracBase {
117 explicit InsetMathBinom(Buffer * buf, Kind kind = BINOM);
119 void write(WriteStream & os) const;
121 void normalize(NormalStream &) const;
122 /// Generalized fractions are of inner class (see The TeXbook, p.292)
123 MathClass mathClass() const { return MC_INNER; }
125 void metrics(MetricsInfo & mi, Dimension & dim) const;
127 void draw(PainterInfo &, int x, int y) const;
128 /// draw decorations.
129 void drawDecoration(PainterInfo & pi, int x, int y) const
130 { drawMarkers2(pi, x, y); }
132 bool extraBraces() const;
134 void mathmlize(MathStream &) const;
136 void htmlize(HtmlStream &) const;
138 void validate(LaTeXFeatures & features) const;
140 InsetCode lyxCode() const { return MATH_FRAC_CODE; }
142 Inset * clone() const;
144 int dw(int height) const;