-
-
-class MathInset {
-public:
- /// short of anything else reasonable
- typedef MathArray::size_type size_type;
- /// type for cursor positions within a cell
- typedef MathArray::size_type pos_type;
- /// type for cell indices
- typedef size_type idx_type;
- /// type for row numbers
- typedef size_type row_type;
- /// type for column numbers
- typedef size_type col_type;
-
- ///
- MathInset();
- /// the virtual base destructor
- virtual ~MathInset();
-
- /// draw the object
- virtual void draw(Painter &, int x, int y) const;
- /// write LaTeX and Lyx code
- virtual void write(WriteStream & os) const;
- /// reproduce itself
- virtual MathInset * clone() const = 0;
- ///substitutes macro arguments if necessary
- virtual void substitute(MathMacro const & macro);
- /// compute the size of the object, sets ascend_, descend_ and width_
- virtual void metrics(MathMetricsInfo const & st) const;
- ///
- virtual int ascent() const { return 1; }
- ///
- virtual int descent() const { return 1; }
- ///
- virtual int width() const { return 2; }
- ///
- virtual int height() const;
-
- /// Where should we go when we press the up cursor key?
- virtual bool idxUp(idx_type & idx, pos_type & pos) const;
- /// The down key
- virtual bool idxDown(idx_type & idx, pos_type & pos) const;
- /// The left key
- virtual bool idxLeft(idx_type & idx, pos_type & pos) const;
- /// The right key
- virtual bool idxRight(idx_type & idx, pos_type & pos) const;
-
- /// Move one physical cell up
- virtual bool idxNext(idx_type & idx, pos_type & pos) const;
- /// Move one physical cell down
- virtual bool idxPrev(idx_type & idx, pos_type & pos) const;
-
- /// Target pos when we enter the inset from the left by pressing "Right"
- virtual bool idxFirst(idx_type & idx, pos_type & pos) const;
- /// Target pos when we enter the inset from the left by pressing "Up"
- virtual bool idxFirstUp(idx_type & idx, pos_type & pos) const;
- /// Target pos when we enter the inset from the left by pressing "Down"
- virtual bool idxFirstDown(idx_type & idx, pos_type & pos) const;
- /// Target pos when we enter the inset from the right by pressing "Left"
- virtual bool idxLast(idx_type & idx, pos_type & pos) const;
- /// Target pos when we enter the inset from the right by pressing "Up"
- virtual bool idxLastUp(idx_type & idx, pos_type & pos) const;
- /// Target pos when we enter the inset from the right by pressing "Down"
- virtual bool idxLastDown(idx_type & idx, pos_type & pos) const;
-
- /// Where should we go if we press home?
- virtual bool idxHome(idx_type & idx, pos_type & pos) const;
- /// Where should we go if we press end?
- virtual bool idxEnd(idx_type & idx, pos_type & pos) const;
-
- /// Delete a cell and move cursor
- // the return value indicates whether the cursor should leave the inset
- // and/or the whole inset should be deleted
- virtual void idxDelete(idx_type & idx, bool & popit, bool & deleteit);
- // deletes a cell range and moves the cursor
- virtual void idxDeleteRange(idx_type from, idx_type to);
- // returns list of cell indices that are "between" from and to for
- // selection purposes
- virtual std::vector<idx_type> idxBetween(idx_type from, idx_type to) const;
-
- ///
- virtual idx_type nargs() const;
-
- ///
+class MathMacro;
+class MathPosFinder;
+class Dimension;
+class LCursor;
+class TextPainter;
+class TextMetricsInfo;
+class ReplaceData;
+
+
+class MathInset : public InsetBase {
+public:
+ /// identification as math inset
+ MathInset * asMathInset() { return this; }
+ /// this is overridden in math text insets (i.e. mbox)
+ bool inMathed() const { return true; }
+
+ /// the ascent of the inset above the baseline
+ /// compute the size of the object for text based drawing
+ virtual void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
+ /// draw the object as text
+ virtual void drawT(TextPainter &, int x, int y) const;
+
+ /// return cell given its number