classicui_pub/editors_api/inc/Aknedsts.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  Data structures to store current state of case
       
    15 *  		    	 modes.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDES 
       
    21 #if !defined(__EIKEDSTS_H__)
       
    22 #define __EIKEDSTS_H__
       
    23 
       
    24 #if !defined(__FEPBASE_H__)
       
    25 #include <fepbase.h>
       
    26 #endif
       
    27 
       
    28 #if !defined(__AKNEDSTSOBS_H__)
       
    29 #include <aknedstsobs.h>
       
    30 #endif
       
    31 
       
    32 #if !defined(__UIKON_HRH__)
       
    33 #include <uikon.hrh>
       
    34 #endif
       
    35 
       
    36 #include <eikon.hrh>
       
    37 
       
    38 #include <frmtlay.h>
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 *  Data structure to store current state of case modes.
       
    44 *  
       
    45 *  Data structure to hold the current state of all case state
       
    46 *  information currently held by the fep and applicable to an
       
    47 *  editor.
       
    48 *
       
    49 *  @since Series 60 0.9
       
    50 */
       
    51 class TAknEditorCaseState
       
    52 	{
       
    53 public:
       
    54 	/**
       
    55 	* Flags that indicate states of the case.
       
    56 	*/
       
    57 	enum TCaseStateFlags
       
    58 		{
       
    59 		/** Has text been entered with current case. */
       
    60 		EFlagTextEnteredInCurrentCase	=0x00000001,    
       
    61 		
       
    62 		/** Initialisation is required. */
       
    63 		EFlagInitialiseRequired			=0x00000002,    
       
    64 		
       
    65 		/** Supress case's automatic update. */
       
    66 		EFlagSupressAutoUpdateCase		=0x00000004     
       
    67 		
       
    68 		};
       
    69 public:
       
    70 	        
       
    71     /**
       
    72     * C++ default constructor.
       
    73     */
       
    74 	IMPORT_C TAknEditorCaseState();
       
    75 	        
       
    76     /**
       
    77     * Sets current case.
       
    78     * @param aCase A new case.
       
    79     */
       
    80 	IMPORT_C void SetCurrentCase(TUint aCase);
       
    81 	        
       
    82     /**
       
    83     * Sets previous case.
       
    84     * @param aCase a Previously used case.
       
    85     */
       
    86 	IMPORT_C void SetPreviousCase(TUint aCase);
       
    87 	        
       
    88     /**
       
    89     * Sets previous case used to enter text.
       
    90     * @param aCase Previously used case to enter text.
       
    91     */
       
    92 	IMPORT_C void SetPreviousCaseUsedToEnterText(TUint aCase);
       
    93 	
       
    94 		        
       
    95     /**
       
    96     * Gets current case.
       
    97     * @return The current case.
       
    98     */
       
    99 	IMPORT_C TUint CurrentCase() const;
       
   100 		        
       
   101     /**
       
   102     * Gets previous case.
       
   103     * @return The previous case.
       
   104     */
       
   105 	IMPORT_C TUint PreviousCase() const;
       
   106 		        
       
   107     /**
       
   108     * Gets previous case used to enter text.
       
   109     * @return The previous case used to enter text.
       
   110     */
       
   111 	IMPORT_C TUint PreviousCaseUsedToEnterText() const;
       
   112 
       
   113 	// flags
       
   114 	        
       
   115     /**
       
   116     * Sets a flag.
       
   117     * @param aFlag a Flag to be set.
       
   118     */
       
   119 	IMPORT_C void SetFlag(TCaseStateFlags aFlag);
       
   120 	        
       
   121     /**
       
   122     * Clear the given flag. 
       
   123     * @param aFlag a Flag to be cleared.
       
   124     */
       
   125 	IMPORT_C void ClearFlag(TCaseStateFlags aFlag);
       
   126 	        
       
   127     /**
       
   128     * Tells whether the given flag is set or not.
       
   129     * @param aFlag The flag to check.
       
   130     * @return @c ETrue if flag is set, @c EFalse if not.
       
   131     */
       
   132 	IMPORT_C TBool IsFlagSet(TCaseStateFlags aFlag) const;
       
   133 
       
   134 private:
       
   135 	TUint8 iCurrentCase;
       
   136 	TUint8 iPreviousCase;
       
   137 	TUint8 iPreviousCaseUsedToEnterText;
       
   138 	TUint8 iFlags;
       
   139 
       
   140     TInt iSpare;
       
   141 	};
       
   142 
       
   143 
       
   144 // FORWARD DECLERATIONS
       
   145 class MEikCcpuEditor;
       
   146 class CEikButtonGroupContainer;
       
   147 class CEikMenuBar;
       
   148 class MObjectProvider;
       
   149 class CAknEdwinFormAccessor;
       
   150 
       
   151 // CLASS DECLARATION
       
   152 
       
   153 /**
       
   154 * Stores the (FEP) states of editor controls.
       
   155 * @since Series 60 0.9
       
   156 */
       
   157 class CAknEdwinState : public MCoeFepAwareTextEditor_Extension1::CState
       
   158 	{
       
   159 public:
       
   160     /**
       
   161     * Control's button array and softkey command id's.
       
   162     */
       
   163 	struct SEditorCbaState
       
   164 		{
       
   165 		/** A wrapper around the different button arrays used in both pen,
       
   166 		 and no-pen devices. */
       
   167 		CEikButtonGroupContainer* iCurrentCba;
       
   168 		/** Left softkey command id. */
       
   169 		TInt iLeftSoftkeyCommandId;
       
   170 		/** Right softkey command id. */
       
   171 		TInt iRightSoftkeyCommandId;
       
   172 		};
       
   173 public:
       
   174     /** 
       
   175     * Destructor
       
   176     */
       
   177 	virtual ~CAknEdwinState();
       
   178 	
       
   179 	/**
       
   180 	* C++ constructor.
       
   181 	* @param aCcpuState Pointer to a control that implements @c MEikCcpuEditor
       
   182 	* interface.
       
   183 	* 
       
   184 	*/
       
   185 	CAknEdwinState(MEikCcpuEditor* aCcpuState);
       
   186 	
       
   187 	/**
       
   188 	* C++ default constructor.
       
   189 	*/
       
   190 	IMPORT_C CAknEdwinState();
       
   191 	
       
   192 public:
       
   193     /**
       
   194     * Sets an observer for this control.
       
   195     * @param aObserver Pointer to an observer.
       
   196     */
       
   197 	IMPORT_C void SetObserver(MAknEdStateObserver* aObserver);
       
   198 
       
   199     /**
       
   200     * From @c MAknEdStateObserver. Sends an state event to control's observer.
       
   201     * @param aEventType Event type.
       
   202     */
       
   203 	IMPORT_C void ReportAknEdStateEventL(
       
   204 		MAknEdStateObserver::EAknEdwinStateEvent aEventType);
       
   205 
       
   206 public:
       
   207 	// Accessors
       
   208 	
       
   209     /**
       
   210     * Returns control's flags.
       
   211     * @return Flags.
       
   212     */
       
   213 	IMPORT_C TInt Flags() const;
       
   214 
       
   215     /**
       
   216     * Get default input mode for the editor. The input mode is used when 
       
   217     * the editor is focused first time. 
       
   218     * @return Initial input mode to be used in the editor.
       
   219     */
       
   220 	IMPORT_C TInt DefaultInputMode() const;
       
   221 
       
   222     /**
       
   223     * Get current input mode for the editor.
       
   224     * @return Current input mode used in the editor.
       
   225     */
       
   226 	IMPORT_C TInt CurrentInputMode() const;
       
   227 
       
   228     /**
       
   229     * Get permitted input modes for the editor.
       
   230     * @return Input modes that are allowed in the editor.
       
   231     */
       
   232 	IMPORT_C TInt PermittedInputModes() const;
       
   233 
       
   234     /**
       
   235     * Get default case for the editor. The case is used when the editor
       
   236     * is focused first time. 
       
   237     * @return Default character case.
       
   238     */
       
   239 	IMPORT_C TInt DefaultCase() const;
       
   240 
       
   241     /**
       
   242     * Get current character case for the editor.
       
   243     * @return Current character case.
       
   244     */
       
   245 	IMPORT_C TInt CurrentCase() const;
       
   246 
       
   247     /**
       
   248     * Get permitted cases for the editor.
       
   249     * @return Case modes that are permitted in the editor.
       
   250     */
       
   251 	IMPORT_C TInt PermittedCases() const;
       
   252 
       
   253     /**
       
   254     * T9 language codes are not anymore supported, use @c LocalLanguage() 
       
   255     * instead.
       
   256     * @return 0
       
   257     */
       
   258 	IMPORT_C TInt DefaultLanguage() const;
       
   259 
       
   260     /**
       
   261     * Get editor specific special character table resource ID. 
       
   262     * @return Special character table dialog resource ID.
       
   263     */
       
   264 	IMPORT_C TInt SpecialCharacterTableResourceId() const;
       
   265 
       
   266     /**
       
   267     * Get number mode key mapping for '*' and '#' keys. The key mapping is used
       
   268     * in editors when numeric input mode is used. Key mapping characters
       
   269     * for '*' key are shown on special character table if also text input modes
       
   270     * are allowed in the editor but the current input mode is numeric mode.
       
   271     * @return Key mapping used in an editor with number input mode.
       
   272     */
       
   273 	IMPORT_C TAknEditorNumericKeymap NumericKeymap() const;
       
   274 
       
   275     /**
       
   276     * Get the cursor or cursor selection within a document.
       
   277     * @return The cursor or cursor selection within a document.
       
   278     */
       
   279 	IMPORT_C TCursorSelection CurrentInlineEditSpan() const;
       
   280 
       
   281     /**
       
   282     * Get control's CBA state.
       
   283     * @return Reference to @c SEditorCbaState struct.
       
   284     */
       
   285 	IMPORT_C SEditorCbaState& CbaState();
       
   286 
       
   287     /**
       
   288     * Get the control's menu bar.
       
   289     * @return A pointer to the control's menu bar.
       
   290     */
       
   291 	IMPORT_C CEikMenuBar* MenuBar() const;
       
   292 
       
   293     /**
       
   294     * Get an interface that provides ccpu (cut, copy, paste and undo) 
       
   295     * functionalities.
       
   296     * @return A pointer to a ccpu interface for this control.
       
   297     */
       
   298 	IMPORT_C MEikCcpuEditor* CcpuState() const;
       
   299 
       
   300     /**
       
   301     * Get control's object provider.
       
   302     * @return A pointer to control's object provider.
       
   303     */
       
   304 	IMPORT_C MObjectProvider* ObjectProvider() const;
       
   305 
       
   306     /**
       
   307     * Get the control's input language.
       
   308     * @return Language identity.
       
   309     */
       
   310 	IMPORT_C TLanguage LocalLanguage() const;
       
   311 
       
   312     /**
       
   313     * Accessor for control's form.
       
   314     * @since Series 60 2.0
       
   315     * @return A pointer to to the form accessor of this control.
       
   316     */
       
   317 	IMPORT_C CAknEdwinFormAccessor* FormAccessor() const;
       
   318 
       
   319 
       
   320 	// Setters
       
   321 
       
   322     /**
       
   323     * Set initial editor flags for the editor.
       
   324     * @param aFlags Avkon editor flags for the editor.
       
   325     */
       
   326 	IMPORT_C void SetFlags(TInt aFlags);
       
   327 
       
   328     /**
       
   329     * Set default input mode for the editor. The input mode is used when 
       
   330     * the editor is focused first time. 
       
   331     * @c EAknEditorTextInputMode is used if the initial input mode is not set 
       
   332     * from EDWIN resource DEFAULT_INPUT_MODE or with this API.
       
   333     * @param aInputMode Initial input mode to be used in the editor.
       
   334     */
       
   335 	IMPORT_C void SetDefaultInputMode(TInt aInputMode);
       
   336 
       
   337     /**
       
   338     * Updates editor input mode. FEP is automatically notified of the
       
   339     * new input mode in editor state and FEP takes new input mode to use 
       
   340     * immediatelly. Current inline editing is reset.
       
   341     * This method should not be used for setting initial input mode for the 
       
   342     * editor. Use @c SetDefaultInputMode() method instead for setting initial
       
   343     * input mode.
       
   344     * @param aInputMode New input mode for the editor.
       
   345     */
       
   346 	IMPORT_C void SetCurrentInputMode(TInt aInputMode);
       
   347 
       
   348     /**
       
   349     * Set permitted input modes for the editor. 
       
   350     * All input modes are allowed ( @c EAknEditorAllInputModes ) if the value 
       
   351     * is not set from EDWIN resource ALLOWED_INPUT_MODES or with this API.
       
   352     * @param aInputModes Input modes that are allowed in the editor.
       
   353     */
       
   354 	IMPORT_C void SetPermittedInputModes(TInt aInputModes);
       
   355 
       
   356     /**
       
   357     * Set default case for the editor. The case is used when the editor
       
   358     * is focused first time. Available case flags from @c uikon.hrh
       
   359     * are @c EAknEditorUpperCase, @c EAknEditorLowerCase and 
       
   360     * @EAknEditorTextCase. @c EAknEditorTextCase is used if the initial case is
       
   361     * not set from EDWIN resource DEFAULT_CASE or with this API.
       
   362     * @param aCase Initial case to be used in the editor.
       
   363     */
       
   364 	IMPORT_C void SetDefaultCase(TInt aCase);
       
   365 
       
   366     /**
       
   367     * Updates editor case. FEP is automatically notified of the
       
   368     * case change in editor state and FEP takes new case to use immediately.
       
   369     * Available case flags from @c uikon.hrh are @c EAknEditorUpperCase, 
       
   370     * @c EAknEditorLowerCase and @c EAknEditorTextCase.
       
   371     * This method should not be used to set initial case for the editor.
       
   372     * Use @c SetDefaultCase() method instead for setting the initial case.
       
   373     * @param aCase New case for the editor.
       
   374     */
       
   375 	IMPORT_C void SetCurrentCase(TInt aCase);
       
   376 
       
   377     /**
       
   378     * Set permitted cases for the editor.
       
   379     * Possible flags from @c uikon.hrh are @c EAknEditorAllCaseModes, 
       
   380     * @c EAknEditorUpperCase,@c EAknEditorLowerCase and @c EAknEditorTextCase.
       
   381     * @c EAknEditorAllCaseModes is used if the value is not set from EDWIN
       
   382     * resource ALLOWED_CASE_MODES or with this API.
       
   383     * @param aCases Case modes that are available in the editor.
       
   384     */
       
   385 	IMPORT_C void SetPermittedCases(TInt aCases);
       
   386 
       
   387     /**
       
   388     * T9 language codes are not anymore supported. Use @c SetLocalLanguage() 
       
   389     * instead.
       
   390     */
       
   391 	IMPORT_C void SetDefaultLanguage(TInt aLanguage);
       
   392 
       
   393     /**
       
   394     * Set editor specific special character table. 
       
   395     * @param aResourceId Special character table dialog resource ID.
       
   396     */
       
   397 	IMPORT_C void SetSpecialCharacterTableResourceId(TInt aResourceId);
       
   398 
       
   399     /**
       
   400     * Set number mode key mapping for '*' and '#' keys. The key mapping is used
       
   401     * in editors when numeric input mode is used. Key mapping characters
       
   402     * for '*' key are shown on special character table if also the text input modes
       
   403     * are allowed in the editor but the current input mode is numeric mode.
       
   404     * @c EAknEditorStandardNumberModeKeymap is used in editors that allow only 
       
   405     * numeric input if the mapping is not set from EDWIN resource NUMERIC_KEYMAP
       
   406     * or with this API. @c EAknEditorAlphanumericNumberModeKeymap is used as 
       
   407     * default if the editor allows also text input mode.
       
   408     * @param aKeymap Key mapping used in an editor with number input mode.
       
   409     */
       
   410 	IMPORT_C void SetNumericKeymap(TAknEditorNumericKeymap aKeymap);
       
   411 
       
   412     /**
       
   413     * Set the cursor or cursor selection within a document.
       
   414     * @param aCurrentInlineEditSpan New cursor or cursor selection within a 
       
   415     * document.
       
   416     */
       
   417 	IMPORT_C void SetInlineEditSpan(TCursorSelection aCurrentInlineEditSpan);
       
   418 
       
   419     /**
       
   420     * Gets the control's button array from object provider and sets the softkey
       
   421     * command id's to 0.
       
   422     */
       
   423 	IMPORT_C void SetCba();
       
   424 
       
   425     /**
       
   426     * Sets the menu bar from the object provider.
       
   427     */
       
   428 	IMPORT_C void SetMenu();
       
   429 
       
   430     /**
       
   431     * Set the object provider for the control.
       
   432     * @param aObjectProvider A pointer to a class that implements an object 
       
   433     * provider.
       
   434     */
       
   435 	IMPORT_C void SetObjectProvider(MObjectProvider* aObjectProvider);
       
   436 
       
   437     /**
       
   438     * Set new local input language for the editor. Global input language
       
   439     * changes have not effect for the input language but the user can still
       
   440     * change the input language from the edit menu.
       
   441     * @param aLanguage Editor local input language.
       
   442     */
       
   443 	IMPORT_C void SetLocalLanguage(TLanguage aLanguage);
       
   444 
       
   445     /**
       
   446     * Set form accessor for this control.
       
   447     * @since Series 60 2.0
       
   448     * @param aFormAccessor Pointer to a form accessor.
       
   449     */
       
   450 	IMPORT_C void SetFormAccessor(CAknEdwinFormAccessor* aFormAccessor);
       
   451 
       
   452 	// non exported setters
       
   453 
       
   454     /**
       
   455     * Set a control that implements ccpu (cut, copy, paste and undo) interface.
       
   456     * @param aCcpuEditor Pointer to a control that implements @c MEikCcpuEditor
       
   457     * interface.
       
   458     */
       
   459 	IMPORT_C void SetCcpuState(MEikCcpuEditor* aCcpuEditor);
       
   460 	
       
   461     /**
       
   462     * Set middle sofkey command id.
       
   463     * @since S60 V3.2
       
   464     * @param aId New middle softkey command id.
       
   465     */
       
   466 	IMPORT_C void SetMiddleSoftkeyCommandId(TInt aCommandId);
       
   467 
       
   468     /**
       
   469     * Return middle sofkey command id.
       
   470     * @since S60 V3.2
       
   471     * @return Current middle softkey command id.
       
   472     */
       
   473 	IMPORT_C TInt MiddleSoftkeyCommandId() const;
       
   474 
       
   475 private:
       
   476 	IMPORT_C void SetCurrentCaseWithNoInitialisation(TInt aCase);
       
   477 	IMPORT_C TAknEditorCaseState& CaseState();
       
   478 
       
   479 private:
       
   480 	void CheckLRCursorAndT9Consistency();
       
   481 
       
   482 private:
       
   483 	friend class CT9FepControl;  // dependency to be removed?
       
   484 	friend class CT9FepCaseManager;  // dependency to be removed?
       
   485 	friend class CAknFepCaseManager;  // dependency to be removed?
       
   486 	friend class CAknFepManager;  // dependency to be removed?
       
   487 
       
   488 private:
       
   489 	TInt iFlags;
       
   490 	TInt iDefaultInputMode;
       
   491 	TInt iCurrentInputMode;
       
   492 	TInt iPermittedInputModes;
       
   493 	
       
   494 	TInt iDefaultCase;
       
   495 	TAknEditorCaseState iCaseState;
       
   496 	TInt iPermittedCases;
       
   497 
       
   498 	TLanguage iLocalLanguage;
       
   499 	TInt iSpecialCharacterTableResourceId;
       
   500 	TAknEditorNumericKeymap iNumericKeymap;
       
   501 	TCursorSelection iCurrentInlineEditSpan;
       
   502 
       
   503 	SEditorCbaState iCbaState;
       
   504 	CEikMenuBar* iMenu;
       
   505 
       
   506 	// to hold c/c/p/u info about an editor
       
   507 	MEikCcpuEditor* iCcpuState;
       
   508 	MObjectProvider* iObjectProvider;
       
   509 
       
   510 	MAknEdStateObserver* iObserver;
       
   511 	CAknEdwinFormAccessor* iFormAccessor;
       
   512 	
       
   513 	TInt iMiddleSoftkeyCommandId;
       
   514 
       
   515     TInt iSpare[3];
       
   516 	};
       
   517 
       
   518 
       
   519 #endif
       
   520 
       
   521 
       
   522 
       
   523 
       
   524