]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettabular.h
changelogs
[lyx.git] / src / insets / insettabular.h
index a12205c7d1d074447616ca8960db8ae6b4414920..b6a6f93970afbe7cb5beb1799c06f86e05c2b3eb 100644 (file)
  */
 
 
-// This is the rewrite of the tabular (table) support.
-
-// Ideally the tabular support should do as the mathed and use
-// LaTeX in the .lyx file too.
+// This is Juergen's rewrite of the tabular (table) support.
 
 // Things to think of when designing the new tabular support:
 // - color support (colortbl, color)
 // This is what I have written about tabular support in the LyX3-Tasks file:
 //
 //  o rewrite of table code. Should probably be written as some
-//          kind of an inset. At least get the code out of the kernel.
-//                - colortbl  -multirow
-//                - hhline    -multicolumn
-//                - dcolumn
+//    kind of an inset. [Done]
 // o enhance longtable support
 
 // Lgb
@@ -56,12 +50,8 @@ public:
        ///
        InsetTabular(Buffer const &, int rows = 1, int columns = 1);
        ///
-       InsetTabular(InsetTabular const &);
-       ///
        ~InsetTabular();
        ///
-       virtual std::auto_ptr<InsetBase> clone() const;
-       ///
        void read(Buffer const &, LyXLex &);
        ///
        void write(Buffer const &, std::ostream &) const;
@@ -72,7 +62,7 @@ public:
        ///
        std::string const editMessage() const;
        ///
-       bool insetAllowed(InsetOld::Code) const { return true; }
+       bool insetAllowed(InsetBase::Code) const { return true; }
        ///
        bool isTextInset() const { return true; }
        /** returns true if, when outputing LaTeX, font changes should
@@ -96,7 +86,7 @@ public:
        ///
        void validate(LaTeXFeatures & features) const;
        ///
-       Code lyxCode() const { return InsetOld::TABULAR_CODE; }
+       Code lyxCode() const { return InsetBase::TABULAR_CODE; }
        /// get the absolute screen x,y of the cursor
        void getCursorPos(LCursor const & cur, int & x, int & y) const;
        ///
@@ -113,9 +103,9 @@ public:
        /// number of cells
        size_t nargs() const;
        ///
-       InsetText const & cell(int) const;
+       boost::shared_ptr<InsetText const> cell(int) const;
        ///
-       InsetText & cell(int);
+       boost::shared_ptr<InsetText> cell(int);
        ///
        LyXText * getText(int) const;
 
@@ -133,11 +123,11 @@ public:
        Buffer const & buffer() const;
 
        /// set the owning buffer
-       void buffer(Buffer * buf);
+       void buffer(Buffer const * buf);
        /// lock cell with given index
        void edit(LCursor & cur, bool left);
        ///
-       InsetBase * editXY(LCursor & cur, int x, int y);
+       InsetBase * editXY(LCursor & cur, int x, int y) const;
        /// can we go further down on mouse click?
        bool descendable() const { return true; }
 
@@ -147,11 +137,15 @@ public:
        mutable LyXTabular tabular;
 
 protected:
-       ///
-       void priv_dispatch(LCursor & cur, FuncRequest & cmd);
+       InsetTabular(InsetTabular const &);
+
+       virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
+
        ///
        bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
+
        ///
        void drawCellLines(Painter &, int x, int baseline,
                int row, int cell) const;
@@ -180,7 +174,7 @@ private:
        ///
        void cutSelection(LCursor & cur);
        ///
-       bool isRightToLeft(LCursor & cur);
+       bool isRightToLeft(LCursor & cur) const;
        ///
        void getSelection(LCursor & cur,
                int & rs, int & re, int & cs, int & ce) const;
@@ -211,8 +205,8 @@ public:
        virtual std::string const & name() const { return name_; }
        ///
        virtual std::string const inset2string(Buffer const &) const;
-       /// Returns the active cell if successful, else -1.
-       static int string2params(std::string const &, InsetTabular &);
+       ///
+       static void string2params(std::string const &, InsetTabular &);
        ///
        static std::string const params2string(InsetTabular const &);
 private: