]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetText.h
This should be the last of the commits refactoring the InsetLayout code.
[lyx.git] / src / insets / InsetText.h
index 6ffdead4d3bbd07904f01342439d0f998c2c84da..ccb7301474e953025e62e096d8528bcb35f96388 100644 (file)
 #define INSETTEXT_H
 
 #include "Inset.h"
-#include "Font.h"
+
+#include "ColorCode.h"
 #include "Text.h"
 
 #include "support/types.h"
 
-#include "frontends/mouse_state.h"
-
-
 namespace lyx {
 
 class Buffer;
@@ -28,8 +26,8 @@ class BufferParams;
 class BufferView;
 class CursorSlice;
 class Dimension;
-class Color_color;
 class ParagraphList;
+class InsetTabular;
 
 
 /**
@@ -42,6 +40,11 @@ public:
        explicit InsetText(BufferParams const &);
        ///
        InsetText();
+       ///
+       InsetText(InsetText const &);
+
+       ///
+       Dimension const dimension(BufferView const &) const;
 
        /// empty inset to empty par
        void clear();
@@ -50,13 +53,9 @@ public:
        ///
        void write(Buffer const & buf, std::ostream & os) const;
        ///
-       bool metrics(MetricsInfo & mi, Dimension & dim) const;
+       void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
        void draw(PainterInfo & pi, int x, int y) const;
-       /// draw inset selection
-       void drawSelection(PainterInfo & pi, int x, int y) const;
-       /// are we inside the area covered by the inset?
-       virtual bool covers(BufferView const & bv, int x, int y) const;
        ///
        virtual docstring const editMessage() const;
        ///
@@ -64,9 +63,9 @@ public:
        ///
        bool canTrackChanges() const { return true; }
        ///
-       InsetText * asTextInset() { return this; }
+       InsetText * asInsetText() { return this; }
        ///
-       InsetText const * asTextInset() const { return this; }
+       InsetText const * asInsetText() const { return this; }
        ///
        int latex(Buffer const &, odocstream &, OutputParams const &) const;
        ///
@@ -80,7 +79,7 @@ public:
        void cursorPos(BufferView const & bv, CursorSlice const & sl,
                bool boundary, int & x, int & y) const;
        ///
-       Code lyxCode() const { return TEXT_CODE; }
+       InsetCode lyxCode() const { return TEXT_CODE; }
        ///
        void setText(docstring const &, Font const &, bool trackChanges);
        ///
@@ -90,9 +89,9 @@ public:
        ///
        void setDrawFrame(bool);
        ///
-       Color_color frameColor() const;
+       ColorCode frameColor() const;
        ///
-       void setFrameColor(Color_color);
+       void setFrameColor(ColorCode);
        ///
        bool showInsetDialog(BufferView *) const;
        ///
@@ -116,7 +115,7 @@ public:
        void addPreview(graphics::PreviewLoader &) const;
 
        ///
-       void edit(Cursor & cur, bool left);
+       void edit(Cursor & cur, bool front, EntryDirection entry_from);
        ///
        Inset * editXY(Cursor & cur, int x, int y);
 
@@ -127,17 +126,37 @@ public:
        ///
        ParagraphList const & paragraphs() const;
        ///
-       bool insetAllowed(Code) const { return true; }
+       bool insetAllowed(InsetCode) const { return true; }
        ///
        bool allowSpellCheck() const { return true; }
        /// should paragraph indendation be ommitted in any case?
        bool neverIndent(Buffer const &) const;
        ///
-       InsetText(InsetText const &);
+       virtual bool isMacroScope(Buffer const &) const { return true; }
        ///
-       virtual bool wide() const { return wide_inset_; }
+       virtual bool allowMultiPar() const { return true; }
+
+       // Update the counters of this inset and of its contents
+       virtual void updateLabels(Buffer const &, ParIterator const &);
        ///
-       void setWide(bool wide_inset) { wide_inset_ = wide_inset; }
+       virtual Inset * clone() const;
+
+       ///
+       bool completionSupported(Cursor const &) const;
+       ///
+       bool inlineCompletionSupported(Cursor const & cur) const;
+       ///
+       bool automaticInlineCompletion() const;
+       ///
+       bool automaticPopupCompletion() const;
+       ///
+       CompletionList const * completionList(Cursor const & cur) const;
+       ///
+       docstring completionPrefix(Cursor const & cur) const;
+       ///
+       bool insertCompletion(Cursor & cur, docstring const & s, bool finished);
+       ///
+       void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const;
 
 protected:
        ///
@@ -145,28 +164,19 @@ protected:
 
 private:
        ///
-       virtual std::auto_ptr<Inset> doClone() const;
-       ///
-       void init();
-
+       void setParagraphOwner();
        ///
        bool drawFrame_;
-       /** We store the Color::color value as an int to get Color.h out
-        *  of the header file.
-        */
-       int frame_color_;
+       ///
+       ColorCode frame_color_;
        ///
        mutable pit_type old_pit;
        ///
-       bool wide_inset_;
+       docstring previousWord(Buffer const & buffer, CursorSlice const & sl) const;
 
 public:
        ///
        mutable Text text_;
-       ///
-       mutable Font font_;
-       ///
-       static int border_;
 };
 
 } // namespace lyx