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 mode_type currentMode() const { return MATH_MODE; }
30 bool idxUpDown(Cursor &, bool up) const;
32 bool idxBackward(Cursor &) const { return false; }
34 bool idxForward(Cursor &) const { return false; }
39 /// Fraction like objects (frac, binom)
40 class InsetMathFrac : public InsetMathFracBase {
57 explicit InsetMathFrac(Kind kind = FRAC, idx_type ncells = 2);
59 bool idxForward(Cursor &) const;
61 bool idxBackward(Cursor &) const;
63 void metrics(MetricsInfo & mi, Dimension & dim) const;
65 void draw(PainterInfo &, int x, int y) const;
67 void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
69 void drawT(TextPainter &, int x, int y) const;
70 /// identifies FracInsets
71 InsetMathFrac * asFracInset();
72 /// identifies FracInsets
73 InsetMathFrac const * asFracInset() const;
75 docstring name() const;
77 bool extraBraces() const;
79 void write(WriteStream & os) const;
81 void maple(MapleStream &) const;
83 void mathematica(MathematicaStream &) const;
85 void octave(OctaveStream &) const;
87 void mathmlize(MathStream &) const;
89 void validate(LaTeXFeatures & features) const;
91 Inset * clone() const;
98 /// Binom like objects
99 class InsetMathBinom : public InsetMathFracBase {
111 explicit InsetMathBinom(Kind kind = BINOM);
113 void write(WriteStream & os) const;
115 void normalize(NormalStream &) const;
117 void metrics(MetricsInfo & mi, Dimension & dim) const;
119 void draw(PainterInfo &, int x, int y) const;
120 /// draw decorations.
121 void drawDecoration(PainterInfo & pi, int x, int y) const
122 { drawMarkers2(pi, x, y); }
124 bool extraBraces() const;
126 void mathmlize(MathStream &) const;
128 void validate(LaTeXFeatures & features) const;
130 Inset * clone() const;
132 int dw(int height) const;