2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Data structures to store current state of case
21 #if !defined(__EIKEDSTS_H__)
22 #define __EIKEDSTS_H__
24 #if !defined(__FEPBASE_H__)
28 #if !defined(__AKNEDSTSOBS_H__)
29 #include <aknedstsobs.h>
32 #if !defined(__UIKON_HRH__)
43 * Data structure to store current state of case modes.
45 * Data structure to hold the current state of all case state
46 * information currently held by the fep and applicable to an
49 * @since Series 60 0.9
51 class TAknEditorCaseState
55 * Flags that indicate states of the case.
59 /** Has text been entered with current case. */
60 EFlagTextEnteredInCurrentCase =0x00000001,
62 /** Initialisation is required. */
63 EFlagInitialiseRequired =0x00000002,
65 /** Supress case's automatic update. */
66 EFlagSupressAutoUpdateCase =0x00000004
72 * C++ default constructor.
74 IMPORT_C TAknEditorCaseState();
78 * @param aCase A new case.
80 IMPORT_C void SetCurrentCase(TUint aCase);
84 * @param aCase a Previously used case.
86 IMPORT_C void SetPreviousCase(TUint aCase);
89 * Sets previous case used to enter text.
90 * @param aCase Previously used case to enter text.
92 IMPORT_C void SetPreviousCaseUsedToEnterText(TUint aCase);
97 * @return The current case.
99 IMPORT_C TUint CurrentCase() const;
102 * Gets previous case.
103 * @return The previous case.
105 IMPORT_C TUint PreviousCase() const;
108 * Gets previous case used to enter text.
109 * @return The previous case used to enter text.
111 IMPORT_C TUint PreviousCaseUsedToEnterText() const;
117 * @param aFlag a Flag to be set.
119 IMPORT_C void SetFlag(TCaseStateFlags aFlag);
122 * Clear the given flag.
123 * @param aFlag a Flag to be cleared.
125 IMPORT_C void ClearFlag(TCaseStateFlags aFlag);
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.
132 IMPORT_C TBool IsFlagSet(TCaseStateFlags aFlag) const;
136 TUint8 iPreviousCase;
137 TUint8 iPreviousCaseUsedToEnterText;
144 // FORWARD DECLERATIONS
145 class MEikCcpuEditor;
146 class CEikButtonGroupContainer;
148 class MObjectProvider;
149 class CAknEdwinFormAccessor;
154 * Stores the (FEP) states of editor controls.
155 * @since Series 60 0.9
157 class CAknEdwinState : public MCoeFepAwareTextEditor_Extension1::CState
161 * Control's button array and softkey command id's.
163 struct SEditorCbaState
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;
177 virtual ~CAknEdwinState();
181 * @param aCcpuState Pointer to a control that implements @c MEikCcpuEditor
185 CAknEdwinState(MEikCcpuEditor* aCcpuState);
188 * C++ default constructor.
190 IMPORT_C CAknEdwinState();
194 * Sets an observer for this control.
195 * @param aObserver Pointer to an observer.
197 IMPORT_C void SetObserver(MAknEdStateObserver* aObserver);
200 * From @c MAknEdStateObserver. Sends an state event to control's observer.
201 * @param aEventType Event type.
203 IMPORT_C void ReportAknEdStateEventL(
204 MAknEdStateObserver::EAknEdwinStateEvent aEventType);
210 * Returns control's flags.
213 IMPORT_C TInt Flags() const;
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.
220 IMPORT_C TInt DefaultInputMode() const;
223 * Get current input mode for the editor.
224 * @return Current input mode used in the editor.
226 IMPORT_C TInt CurrentInputMode() const;
229 * Get permitted input modes for the editor.
230 * @return Input modes that are allowed in the editor.
232 IMPORT_C TInt PermittedInputModes() const;
235 * Get default case for the editor. The case is used when the editor
236 * is focused first time.
237 * @return Default character case.
239 IMPORT_C TInt DefaultCase() const;
242 * Get current character case for the editor.
243 * @return Current character case.
245 IMPORT_C TInt CurrentCase() const;
248 * Get permitted cases for the editor.
249 * @return Case modes that are permitted in the editor.
251 IMPORT_C TInt PermittedCases() const;
254 * T9 language codes are not anymore supported, use @c LocalLanguage()
258 IMPORT_C TInt DefaultLanguage() const;
261 * Get editor specific special character table resource ID.
262 * @return Special character table dialog resource ID.
264 IMPORT_C TInt SpecialCharacterTableResourceId() const;
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.
273 IMPORT_C TAknEditorNumericKeymap NumericKeymap() const;
276 * Get the cursor or cursor selection within a document.
277 * @return The cursor or cursor selection within a document.
279 IMPORT_C TCursorSelection CurrentInlineEditSpan() const;
282 * Get control's CBA state.
283 * @return Reference to @c SEditorCbaState struct.
285 IMPORT_C SEditorCbaState& CbaState();
288 * Get the control's menu bar.
289 * @return A pointer to the control's menu bar.
291 IMPORT_C CEikMenuBar* MenuBar() const;
294 * Get an interface that provides ccpu (cut, copy, paste and undo)
296 * @return A pointer to a ccpu interface for this control.
298 IMPORT_C MEikCcpuEditor* CcpuState() const;
301 * Get control's object provider.
302 * @return A pointer to control's object provider.
304 IMPORT_C MObjectProvider* ObjectProvider() const;
307 * Get the control's input language.
308 * @return Language identity.
310 IMPORT_C TLanguage LocalLanguage() const;
313 * Accessor for control's form.
314 * @since Series 60 2.0
315 * @return A pointer to to the form accessor of this control.
317 IMPORT_C CAknEdwinFormAccessor* FormAccessor() const;
323 * Set initial editor flags for the editor.
324 * @param aFlags Avkon editor flags for the editor.
326 IMPORT_C void SetFlags(TInt aFlags);
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.
335 IMPORT_C void SetDefaultInputMode(TInt aInputMode);
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
344 * @param aInputMode New input mode for the editor.
346 IMPORT_C void SetCurrentInputMode(TInt aInputMode);
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.
354 IMPORT_C void SetPermittedInputModes(TInt aInputModes);
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.
364 IMPORT_C void SetDefaultCase(TInt aCase);
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.
375 IMPORT_C void SetCurrentCase(TInt aCase);
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.
385 IMPORT_C void SetPermittedCases(TInt aCases);
388 * T9 language codes are not anymore supported. Use @c SetLocalLanguage()
391 IMPORT_C void SetDefaultLanguage(TInt aLanguage);
394 * Set editor specific special character table.
395 * @param aResourceId Special character table dialog resource ID.
397 IMPORT_C void SetSpecialCharacterTableResourceId(TInt aResourceId);
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.
410 IMPORT_C void SetNumericKeymap(TAknEditorNumericKeymap aKeymap);
413 * Set the cursor or cursor selection within a document.
414 * @param aCurrentInlineEditSpan New cursor or cursor selection within a
417 IMPORT_C void SetInlineEditSpan(TCursorSelection aCurrentInlineEditSpan);
420 * Gets the control's button array from object provider and sets the softkey
423 IMPORT_C void SetCba();
426 * Sets the menu bar from the object provider.
428 IMPORT_C void SetMenu();
431 * Set the object provider for the control.
432 * @param aObjectProvider A pointer to a class that implements an object
435 IMPORT_C void SetObjectProvider(MObjectProvider* aObjectProvider);
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.
443 IMPORT_C void SetLocalLanguage(TLanguage aLanguage);
446 * Set form accessor for this control.
447 * @since Series 60 2.0
448 * @param aFormAccessor Pointer to a form accessor.
450 IMPORT_C void SetFormAccessor(CAknEdwinFormAccessor* aFormAccessor);
452 // non exported setters
455 * Set a control that implements ccpu (cut, copy, paste and undo) interface.
456 * @param aCcpuEditor Pointer to a control that implements @c MEikCcpuEditor
459 IMPORT_C void SetCcpuState(MEikCcpuEditor* aCcpuEditor);
462 * Set middle sofkey command id.
464 * @param aId New middle softkey command id.
466 IMPORT_C void SetMiddleSoftkeyCommandId(TInt aCommandId);
469 * Return middle sofkey command id.
471 * @return Current middle softkey command id.
473 IMPORT_C TInt MiddleSoftkeyCommandId() const;
476 IMPORT_C void SetCurrentCaseWithNoInitialisation(TInt aCase);
477 IMPORT_C TAknEditorCaseState& CaseState();
480 void CheckLRCursorAndT9Consistency();
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?
490 TInt iDefaultInputMode;
491 TInt iCurrentInputMode;
492 TInt iPermittedInputModes;
495 TAknEditorCaseState iCaseState;
496 TInt iPermittedCases;
498 TLanguage iLocalLanguage;
499 TInt iSpecialCharacterTableResourceId;
500 TAknEditorNumericKeymap iNumericKeymap;
501 TCursorSelection iCurrentInlineEditSpan;
503 SEditorCbaState iCbaState;
506 // to hold c/c/p/u info about an editor
507 MEikCcpuEditor* iCcpuState;
508 MObjectProvider* iObjectProvider;
510 MAknEdStateObserver* iObserver;
511 CAknEdwinFormAccessor* iFormAccessor;
513 TInt iMiddleSoftkeyCommandId;