X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathFrac.h;h=b43180c41639405bae1732f944301da37db0b240;hb=cdc847fd304019a19425a0d5d9d42a556a937097;hp=ffcab063530cf09a9b9db27a5f16f3e5820a8b26;hpb=cd95a4bae8cc2a134597369a3cf8b6ea4ddf74e4;p=lyx.git diff --git a/src/mathed/InsetMathFrac.h b/src/mathed/InsetMathFrac.h index ffcab06353..b43180c416 100644 --- a/src/mathed/InsetMathFrac.h +++ b/src/mathed/InsetMathFrac.h @@ -5,7 +5,8 @@ * 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. */ @@ -22,13 +23,17 @@ namespace lyx { class InsetMathFracBase : public InsetMathNest { public: /// - explicit InsetMathFracBase(idx_type ncells = 2); + 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; } }; @@ -39,20 +44,26 @@ public: /// enum Kind { FRAC, + 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 idxBackward(Cursor &) const; /// + MathClass mathClass() const; + /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// void draw(PainterInfo &, int x, int y) const; @@ -68,7 +79,6 @@ public: docstring name() const; /// bool extraBraces() const; - /// void write(WriteStream & os) const; /// @@ -80,125 +90,66 @@ public: /// void mathmlize(MathStream &) const; /// - void validate(LaTeXFeatures & features) const; -public: - Inset * clone() const; - /// - Kind kind_; -}; - - -/// \dfrac support -class InsetMathDFrac : public InsetMathFrac { -public: - /// - InsetMathDFrac() {} - /// - void metrics(MetricsInfo & mi, Dimension & dim) const; - /// - void draw(PainterInfo &, int x, int y) const; - /// - docstring name() const; - /// - void mathmlize(MathStream &) const; + void htmlize(HtmlStream &) const; /// void validate(LaTeXFeatures & features) const; private: - Inset * clone() const; -}; - - -/// \tfrac support -class InsetMathTFrac : public InsetMathFrac { -public: - /// - InsetMathTFrac() {} + /// vertical displacement + int dy(FontInfo & fi) const; /// - 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; + /// + Kind kind_; }; + /// Binom like objects class InsetMathBinom : public InsetMathFracBase { public: /// - explicit InsetMathBinom(bool choose = false); + 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; -private: - Inset * clone() const; - /// - int dw(int height) const; - /// - bool choose_; -}; - - -/// \dbinom support -class InsetMathDBinom : public InsetMathFracBase { -public: - /// - InsetMathDBinom() {} + marker_type marker() const { return MARKER2; } /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// void draw(PainterInfo &, int x, int y) const; /// - docstring name() const; + bool extraBraces() const; /// void mathmlize(MathStream &) const; /// - void validate(LaTeXFeatures & features) const; -private: - Inset * clone() const; - /// - 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 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_; }; + } // namespace lyx #endif