]> git.lyx.org Git - lyx.git/blobdiff - src/insets/Inset.h
pimpl not needed here
[lyx.git] / src / insets / Inset.h
index 6179e119905e2f4f929d5346a34293caab34d84f..c38e44e67ddb88d39a532d8b3324cdde18652bc1 100644 (file)
 #ifndef INSETBASE_H
 #define INSETBASE_H
 
+#include "ColorCode.h"
 #include "InsetCode.h"
 
-#include "Dimension.h"
+#include "support/strfwd.h"
 
-#include "support/docstream.h"
-
-#include <memory>
 #include <vector>
 
 namespace lyx {
@@ -31,13 +29,15 @@ class Buffer;
 class BufferParams;
 class BufferView;
 class Change;
-class Color_color;
 class Cursor;
 class CursorSlice;
+class Dimension;
 class FuncRequest;
 class FuncStatus;
 class InsetIterator;
+class InsetCollapsable;
 class InsetLayout;
+class InsetList;
 class InsetMath;
 class InsetText;
 class LaTeXFeatures;
@@ -46,7 +46,6 @@ class MathAtom;
 class MetricsInfo;
 class OutputParams;
 class PainterInfo;
-class Paragraph;
 class ParConstIterator;
 class ParIterator;
 class Text;
@@ -90,6 +89,10 @@ public:
        virtual InsetText * asTextInset() { return 0; }
        /// is this inset based on the TextInset class?
        virtual InsetText const * asTextInset() const { return 0; }
+       /// is this inset based on the InsetCollapsable class?
+       virtual InsetCollapsable * asInsetCollapsable() { return 0; }
+       /// is this inset based on the InsetCollapsable class?
+       virtual InsetCollapsable const * asInsetCollapsable() const { return 0; }
        
        /// the real dispatcher
        void dispatch(Cursor & cur, FuncRequest & cmd);
@@ -157,6 +160,11 @@ public:
        virtual void cursorPos(BufferView const & bv,
                CursorSlice const & sl, bool boundary, int & x, int & y) const;
 
+       ///
+       virtual bool isFreeSpacing() const { return false; }
+       ///
+       virtual bool allowEmpty() const { return false; }
+
        /// is this an inset that can be moved into?
        /// FIXME: merge with editable()
        virtual bool isActive() const { return nargs() > 0; }
@@ -243,7 +251,7 @@ public:
        /** This enum indicates by which means the inset can be modified:
        - NOT_EDITABLE: the inset's content cannot be modified at all
          (e.g. printindex, insetspecialchar)
-       - IS_EDITABLE: content can be edited via dialog (e.g. bibtex, index, url)
+       - IS_EDITABLE: content can be edited via dialog (e.g. bibtex, index, href)
        - HIGHLY_EDITABLE: content can be edited on screen (normally means that
          insettext is contained, e.g. collapsables, tabular) */
        // FIXME: This has not yet been fully implemented to math insets
@@ -275,7 +283,7 @@ public:
        virtual bool hasFixedWidth() const { return false; }
 
        ///
-       virtual docstring name() const { return from_ascii("unknown"); }
+       virtual docstring name() const;
        ///
        virtual InsetLayout const & getLayout(BufferParams const & bp) const;
        /// used to toggle insets
@@ -334,12 +342,12 @@ public:
        /// pit is the ParConstIterator of the paragraph containing the inset
        virtual void addToToc(TocList &, Buffer const &, ParConstIterator const &) const {}
        /// report files that can be embedded with the lyx file
-       virtual void registerEmbeddedFiles(Buffer const &, EmbeddedFiles &) const {};
+       virtual void registerEmbeddedFiles(Buffer const &, EmbeddedFiles &) const {}
        /// use embedded or external file after the embedding status of a file is changed
        virtual void updateEmbeddedFile(Buffer const &, EmbeddedFile const &) {}
        /// Fill keys with BibTeX information
        virtual void fillWithBibKeys(Buffer const &,
-               BiblioInfo &, InsetIterator const &) const { return; }
+               BiblioInfo &, InsetIterator const &) const {}
        /// Update the counters of this inset and of its contents
        virtual void updateLabels(Buffer const &, ParIterator const &) {}
 
@@ -376,7 +384,7 @@ public:
        ///
        int scroll() const { return 0; }
        ///
-       virtual Color_color backgroundColor() const;
+       virtual ColorCode backgroundColor() const;
        ///
        enum CollapseStatus {
                Collapsed,
@@ -388,10 +396,10 @@ public:
        enum { TEXT_TO_INSET_OFFSET = 4 };
 
 protected:
-       Inset();
+       Inset() {}
 
        /// replicate ourselves
-       friend class Paragraph;
+       friend class InsetList;
        friend class MathAtom;
        virtual Inset * clone() const = 0;
 
@@ -409,21 +417,6 @@ protected:
        virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
 };
 
-
-/**
- * returns true if pointer argument is valid
- * and points to an editable inset
- */
-bool isEditableInset(Inset const * inset);
-
-
-/**
- * returns true if pointer argument is valid
- * and points to a highly editable inset
- */
-bool isHighlyEditableInset(Inset const * inset);
-
-
 } // namespace lyx
 
 #endif