4 * Copyright 1995-2001 the LyX Team
5 * Read the file COPYING
7 * \author Matthias Ettrich
14 #include "ParagraphList.h"
15 #include "support/types.h"
18 * The cursor class describes the position of a cursor within a document.
19 * Several cursors exist within LyX; for example, when locking an inset,
20 * the position of the cursor in the containing inset is stored.
27 /// set the paragraph that contains this cursor
28 void par(ParagraphList::iterator pit);
29 /// return the paragraph this cursor is in
30 ParagraphList::iterator par() const;
31 /// set the position within the paragraph
32 void pos(lyx::pos_type p);
33 /// return the position within the paragraph
34 lyx::pos_type pos() const;
36 void boundary(bool b);
38 bool boundary() const;
39 /// set the x position in pixels
41 /// return the x position in pixels
43 /// set the stored next-line position when at the end of a row
46 * Return the x position of the start of the next row, when this
47 * cursor is at the end of the previous row, for insets that take
50 * FIXME: explain why we need this ?
53 /// set the cached x position
56 * Return the cached x position of the cursor. This is used for when
59 * blah blah blah blah| blah blah blah
61 * blah blah blah blah blah blah
63 * When we move onto row 3, we would like to be vertically aligned
64 * with where we were in row 1, despite the fact that row 2 is
68 /// set the y position in pixels
70 /// return the y position in pixels
72 /// set the stored next-line y position when at the end of a row
75 * Return the y position of the start of the next row, when this
76 * cursor is at the end of the previous row, for insets that take
79 * FIXME: explain why we need this ? especially for y...
82 /// set the stored next row
83 void irow(RowList::iterator r);
85 * Return the next row, when this
86 * cursor is at the end of the previous row, for insets that take
89 * FIXME: explain why we need this ? especially for y...
91 RowList::iterator irow() const;
93 /// The paragraph the cursor is in.
94 ParagraphList::iterator par_;
95 /// The position inside the paragraph
98 * When the cursor position is i, is the cursor is after the i-th char
99 * or before the i+1-th char ? Normally, these two interpretations are
100 * equivalent, except when the fonts of the i-th and i+1-th char
102 * We use boundary_ to distinguish between the two options:
103 * If boundary_=true, then the cursor is after the i-th char
104 * and if boundary_=false, then the cursor is before the i+1-th char.
106 * We currently use the boundary only when the language direction of
107 * the i-th char is different than the one of the i+1-th char.
108 * In this case it is important to distinguish between the two
109 * cursor interpretations, in order to give a reasonable behavior to
113 /// the pixel x position
115 /// the stored next-row x position
117 /// the cached x position
119 /// the pixel y position
121 /// the stored next-row y position
123 /// the containing row for the next line
124 RowList::iterator irow_;
128 bool operator==(LyXCursor const & a, LyXCursor const & b);
130 bool operator!=(LyXCursor const & a, LyXCursor const & b);
132 #endif // LYXCURSOR_H