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 explicit InsetMathFracBase(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; }
37 /// Fraction like objects (frac, binom)
38 class InsetMathFrac : public InsetMathFracBase {
53 explicit InsetMathFrac(Kind kind = FRAC, idx_type ncells = 2);
55 bool idxForward(Cursor &) const;
57 bool idxBackward(Cursor &) const;
59 void metrics(MetricsInfo & mi, Dimension & dim) const;
61 void draw(PainterInfo &, int x, int y) const;
63 void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
65 void drawT(TextPainter &, int x, int y) const;
66 /// identifies FracInsets
67 InsetMathFrac * asFracInset();
68 /// identifies FracInsets
69 InsetMathFrac const * asFracInset() const;
71 docstring name() const;
73 bool extraBraces() const;
75 void write(WriteStream & os) const;
77 void maple(MapleStream &) const;
79 void mathematica(MathematicaStream &) const;
81 void octave(OctaveStream &) const;
83 void mathmlize(MathStream &) const;
85 void validate(LaTeXFeatures & features) const;
87 Inset * clone() const;
94 /// Binom like objects
95 class InsetMathBinom : public InsetMathFracBase {
107 explicit InsetMathBinom(Kind kind = BINOM);
109 void write(WriteStream & os) const;
111 void normalize(NormalStream &) const;
113 void metrics(MetricsInfo & mi, Dimension & dim) const;
115 void draw(PainterInfo &, int x, int y) const;
116 /// draw decorations.
117 void drawDecoration(PainterInfo & pi, int x, int y) const
118 { drawMarkers2(pi, x, y); }
120 bool extraBraces() const;
122 void mathmlize(MathStream &) const;
124 void validate(LaTeXFeatures & features) const;
126 Inset * clone() const;
128 int dw(int height) const;