sl@0: /*
sl@0: * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: * All rights reserved.
sl@0: * This component and the accompanying materials are made available
sl@0: * under the terms of "Eclipse Public License v1.0"
sl@0: * which accompanies this distribution, and is available
sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: *
sl@0: * Initial Contributors:
sl@0: * Nokia Corporation - initial contribution.
sl@0: *
sl@0: * Contributors:
sl@0: *
sl@0: * Description: 
sl@0: * FORM Cursor Navigation header file holding policy interface class.
sl@0: *
sl@0: */
sl@0: 
sl@0: 
sl@0: #ifndef __FRMCURS_H__
sl@0: #define __FRMCURS_H__
sl@0: 
sl@0: 
sl@0: #include <frmconst.h>
sl@0: #include <frmconst_partner.h>
sl@0: 
sl@0: 
sl@0: class CTmViewAnchoredLayout;
sl@0: class TTmDocPos;
sl@0: 
sl@0: /**
sl@0: This policy interface class maintains the cursor position and sets the 
sl@0: policy for its movement.
sl@0: @publishedPartner
sl@0: @deprecated
sl@0: */
sl@0: class MCursorPositioningPolicy
sl@0: 
sl@0: 	{
sl@0: public:
sl@0: 
sl@0: 	//-- Interface enumerations ---------------------------------------------
sl@0: 
sl@0: 
sl@0: 	/** Types of delete operation. This is used when...???
sl@0: 	*/
sl@0: 	enum TDeleteType
sl@0: 		{
sl@0: 		EDeleteUndefined = 0,
sl@0: 		EDeleteBackspace = 1,
sl@0: 		EDeleteForward   = 2,
sl@0: 
sl@0: 		EDeleteLast
sl@0: 		};
sl@0:  
sl@0: 	/** Types of reformatting. This is used when...???
sl@0: 	*/
sl@0: 	enum TTextChangeType
sl@0: 		{
sl@0: 		ETextChangeUndefined = 0,
sl@0: 		/** Change that causes no change in cursor position. */
sl@0: 		ETextChangeNonLocal  = 1,
sl@0: 		/** Change that moves the cursor to its trailing edge. */
sl@0: 		ETextChangeTyping    = 2,
sl@0: 
sl@0: 		// Maybe several more.
sl@0: 		// ...
sl@0: 		ETExtChangeLast
sl@0: 	};
sl@0:  
sl@0: 	/** 
sl@0: 	Hint for positioning the visual cursor. Describes properties of the
sl@0: 	editing operation that is most likely to happen next. 
sl@0: 	*/
sl@0: 	enum TPosHint
sl@0: 		{
sl@0: 		EPosHintUndefined           = 0,
sl@0: 		/** Left to right typing expected. */
sl@0: 		EInsertStrongL2R = 1,
sl@0: 		/** Right to left typing expected. */
sl@0: 		EInsertStrongR2L = 2,
sl@0: 
sl@0: 		// Maybe several more.
sl@0: 		//...
sl@0: 		EPosHintLast
sl@0: 		};
sl@0: 
sl@0: public:
sl@0: 
sl@0: 	//-- Object creation/setup API ------------------------------------------
sl@0: 
sl@0: 	/**
sl@0: 	*/
sl@0: 	virtual ~MCursorPositioningPolicy() {}
sl@0: 
sl@0: 	/**
sl@0: 	Sets the document/layout object on which all the cursor navigation will 
sl@0: 	take place. 
sl@0: 	*/
sl@0: 	virtual void SetTmLayout(CTmViewAnchoredLayout* aLayout) = 0;
sl@0: 
sl@0: 
sl@0: 	//-- Cursor positioning API ---------------------------------------------
sl@0: 	
sl@0: 	/** 
sl@0: 	Gets the cursor position for display and insertion. 
sl@0: 	@return TTmDocPos value holding cursor document position.
sl@0: 	*/
sl@0: 	virtual const TTmDocPos& Pos() const = 0;
sl@0: 
sl@0: 	/** 
sl@0: 	Sets the cursor position explicitly.
sl@0: 	@param aNewPos New position cursor is to be moved to.
sl@0: 	*/
sl@0: 	virtual void SetPos(const TTmDocPos& aNewPos) = 0;
sl@0: 
sl@0: 
sl@0: 	/** 
sl@0: 	@return ETrue if successful, EFalse otherwise e.g. no formatting	
sl@0: 	*/
sl@0: 	virtual void PosXyL(TPoint& aXy) const = 0;
sl@0: 
sl@0: 	/** 
sl@0: 	Sets the X, Y co-ordinates to jump to. 
sl@0: 	@param aXy Layout co-ordinates to approx. move the cursor to.
sl@0: 			   On exit
sl@0: 	@return ETrue if successful, EFalse otherwise e.g. no formatting	
sl@0: 	*/
sl@0: 	virtual void SetPosByXyL(TPoint& aNewXy) = 0;
sl@0: 
sl@0: 	/** 
sl@0: 	Allows change of cursor position in response to a hint as to 
sl@0: 	positioning. 
sl@0: 	@param aHint Text directional hint from client.
sl@0: 	*/
sl@0: 	virtual void SetPositioningHintL(TPosHint aHint) = 0;
sl@0: 	
sl@0: 	/** 
sl@0: 	Suggests a new latent X,Y position for Up/Down operations/scrolls. 
sl@0: 	@param aX X Layout co-ordinate for latent position of cursor.
sl@0: 	*/
sl@0: 	virtual void SetLatentX(TInt aX) = 0;
sl@0: 
sl@0: 	/** 
sl@0: 	Suggests a new latent X,Y position for Up/Down operations/scrolls. 
sl@0: 	@param aY Y Layout co-ordinate for latent position of cursor.
sl@0: 	*/
sl@0: 	virtual void SetLatentY(TInt aY) = 0;
sl@0: 
sl@0: 	/** 
sl@0: 	Suggests a new latent X,Y position for Up/Down operations/scrolls. 
sl@0: 	@param aXy X,Y Layout co-ordinate for latent position of cursor.
sl@0: 	*/
sl@0: 	virtual const TPoint& LatentXy() const = 0;
sl@0: 
sl@0: 	/** 
sl@0: 	Suggests a new latent X,Y position for Up/Down operations/scrolls. 
sl@0: 	@param aXy X,Y Layout co-ordinate for latent position of cursor.
sl@0: 	*/
sl@0: 	virtual void SetLatentXy(const TPoint& aXy) = 0;
sl@0: 
sl@0: 	/** 
sl@0: 	@leave 
sl@0: 	*/
sl@0: 	virtual const TPoint& UpdateLatentXyL() = 0;
sl@0: 
sl@0: 
sl@0: 	//--- Cursor navigation API ---------------------------------------------
sl@0: 	
sl@0: 
sl@0: 	/**
sl@0: 	Moves the cursor up or down a line.
sl@0: 	@param aUp ETrue if wish to move up, EFalse to go down.
sl@0: 	@return TCursorMove Actual movement that took place.
sl@0: 	*/
sl@0: 	virtual TCursorMove UpDownL(TBool aUp) = 0;
sl@0: 
sl@0: 	/** 
sl@0: 	Moves the cursor left or right a character position. 
sl@0: 	@param aDown ETrue if wish to move left, EFalse to go right.
sl@0: 	@return TCursorMove Actual movement that took place.
sl@0: 	*/
sl@0: 	virtual TCursorMove LeftRightL(TBool aLeft) = 0;
sl@0: 
sl@0: 	/** 
sl@0: 	Moves the cursor to the start or to the end of the line. 
sl@0: 	@param aStart ETrue if wish to move to the start, EFalse to go to the end.
sl@0: 	@return TCursorMove Actual movement that took place.
sl@0: 	*/
sl@0: 	virtual TCursorMove LineStartEndL(TBool aStart) = 0;
sl@0: 
sl@0: 
sl@0: 	//--- Cursor reactionary API to changes ---------------------------------
sl@0: 
sl@0: 
sl@0: 	/** 
sl@0: 	Responds to total change of formatting. 
sl@0: 	*/
sl@0: 	virtual void HandleGlobalReformatL() = 0;
sl@0: 
sl@0: 	/** 
sl@0: 	Responds to partial change of formatting.
sl@0: 	@param aStart ?
sl@0: 	@param aOldEnd ?
sl@0: 	@param aNewEnd ?
sl@0: 	@param aParaFormatChg ?
sl@0: 	@param aChgType ?
sl@0: 	*/
sl@0: 	virtual void HandleReformatL(TInt aStart, TInt aOldEnd, 
sl@0: 		TInt aNewEnd, TBool aParaFormatChg, TTextChangeType aChgType) = 0;
sl@0: 	
sl@0: 
sl@0: 	//-- Misc/Unknown API ---------------------------------------------------
sl@0: 
sl@0: 
sl@0: 	/** 
sl@0: 	Gets the cursor position for delete. ???
sl@0: 	@param aDelType ?
sl@0: 	@param aStart ?
sl@0: 	@param aEnd ?
sl@0: 	*/
sl@0: 	virtual void GetDeletePosition(TDeleteType aDelType, TInt& aStart, 
sl@0: 		TInt& aEnd) const = 0;
sl@0: 		
sl@0: 	/**
sl@0: 	Place holder for future expansion when if more virtual methods 
sl@0: 	are requried.
sl@0: 	*/
sl@0: 	virtual void* ExtendedInterface(TUid aInterfaceId) = 0;
sl@0: 
sl@0: 	};
sl@0: 
sl@0: 
sl@0: #endif // __FRMCURS_H__