]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathGrid.h
Fixup 097da3a9: update the math parser
[lyx.git] / src / mathed / InsetMathGrid.h
index bd3066db0b2e85b662925eff3c00af65d6987ab3..f93dc822148da2ae367b762b851bfcd1fa0a8a50 100644 (file)
@@ -18,6 +18,8 @@
 
 namespace lyx {
 
+class BufferParams;
+
 
 /** Gridded math inset base class.
  *  This is the base to all grid-like editable math objects
@@ -44,13 +46,6 @@ public:
                Multicolumn multi_;
                /// special multi colums alignment
                docstring align_;
-               /// these should be a per-cell property, but ok to have it here
-               /// for single-column grids like paragraphs
-               mutable int glue_;
-               ///
-               mutable pos_type begin_;
-               ///
-               mutable pos_type end_;
        };
 
        /// additional per-row information
@@ -107,16 +102,12 @@ public:
        InsetMathGrid(Buffer * buf, col_type m, row_type n, char valign,
                docstring const & halign);
        ///
+       marker_type marker(BufferView const *) const { return MARKER2; };
+       ///
        void metrics(MetricsInfo & mi, Dimension &) const;
        ///
        void draw(PainterInfo & pi, int x, int y) const;
        ///
-       void drawWithMargin(PainterInfo & pi, int x, int y,
-               int lmargin = 0, int rmargin = 0) const;
-       /// draw decorations.
-       void drawDecoration(PainterInfo & pi, int x, int y) const
-       { drawMarkers2(pi, x, y); }
-       ///
        void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
        ///
        void drawT(TextPainter & pi, int x, int y) const;
@@ -154,6 +145,8 @@ public:
        InsetMathGrid * asGridInset() { return this; }
        /// identifies GridInset
        InsetMathGrid const * asGridInset() const { return this; }
+       //
+       bool isTable() const { return true; }
        ///
        col_type ncols() const;
        ///
@@ -171,10 +164,10 @@ public:
        bool idxBackward(Cursor &) const;
        ///
        bool idxForward(Cursor &) const;
-       ///
-       bool idxFirst(Cursor &) const;
-       ///
-       bool idxLast(Cursor &) const;
+       //
+       idx_type firstIdx() const;
+       //
+       idx_type lastIdx() const;
        ///
        bool idxDelete(idx_type & idx);
        /// pulls cell after pressing erase
@@ -219,6 +212,8 @@ public:
        virtual int vlinesep() const;
        ///
        virtual int border() const;
+       ///
+       virtual bool handlesMulticolumn() const { return false; }
 
        ///
        void write(WriteStream & os) const;
@@ -232,11 +227,13 @@ public:
        //void maple(MapleStream &) const;
        ///
        void mathmlize(MathStream &) const;
-       /// 
+       ///
        void htmlize(HtmlStream &) const;
        ///
        void htmlize(HtmlStream &, std::string attrib) const;
        ///
+       void validate(LaTeXFeatures & features) const;
+       ///
        //void octave(OctaveStream &) const;
 
 protected:
@@ -251,6 +248,11 @@ protected:
        int cellYOffset(idx_type idx) const;
        /// Width of cell, taking combined columns into account
        int cellWidth(idx_type idx) const;
+       ///
+       virtual int leftMargin() const { return 0; }
+       ///
+       virtual int rightMargin() const { return 0; }
+
        /// returns proper 'end of line' code for LaTeX
        virtual docstring eolString(row_type row, bool fragile, bool latex,
                        bool last_eoln) const;
@@ -258,10 +260,24 @@ protected:
        virtual docstring eocString(col_type col, col_type lastcol) const;
        /// splits cells and shifts right part to the next cell
        void splitCell(Cursor & cur);
-       /// Column aligmment for display of cell \p idx.
+       /// Column alignment for display of cell \p idx.
        /// Must not be written to file!
        virtual char displayColAlign(idx_type idx) const;
+       /// Column spacing for display of column \p col.
+       /// Must not be written to file!
+       virtual int displayColSpace(col_type col) const;
+
+       // The following two functions are used in InsetMathHull and
+       // InsetMathSplit.
+       /// The value of a fixed col align for a certain hull type (can
+       /// depend on the "indent math" setting).
+       static char colAlign(HullType type, col_type col,  BufferParams const &);
+       /// The value of a fixed col spacing for a certain hull type
+       static int colSpace(HullType type, col_type col);
 
+       /// positions of vertical and horizontal lines
+       int vLineHOffset(col_type col, unsigned int line) const;
+       int hLineVOffset(row_type row, unsigned int line) const;
 
        /// row info.
        /// rowinfo_[nrows()] is a dummy row used only for hlines.
@@ -276,7 +292,7 @@ protected:
 
 private:
        ///
-       char v_align_; // add approp. type
+       char v_align_; // FIXME: add approp. type
        ///
        Inset * clone() const;
 };