]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbase.h
Clean up InsetGraphics::Cache and rename as GraphicsInset.
[lyx.git] / src / insets / insetbase.h
index 79933fcc62d3598fa7219354cfa260c5e45d58e2..51ba1a981a674fb68b9c1c8360d600079b1401d3 100644 (file)
 
 #include <vector>
 
+class BufferView;
 class FuncRequest;
+class MetricsInfo;
+class Dimension;
+class PainterInfo;
+class LaTeXFeatures;
 
 /** Dispatch result codes
                DISPATCHED          = the inset catched the action
@@ -46,14 +51,18 @@ enum dispatch_result {
 /// Common base class to all insets
 class InsetBase {
 public:
+       ///
+       typedef int      difference_type;
+       /// short of anything else reasonable
+       typedef size_t   size_type;
        /// type for cell indices
-       typedef size_t                   idx_type;
+       typedef size_t  idx_type;
        /// type for cursor positions
-       typedef size_t                   pos_type;
+       typedef size_t  pos_type;
        /// type for row numbers
-       typedef size_t                   row_type;
+       typedef size_t  row_type;
        /// type for column numbers
-       typedef size_t                   col_type;
+       typedef size_t  col_type;
 
        // the real dispatcher
        virtual dispatch_result dispatch
@@ -61,9 +70,20 @@ public:
 
        /// small wrapper for the time being
        virtual dispatch_result localDispatch(FuncRequest const & cmd);
+       /// compute the size of the object returned in dim
+       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;
 
        ///
        virtual ~InsetBase() {}
+
+       /// Methods to cache and retrieve a cached BufferView.
+       virtual void cache(BufferView *) const {}
+       ///
+       virtual BufferView * view() const { return 0; }
+       /// request "external features"
+       virtual void validate(LaTeXFeatures &) const {}
 };
 
 #endif