]> git.lyx.org Git - features.git/blobdiff - src/insets/insetbase.h
Part of IU.
[features.git] / src / insets / insetbase.h
index 771ff610fa74110866f610ecb4154a4f6a8557c9..0702a5f85eec2f177bdb3bd023f49f58cbfff858 100644 (file)
@@ -21,6 +21,7 @@ class BufferView;
 class DispatchResult;
 class FuncRequest;
 class LaTeXFeatures;
+class LCursor;
 class MathInset;
 class MetricsInfo;
 class Dimension;
@@ -54,23 +55,17 @@ public:
        virtual UpdatableInset * asUpdatableInset() { return 0; }
 
        // the real dispatcher
-       DispatchResult dispatch(BufferView & bv, FuncRequest const & cmd);
+       DispatchResult dispatch(LCursor & cur, FuncRequest const & cmd);
 
        /// cursor enters
-       virtual void edit(BufferView * bv, bool left);
+       virtual void edit(LCursor & cur, bool left);
        /// cursor enters
-       virtual void edit(BufferView * bv, int x, int y);
+       virtual void edit(LCursor & cur, int x, int y);
 
        /// 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;
-
-       /// request "external features"
-       virtual void validate(LaTeXFeatures &) const {}
-       /// Appends \c list with all labels found within this inset.
-       virtual void getLabelList(Buffer const &,
-                                 std::vector<std::string> & /* list */) const {}
        /// last drawn position for 'important' insets
        virtual int x() const { return 0; }
        /// last drawn position for 'important' insets
@@ -82,10 +77,125 @@ public:
        virtual size_t nrows() const { return 0; }
        /// number of columns in gridlike structures
        virtual size_t ncols() const { return 0; }
+
+       /// request "external features"
+       virtual void validate(LaTeXFeatures &) const {}
+       /// Appends \c list with all labels found within this inset.
+       virtual void getLabelList(Buffer const &,
+                                 std::vector<std::string> & /* list */) const {}
+       /// describe content if cursor inside
+       virtual void infoize(std::ostream &) const {}
+       /// describe content if cursor behind
+       virtual void infoize2(std::ostream &) const {}
 protected:
        // the real dispatcher
        virtual
-       DispatchResult priv_dispatch(BufferView & bv, FuncRequest const & cmd);
+       DispatchResult priv_dispatch(LCursor & cur, FuncRequest const & cmd);
+public:
+       /** This is not quite the correct place for this enum. I think
+           the correct would be to let each subclass of Inset declare
+           its own enum code. Actually the notion of an InsetOld::Code
+           should be avoided, but I am not sure how this could be done
+           in a cleaner way. */
+       enum Code {
+               ///
+               NO_CODE, // 0
+               ///
+               TOC_CODE,  // do these insets really need a code? (ale)
+               ///
+               QUOTE_CODE,
+               ///
+               MARK_CODE,
+               ///
+               REF_CODE,
+               ///
+               URL_CODE, // 5
+               ///
+               HTMLURL_CODE,
+               ///
+               SEPARATOR_CODE,
+               ///
+               ENDING_CODE,
+               ///
+               LABEL_CODE,
+               ///
+               NOTE_CODE, // 10
+               ///
+               ACCENT_CODE,
+               ///
+               MATH_CODE,
+               ///
+               INDEX_CODE,
+               ///
+               INCLUDE_CODE,
+               ///
+               GRAPHICS_CODE, // 15
+               ///
+               BIBITEM_CODE,
+               ///
+               BIBTEX_CODE,
+               ///
+               TEXT_CODE,
+               ///
+               ERT_CODE,
+               ///
+               FOOT_CODE, // 20
+               ///
+               MARGIN_CODE,
+               ///
+               FLOAT_CODE,
+               ///
+               WRAP_CODE,
+               ///
+               SPACE_CODE, // 25
+               ///
+               SPECIALCHAR_CODE,
+               ///
+               TABULAR_CODE,
+               ///
+               EXTERNAL_CODE,
+#if 0
+               ///
+               THEOREM_CODE,
+#endif
+               ///
+               CAPTION_CODE,
+               ///
+               MATHMACRO_CODE, // 30
+               ///
+               ERROR_CODE,
+               ///
+               CITE_CODE,
+               ///
+               FLOAT_LIST_CODE,
+               ///
+               INDEX_PRINT_CODE,
+               ///
+               OPTARG_CODE, // 35
+               ///
+               ENVIRONMENT_CODE,
+               ///
+               HFILL_CODE,
+               ///
+               NEWLINE_CODE,
+               ///
+               LINE_CODE,
+               ///
+               BRANCH_CODE, // 40
+               ///
+               BOX_CODE,
+               ///
+               CHARSTYLE_CODE,
+               ///
+               VSPACE_CODE,
+               ///
+               MATHGRID_CODE,
+               ///
+               MATHHULL_CODE
+       };
+       /// returns LyX code associated with the inset. Used for TOC, ...)
+       virtual InsetBase::Code lyxCode() const { return NO_CODE; }
+
 };
 
 #endif