]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathFrac.h
Do not throw exceptions here either. See r22806.
[lyx.git] / src / mathed / InsetMathFrac.h
index 0788747d39d4022696e98e9c7ed7486608abc477..5030730647db540a4f0047f8d875be434c0934ff 100644 (file)
@@ -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,13 @@ 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 idxLeft(Cursor &) const { return false; }
+       bool idxBackward(Cursor &) const { return false; }
        ///
-       bool idxRight(Cursor &) const { return false; }
+       bool idxForward(Cursor &) const { return false; }
 };
 
 
@@ -39,19 +40,23 @@ 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 idxRight(Cursor &) const;
+       bool idxForward(Cursor &) const;
        ///
-       bool idxLeft(Cursor &) const;
+       bool idxBackward(Cursor &) const;
        ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
@@ -68,7 +73,6 @@ public:
        docstring name() const;
        ///
        bool extraBraces() const;
-
        ///
        void write(WriteStream & os) const;
        ///
@@ -80,6 +84,8 @@ public:
        ///
        void mathmlize(MathStream &) const;
        ///
+       void htmlize(HtmlStream &) const;
+       ///
        void validate(LaTeXFeatures & features) const;
 public:
        Inset * clone() const;
@@ -88,51 +94,21 @@ 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;
-};
-
 
 /// 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;
        ///
@@ -146,59 +122,24 @@ public:
        { 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() {}
-       ///
-       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