*
* \author Alejandro Aguilar Sierra
* \author André Pönitz
+ * \author Uwe Stöhr
*
* Full author contact details are available in file CREDITS.
*/
class InsetMathFracBase : public InsetMathNest {
public:
///
- explicit InsetMathFracBase(idx_type ncells = 2);
+ InsetMathFracBase(Buffer * buf, idx_type ncells = 2);
///
- bool idxUpDown(Cursor &, bool up) const;
+ marker_type marker(BufferView const *) const override { return marker_type::MARKER2; }
///
- bool idxBackward(Cursor &) const { return false; }
+ bool idxUpDown(Cursor &, bool up) const override;
///
- bool idxForward(Cursor &) const { return false; }
+ bool idxBackward(Cursor &) const override { return false; }
+ ///
+ bool idxForward(Cursor &) const override { return false; }
+ ///
+ InsetMathFracBase * asFracBaseInset() override { return this; }
+ ///
+ InsetMathFracBase const * asFracBaseInset() const override { return this; }
};
///
enum Kind {
FRAC,
+ AASTEX_CASE,
+ CFRAC,
+ CFRACLEFT,
+ CFRACRIGHT,
+ DFRAC,
+ TFRAC,
OVER,
ATOP,
NICEFRAC,
UNITFRAC,
UNIT
};
-
///
- explicit InsetMathFrac(Kind kind = FRAC, idx_type ncells = 2);
+ explicit InsetMathFrac(Buffer * buf, Kind kind = FRAC, idx_type ncells = 2);
///
- bool idxForward(Cursor &) const;
+ bool idxForward(Cursor &) const override;
///
- bool idxBackward(Cursor &) const;
+ bool idxBackward(Cursor &) const override;
///
- void metrics(MetricsInfo & mi, Dimension & dim) const;
+ MathClass mathClass() const override;
///
- void draw(PainterInfo &, int x, int y) const;
+ void metrics(MetricsInfo & mi, Dimension & dim) const override;
///
- void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
+ void draw(PainterInfo &, int x, int y) const override;
///
- void drawT(TextPainter &, int x, int y) const;
+ void metricsT(TextMetricsInfo const & mi, Dimension & dim) const override;
+ ///
+ void drawT(TextPainter &, int x, int y) const override;
/// identifies FracInsets
- InsetMathFrac * asFracInset();
+ InsetMathFrac * asFracInset() override;
/// identifies FracInsets
- InsetMathFrac const * asFracInset() const;
- ///
- docstring name() const;
- ///
- bool extraBraces() const;
-
- ///
- void write(WriteStream & os) const;
- ///
- void maple(MapleStream &) const;
- ///
- void mathematica(MathematicaStream &) const;
+ InsetMathFrac const * asFracInset() const override;
///
- void octave(OctaveStream &) const;
+ docstring name() const override;
///
- void mathmlize(MathStream &) const;
+ bool extraBraces() const override;
///
- void validate(LaTeXFeatures & features) const;
-public:
- Inset * clone() const;
- ///
- Kind kind_;
-};
-
-
-/// \dfrac support
-class InsetMathDFrac : public InsetMathFrac {
-public:
+ void write(TeXMathStream & os) const override;
///
- InsetMathDFrac() {}
+ void maple(MapleStream &) const override;
///
- void metrics(MetricsInfo & mi, Dimension & dim) const;
+ void mathematica(MathematicaStream &) const override;
///
- void draw(PainterInfo &, int x, int y) const;
+ void octave(OctaveStream &) const override;
///
- docstring name() const;
+ void mathmlize(MathMLStream &) const override;
///
- void mathmlize(MathStream &) const;
+ void htmlize(HtmlStream &) const override;
///
- void validate(LaTeXFeatures & features) const;
+ void validate(LaTeXFeatures & features) const override;
private:
- Inset * clone() const;
-};
-
-
-/// \tfrac support
-class InsetMathTFrac : public InsetMathFrac {
-public:
- ///
- InsetMathTFrac() {}
- ///
- void metrics(MetricsInfo & mi, Dimension & dim) const;
- ///
- void draw(PainterInfo &, int x, int y) const;
+ /// vertical displacement
+ int dy(FontInfo & fi) const;
///
- docstring name() const;
+ Inset * clone() const override;
///
- void mathmlize(MathStream &) const;
- ///
- void validate(LaTeXFeatures & features) const;
-private:
- Inset * clone() const;
+ Kind kind_;
};
+
/// Binom like objects
class InsetMathBinom : public InsetMathFracBase {
public:
///
enum Kind {
BINOM,
+ DBINOM,
+ TBINOM,
CHOOSE,
BRACE,
BRACK
};
-
- ///
- explicit InsetMathBinom(Kind kind = BINOM);
- ///
- void write(WriteStream & os) const;
- ///
- void normalize(NormalStream &) const;
- ///
- void metrics(MetricsInfo & mi, Dimension & dim) const;
- ///
- void draw(PainterInfo &, int x, int y) const;
- /// draw decorations.
- void drawDecoration(PainterInfo & pi, int x, int y) const
- { drawMarkers2(pi, x, y); }
///
- bool extraBraces() const;
+ explicit InsetMathBinom(Buffer * buf, Kind kind = BINOM);
///
- void validate(LaTeXFeatures & features) const;
-private:
- Inset * clone() const;
+ void write(TeXMathStream & os) const override;
///
- int dw(int height) const;
+ void normalize(NormalStream &) const override;
+ /// Generalized fractions are of inner class (see The TeXbook, p.292)
+ MathClass mathClass() const override { return MC_INNER; }
///
- Kind kind_;
-};
-
-
-/// \dbinom support
-class InsetMathDBinom : public InsetMathFracBase {
-public:
+ void metrics(MetricsInfo & mi, Dimension & dim) const override;
///
- InsetMathDBinom() {}
+ void draw(PainterInfo &, int x, int y) const override;
///
- void metrics(MetricsInfo & mi, Dimension & dim) const;
+ bool extraBraces() const override;
///
- void draw(PainterInfo &, int x, int y) const;
+ void mathmlize(MathMLStream &) const override;
///
- docstring name() const;
+ void htmlize(HtmlStream &) const override;
///
- void mathmlize(MathStream &) const;
+ void validate(LaTeXFeatures & features) const override;
///
- void validate(LaTeXFeatures & features) const;
+ InsetCode lyxCode() const override { return MATH_FRAC_CODE; }
private:
- Inset * clone() const;
+ Inset * clone() const override;
///
int dw(int height) const;
-};
-
-
-/// \tbinom support
-class InsetMathTBinom : public InsetMathFracBase {
-public:
- ///
- InsetMathTBinom() {}
- ///
- void metrics(MetricsInfo & mi, Dimension & dim) const;
- ///
- void draw(PainterInfo &, int x, int y) const;
///
- docstring name() const;
- ///
- void mathmlize(MathStream &) const;
- ///
- void validate(LaTeXFeatures & features) const;
-private:
- Inset * clone() const;
- ///
- int dw(int height) const;
+ Kind kind_;
};
+
} // namespace lyx
#endif