]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_inset.h
mathed uglyfication
[lyx.git] / src / mathed / math_inset.h
index a4c0751dfba9bccbf34688b872cea69c3538b72b..2503ca5228062e11c5e292367961c92f41750fb3 100644 (file)
 #ifndef MATH_INSET_H
 #define MATH_INSET_H
 
-#include "support/std_string.h"
+#include "cursor_slice.h"
 #include "insets/insetbase.h"
 
+#include <string>
+
 /**
 
 Abstract base class for all math objects.  A math insets is for use of the
@@ -30,7 +32,7 @@ inclusion in the "real LyX insets" FormulaInset and FormulaMacroInset.
 
 */
 
-
+class OutputParams;
 class MathArrayInset;
 class MathAMSArrayInset;
 class MathCharInset;
@@ -78,6 +80,8 @@ class MathInset : public InsetBase {
 public:
        /// our members behave nicely...
        MathInset() {}
+       /// identification as math inset
+       MathInset * asMathInset() { return this; }
 
        /// substitutes macro arguments if necessary
        virtual void substitute(MathMacro const & macro);
@@ -91,30 +95,28 @@ public:
        virtual void drawT(TextPainter &, int x, int y) const;
 
        /// Where should we go when we press the up or down cursor key?
-       virtual bool idxUpDown(idx_type & idx, pos_type & pos, bool up,
-               int targetx) const;
+       virtual bool idxUpDown(BufferView & bv, bool up, int targetx) const;
        /// Where should we go when we press the up or down cursor key?
-       virtual bool idxUpDown2(idx_type & idx, pos_type & pos, bool up,
-               int targetx) const;
+       virtual bool idxUpDown2(BufferView & bv, bool up, int targetx) const;
        /// The left key
-       virtual bool idxLeft(idx_type & idx, pos_type & pos) const;
+       virtual bool idxLeft(BufferView & bv) const;
        /// The right key
-       virtual bool idxRight(idx_type & idx, pos_type & pos) const;
+       virtual bool idxRight(BufferView & bv) const;
 
        /// Move one physical cell up
-       virtual bool idxNext(idx_type & idx, pos_type & pos) const;
+       virtual bool idxNext(BufferView & bv) const;
        /// Move one physical cell down
-       virtual bool idxPrev(idx_type & idx, pos_type & pos) const;
+       virtual bool idxPrev(BufferView & bv) const;
 
        /// Target pos when we enter the inset from the left by pressing "Right"
-       virtual bool idxFirst(idx_type & idx, pos_type & pos) const;
+       virtual bool idxFirst(BufferView & bv) const;
        /// Target pos when we enter the inset from the right by pressing "Left"
-       virtual bool idxLast(idx_type & idx, pos_type & pos) const;
+       virtual bool idxLast(BufferView & bv) const;
 
        /// Where should we go if we press home?
-       virtual bool idxHome(idx_type & idx, pos_type & pos) const;
+       virtual bool idxHome(BufferView & bv) const;
        /// Where should we go if we press end?
-       virtual bool idxEnd(idx_type & idx, pos_type & pos) const;
+       virtual bool idxEnd(BufferView & bv) const;
 
        /// Delete a cell and move cursor
        virtual bool idxDelete(idx_type &) { return false; }
@@ -149,7 +151,7 @@ public:
        /// can we enter this cell?
        virtual bool validCell(idx_type) const { return true; }
        /// get coordinates
-       virtual void getPos(idx_type idx, pos_type pos, int & x, int & y) const;
+       virtual void getScreenPos(idx_type idx, pos_type pos, int & x, int & y) const;
 
        /// identifies certain types of insets
        virtual MathAMSArrayInset       * asAMSArrayInset()       { return 0; }
@@ -203,9 +205,7 @@ public:
        virtual bool takesLimits() const { return false; }
 
        /// char char code if possible
-       virtual void handleFont(string const &) {}
-       /// is this inset equal to a given other inset?
-       virtual bool match(MathAtom const &) const { return false; }
+       virtual void handleFont(std::string const &) {}
        /// replace things by other things
        virtual void replace(ReplaceData &) {}
        /// do we contain a given subsequence?
@@ -236,11 +236,11 @@ public:
        /// describe content if cursor behind
        virtual void infoize2(std::ostream &) const {}
        /// plain ascii output
-       virtual int ascii(std::ostream & os, int) const;
+       virtual int plaintext(std::ostream & os, OutputParams const &) const;
        /// linuxdoc output
-       virtual int linuxdoc(std::ostream & os) const;
+       virtual int linuxdoc(std::ostream & os, OutputParams const &) const;
        /// docbook output
-       virtual int docbook(std::ostream & os, bool) const;
+       virtual int docbook(std::ostream & os, OutputParams const &) const;
 
        /// dump content to stderr for debugging
        virtual void dump() const;
@@ -248,17 +248,13 @@ public:
        /// LyXInset stuff
        virtual bool numberedType() const { return false; }
        /// hull type
-       virtual string const & getType() const;
+       virtual std::string const & getType() const;
        /// change type
-       virtual void mutate(string const &) {}
+       virtual void mutate(std::string const &) {}
        /// how is the inset called in the .lyx file?
-       virtual string fileInsetLabel() const;
+       virtual std::string fileInsetLabel() const;
        /// usually the latex name
-       virtual string name() const;
-
-protected:
-       /// a dirty hack
-       BufferView * view() const;
+       virtual std::string name() const;
 };
 
 std::ostream & operator<<(std::ostream &, MathAtom const &);