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 marker_type marker(BufferView const *) const { return MARKER2; }
30 bool idxUpDown(Cursor &, bool up) const;
32 bool idxBackward(Cursor &) const { return false; }
34 bool idxForward(Cursor &) const { return false; }
36 InsetMathFracBase * asFracBaseInset() { return this; }
38 InsetMathFracBase const * asFracBaseInset() const { return this; }
43 /// Fraction like objects (frac, binom)
44 class InsetMathFrac : public InsetMathFracBase {
61 explicit InsetMathFrac(Buffer * buf, Kind kind = FRAC, idx_type ncells = 2);
63 bool idxForward(Cursor &) const;
65 bool idxBackward(Cursor &) const;
67 MathClass mathClass() const;
69 void metrics(MetricsInfo & mi, Dimension & dim) const;
71 void draw(PainterInfo &, int x, int y) const;
73 void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
75 void drawT(TextPainter &, int x, int y) const;
76 /// identifies FracInsets
77 InsetMathFrac * asFracInset();
78 /// identifies FracInsets
79 InsetMathFrac const * asFracInset() const;
81 docstring name() const;
83 bool extraBraces() const;
85 void write(WriteStream & os) const;
87 void maple(MapleStream &) const;
89 void mathematica(MathematicaStream &) const;
91 void octave(OctaveStream &) const;
93 void mathmlize(MathStream &) const;
95 void htmlize(HtmlStream &) const;
97 void validate(LaTeXFeatures & features) const;
99 /// vertical displacement
100 int dy(FontInfo & fi) const;
102 Inset * clone() const;
109 /// Binom like objects
110 class InsetMathBinom : public InsetMathFracBase {
122 explicit InsetMathBinom(Buffer * buf, Kind kind = BINOM);
124 void write(WriteStream & os) const;
126 void normalize(NormalStream &) const;
127 /// Generalized fractions are of inner class (see The TeXbook, p.292)
128 MathClass mathClass() const { return MC_INNER; }
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;