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 "textcursor.h"
17 #include "support/types.h"
31 * The cursor class describes the position of a cursor within a document.
37 CursorItem() : inset_(0), par_(0), pos_(0) {}
39 explicit CursorItem(UpdatableInset * inset)
40 : inset_(inset), par_(0), pos_(0)
43 LyXText * text() const;
45 friend std::ostream & operator<<(std::ostream &, CursorItem const &);
48 UpdatableInset * inset_;
58 /// create 'empty' cursor
59 explicit LCursor(BufferView * bv);
60 /// dispatch from innermost inset upwards
61 DispatchResult dispatch(FuncRequest const & cmd);
63 void push(UpdatableInset * inset);
64 /// restrict cursor nesting to given size
66 /// pop one level off the cursor
69 UpdatableInset * innerInset() const;
71 UpdatableInset * innerInsetOfType(int code) const;
73 InsetTabular * innerInsetTabular() const;
75 LyXText * innerText() const;
76 /// returns x,y position
77 void getPos(int & x, int & y) const;
78 /// returns cursor dimension
79 void getDim(int & asc, int & desc) const;
80 /// cache the absolute coordinate from the top inset
83 friend std::ostream & operator<<(std::ostream &, LCursor const &);
85 /// mainly used as stack, but wee need random access
86 std::vector<CursorItem> data_;