]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettabular.h
remove Inset::deletable() as it returns always 'true'
[lyx.git] / src / insets / insettabular.h
index 40c2b0736077615c56a2073c1d762a91a9b61ab8..99da476657885f3b937fe8aa95e679cfdd46a7a0 100644 (file)
@@ -1,12 +1,12 @@
 // -*- C++ -*-
-/* This file is part of
- * ======================================================
- * 
- *           LyX, The Document Processor
+/**
+ * \file insettabular.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           Copyright 1995-2001 The LyX Team.
+ * \author Jürgen Vigna
  *
- *======================================================
+ * Full author contact details are available in file CREDITS
  */
 // This is the rewrite of the tabular (table) support.
 
 #ifndef INSETTABULAR_H
 #define INSETTABULAR_H
 
-#include <sigc++/signal_system.h>
-#include <boost/smart_ptr.hpp>
-
-#ifdef __GNUG__
-#pragma interface
-#endif
 
 #include "inset.h"
 #include "tabular.h"
 #include "LString.h"
 #include "lyxcursor.h"
-#include "func_status.h"
+#include "FuncStatus.h"
+
+#include <boost/scoped_ptr.hpp>
+
+#include <boost/signals/signal0.hpp>
 
 class LyXLex;
 class Painter;
 class BufferView;
 class Buffer;
+class BufferParams;
 class Paragraph;
 
 class InsetTabular : public UpdatableInset {
@@ -100,7 +99,7 @@ public:
        ///
        string const editMessage() const;
        ///
-       void edit(BufferView *, int x, int y, unsigned int);
+       void edit(BufferView *, int x, int y, mouse_button::state);
        ///
        void edit(BufferView * bv, bool front = true);
        ///
@@ -117,7 +116,7 @@ public:
        ///
        bool updateInsetInInset(BufferView *, Inset *);
        ///
-       unsigned int insetInInsetY();
+       int insetInInsetY() const;
        ///
        UpdatableInset * getLockingInset() const;
        ///
@@ -128,19 +127,14 @@ public:
        bool insetAllowed(Inset::Code code) const;
        ///
        bool isTextInset() const { return true; }
+       /** returns true if, when outputing LaTeX, font changes should
+           be closed before generating this inset. This is needed for
+           insets that may contain several paragraphs */
+       bool noFontChange() const { return true; }
        ///
        bool display() const { return tabular->IsLongTabular(); }
        ///
-       void insetButtonRelease(BufferView *, int, int, int);
-       ///
-       void insetButtonPress(BufferView *, int, int, int);
-       ///
-       void insetMotionNotify(BufferView *, int, int, int);
-       ///
-       void insetKeyPress(XKeyEvent *);
-       ///
-       UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
-                                            string const &);
+       RESULT localDispatch(FuncRequest const &);
        ///
        int latex(Buffer const *, std::ostream &, bool, bool) const;
        ///
@@ -148,7 +142,7 @@ public:
        ///
        int linuxdoc(Buffer const *, std::ostream &) const;
        ///
-       int docBook(Buffer const *, std::ostream &) const;
+       int docbook(Buffer const *, std::ostream &, bool mixcont) const;
        ///
        void validate(LaTeXFeatures & features) const;
        ///
@@ -166,7 +160,7 @@ public:
        int getActCell() const { return actcell; }
        ///
        void setFont(BufferView *, LyXFont const &, bool toggleall = false,
-                    bool selectall = false);
+                    bool selectall = false);
        ///
        int getMaxWidth(BufferView *, UpdatableInset const *) const;
        ///
@@ -183,7 +177,7 @@ public:
        ///
        bool showInsetDialog(BufferView *) const;
        ///
-       func_status::value_type getStatus(string const & argument) const;
+       FuncStatus getStatus(string const & argument) const;
        ///
        std::vector<string> const getLabelList() const;
        ///
@@ -202,8 +196,6 @@ public:
                UpdatableInset::scroll(bv, offset);
        }
        ///
-       Paragraph * getParFromID(int id) const;
-       ///
        Inset * getInsetFromID(int id) const;
        ///
        Paragraph * firstParagraph() const;
@@ -212,23 +204,54 @@ public:
        ///
        LyXCursor const & cursor(BufferView *) const;
        ///
-       string const selectNextWord(BufferView *, float & value) const;
+       bool allowSpellcheck() const { return true; }
+       ///
+       WordLangTuple const
+       selectNextWordToSpellcheck(BufferView *, float & value) const;
+       ///
        void selectSelectedWord(BufferView *);
+       ///
        void toggleSelection(BufferView *, bool kill_selection);
+
+       void markErased();
+
+       /// find next change
+       bool nextChange(BufferView *, lyx::pos_type & length);
        ///
        bool searchForward(BufferView *, string const &,
-                          bool const & = true, bool const & = false);
+                          bool = true, bool = false);
        bool searchBackward(BufferView *, string const &,
-                           bool const & = true, bool const & = false);
+                           bool = true, bool = false);
+
+       // this should return true if we have a "normal" cell, otherwise true.
+       // "normal" means without width set!
+       bool forceDefaultParagraphs(Inset const * in) const;
+
+       ///
+       void addPreview(grfx::PreviewLoader &) const;
 
        //
        // Public structures and variables
        ///
        boost::scoped_ptr<LyXTabular> tabular;
        ///
-       SigC::Signal0<void> hideDialog;
+       boost::signal0<void> hideDialog;
 
+       /// are some cells selected ?
+       bool hasSelection() const {
+               return has_selection;
+       }
 private:
+       ///
+       void lfunMousePress(FuncRequest const &);
+       ///
+       // the bool return is used to see if we opened a dialog so that we can
+       // check this from an outer inset and open the dialog of the outer inset
+       // if that one has one!
+       ///
+       bool lfunMouseRelease(FuncRequest const &);
+       ///
+       void lfunMouseMotion(FuncRequest const &);
        ///
        bool calculate_dimensions_of_cells(BufferView *, LyXFont const &,
                                           bool = false) const;
@@ -247,40 +270,40 @@ private:
        ///
        void setPos(BufferView *, int x, int y) const;
        ///
-       UpdatableInset::RESULT moveRight(BufferView *, bool lock = true);
+       RESULT moveRight(BufferView *, bool lock = true);
        ///
-       UpdatableInset::RESULT moveLeft(BufferView *, bool lock = true);
+       RESULT moveLeft(BufferView *, bool lock = true);
        ///
-       UpdatableInset::RESULT moveUp(BufferView *, bool lock = true);
+       RESULT moveUp(BufferView *, bool lock = true);
        ///
-       UpdatableInset::RESULT moveDown(BufferView *, bool lock = true);
+       RESULT moveDown(BufferView *, bool lock = true);
        ///
        bool moveNextCell(BufferView *, bool lock = false);
        ///
        bool movePrevCell(BufferView *, bool lock = false);
        ///
-       bool deletable();
-       ///
        int getCellXPos(int cell) const;
        ///
        void resetPos(BufferView *) const;
        ///
        void removeTabularRow();
        ///
-       bool hasSelection() const {
-               return sel_cell_start != sel_cell_end;
-       }
-       ///
        void clearSelection() const {
-       sel_cell_start = sel_cell_end = 0;
+               sel_cell_start = sel_cell_end = 0;
+               has_selection = false;
+       }
+       void setSelection(int start, int end) const {
+               sel_cell_start = start;
+               sel_cell_end = end;
+               has_selection = true;
        }
        ///
        bool activateCellInset(BufferView *, int x = 0, int y = 0,
-                              int button = 0,
+                              mouse_button::state button = mouse_button::none,
                               bool behind = false);
        ///
        bool activateCellInsetAbs(BufferView *, int x = 0, int y = 0,
-                                 int button = 0);
+                                 mouse_button::state button = mouse_button::none);
        ///
        bool insetHit(BufferView * bv, int x, int y) const;
        ///
@@ -292,14 +315,16 @@ private:
        ///
        bool pasteSelection(BufferView *);
        ///
-       bool cutSelection();
+       bool cutSelection(BufferParams const & bp);
        ///
        bool isRightToLeft(BufferView *);
        ///
        void getSelection(int & scol, int & ecol,
                          int & srow, int & erow) const;
        ///
-       string selectNextWordInt(BufferView *, float & value) const;
+       WordLangTuple selectNextWordInt(BufferView *, float & value) const;
+       ///
+       bool insertAsciiString(BufferView *, string const & buf, bool usePaste);
 
        //
        // Private structures and variables
@@ -315,9 +340,11 @@ private:
        mutable unsigned int inset_x;
        ///
        mutable unsigned int inset_y;
-       ///
+       /// true if a set of cells are selected
+       mutable bool has_selection;
+       /// the starting cell selection nr
        mutable int sel_cell_start;
-       ///
+       /// the ending cell selection nr
        mutable int sel_cell_end;
        ///
        mutable int actcell;
@@ -337,5 +364,7 @@ private:
        mutable UpdateCodes need_update;
        ///
        bool in_update;
+       ///
+       mutable int in_reset_pos;
 };
 #endif