]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetText.h
* src/paragraph_funcs.cpp (breakParagraph): change parameter 'flag' to
[lyx.git] / src / insets / InsetText.h
index cac2851396bf56e57e04807eebfc08270282a2fe..673faf6a1b54f172cb0172fd49ff7884a3d781ef 100644 (file)
 #define INSETTEXT_H
 
 #include "Inset.h"
-#include "RowList_fwd.h"
-#include "LyXFont.h"
-#include "LyXText.h"
+#include "Font.h"
+#include "Text.h"
 
 #include "support/types.h"
 
-#include "frontends/mouse_state.h"
-
-
 namespace lyx {
 
 class Buffer;
@@ -29,21 +25,25 @@ class BufferParams;
 class BufferView;
 class CursorSlice;
 class Dimension;
-class LColor_color;
+class Color_color;
 class ParagraphList;
+class InsetTabular;
 
 
 /**
  A text inset is like a TeX box to write full text
  (including styles and other insets) in a given space.
  */
-class InsetText : public InsetOld {
+class InsetText : public Inset {
 public:
        ///
        explicit InsetText(BufferParams const &);
        ///
        InsetText();
 
+       ///
+       Dimension const dimension(BufferView const &) const;
+
        /// empty inset to empty par
        void clear();
        ///
@@ -51,13 +51,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;
        ///
@@ -65,6 +61,8 @@ public:
        ///
        bool canTrackChanges() const { return true; }
        ///
+       InsetText * asTextInset() { return this; }
+       ///
        InsetText const * asTextInset() const { return this; }
        ///
        int latex(Buffer const &, odocstream &, OutputParams const &) const;
@@ -81,7 +79,7 @@ public:
        ///
        Code lyxCode() const { return TEXT_CODE; }
        ///
-       void setText(docstring const &, LyXFont const &, bool trackChanges);
+       void setText(docstring const &, Font const &, bool trackChanges);
        ///
        void setAutoBreakRows(bool);
        ///
@@ -89,14 +87,14 @@ public:
        ///
        void setDrawFrame(bool);
        ///
-       LColor_color frameColor() const;
+       Color_color frameColor() const;
        ///
-       void setFrameColor(LColor_color);
+       void setFrameColor(Color_color);
        ///
        bool showInsetDialog(BufferView *) const;
        ///
-       LyXText * getText(int i) const {
-               return (i == 0) ? const_cast<LyXText*>(&text_) : 0;
+       Text * getText(int i) const {
+               return (i == 0) ? const_cast<Text*>(&text_) : 0;
        }
        ///
        virtual bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
@@ -117,7 +115,7 @@ public:
        ///
        void edit(Cursor & cur, bool left);
        ///
-       InsetBase * editXY(Cursor & cur, int x, int y);
+       Inset * editXY(Cursor & cur, int x, int y);
 
        /// number of cells in this inset
        size_t nargs() const { return 1; }
@@ -133,38 +131,32 @@ public:
        bool neverIndent(Buffer const &) const;
        ///
        InsetText(InsetText const &);
+
+       // Update the counters of this inset and of its contents
+       virtual void updateLabels(Buffer const &, ParIterator const &);
        ///
-       virtual bool wide() const { return wide_inset_; }
-       ///
-       void setWide(bool wide_inset) { wide_inset_ = wide_inset; }
+       virtual Inset * clone() const;
 
 protected:
        ///
        virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
 
 private:
-       ///
-       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        void init();
 
        ///
        bool drawFrame_;
-       /** We store the LColor::color value as an int to get LColor.h out
+       /** We store the Color::color value as an int to get Color.h out
         *  of the header file.
         */
        int frame_color_;
        ///
        mutable pit_type old_pit;
-       ///
-       bool wide_inset_;
+
 public:
        ///
-       mutable LyXText text_;
-       ///
-       mutable LyXFont font_;
-       ///
-       static int border_;
+       mutable Text text_;
 };
 
 } // namespace lyx