]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetTabular.h
Remove color dependency of framed note, fix bug 3598
[lyx.git] / src / insets / InsetTabular.h
index f042b0a6f32a98377f7c9608d34712680bfa4309..bc8c36a27dbe90ad5ffb3b44cba3d402e6032787 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "Inset.h"
 #include "MailInset.h"
-#include "LyXLength.h"
+#include "Length.h"
 #include "InsetText.h"
 
 
@@ -61,7 +61,7 @@ namespace frontend { class Painter; }
 
 
 class InsetTabular;
-class LCursor;
+class Cursor;
 class OutputParams;
 
 //
@@ -144,10 +144,14 @@ public:
                ///
                UNSET_ROTATE_TABULAR,
                ///
+               TOGGLE_ROTATE_TABULAR,
+               ///
                SET_ROTATE_CELL,
                ///
                UNSET_ROTATE_CELL,
                ///
+               TOGGLE_ROTATE_CELL,
+               ///
                SET_USEBOX,
                ///
                SET_LTHEAD,
@@ -294,9 +298,9 @@ public:
        void setVAlignment(idx_type cell, VAlignment align,
                           bool onlycolumn = false);
        ///
-       void setColumnPWidth(LCursor &, idx_type, LyXLength const &);
+       void setColumnPWidth(Cursor &, idx_type, Length const &);
        ///
-       bool setMColumnPWidth(LCursor &, idx_type, LyXLength const &);
+       bool setMColumnPWidth(Cursor &, idx_type, Length const &);
        ///
        void setAlignSpecial(idx_type cell, docstring const & special,
                             Feature what);
@@ -307,11 +311,11 @@ public:
        VAlignment getVAlignment(idx_type cell,
                                 bool onlycolumn = false) const;
        ///
-       LyXLength const getPWidth(idx_type cell) const;
+       Length const getPWidth(idx_type cell) const;
        ///
-       LyXLength const getColumnPWidth(idx_type cell) const;
+       Length const getColumnPWidth(idx_type cell) const;
        ///
-       LyXLength const getMColumnPWidth(idx_type cell) const;
+       Length const getMColumnPWidth(idx_type cell) const;
        ///
        docstring const getAlignSpecial(idx_type cell, int what) const;
        ///
@@ -444,7 +448,7 @@ public:
                          boost::shared_ptr<InsetText>) const;
        /// Search for \param inset in the tabular, with the
        ///
-       idx_type getCellFromInset(InsetBase const * inset) const;
+       idx_type getCellFromInset(Inset const * inset) const;
        ///
        row_type rows() const { return rows_; }
        ///
@@ -489,7 +493,7 @@ public:
                ///
                docstring align_special;
                ///
-               LyXLength p_width; // this is only set for multicolumn!!!
+               Length p_width; // this is only set for multicolumn!!!
                ///
                boost::shared_ptr<InsetText> inset;
        };
@@ -513,15 +517,15 @@ public:
                ///
                bool bottom_line;
                /// Extra space between the top line and this row
-               LyXLength top_space;
+               Length top_space;
                /// Ignore top_space if true and use the default top space
                bool top_space_default;
                /// Extra space between this row and the bottom line
-               LyXLength bottom_space;
+               Length bottom_space;
                /// Ignore bottom_space if true and use the default bottom space
                bool bottom_space_default;
                /// Extra space between the bottom line and the next top line
-               LyXLength interline_space;
+               Length interline_space;
                /// Ignore interline_space if true and use the default interline space
                bool interline_space_default;
                /// This are for longtabulars only
@@ -555,7 +559,7 @@ public:
                ///
                int  width_of_column;
                ///
-               LyXLength p_width;
+               Length p_width;
                ///
                docstring align_special;
        };
@@ -661,7 +665,7 @@ private:
 
 
 
-class InsetTabular : public InsetOld {
+class InsetTabular : public Inset {
 public:
        ///
        InsetTabular(Buffer const &, row_type rows = 1,
@@ -683,7 +687,7 @@ public:
        ///
        EDITABLE editable() const { return HIGHLY_EDITABLE; }
        ///
-       bool insetAllowed(InsetBase::Code) const { return true; }
+       bool insetAllowed(Inset::Code) const { return true; }
        ///
        bool allowSpellCheck() const { return true; }
        ///
@@ -693,7 +697,7 @@ public:
            insets that may contain several paragraphs */
        bool noFontChange() const { return true; }
        ///
-       bool display() const { return tabular.isLongTabular(); }
+       DisplayType display() const { return tabular.isLongTabular() ? AlignCenter : Inline; }
        ///
        int latex(Buffer const &, odocstream &,
                  OutputParams const &) const;
@@ -706,14 +710,14 @@ public:
        ///
        void validate(LaTeXFeatures & features) const;
        ///
-       Code lyxCode() const { return InsetBase::TABULAR_CODE; }
+       Code lyxCode() const { return Inset::TABULAR_CODE; }
        /// get offset of this cursor slice relative to our upper left corner
        void cursorPos(BufferView const & bv, CursorSlice const & sl,
                bool boundary, int & x, int & y) const;
        ///
-       bool tabularFeatures(LCursor & cur, std::string const & what);
+       bool tabularFeatures(Cursor & cur, std::string const & what);
        ///
-       void tabularFeatures(LCursor & cur, Tabular::Feature feature,
+       void tabularFeatures(Cursor & cur, Tabular::Feature feature,
                             std::string const & val = std::string());
        ///
        void openLayoutDialog(BufferView *) const;
@@ -726,7 +730,7 @@ public:
        ///
        boost::shared_ptr<InsetText> cell(idx_type);
        ///
-       LyXText * getText(int) const;
+       Text * getText(int) const;
 
        /// set the change for the entire inset
        void setChange(Change const & change);
@@ -749,9 +753,9 @@ public:
        /// set the owning buffer
        void buffer(Buffer const * buf);
        /// lock cell with given index
-       void edit(LCursor & cur, bool left);
+       void edit(Cursor & cur, bool left);
        ///
-       InsetBase * editXY(LCursor & cur, int x, int y);
+       Inset * editXY(Cursor & cur, int x, int y);
        /// can we go further down on mouse click?
        bool descendable() const { return true; }
 
@@ -764,52 +768,56 @@ protected:
        ///
        InsetTabular(InsetTabular const &);
        ///
-       virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
+       virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
        ///
-       bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
+       bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
        ///
        int scroll() const { return scx_; }
 
 private:
-       virtual std::auto_ptr<InsetBase> doClone() const;
+       virtual std::auto_ptr<Inset> doClone() const;
 
        ///
        void drawCellLines(frontend::Painter &, int x, int y, row_type row,
                           idx_type cell, bool erased) const;
        ///
-       void setCursorFromCoordinates(LCursor & cur, int x, int y) const;
+       void setCursorFromCoordinates(Cursor & cur, int x, int y) const;
 
        ///
-       void moveNextCell(LCursor & cur);
+       void moveNextCell(Cursor & cur);
        ///
-       void movePrevCell(LCursor & cur);
+       void movePrevCell(Cursor & cur);
        ///
        int getCellXPos(idx_type cell) const;
        ///
-       void resetPos(LCursor & cur) const;
+       void resetPos(Cursor & cur) const;
        ///
        void removeTabularRow();
        ///
-       bool copySelection(LCursor & cur);
+       bool copySelection(Cursor & cur);
        ///
-       bool pasteClipboard(LCursor & cur);
+       bool pasteClipboard(Cursor & cur);
        ///
-       void cutSelection(LCursor & cur);
+       void cutSelection(Cursor & cur);
        ///
-       bool isRightToLeft(LCursor & cur) const;
+       bool isRightToLeft(Cursor & cur) const;
        ///
-       void getSelection(LCursor & cur, row_type & rs, row_type & re,
+       void getSelection(Cursor & cur, row_type & rs, row_type & re,
                          col_type & cs, col_type & ce) const;
        ///
        bool insertPlaintextString(BufferView &, docstring const & buf, bool usePaste);
        /// are we operating on several cells?
-       bool tablemode(LCursor & cur) const;
+       bool tablemode(Cursor & cur) const;
 
        /// return the "Manhattan distance" to nearest corner
        int dist(BufferView &, idx_type cell, int x, int y) const;
        /// return the cell nearest to x, y
        idx_type getNearestCell(BufferView &, int x, int y) const;
 
+       /// test the rotation state of the give cell range.
+       bool oneCellHasRotationState(bool rotated,
+                               row_type row_start, row_type row_end, 
+                               col_type col_start, col_type col_end) const;
        ///
        Buffer const * buffer_;
        ///
@@ -827,7 +835,7 @@ public:
        ///
        InsetTabularMailer(InsetTabular const & inset);
        ///
-       virtual InsetBase & inset() const { return inset_; }
+       virtual Inset & inset() const { return inset_; }
        ///
        virtual std::string const & name() const { return name_; }
        ///