textrendering/textformatting/inc/FRMCURS.H
changeset 0 1fb32624e06b
equal deleted inserted replaced
-1:000000000000 0:1fb32624e06b
       
     1 /*
       
     2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * FORM Cursor Navigation header file holding policy interface class.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __FRMCURS_H__
       
    21 #define __FRMCURS_H__
       
    22 
       
    23 
       
    24 #include <frmconst.h>
       
    25 #include <frmconst_partner.h>
       
    26 
       
    27 
       
    28 class CTmViewAnchoredLayout;
       
    29 class TTmDocPos;
       
    30 
       
    31 /**
       
    32 This policy interface class maintains the cursor position and sets the 
       
    33 policy for its movement.
       
    34 @publishedPartner
       
    35 @deprecated
       
    36 */
       
    37 class MCursorPositioningPolicy
       
    38 
       
    39 	{
       
    40 public:
       
    41 
       
    42 	//-- Interface enumerations ---------------------------------------------
       
    43 
       
    44 
       
    45 	/** Types of delete operation. This is used when...???
       
    46 	*/
       
    47 	enum TDeleteType
       
    48 		{
       
    49 		EDeleteUndefined = 0,
       
    50 		EDeleteBackspace = 1,
       
    51 		EDeleteForward   = 2,
       
    52 
       
    53 		EDeleteLast
       
    54 		};
       
    55  
       
    56 	/** Types of reformatting. This is used when...???
       
    57 	*/
       
    58 	enum TTextChangeType
       
    59 		{
       
    60 		ETextChangeUndefined = 0,
       
    61 		/** Change that causes no change in cursor position. */
       
    62 		ETextChangeNonLocal  = 1,
       
    63 		/** Change that moves the cursor to its trailing edge. */
       
    64 		ETextChangeTyping    = 2,
       
    65 
       
    66 		// Maybe several more.
       
    67 		// ...
       
    68 		ETExtChangeLast
       
    69 	};
       
    70  
       
    71 	/** 
       
    72 	Hint for positioning the visual cursor. Describes properties of the
       
    73 	editing operation that is most likely to happen next. 
       
    74 	*/
       
    75 	enum TPosHint
       
    76 		{
       
    77 		EPosHintUndefined           = 0,
       
    78 		/** Left to right typing expected. */
       
    79 		EInsertStrongL2R = 1,
       
    80 		/** Right to left typing expected. */
       
    81 		EInsertStrongR2L = 2,
       
    82 
       
    83 		// Maybe several more.
       
    84 		//...
       
    85 		EPosHintLast
       
    86 		};
       
    87 
       
    88 public:
       
    89 
       
    90 	//-- Object creation/setup API ------------------------------------------
       
    91 
       
    92 	/**
       
    93 	*/
       
    94 	virtual ~MCursorPositioningPolicy() {}
       
    95 
       
    96 	/**
       
    97 	Sets the document/layout object on which all the cursor navigation will 
       
    98 	take place. 
       
    99 	*/
       
   100 	virtual void SetTmLayout(CTmViewAnchoredLayout* aLayout) = 0;
       
   101 
       
   102 
       
   103 	//-- Cursor positioning API ---------------------------------------------
       
   104 	
       
   105 	/** 
       
   106 	Gets the cursor position for display and insertion. 
       
   107 	@return TTmDocPos value holding cursor document position.
       
   108 	*/
       
   109 	virtual const TTmDocPos& Pos() const = 0;
       
   110 
       
   111 	/** 
       
   112 	Sets the cursor position explicitly.
       
   113 	@param aNewPos New position cursor is to be moved to.
       
   114 	*/
       
   115 	virtual void SetPos(const TTmDocPos& aNewPos) = 0;
       
   116 
       
   117 
       
   118 	/** 
       
   119 	@return ETrue if successful, EFalse otherwise e.g. no formatting	
       
   120 	*/
       
   121 	virtual void PosXyL(TPoint& aXy) const = 0;
       
   122 
       
   123 	/** 
       
   124 	Sets the X, Y co-ordinates to jump to. 
       
   125 	@param aXy Layout co-ordinates to approx. move the cursor to.
       
   126 			   On exit
       
   127 	@return ETrue if successful, EFalse otherwise e.g. no formatting	
       
   128 	*/
       
   129 	virtual void SetPosByXyL(TPoint& aNewXy) = 0;
       
   130 
       
   131 	/** 
       
   132 	Allows change of cursor position in response to a hint as to 
       
   133 	positioning. 
       
   134 	@param aHint Text directional hint from client.
       
   135 	*/
       
   136 	virtual void SetPositioningHintL(TPosHint aHint) = 0;
       
   137 	
       
   138 	/** 
       
   139 	Suggests a new latent X,Y position for Up/Down operations/scrolls. 
       
   140 	@param aX X Layout co-ordinate for latent position of cursor.
       
   141 	*/
       
   142 	virtual void SetLatentX(TInt aX) = 0;
       
   143 
       
   144 	/** 
       
   145 	Suggests a new latent X,Y position for Up/Down operations/scrolls. 
       
   146 	@param aY Y Layout co-ordinate for latent position of cursor.
       
   147 	*/
       
   148 	virtual void SetLatentY(TInt aY) = 0;
       
   149 
       
   150 	/** 
       
   151 	Suggests a new latent X,Y position for Up/Down operations/scrolls. 
       
   152 	@param aXy X,Y Layout co-ordinate for latent position of cursor.
       
   153 	*/
       
   154 	virtual const TPoint& LatentXy() const = 0;
       
   155 
       
   156 	/** 
       
   157 	Suggests a new latent X,Y position for Up/Down operations/scrolls. 
       
   158 	@param aXy X,Y Layout co-ordinate for latent position of cursor.
       
   159 	*/
       
   160 	virtual void SetLatentXy(const TPoint& aXy) = 0;
       
   161 
       
   162 	/** 
       
   163 	@leave 
       
   164 	*/
       
   165 	virtual const TPoint& UpdateLatentXyL() = 0;
       
   166 
       
   167 
       
   168 	//--- Cursor navigation API ---------------------------------------------
       
   169 	
       
   170 
       
   171 	/**
       
   172 	Moves the cursor up or down a line.
       
   173 	@param aUp ETrue if wish to move up, EFalse to go down.
       
   174 	@return TCursorMove Actual movement that took place.
       
   175 	*/
       
   176 	virtual TCursorMove UpDownL(TBool aUp) = 0;
       
   177 
       
   178 	/** 
       
   179 	Moves the cursor left or right a character position. 
       
   180 	@param aDown ETrue if wish to move left, EFalse to go right.
       
   181 	@return TCursorMove Actual movement that took place.
       
   182 	*/
       
   183 	virtual TCursorMove LeftRightL(TBool aLeft) = 0;
       
   184 
       
   185 	/** 
       
   186 	Moves the cursor to the start or to the end of the line. 
       
   187 	@param aStart ETrue if wish to move to the start, EFalse to go to the end.
       
   188 	@return TCursorMove Actual movement that took place.
       
   189 	*/
       
   190 	virtual TCursorMove LineStartEndL(TBool aStart) = 0;
       
   191 
       
   192 
       
   193 	//--- Cursor reactionary API to changes ---------------------------------
       
   194 
       
   195 
       
   196 	/** 
       
   197 	Responds to total change of formatting. 
       
   198 	*/
       
   199 	virtual void HandleGlobalReformatL() = 0;
       
   200 
       
   201 	/** 
       
   202 	Responds to partial change of formatting.
       
   203 	@param aStart ?
       
   204 	@param aOldEnd ?
       
   205 	@param aNewEnd ?
       
   206 	@param aParaFormatChg ?
       
   207 	@param aChgType ?
       
   208 	*/
       
   209 	virtual void HandleReformatL(TInt aStart, TInt aOldEnd, 
       
   210 		TInt aNewEnd, TBool aParaFormatChg, TTextChangeType aChgType) = 0;
       
   211 	
       
   212 
       
   213 	//-- Misc/Unknown API ---------------------------------------------------
       
   214 
       
   215 
       
   216 	/** 
       
   217 	Gets the cursor position for delete. ???
       
   218 	@param aDelType ?
       
   219 	@param aStart ?
       
   220 	@param aEnd ?
       
   221 	*/
       
   222 	virtual void GetDeletePosition(TDeleteType aDelType, TInt& aStart, 
       
   223 		TInt& aEnd) const = 0;
       
   224 		
       
   225 	/**
       
   226 	Place holder for future expansion when if more virtual methods 
       
   227 	are requried.
       
   228 	*/
       
   229 	virtual void* ExtendedInterface(TUid aInterfaceId) = 0;
       
   230 
       
   231 	};
       
   232 
       
   233 
       
   234 #endif // __FRMCURS_H__