]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathFrac.h
This patch does two closely related things.
[lyx.git] / src / mathed / InsetMathFrac.h
index 59c198691b7f82e7fd6761bb2611892609b45771..c030c8a51a0203f15b2429b64988f345a744e2e7 100644 (file)
@@ -23,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; }
 };
 
 
@@ -40,15 +44,19 @@ 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;
        ///
@@ -69,7 +77,6 @@ public:
        docstring name() const;
        ///
        bool extraBraces() const;
-
        ///
        void write(WriteStream & os) const;
        ///
@@ -81,6 +88,8 @@ public:
        ///
        void mathmlize(MathStream &) const;
        ///
+       void htmlize(HtmlStream &) const;
+       ///
        void validate(LaTeXFeatures & features) const;
 public:
        Inset * clone() const;
@@ -89,65 +98,6 @@ public:
 };
 
 
-/// \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 validate(LaTeXFeatures & features) const;
-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;
-       ///
-       docstring name() const;
-       ///
-       void mathmlize(MathStream &) const;
-       ///
-       void validate(LaTeXFeatures & features) const;
-private:
-       Inset * clone() const;
-};
-
-
-/// \cfrac support
-class InsetMathCFrac : public InsetMathFrac {
-public:
-       ///
-       InsetMathCFrac() {}
-       ///
-       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;
-};
-
 
 /// Binom like objects
 class InsetMathBinom : public InsetMathFracBase {
@@ -155,13 +105,14 @@ public:
        ///
        enum Kind {
                BINOM,
+               DBINOM,
+               TBINOM,
                CHOOSE,
                BRACE,
                BRACK
        };
-
        ///
-       explicit InsetMathBinom(Kind kind = BINOM);
+       explicit InsetMathBinom(Buffer * buf, Kind kind = BINOM);
        ///
        void write(WriteStream & os) const;
        ///
@@ -176,60 +127,23 @@ public:
        ///
        bool extraBraces() const;
        ///
-       void validate(LaTeXFeatures & features) const;
-private:
-       Inset * clone() const;
-       ///
-       int dw(int height) const;
-       ///
-       Kind kind_;
-};
-
-
-/// \dbinom support
-class InsetMathDBinom : public InsetMathFracBase {
-public:
-       ///
-       InsetMathDBinom() {}
-       ///
-       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;
-};
-
-
-/// \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