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 /// vertical displacement
98 int dy(FontInfo & fi) const;
100 Inset * clone() const;
107 /// Binom like objects
108 class InsetMathBinom : public InsetMathFracBase {
120 explicit InsetMathBinom(Buffer * buf, Kind kind = BINOM);
122 void write(WriteStream & os) const;
124 void normalize(NormalStream &) const;
125 /// Generalized fractions are of inner class (see The TeXbook, p.292)
126 MathClass mathClass() const { return MC_INNER; }
128 marker_type marker() const { return MARKER2; }
130 void metrics(MetricsInfo & mi, Dimension & dim) const;
132 void draw(PainterInfo &, int x, int y) const;
134 bool extraBraces() const;
136 void mathmlize(MathStream &) const;
138 void htmlize(HtmlStream &) const;
140 void validate(LaTeXFeatures & features) const;
142 InsetCode lyxCode() const { return MATH_FRAC_CODE; }
144 Inset * clone() const;
146 int dw(int height) const;