williamr@2: /* williamr@2: * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * 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 williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: Data structures to store current state of case williamr@2: * modes. williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: // INCLUDES williamr@2: #if !defined(__EIKEDSTS_H__) williamr@2: #define __EIKEDSTS_H__ williamr@2: williamr@2: #if !defined(__FEPBASE_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: #if !defined(__AKNEDSTSOBS_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: #if !defined(__UIKON_HRH__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: #include williamr@2: williamr@2: #include williamr@2: williamr@2: // CLASS DECLARATION williamr@2: williamr@2: /** williamr@2: * Data structure to store current state of case modes. williamr@2: * williamr@2: * Data structure to hold the current state of all case state williamr@2: * information currently held by the fep and applicable to an williamr@2: * editor. williamr@2: * williamr@2: * @since Series 60 0.9 williamr@2: */ williamr@2: class TAknEditorCaseState williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Flags that indicate states of the case. williamr@2: */ williamr@2: enum TCaseStateFlags williamr@2: { williamr@2: /** Has text been entered with current case. */ williamr@2: EFlagTextEnteredInCurrentCase =0x00000001, williamr@2: williamr@2: /** Initialisation is required. */ williamr@2: EFlagInitialiseRequired =0x00000002, williamr@2: williamr@2: /** Supress case's automatic update. */ williamr@2: EFlagSupressAutoUpdateCase =0x00000004 williamr@2: williamr@2: }; williamr@2: public: williamr@2: williamr@2: /** williamr@2: * C++ default constructor. williamr@2: */ williamr@2: IMPORT_C TAknEditorCaseState(); williamr@2: williamr@2: /** williamr@2: * Sets current case. williamr@2: * @param aCase A new case. williamr@2: */ williamr@2: IMPORT_C void SetCurrentCase(TUint aCase); williamr@2: williamr@2: /** williamr@2: * Sets previous case. williamr@2: * @param aCase a Previously used case. williamr@2: */ williamr@2: IMPORT_C void SetPreviousCase(TUint aCase); williamr@2: williamr@2: /** williamr@2: * Sets previous case used to enter text. williamr@2: * @param aCase Previously used case to enter text. williamr@2: */ williamr@2: IMPORT_C void SetPreviousCaseUsedToEnterText(TUint aCase); williamr@2: williamr@2: williamr@2: /** williamr@2: * Gets current case. williamr@2: * @return The current case. williamr@2: */ williamr@2: IMPORT_C TUint CurrentCase() const; williamr@2: williamr@2: /** williamr@2: * Gets previous case. williamr@2: * @return The previous case. williamr@2: */ williamr@2: IMPORT_C TUint PreviousCase() const; williamr@2: williamr@2: /** williamr@2: * Gets previous case used to enter text. williamr@2: * @return The previous case used to enter text. williamr@2: */ williamr@2: IMPORT_C TUint PreviousCaseUsedToEnterText() const; williamr@2: williamr@2: // flags williamr@2: williamr@2: /** williamr@2: * Sets a flag. williamr@2: * @param aFlag a Flag to be set. williamr@2: */ williamr@2: IMPORT_C void SetFlag(TCaseStateFlags aFlag); williamr@2: williamr@2: /** williamr@2: * Clear the given flag. williamr@2: * @param aFlag a Flag to be cleared. williamr@2: */ williamr@2: IMPORT_C void ClearFlag(TCaseStateFlags aFlag); williamr@2: williamr@2: /** williamr@2: * Tells whether the given flag is set or not. williamr@2: * @param aFlag The flag to check. williamr@2: * @return @c ETrue if flag is set, @c EFalse if not. williamr@2: */ williamr@2: IMPORT_C TBool IsFlagSet(TCaseStateFlags aFlag) const; williamr@2: williamr@2: private: williamr@2: TUint8 iCurrentCase; williamr@2: TUint8 iPreviousCase; williamr@2: TUint8 iPreviousCaseUsedToEnterText; williamr@2: TUint8 iFlags; williamr@2: williamr@2: TInt iSpare; williamr@2: }; williamr@2: williamr@2: williamr@2: // FORWARD DECLERATIONS williamr@2: class MEikCcpuEditor; williamr@2: class CEikButtonGroupContainer; williamr@2: class CEikMenuBar; williamr@2: class MObjectProvider; williamr@2: class CAknEdwinFormAccessor; williamr@2: williamr@2: // CLASS DECLARATION williamr@2: williamr@2: /** williamr@2: * Stores the (FEP) states of editor controls. williamr@2: * @since Series 60 0.9 williamr@2: */ williamr@2: class CAknEdwinState : public MCoeFepAwareTextEditor_Extension1::CState williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Control's button array and softkey command id's. williamr@2: */ williamr@2: struct SEditorCbaState williamr@2: { williamr@2: /** A wrapper around the different button arrays used in both pen, williamr@2: and no-pen devices. */ williamr@2: CEikButtonGroupContainer* iCurrentCba; williamr@2: /** Left softkey command id. */ williamr@2: TInt iLeftSoftkeyCommandId; williamr@2: /** Right softkey command id. */ williamr@2: TInt iRightSoftkeyCommandId; williamr@2: }; williamr@2: public: williamr@2: /** williamr@2: * Destructor williamr@2: */ williamr@2: virtual ~CAknEdwinState(); williamr@2: williamr@2: /** williamr@2: * C++ constructor. williamr@2: * @param aCcpuState Pointer to a control that implements @c MEikCcpuEditor williamr@2: * interface. williamr@2: * williamr@2: */ williamr@2: CAknEdwinState(MEikCcpuEditor* aCcpuState); williamr@2: williamr@2: /** williamr@2: * C++ default constructor. williamr@2: */ williamr@2: IMPORT_C CAknEdwinState(); williamr@2: williamr@2: public: williamr@2: /** williamr@2: * Sets an observer for this control. williamr@2: * @param aObserver Pointer to an observer. williamr@2: */ williamr@2: IMPORT_C void SetObserver(MAknEdStateObserver* aObserver); williamr@2: williamr@2: /** williamr@2: * From @c MAknEdStateObserver. Sends an state event to control's observer. williamr@2: * @param aEventType Event type. williamr@2: */ williamr@2: IMPORT_C void ReportAknEdStateEventL( williamr@2: MAknEdStateObserver::EAknEdwinStateEvent aEventType); williamr@2: williamr@2: public: williamr@2: // Accessors williamr@2: williamr@2: /** williamr@2: * Returns control's flags. williamr@2: * @return Flags. williamr@2: */ williamr@2: IMPORT_C TInt Flags() const; williamr@2: williamr@2: /** williamr@2: * Get default input mode for the editor. The input mode is used when williamr@2: * the editor is focused first time. williamr@2: * @return Initial input mode to be used in the editor. williamr@2: */ williamr@2: IMPORT_C TInt DefaultInputMode() const; williamr@2: williamr@2: /** williamr@2: * Get current input mode for the editor. williamr@2: * @return Current input mode used in the editor. williamr@2: */ williamr@2: IMPORT_C TInt CurrentInputMode() const; williamr@2: williamr@2: /** williamr@2: * Get permitted input modes for the editor. williamr@2: * @return Input modes that are allowed in the editor. williamr@2: */ williamr@2: IMPORT_C TInt PermittedInputModes() const; williamr@2: williamr@2: /** williamr@2: * Get default case for the editor. The case is used when the editor williamr@2: * is focused first time. williamr@2: * @return Default character case. williamr@2: */ williamr@2: IMPORT_C TInt DefaultCase() const; williamr@2: williamr@2: /** williamr@2: * Get current character case for the editor. williamr@2: * @return Current character case. williamr@2: */ williamr@2: IMPORT_C TInt CurrentCase() const; williamr@2: williamr@2: /** williamr@2: * Get permitted cases for the editor. williamr@2: * @return Case modes that are permitted in the editor. williamr@2: */ williamr@2: IMPORT_C TInt PermittedCases() const; williamr@2: williamr@2: /** williamr@2: * T9 language codes are not anymore supported, use @c LocalLanguage() williamr@2: * instead. williamr@2: * @return 0 williamr@2: */ williamr@2: IMPORT_C TInt DefaultLanguage() const; williamr@2: williamr@2: /** williamr@2: * Get editor specific special character table resource ID. williamr@2: * @return Special character table dialog resource ID. williamr@2: */ williamr@2: IMPORT_C TInt SpecialCharacterTableResourceId() const; williamr@2: williamr@2: /** williamr@2: * Get number mode key mapping for '*' and '#' keys. The key mapping is used williamr@2: * in editors when numeric input mode is used. Key mapping characters williamr@2: * for '*' key are shown on special character table if also text input modes williamr@2: * are allowed in the editor but the current input mode is numeric mode. williamr@2: * @return Key mapping used in an editor with number input mode. williamr@2: */ williamr@2: IMPORT_C TAknEditorNumericKeymap NumericKeymap() const; williamr@2: williamr@2: /** williamr@2: * Get the cursor or cursor selection within a document. williamr@2: * @return The cursor or cursor selection within a document. williamr@2: */ williamr@2: IMPORT_C TCursorSelection CurrentInlineEditSpan() const; williamr@2: williamr@2: /** williamr@2: * Get control's CBA state. williamr@2: * @return Reference to @c SEditorCbaState struct. williamr@2: */ williamr@2: IMPORT_C SEditorCbaState& CbaState(); williamr@2: williamr@2: /** williamr@2: * Get the control's menu bar. williamr@2: * @return A pointer to the control's menu bar. williamr@2: */ williamr@2: IMPORT_C CEikMenuBar* MenuBar() const; williamr@2: williamr@2: /** williamr@2: * Get an interface that provides ccpu (cut, copy, paste and undo) williamr@2: * functionalities. williamr@2: * @return A pointer to a ccpu interface for this control. williamr@2: */ williamr@2: IMPORT_C MEikCcpuEditor* CcpuState() const; williamr@2: williamr@2: /** williamr@2: * Get control's object provider. williamr@2: * @return A pointer to control's object provider. williamr@2: */ williamr@2: IMPORT_C MObjectProvider* ObjectProvider() const; williamr@2: williamr@2: /** williamr@2: * Get the control's input language. williamr@2: * @return Language identity. williamr@2: */ williamr@2: IMPORT_C TLanguage LocalLanguage() const; williamr@2: williamr@2: /** williamr@2: * Accessor for control's form. williamr@2: * @since Series 60 2.0 williamr@2: * @return A pointer to to the form accessor of this control. williamr@2: */ williamr@2: IMPORT_C CAknEdwinFormAccessor* FormAccessor() const; williamr@2: williamr@2: williamr@2: // Setters williamr@2: williamr@2: /** williamr@2: * Set initial editor flags for the editor. williamr@2: * @param aFlags Avkon editor flags for the editor. williamr@2: */ williamr@2: IMPORT_C void SetFlags(TInt aFlags); williamr@2: williamr@2: /** williamr@2: * Set default input mode for the editor. The input mode is used when williamr@2: * the editor is focused first time. williamr@2: * @c EAknEditorTextInputMode is used if the initial input mode is not set williamr@2: * from EDWIN resource DEFAULT_INPUT_MODE or with this API. williamr@2: * @param aInputMode Initial input mode to be used in the editor. williamr@2: */ williamr@2: IMPORT_C void SetDefaultInputMode(TInt aInputMode); williamr@2: williamr@2: /** williamr@2: * Updates editor input mode. FEP is automatically notified of the williamr@2: * new input mode in editor state and FEP takes new input mode to use williamr@2: * immediatelly. Current inline editing is reset. williamr@2: * This method should not be used for setting initial input mode for the williamr@2: * editor. Use @c SetDefaultInputMode() method instead for setting initial williamr@2: * input mode. williamr@2: * @param aInputMode New input mode for the editor. williamr@2: */ williamr@2: IMPORT_C void SetCurrentInputMode(TInt aInputMode); williamr@2: williamr@2: /** williamr@2: * Set permitted input modes for the editor. williamr@2: * All input modes are allowed ( @c EAknEditorAllInputModes ) if the value williamr@2: * is not set from EDWIN resource ALLOWED_INPUT_MODES or with this API. williamr@2: * @param aInputModes Input modes that are allowed in the editor. williamr@2: */ williamr@2: IMPORT_C void SetPermittedInputModes(TInt aInputModes); williamr@2: williamr@2: /** williamr@2: * Set default case for the editor. The case is used when the editor williamr@2: * is focused first time. Available case flags from @c uikon.hrh williamr@2: * are @c EAknEditorUpperCase, @c EAknEditorLowerCase and williamr@2: * @EAknEditorTextCase. @c EAknEditorTextCase is used if the initial case is williamr@2: * not set from EDWIN resource DEFAULT_CASE or with this API. williamr@2: * @param aCase Initial case to be used in the editor. williamr@2: */ williamr@2: IMPORT_C void SetDefaultCase(TInt aCase); williamr@2: williamr@2: /** williamr@2: * Updates editor case. FEP is automatically notified of the williamr@2: * case change in editor state and FEP takes new case to use immediately. williamr@2: * Available case flags from @c uikon.hrh are @c EAknEditorUpperCase, williamr@2: * @c EAknEditorLowerCase and @c EAknEditorTextCase. williamr@2: * This method should not be used to set initial case for the editor. williamr@2: * Use @c SetDefaultCase() method instead for setting the initial case. williamr@2: * @param aCase New case for the editor. williamr@2: */ williamr@2: IMPORT_C void SetCurrentCase(TInt aCase); williamr@2: williamr@2: /** williamr@2: * Set permitted cases for the editor. williamr@2: * Possible flags from @c uikon.hrh are @c EAknEditorAllCaseModes, williamr@2: * @c EAknEditorUpperCase,@c EAknEditorLowerCase and @c EAknEditorTextCase. williamr@2: * @c EAknEditorAllCaseModes is used if the value is not set from EDWIN williamr@2: * resource ALLOWED_CASE_MODES or with this API. williamr@2: * @param aCases Case modes that are available in the editor. williamr@2: */ williamr@2: IMPORT_C void SetPermittedCases(TInt aCases); williamr@2: williamr@2: /** williamr@2: * T9 language codes are not anymore supported. Use @c SetLocalLanguage() williamr@2: * instead. williamr@2: */ williamr@2: IMPORT_C void SetDefaultLanguage(TInt aLanguage); williamr@2: williamr@2: /** williamr@2: * Set editor specific special character table. williamr@2: * @param aResourceId Special character table dialog resource ID. williamr@2: */ williamr@2: IMPORT_C void SetSpecialCharacterTableResourceId(TInt aResourceId); williamr@2: williamr@2: /** williamr@2: * Set number mode key mapping for '*' and '#' keys. The key mapping is used williamr@2: * in editors when numeric input mode is used. Key mapping characters williamr@2: * for '*' key are shown on special character table if also the text input modes williamr@2: * are allowed in the editor but the current input mode is numeric mode. williamr@2: * @c EAknEditorStandardNumberModeKeymap is used in editors that allow only williamr@2: * numeric input if the mapping is not set from EDWIN resource NUMERIC_KEYMAP williamr@2: * or with this API. @c EAknEditorAlphanumericNumberModeKeymap is used as williamr@2: * default if the editor allows also text input mode. williamr@2: * @param aKeymap Key mapping used in an editor with number input mode. williamr@2: */ williamr@2: IMPORT_C void SetNumericKeymap(TAknEditorNumericKeymap aKeymap); williamr@2: williamr@2: /** williamr@2: * Set the cursor or cursor selection within a document. williamr@2: * @param aCurrentInlineEditSpan New cursor or cursor selection within a williamr@2: * document. williamr@2: */ williamr@2: IMPORT_C void SetInlineEditSpan(TCursorSelection aCurrentInlineEditSpan); williamr@2: williamr@2: /** williamr@2: * Gets the control's button array from object provider and sets the softkey williamr@2: * command id's to 0. williamr@2: */ williamr@2: IMPORT_C void SetCba(); williamr@2: williamr@2: /** williamr@2: * Sets the menu bar from the object provider. williamr@2: */ williamr@2: IMPORT_C void SetMenu(); williamr@2: williamr@2: /** williamr@2: * Set the object provider for the control. williamr@2: * @param aObjectProvider A pointer to a class that implements an object williamr@2: * provider. williamr@2: */ williamr@2: IMPORT_C void SetObjectProvider(MObjectProvider* aObjectProvider); williamr@2: williamr@2: /** williamr@2: * Set new local input language for the editor. Global input language williamr@2: * changes have not effect for the input language but the user can still williamr@2: * change the input language from the edit menu. williamr@2: * @param aLanguage Editor local input language. williamr@2: */ williamr@2: IMPORT_C void SetLocalLanguage(TLanguage aLanguage); williamr@2: williamr@2: /** williamr@2: * Set form accessor for this control. williamr@2: * @since Series 60 2.0 williamr@2: * @param aFormAccessor Pointer to a form accessor. williamr@2: */ williamr@2: IMPORT_C void SetFormAccessor(CAknEdwinFormAccessor* aFormAccessor); williamr@2: williamr@2: // non exported setters williamr@2: williamr@2: /** williamr@2: * Set a control that implements ccpu (cut, copy, paste and undo) interface. williamr@2: * @param aCcpuEditor Pointer to a control that implements @c MEikCcpuEditor williamr@2: * interface. williamr@2: */ williamr@2: IMPORT_C void SetCcpuState(MEikCcpuEditor* aCcpuEditor); williamr@2: williamr@2: /** williamr@2: * Set middle sofkey command id. williamr@2: * @since S60 V3.2 williamr@2: * @param aId New middle softkey command id. williamr@2: */ williamr@2: IMPORT_C void SetMiddleSoftkeyCommandId(TInt aCommandId); williamr@2: williamr@2: /** williamr@2: * Return middle sofkey command id. williamr@2: * @since S60 V3.2 williamr@2: * @return Current middle softkey command id. williamr@2: */ williamr@2: IMPORT_C TInt MiddleSoftkeyCommandId() const; williamr@2: williamr@2: private: williamr@2: IMPORT_C void SetCurrentCaseWithNoInitialisation(TInt aCase); williamr@2: IMPORT_C TAknEditorCaseState& CaseState(); williamr@2: williamr@2: private: williamr@2: void CheckLRCursorAndT9Consistency(); williamr@2: williamr@2: private: williamr@2: friend class CT9FepControl; // dependency to be removed? williamr@2: friend class CT9FepCaseManager; // dependency to be removed? williamr@2: friend class CAknFepCaseManager; // dependency to be removed? williamr@2: friend class CAknFepManager; // dependency to be removed? williamr@2: williamr@2: private: williamr@2: TInt iFlags; williamr@2: TInt iDefaultInputMode; williamr@2: TInt iCurrentInputMode; williamr@2: TInt iPermittedInputModes; williamr@2: williamr@2: TInt iDefaultCase; williamr@2: TAknEditorCaseState iCaseState; williamr@2: TInt iPermittedCases; williamr@2: williamr@2: TLanguage iLocalLanguage; williamr@2: TInt iSpecialCharacterTableResourceId; williamr@2: TAknEditorNumericKeymap iNumericKeymap; williamr@2: TCursorSelection iCurrentInlineEditSpan; williamr@2: williamr@2: SEditorCbaState iCbaState; williamr@2: CEikMenuBar* iMenu; williamr@2: williamr@2: // to hold c/c/p/u info about an editor williamr@2: MEikCcpuEditor* iCcpuState; williamr@2: MObjectProvider* iObjectProvider; williamr@2: williamr@2: MAknEdStateObserver* iObserver; williamr@2: CAknEdwinFormAccessor* iFormAccessor; williamr@2: williamr@2: TInt iMiddleSoftkeyCommandId; williamr@2: williamr@2: TInt iSpare[3]; williamr@2: }; williamr@2: williamr@2: williamr@2: #endif williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: