]> git.lyx.org Git - lyx.git/blobdiff - src/insets/Inset.h
* src/paragraph_funcs.cpp (breakParagraph): change parameter 'flag' to
[lyx.git] / src / insets / Inset.h
index bae6669ee6a44406e3371ebc90471bde1195d4c6..2090a7e369ae0600a21f1c6d79a28c4d20f5a5e6 100644 (file)
@@ -15,7 +15,6 @@
 #ifndef INSETBASE_H
 #define INSETBASE_H
 
-#include "Changes.h"
 #include "Dimension.h"
 
 #include "support/docstream.h"
 
 namespace lyx {
 
+class BiblioInfo;
 class Buffer;
 class BufferParams;
 class BufferView;
-class ParIterator;
-class ParConstIterator;
+class Change;
+class Color_color;
+class Cursor;
 class CursorSlice;
-class InsetIterator;
 class FuncRequest;
 class FuncStatus;
+class InsetIterator;
 class InsetLayout;
 class InsetMath;
 class InsetText;
 class LaTeXFeatures;
-class Color_color;
-class Cursor;
 class Lexer;
-class Text;
+class MathAtom;
 class MetricsInfo;
-class Dimension;
-class PainterInfo;
 class OutputParams;
+class PainterInfo;
+class Paragraph;
+class ParConstIterator;
+class ParIterator;
+class Text;
 class TocList;
+class EmbeddedFile;
+class EmbeddedFiles;
 
 
 namespace graphics { class PreviewLoader; }
@@ -75,8 +79,6 @@ public:
 
        /// virtual base class destructor
        virtual ~Inset() {}
-       /// replicate ourselves
-       std::auto_ptr<Inset> clone() const;
 
        /// identification as math inset
        virtual InsetMath * asInsetMath() { return 0; }
@@ -118,7 +120,7 @@ public:
 
        /// compute the size of the object returned in dim
        /// \retval true if metrics changed.
-       virtual bool metrics(MetricsInfo & mi, Dimension & dim) const = 0;
+       virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
        /// draw inset and update (xo, yo)-cache
        virtual void draw(PainterInfo & pi, int x, int y) const = 0;
        /// draw inset selection if necessary
@@ -145,6 +147,8 @@ public:
        int yo(BufferView const & bv) const;
        /// set x/y drawing position cache if available
        virtual void setPosCache(PainterInfo const &, int, int) const;
+       ///
+       void setDimCache(MetricsInfo const &, Dimension const &) const;
        /// do we cover screen position x/y?
        virtual bool covers(BufferView const & bv, int x, int y) const;
        /// get the screen positions of the cursor (see note in Cursor.cpp)
@@ -351,7 +355,7 @@ public:
                ///
                BOX_CODE,
                ///
-               CHARSTYLE_CODE,
+               FLEX_CODE,
                ///
                VSPACE_CODE,
                ///
@@ -438,10 +442,13 @@ public:
        /// Add an entry to the TocList
        /// 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 {};
+       /// 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 &,
-               std::vector<std::pair<std::string, docstring> > &,
-               InsetIterator const &) const { return; }
+               BiblioInfo &, InsetIterator const &) const { return; }
        /// Update the counters of this inset and of its contents
        virtual void updateLabels(Buffer const &, ParIterator const &) {}
 
@@ -473,12 +480,8 @@ public:
        /// reject the changes within the inset
        virtual void rejectChanges(BufferParams const &) {};
 
-       /// inset width.
-       int width() const { return dim_.wid; }
-       /// inset ascent.
-       int ascent() const { return dim_.asc; }
-       /// inset descent.
-       int descent() const { return dim_.des; }
+       ///
+       virtual Dimension const dimension(BufferView const &) const;
        ///
        int scroll() const { return 0; }
        ///
@@ -486,7 +489,6 @@ public:
        ///
        enum CollapseStatus {
                Collapsed,
-               Inlined,
                Open
        };
        ///
@@ -497,6 +499,11 @@ public:
 protected:
        Inset();
 
+       /// replicate ourselves
+       friend class Paragraph;
+       friend class MathAtom;
+       virtual Inset * clone() const = 0;
+
        /** The real dispatcher.
         *  Gets normally called from Cursor::dispatch(). Cursor::dispatch()
         *  assumes the common case of 'LFUN handled, need update'.
@@ -509,11 +516,6 @@ protected:
         *  \sa getStatus
         */
        virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
-
-       /// Cached dimensions of the inset.
-       mutable Dimension dim_;
-private:
-       virtual std::auto_ptr<Inset> doClone() const = 0;
 };