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 void metrics(MetricsInfo & mi, Dimension & dim) const;
67 void draw(PainterInfo &, int x, int y) const;
69 void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
71 void drawT(TextPainter &, int x, int y) const;
72 /// identifies FracInsets
73 InsetMathFrac * asFracInset();
74 /// identifies FracInsets
75 InsetMathFrac const * asFracInset() const;
77 docstring name() const;
79 bool extraBraces() const;
81 void write(WriteStream & os) const;
83 void maple(MapleStream &) const;
85 void mathematica(MathematicaStream &) const;
87 void octave(OctaveStream &) const;
89 void mathmlize(MathStream &) const;
91 void htmlize(HtmlStream &) const;
93 void validate(LaTeXFeatures & features) const;
95 Inset * clone() const;
102 /// Binom like objects
103 class InsetMathBinom : public InsetMathFracBase {
115 explicit InsetMathBinom(Buffer * buf, Kind kind = BINOM);
117 void write(WriteStream & os) const;
119 void normalize(NormalStream &) const;
121 void metrics(MetricsInfo & mi, Dimension & dim) const;
123 void draw(PainterInfo &, int x, int y) const;
124 /// draw decorations.
125 void drawDecoration(PainterInfo & pi, int x, int y) const
126 { drawMarkers2(pi, x, y); }
128 bool extraBraces() const;
130 void mathmlize(MathStream &) const;
132 void htmlize(HtmlStream &) const;
134 void validate(LaTeXFeatures & features) const;
136 InsetCode lyxCode() const { return MATH_FRAC_CODE; }
138 Inset * clone() const;
140 int dw(int height) const;