|
1 /* |
|
2 * Copyright (c) 2002-2006 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: MsgBodyControlEditor declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CMSGBODYCONTROLEDITOR_H |
|
21 #define CMSGBODYCONTROLEDITOR_H |
|
22 |
|
23 // ========== INCLUDE FILES ================================ |
|
24 |
|
25 #include <ItemFinder.h> |
|
26 #include <itemfinderobserver.h> |
|
27 #include "MsgExpandableControlEditor.h" // for CMsgExpandableControlEditor |
|
28 #include "MsgEditor.hrh" |
|
29 |
|
30 // ========== CONSTANTS ==================================== |
|
31 |
|
32 // ========== MACROS ======================================= |
|
33 |
|
34 // ========== DATA TYPES =================================== |
|
35 |
|
36 // ========== FUNCTION PROTOTYPES ========================== |
|
37 |
|
38 // ========== FORWARD DECLARATIONS ========================= |
|
39 class CMsgEditorCustomDraw; |
|
40 |
|
41 // ========== CLASS DECLARATION ============================ |
|
42 |
|
43 |
|
44 /** |
|
45 * Defines an editor for the body control. |
|
46 */ |
|
47 class CMsgBodyControlEditor : public CMsgExpandableControlEditor, |
|
48 public MItemFinderObserver, |
|
49 public MAknItemFinderObserver |
|
50 { |
|
51 public: |
|
52 |
|
53 /** |
|
54 * Constructor. |
|
55 * @param aFlags |
|
56 */ |
|
57 CMsgBodyControlEditor( |
|
58 const CCoeControl* aParent, |
|
59 TUint32& aFlags, |
|
60 MMsgBaseControlObserver* aBaseControlObserver ); |
|
61 |
|
62 /** |
|
63 * Destructor. |
|
64 */ |
|
65 virtual ~CMsgBodyControlEditor(); |
|
66 |
|
67 /** |
|
68 * 2nd phase constructor. |
|
69 */ |
|
70 void ConstructL(); |
|
71 |
|
72 /** |
|
73 * Calculates and sets the size of the control and returns new size as reference aSize. |
|
74 * @param aSize |
|
75 */ |
|
76 void SetAndGetSizeL( TSize& aSize ); |
|
77 |
|
78 /** |
|
79 * Inserts a character to the editor. |
|
80 * @param aCharacter |
|
81 */ |
|
82 void InsertCharacterL( const TChar& aCharacter ); |
|
83 |
|
84 /** |
|
85 * Inserts text to the editor. |
|
86 * @param aText |
|
87 */ |
|
88 void InsertTextL( const TDesC& aText ); |
|
89 |
|
90 /** |
|
91 * Prepares focus transition. |
|
92 */ |
|
93 void PrepareFocusTransition(); |
|
94 |
|
95 public: // from CMsgExpandableControlEditor |
|
96 |
|
97 /** |
|
98 * Checks if the cursor is on the last line. |
|
99 * @return |
|
100 */ |
|
101 TBool CursorInLastLine(); |
|
102 |
|
103 /** |
|
104 * Reads layout data from "LAF". |
|
105 */ |
|
106 void ResolveLayouts(); |
|
107 |
|
108 /** |
|
109 * Sets text format. |
|
110 */ |
|
111 void LayoutEdwin(); |
|
112 |
|
113 /** |
|
114 * Sets the currently applicable text skin color ID. |
|
115 * Overwrites expandable editor behaviour and sets |
|
116 * only single text color independent of the control state. |
|
117 */ |
|
118 void SetTextSkinColorIdL(); |
|
119 |
|
120 /** |
|
121 * For handling dynamic layout switch. |
|
122 */ |
|
123 void HandleResourceChange( TInt aType ); |
|
124 |
|
125 /** |
|
126 * Preparing for readonly/ viewers |
|
127 */ |
|
128 void PrepareForReadOnlyL( TBool aReadOnly ); |
|
129 |
|
130 public: // from CEikRichTextEditor |
|
131 |
|
132 /** |
|
133 * Handles key events. |
|
134 * @param aKeyEvent |
|
135 * @param aType |
|
136 * @return |
|
137 */ |
|
138 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
139 |
|
140 /** |
|
141 * From CCoeControl. See coecntrl.h |
|
142 */ |
|
143 void HandlePointerEventL( const TPointerEvent& aPointerEvent ); |
|
144 |
|
145 public: // from MItemFinderObserver |
|
146 |
|
147 void HandleParsingComplete(); |
|
148 |
|
149 public: // from MAknItemFinderObserver |
|
150 |
|
151 void HandleFindItemEventL( |
|
152 const CItemFinder::CFindItemExt& aItem, |
|
153 MAknItemFinderObserver::TEventFlag aEvent, |
|
154 TUint aFlags = 0 ); |
|
155 |
|
156 public: // new |
|
157 |
|
158 /** |
|
159 * |
|
160 */ |
|
161 TBool IsFocusChangePossibleL( TMsgFocusDirection aDirection ); |
|
162 |
|
163 /** |
|
164 * Should be called when focus is changed to body. |
|
165 * @param aBeginning: ETrue if search started from the beginning of the body text, EFalse if from the end |
|
166 */ |
|
167 void SetupAutomaticFindAfterFocusChangeL( TBool aBeginning ); |
|
168 |
|
169 protected: // new |
|
170 |
|
171 /** |
|
172 * |
|
173 */ |
|
174 void SetHighlightL( TInt aCursorPos, TMsgFocusDirection aDirection, TBool aInit = EFalse ); |
|
175 |
|
176 private: // from CCoeControl |
|
177 |
|
178 /** |
|
179 * |
|
180 */ |
|
181 void ActivateL(); |
|
182 |
|
183 private: |
|
184 |
|
185 /** |
|
186 * Constructor (not available). |
|
187 */ |
|
188 CMsgBodyControlEditor(); |
|
189 |
|
190 /** |
|
191 * Performs parsing complete handling. |
|
192 */ |
|
193 void DoHandleParsingCompleteL(); |
|
194 |
|
195 private: |
|
196 |
|
197 TBool iTextParsed; |
|
198 TBool iFocusChangedBeforeParseFinish; |
|
199 TBool iInitTop; // ETrue if start from top, EFalse if bottom |
|
200 |
|
201 CMsgEditorCustomDraw* iCustomDraw; |
|
202 |
|
203 TInt iPreviousItemStart; |
|
204 TInt iPreviousItemLength; |
|
205 }; |
|
206 |
|
207 #endif // CMSGBODYCONTROLEDITOR_H |
|
208 |
|
209 // End of File |