]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettabular.h
Enable convertDefault.sh to run even if its executable bit is not set.
[lyx.git] / src / insets / insettabular.h
index 3076dbb441ecc71cf7a1d9d0a4e3dea013bd3222..f3f6781e7120f35dcc35f1d15190b10e9b7b7b4c 100644 (file)
@@ -6,7 +6,7 @@
  *
  * \author Jürgen Vigna
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 // This is the rewrite of the tabular (table) support.
 
 #include "inset.h"
 #include "tabular.h"
 #include "LString.h"
-#include "lyxcursor.h"
 #include "FuncStatus.h"
 #include "frontends/mouse_state.h"
 
-#include <boost/scoped_ptr.hpp>
-#include <boost/weak_ptr.hpp>
-
 class LyXLex;
 class Painter;
 class BufferView;
@@ -64,15 +60,6 @@ class Paragraph;
 
 class InsetTabular : public UpdatableInset {
 public:
-       ///
-       enum UpdateCodes {
-               NONE = 0,
-               CURSOR = 1,
-               CELL = 2,
-               SELECTION = 3,
-               FULL = 4,
-               INIT = 5
-       };
        ///
        InsetTabular(Buffer const &, int rows = 1, int columns = 1);
        ///
@@ -80,40 +67,36 @@ public:
        ///
        ~InsetTabular();
        ///
-       Inset * clone() const;
+       virtual std::auto_ptr<InsetBase> clone() const;
        ///
-       void read(Buffer const *, LyXLex &);
+       void read(Buffer const &, LyXLex &);
        ///
-       void write(Buffer const *, std::ostream &) const;
+       void write(Buffer const &, std::ostream &) const;
        ///
        void metrics(MetricsInfo &, Dimension &) const;
        ///
        void draw(PainterInfo & pi, int x, int y) const;
        ///
-       void update(BufferView *, bool = false);
-       ///
        string const editMessage() const;
        //
        void insetUnlock(BufferView *);
        ///
-       void updateLocal(BufferView *, UpdateCodes) const;
+       void updateLocal(BufferView *) const;
        ///
        bool lockInsetInInset(BufferView *, UpdatableInset *);
        ///
        bool unlockInsetInInset(BufferView *, UpdatableInset *,
                                bool lr = false);
        ///
-       bool updateInsetInInset(BufferView *, Inset *);
-       ///
        int insetInInsetY() const;
        ///
        UpdatableInset * getLockingInset() const;
        ///
-       UpdatableInset * getFirstLockingInsetOfType(Inset::Code);
+       UpdatableInset * getFirstLockingInsetOfType(InsetOld::Code);
        ///
-       bool insertInset(BufferView *, Inset *);
+       bool insertInset(BufferView *, InsetOld *);
        ///
-       bool insetAllowed(Inset::Code code) const;
+       bool insetAllowed(InsetOld::Code code) const;
        ///
        bool isTextInset() const { return true; }
        /** returns true if, when outputing LaTeX, font changes should
@@ -121,22 +104,22 @@ public:
            insets that may contain several paragraphs */
        bool noFontChange() const { return true; }
        ///
-       bool display() const { return tabular->isLongTabular(); }
+       bool display() const { return tabular.isLongTabular(); }
        ///
        RESULT localDispatch(FuncRequest const &);
        ///
-       int latex(Buffer const *, std::ostream &,
+       int latex(Buffer const &, std::ostream &,
                  LatexRunParams const &) const;
        ///
-       int ascii(Buffer const *, std::ostream &, int linelen) const;
+       int ascii(Buffer const &, std::ostream &, int linelen) const;
        ///
-       int linuxdoc(Buffer const *, std::ostream &) const;
+       int linuxdoc(Buffer const &, std::ostream &) const;
        ///
-       int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+       int docbook(Buffer const &, std::ostream &, bool mixcont) const;
        ///
        void validate(LaTeXFeatures & features) const;
        ///
-       Inset::Code lyxCode() const { return Inset::TABULAR_CODE; }
+       InsetOld::Code lyxCode() const { return InsetOld::TABULAR_CODE; }
        /// FIXME, document
        void getCursorPos(BufferView *, int & x, int & y) const;
        /// Get the absolute document x,y of the cursor
@@ -152,27 +135,18 @@ public:
        void setFont(BufferView *, LyXFont const &, bool toggleall = false,
                     bool selectall = false);
        ///
-       int getMaxWidth(BufferView *, UpdatableInset const *) const;
-       ///
        LyXText * getLyXText(BufferView const *,
                             bool const recursive = false) const;
        ///
        void deleteLyXText(BufferView *, bool recursive = true) const;
        ///
-       void resizeLyXText(BufferView *, bool force = false) const;
-       ///
        void openLayoutDialog(BufferView *) const;
        ///
        bool showInsetDialog(BufferView *) const;
        ///
        FuncStatus getStatus(string const & argument) const;
        ///
-       std::vector<string> const getLabelList() const;
-       ///
-       void nodraw(bool b) const {
-               UpdatableInset::nodraw(b);
-       }
-       bool nodraw() const;
+       void getLabelList(std::vector<string> &) const;
        ///
        int scroll(bool recursive=true) const;
        ///
@@ -184,7 +158,7 @@ public:
                UpdatableInset::scroll(bv, offset);
        }
        ///
-       Inset * getInsetFromID(int id) const;
+       InsetOld * getInsetFromID(int id) const;
        ///
        ParagraphList * getParagraphs(int) const;
        ///
@@ -196,8 +170,6 @@ public:
        selectNextWordToSpellcheck(BufferView *, float & value) const;
        ///
        void selectSelectedWord(BufferView *);
-       ///
-       void toggleSelection(BufferView *, bool kill_selection);
 
        void markErased();
 
@@ -211,15 +183,15 @@ public:
 
        // this should return true if we have a "normal" cell, otherwise true.
        // "normal" means without width set!
-       bool forceDefaultParagraphs(Inset const * in) const;
+       bool forceDefaultParagraphs(InsetOld const * in) const;
 
        ///
-       void addPreview(grfx::PreviewLoader &) const;
+       void addPreview(lyx::graphics::PreviewLoader &) const;
 
        //
        // Public structures and variables
        ///
-       boost::scoped_ptr<LyXTabular> tabular;
+       mutable LyXTabular tabular;
 
        /// are some cells selected ?
        bool hasSelection() const {
@@ -228,6 +200,8 @@ public:
 
        ///
        virtual BufferView * view() const;
+       ///
+       Buffer const & buffer() const;
 
        /// set the owning buffer
        void buffer(Buffer * b);
@@ -244,7 +218,7 @@ private:
        ///
        void lfunMouseMotion(FuncRequest const &);
        ///
-       bool calculate_dimensions_of_cells(BufferView *, bool = false) const;
+       void calculate_dimensions_of_cells(MetricsInfo & mi) const;
        ///
        void drawCellLines(Painter &, int x, int baseline,
                           int row, int cell) const;
@@ -293,8 +267,6 @@ private:
        ///
        bool insetHit(BufferView * bv, int x, int y) const;
        ///
-       int getMaxWidthOfCell(BufferView * bv, int cell) const;
-       ///
        bool hasPasteBuffer() const;
        ///
        bool copySelection(BufferView *);
@@ -321,7 +293,9 @@ private:
        ///
        Buffer const * buffer_;
        ///
-       mutable LyXCursor cursor_;
+       mutable int cursorx_;
+       ///
+       mutable int cursory_;
        ///
        mutable unsigned int inset_x;
        ///
@@ -347,10 +321,6 @@ private:
        ///
        mutable bool locked;
        ///
-       mutable UpdateCodes need_update;
-       ///
-       bool in_update;
-       ///
        mutable int in_reset_pos;
 };
 
@@ -361,13 +331,13 @@ private:
 class InsetTabularMailer : public MailInset {
 public:
        ///
-       InsetTabularMailer(InsetTabular & inset);
+       InsetTabularMailer(InsetTabular const & inset);
        ///
        virtual InsetBase & inset() const { return inset_; }
        ///
        virtual string const & name() const { return name_; }
        ///
-       virtual string const inset2string() const;
+       virtual string const inset2string(Buffer const &) const;
        /// Returns the active cell if successful, else -1.
        static int string2params(string const &, InsetTabular &);
        ///