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