]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_inset.h
fix pullArg when pressing <Delete> at the end of an cell
[lyx.git] / src / mathed / math_inset.h
index bb56cdb4b8d21612a10c78141a8fc6e61d7e3b0b..76279a19703cc7eb450b197d5d59b7bd1e465224 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef MATH_INSET_H
 #define MATH_INSET_H
 
+#include <config.h>
+
 #ifdef __GNUG__
 #pragma interface
 #endif
 */
 
 
+class LaTeXFeatures;
+
 class MathInset {
 public: 
        /** A math inset has a name (usually its LaTeX name),
            type and font-size
        */
        ///
-       explicit
-       MathInset (string const & nm = string(), MathInsetTypes ot = LM_OT_SIMPLE, int na = 0);
+       explicit MathInset
+       (int na = 0, string const & nm = string(), MathInsetTypes ot = LM_OT_SIMPLE);
+
        /// The virtual base destructor
        virtual ~MathInset() {}
 
@@ -59,7 +64,7 @@ public:
        /// Appends itself with macro arguments substituted
        virtual void substitute(MathArray & array, MathMacro const & macro) const;
        /// Compute the size of the object
-       virtual void Metrics(MathStyles st) = 0;
+       virtual void Metrics(MathStyles st, int = 0, int = 0) = 0;
        /// 
        virtual int ascent() const;
        ///
@@ -69,8 +74,6 @@ public:
        ///
        virtual int height() const;
        ///
-       virtual bool hasLimits() const;
-       ///
        virtual int limits() const;
        ///
        virtual void limits(int);
@@ -95,6 +98,11 @@ public:
        /// The right key
        virtual bool idxRight(int & idx, int & pos) const;
 
+       /// Move one physical cell up
+       virtual bool idxNext(int & idx, int & pos) const;
+       /// Move one physical cell down
+       virtual bool idxPrev(int & idx, int & pos) const;
+
        /// Target pos when we enter the inset from the left by pressing "Right"
        virtual bool idxFirst(int & idx, int & pos) const;
        /// Target pos when we enter the inset from the left by pressing "Up"
@@ -115,8 +123,14 @@ public:
        virtual bool idxEnd(int & idx, int & pos) const;
 
        /// Delete a cell and move cursor
-       // a return value true indicates that the whole inset should be deleted
-       virtual bool idxDelete(int idx);
+       // the return value indicates whether the cursor should leave the inset
+       // and/or the whole inset should be deleted
+       virtual void idxDelete(int & idx, bool & popit, bool & deleteit);
+       // deletes a cell range and moves the cursor 
+       virtual void idxDeleteRange(int from, int to);
+       // returns list of cell indices that are "between" from and to for
+       // selction purposes
+       virtual std::vector<int> idxBetween(int from, int to) const;
 
        ///
        int nargs() const;
@@ -129,8 +143,6 @@ public:
        MathXArray & xcell(int);
        ///
        MathXArray const & xcell(int) const;
-       ///
-       void setData(MathArray const &, int);
                        
        ///
        int xo() const;
@@ -167,7 +179,9 @@ public:
        ///
        bool covers(int x, int y) const;
        /// Identifies ScriptInsets
-       virtual bool isScriptInset() const { return false; }
+       virtual bool isUpDownInset() const { return false; }
+       /// Identifies BigopInsets
+       virtual bool isBigopInset() const { return false; }
        ///
        virtual bool isActive() const { return nargs() > 0; }
 
@@ -175,11 +189,13 @@ public:
        ///
        void push_back(MathInset *);
        ///
-       void push_back(byte ch, MathTextCodes fcode);
+       void push_back(unsigned char ch, MathTextCodes fcode);
        ///
        void dump() const;
 
        ///
+       void Validate(LaTeXFeatures & features) const;
+
        ///
        static int workwidth;
 protected: