]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathFrac.h
Merge branch 'master' of git.lyx.org:lyx
[lyx.git] / src / mathed / InsetMathFrac.h
index c03157bdaacbbee2cc674e7fee838d902a2bc428..5030730647db540a4f0047f8d875be434c0934ff 100644 (file)
@@ -5,35 +5,60 @@
  * 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; }
+};
+
+
+
 /// Fraction like objects (frac, binom)
 class InsetMathFrac : public InsetMathFracBase {
 public:
        ///
        enum Kind {
                FRAC,
+               CFRAC,
+               CFRACLEFT,
+               CFRACRIGHT,
+               DFRAC,
+               TFRAC,
                OVER,
                ATOP,
-               NICEFRAC
+               NICEFRAC,
+               UNITFRAC,
+               UNIT
        };
-
        ///
-       explicit InsetMathFrac(Kind kind = FRAC);
+       explicit InsetMathFrac(Buffer * buf, Kind kind = FRAC, idx_type ncells = 2);
+       ///
+       bool idxForward(Cursor &) const;
        ///
-       bool metrics(MetricsInfo & mi, Dimension & dim) const;
+       bool idxBackward(Cursor &) const;
+       ///
+       void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
        void draw(PainterInfo &, int x, int y) const;
        ///
@@ -48,7 +73,6 @@ public:
        docstring name() const;
        ///
        bool extraBraces() const;
-
        ///
        void write(WriteStream & os) const;
        ///
@@ -60,9 +84,56 @@ public:
        ///
        void mathmlize(MathStream &) const;
        ///
+       void htmlize(HtmlStream &) const;
+       ///
        void validate(LaTeXFeatures & features) const;
 public:
-       virtual Inset * clone() const;
+       Inset * clone() const;
+       ///
+       Kind kind_;
+};
+
+
+
+/// Binom like objects
+class InsetMathBinom : public InsetMathFracBase {
+public:
+       ///
+       enum Kind {
+               BINOM,
+               DBINOM,
+               TBINOM,
+               CHOOSE,
+               BRACE,
+               BRACK
+       };
+       ///
+       explicit InsetMathBinom(Buffer * buf, 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;
+       ///
+       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_;
 };
@@ -70,4 +141,5 @@ public:
 
 
 } // namespace lyx
+
 #endif