X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathFrac.h;h=9d5484487687932368f8bd45dc2be588cd4f47c1;hb=5fdc577badb1cb133d6a0dc7d831bb1f82576adb;hp=6668654b7567b688dea22064d0f9e15cf36750f8;hpb=0ea6f2c7f129fc400b6935c4a722a1483583c058;p=lyx.git diff --git a/src/mathed/InsetMathFrac.h b/src/mathed/InsetMathFrac.h index 6668654b75..9d54844876 100644 --- a/src/mathed/InsetMathFrac.h +++ b/src/mathed/InsetMathFrac.h @@ -5,42 +5,66 @@ * Licence details can be found in the file COPYING. * * \author Alejandro Aguilar Sierra - * \author André Pönitz + * \author André Pönitz + * \author Uwe Stöhr * * Full author contact details are available in file CREDITS. */ -#ifndef MATH_FRACINSET_H -#define MATH_FRACINSET_H +#ifndef MATH_FRAC_H +#define MATH_FRAC_H -#include "InsetMathFracBase.h" +#include "InsetMathNest.h" namespace lyx { +class InsetMathFracBase : public InsetMathNest { +public: + /// + InsetMathFracBase(Buffer * buf, idx_type ncells = 2); + /// + bool idxUpDown(Cursor &, bool up) const; + /// + bool idxBackward(Cursor &) const { return false; } + /// + bool idxForward(Cursor &) const { return false; } + /// + InsetMathFracBase * asFracBaseInset() { return this; } + /// + InsetMathFracBase const * asFracBaseInset() const { return this; } +}; + + + /// Fraction like objects (frac, binom) class InsetMathFrac : public InsetMathFracBase { public: /// enum Kind { FRAC, + CFRAC, + CFRACLEFT, + CFRACRIGHT, + DFRAC, + TFRAC, OVER, ATOP, NICEFRAC, UNITFRAC, - UNIT, - UNITFRAC3 + 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 idxRight(Cursor &) const; + bool idxBackward(Cursor &) const; /// - bool idxLeft(Cursor &) const; + MathClass mathClass() const; /// - bool metrics(MetricsInfo & mi, Dimension & dim) const; + void metrics(MetricsInfo & mi, Dimension & dim) const; /// void draw(PainterInfo &, int x, int y) const; /// @@ -55,7 +79,6 @@ public: docstring name() const; /// bool extraBraces() const; - /// void write(WriteStream & os) const; /// @@ -67,9 +90,61 @@ public: /// void mathmlize(MathStream &) const; /// + void htmlize(HtmlStream &) const; + /// void validate(LaTeXFeatures & features) const; +private: + /// vertical displacement + int dy(FontInfo & fi) const; + /// + Inset * clone() const; + /// + Kind kind_; +}; + + + +/// Binom like objects +class InsetMathBinom : public InsetMathFracBase { public: - virtual Inset * clone() const; + /// + enum Kind { + BINOM, + DBINOM, + TBINOM, + CHOOSE, + BRACE, + BRACK + }; + /// + explicit InsetMathBinom(Buffer * buf, Kind kind = BINOM); + /// + void write(WriteStream & os) const; + /// + void normalize(NormalStream &) const; + /// Generalized fractions are of inner class (see The TeXbook, p.292) + MathClass mathClass() const { return MC_INNER; } + /// + 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; + /// + void mathmlize(MathStream &) const; + /// + void htmlize(HtmlStream &) const; + /// + void validate(LaTeXFeatures & features) const; + /// + InsetCode lyxCode() const { return MATH_FRAC_CODE; } +private: + Inset * clone() const; + /// + int dw(int height) const; /// Kind kind_; }; @@ -77,4 +152,5 @@ public: } // namespace lyx + #endif