4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
30 /// Common base class to all insets
34 typedef ptrdiff_t difference_type;
35 /// short of anything else reasonable
36 typedef size_t size_type;
37 /// type for cell indices
38 typedef size_t idx_type;
39 /// type for cursor positions
40 typedef ptrdiff_t pos_type;
41 /// type for row numbers
42 typedef size_t row_type;
43 /// type for column numbers
44 typedef size_t col_type;
46 /// virtual base class destructor
47 virtual ~InsetBase() {}
48 /// replicate ourselves
49 virtual std::auto_ptr<InsetBase> clone() const = 0;
51 /// identification as math inset
52 virtual MathInset * asMathInset() { return 0; }
53 /// identification as non-math inset
54 virtual UpdatableInset * asUpdatableInset() { return 0; }
56 // the real dispatcher
57 DispatchResult dispatch(BufferView & bv, FuncRequest const & cmd);
60 virtual void edit(BufferView * bv, bool left);
62 virtual void edit(BufferView * bv, int x, int y);
64 /// compute the size of the object returned in dim
65 virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
66 /// draw inset and update (xo, yo)-cache
67 virtual void draw(PainterInfo & pi, int x, int y) const = 0;
69 /// request "external features"
70 virtual void validate(LaTeXFeatures &) const {}
71 /// Appends \c list with all labels found within this inset.
72 virtual void getLabelList(Buffer const &,
73 std::vector<std::string> & /* list */) const {}
74 /// last drawn position for 'important' insets
75 virtual int x() const { return 0; }
76 /// last drawn position for 'important' insets
77 virtual int y() const { return 0; }
79 /// number of embedded cells
80 virtual size_t nargs() const { return 0; }
81 /// number of rows in gridlike structures
82 virtual size_t nrows() const { return 0; }
83 /// number of columns in gridlike structures
84 virtual size_t ncols() const { return 0; }
86 // the real dispatcher
88 DispatchResult priv_dispatch(BufferView & bv, FuncRequest const & cmd);