1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // FORM Cursor Navigation header file holding policy interface class.
25 class CTmViewAnchoredLayout;
29 This policy interface class maintains the cursor position and sets the
30 policy for its movement.
34 class MCursorPositioningPolicy
39 //-- Interface enumerations ---------------------------------------------
42 /** Types of delete operation. This is used when...???
53 /** Types of reformatting. This is used when...???
57 ETextChangeUndefined = 0,
58 /** Change that causes no change in cursor position. */
59 ETextChangeNonLocal = 1,
60 /** Change that moves the cursor to its trailing edge. */
61 ETextChangeTyping = 2,
63 // Maybe several more.
69 Hint for positioning the visual cursor. Describes properties of the
70 editing operation that is most likely to happen next.
74 EPosHintUndefined = 0,
75 /** Left to right typing expected. */
77 /** Right to left typing expected. */
80 // Maybe several more.
87 //-- Object creation/setup API ------------------------------------------
91 virtual ~MCursorPositioningPolicy() {}
94 Sets the document/layout object on which all the cursor navigation will
97 virtual void SetTmLayout(CTmViewAnchoredLayout* aLayout) = 0;
100 //-- Cursor positioning API ---------------------------------------------
103 Gets the cursor position for display and insertion.
104 @return TTmDocPos value holding cursor document position.
106 virtual const TTmDocPos& Pos() const = 0;
109 Sets the cursor position explicitly.
110 @param aNewPos New position cursor is to be moved to.
112 virtual void SetPos(const TTmDocPos& aNewPos) = 0;
116 @return ETrue if successful, EFalse otherwise e.g. no formatting
118 virtual void PosXyL(TPoint& aXy) const = 0;
121 Sets the X, Y co-ordinates to jump to.
122 @param aXy Layout co-ordinates to approx. move the cursor to.
124 @return ETrue if successful, EFalse otherwise e.g. no formatting
126 virtual void SetPosByXyL(TPoint& aNewXy) = 0;
129 Allows change of cursor position in response to a hint as to
131 @param aHint Text directional hint from client.
133 virtual void SetPositioningHintL(TPosHint aHint) = 0;
136 Suggests a new latent X,Y position for Up/Down operations/scrolls.
137 @param aX X Layout co-ordinate for latent position of cursor.
139 virtual void SetLatentX(TInt aX) = 0;
142 Suggests a new latent X,Y position for Up/Down operations/scrolls.
143 @param aY Y Layout co-ordinate for latent position of cursor.
145 virtual void SetLatentY(TInt aY) = 0;
148 Suggests a new latent X,Y position for Up/Down operations/scrolls.
149 @param aXy X,Y Layout co-ordinate for latent position of cursor.
151 virtual const TPoint& LatentXy() const = 0;
154 Suggests a new latent X,Y position for Up/Down operations/scrolls.
155 @param aXy X,Y Layout co-ordinate for latent position of cursor.
157 virtual void SetLatentXy(const TPoint& aXy) = 0;
162 virtual const TPoint& UpdateLatentXyL() = 0;
165 //--- Cursor navigation API ---------------------------------------------
169 Moves the cursor up or down a line.
170 @param aUp ETrue if wish to move up, EFalse to go down.
171 @return TCursorMove Actual movement that took place.
173 virtual TCursorMove UpDownL(TBool aUp) = 0;
176 Moves the cursor left or right a character position.
177 @param aDown ETrue if wish to move left, EFalse to go right.
178 @return TCursorMove Actual movement that took place.
180 virtual TCursorMove LeftRightL(TBool aLeft) = 0;
183 Moves the cursor to the start or to the end of the line.
184 @param aStart ETrue if wish to move to the start, EFalse to go to the end.
185 @return TCursorMove Actual movement that took place.
187 virtual TCursorMove LineStartEndL(TBool aStart) = 0;
190 //--- Cursor reactionary API to changes ---------------------------------
194 Responds to total change of formatting.
196 virtual void HandleGlobalReformatL() = 0;
199 Responds to partial change of formatting.
203 @param aParaFormatChg ?
206 virtual void HandleReformatL(TInt aStart, TInt aOldEnd,
207 TInt aNewEnd, TBool aParaFormatChg, TTextChangeType aChgType) = 0;
210 //-- Misc/Unknown API ---------------------------------------------------
214 Gets the cursor position for delete. ???
219 virtual void GetDeletePosition(TDeleteType aDelType, TInt& aStart,
220 TInt& aEnd) const = 0;
223 Place holder for future expansion when if more virtual methods
226 virtual void* ExtendedInterface(TUid aInterfaceId) = 0;
231 #endif // __FRMCURS_H__