4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Matthias Ettrich
10 * \author André Pönitz
12 * \author Jürgen Vigna
14 * Full author contact details are available in file CREDITS.
20 #include "ParagraphList.h"
21 #include "support/types.h"
24 * The cursor class describes the position of a cursor within a document.
25 * Several cursors exist within LyX; for example, when locking an inset,
26 * the position of the cursor in the containing inset is stored.
33 /// set the paragraph that contains this cursor
34 void par(ParagraphList::iterator pit);
35 /// return the paragraph this cursor is in
36 ParagraphList::iterator par() const;
37 /// set the position within the paragraph
38 void pos(lyx::pos_type p);
39 /// return the position within the paragraph
40 lyx::pos_type pos() const;
42 void boundary(bool b);
44 bool boundary() const;
45 /// set the x position in pixels
47 /// return the x position in pixels
49 /// set the stored next-line position when at the end of a row
52 * Return the x position of the start of the next row, when this
53 * cursor is at the end of the previous row, for insets that take
56 * FIXME: explain why we need this ?
59 /// set the cached x position
62 * Return the cached x position of the cursor. This is used for when
65 * blah blah blah blah| blah blah blah
67 * blah blah blah blah blah blah
69 * When we move onto row 3, we would like to be vertically aligned
70 * with where we were in row 1, despite the fact that row 2 is
74 /// set the y position in pixels
76 /// return the y position in pixels
78 /// set the stored next-line y position when at the end of a row
81 * Return the y position of the start of the next row, when this
82 * cursor is at the end of the previous row, for insets that take
85 * FIXME: explain why we need this ? especially for y...
89 /// The paragraph the cursor is in.
90 ParagraphList::iterator par_;
91 /// The position inside the paragraph
94 * When the cursor position is i, is the cursor is after the i-th char
95 * or before the i+1-th char ? Normally, these two interpretations are
96 * equivalent, except when the fonts of the i-th and i+1-th char
98 * We use boundary_ to distinguish between the two options:
99 * If boundary_=true, then the cursor is after the i-th char
100 * and if boundary_=false, then the cursor is before the i+1-th char.
102 * We currently use the boundary only when the language direction of
103 * the i-th char is different than the one of the i+1-th char.
104 * In this case it is important to distinguish between the two
105 * cursor interpretations, in order to give a reasonable behavior to
109 /// the pixel x position
111 /// the stored next-row x position
113 /// the cached x position
115 /// the pixel y position
117 /// the stored next-row y position
122 bool operator==(LyXCursor const & a, LyXCursor const & b);
124 bool operator!=(LyXCursor const & a, LyXCursor const & b);
126 #endif // LYXCURSOR_H