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.
15 #include "cursor_slice.h"
29 * The cursor class describes the position of a cursor within a document.
34 /// type for cell number in inset
35 typedef CursorSlice::idx_type idx_type;
36 /// type for paragraph numbers positions within a cell
37 typedef CursorSlice::par_type par_type;
38 /// type for cursor positions within a cell
39 typedef CursorSlice::pos_type pos_type;
41 /// create 'empty' cursor. REMOVE ME
43 /// create 'empty' cursor
44 explicit LCursor(BufferView & bv);
45 /// dispatch from innermost inset upwards
46 DispatchResult dispatch(FuncRequest const & cmd);
48 void push(InsetBase * inset);
49 /// restrict cursor nesting to given size
51 /// pop one level off the cursor
53 /// access to cursor 'tip'
54 CursorSlice & top() { return cursor_.back(); }
55 /// access to cursor 'tip'
56 CursorSlice const & top() const { return cursor_.back(); }
58 /// set the cell the cursor is in
60 /// return the cell this cursor is in
63 UpdatableInset * innerInset() const;
65 UpdatableInset * innerInsetOfType(int code) const;
67 InsetTabular * innerInsetTabular() const;
69 LyXText * innerText() const;
70 /// returns x,y position
71 void getPos(int & x, int & y) const;
72 /// returns cursor dimension
73 void getDim(int & asc, int & desc) const;
74 /// cache the absolute coordinate from the top inset
76 /// sets anchor to cursor position
78 /// sets anchor to cursor position
79 BufferView & bv() const;
81 friend std::ostream & operator<<(std::ostream &, LCursor const &);
83 /// mainly used as stack, but wee need random access
84 std::vector<CursorSlice> cursor_;
86 std::vector<CursorSlice> anchor_;