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