|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Bio control for Wap bookmarks and access points. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef CWMLBIOCONTROL_H |
|
22 #define CWMLBIOCONTROL_H |
|
23 |
|
24 // INCLUDES |
|
25 #include "WMLBC.hrh" |
|
26 |
|
27 #include <msgbiocontrol.h> // CMsgBioControl |
|
28 #include <MMsgBioControlExtension.h> // MMsgBioControlExtension; |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 |
|
32 class RMsvReadStream; |
|
33 class CParsedField; |
|
34 class CRichBio; |
|
35 class CWmlStateFactory; |
|
36 class CWmlItemEngine; |
|
37 |
|
38 // CONSTANTS |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 /** |
|
43 * Bio Control for viewing WAP accesspoints, |
|
44 * MMS settings and bookmarks. |
|
45 */ |
|
46 NONSHARABLE_CLASS(CWmlBioControl): public CMsgBioControl, |
|
47 public MMsgBioControlExtension, |
|
48 public MMsgBioControlScrollExtension |
|
49 { |
|
50 |
|
51 public: // Constructor and destructor |
|
52 |
|
53 /** |
|
54 * Two-phased constructor. |
|
55 * |
|
56 * <b>IMPORTANT NOTICE:</b> |
|
57 * This signature must be EXACTLY THIS as |
|
58 * CMsgBioControlFactory::DoCreateControlL uses this function and |
|
59 * <b>EXACTLY THIS SIGNATURE</b> to create the control. |
|
60 * |
|
61 * @param aObserver Reference to the owning editor (normally), so that |
|
62 * control can communicate with it when handling (menu) |
|
63 * commands. |
|
64 * @param aSession Pointer to session in Message Server. |
|
65 * Cannot be NULL for CWmlBioControl. |
|
66 * @param aId Message Server entry ID. |
|
67 * @param aIsEditor Whether the control is part of editor or viewer. |
|
68 * @param aFile Handle to the file resource, not used by WML |
|
69 * @return Pointer to the created CWMLBioControl object. |
|
70 * @exception Leaves if aSession is NULL |
|
71 */ |
|
72 IMPORT_C static CMsgBioControl* NewL( |
|
73 MMsgBioControlObserver& aObserver, |
|
74 CMsvSession* aSession, |
|
75 TMsvId aId, |
|
76 TMsgBioMode aIsEditor, |
|
77 const RFile* aFile); |
|
78 |
|
79 /** |
|
80 * Destructor. |
|
81 */ |
|
82 ~CWmlBioControl(); |
|
83 |
|
84 public: // from MMsgBioControl |
|
85 |
|
86 /** |
|
87 * Calculates and sets size for a Bio control according to aSize. |
|
88 * The height of the Bio control may be less or more than requested by |
|
89 * aSize, but the width must be exactly the same. If width of the Bio |
|
90 * control is not the same as given by aSize, the width must be reset |
|
91 * back to requested one. |
|
92 * @param aSize Size. Set the desired to to the aSize. |
|
93 */ |
|
94 void SetAndGetSizeL( TSize& aSize ); |
|
95 |
|
96 /** |
|
97 * This is called by the container to allow the Bio control to add |
|
98 * a menu item. |
|
99 * @param aMenuPane Reference to the applications menu. |
|
100 */ |
|
101 void SetMenuCommandSetL( CEikMenuPane& aMenuPane ); |
|
102 |
|
103 /** |
|
104 * The command handler. The Bio Control should only handle its own |
|
105 * commands that it has set using the function SetMenuCommandSetL(). |
|
106 * @param aCommand ID of command to be handled. |
|
107 * @return If the command is handled, it returns ETrue, and vice versa |
|
108 */ |
|
109 TBool HandleBioCommandL(TInt aCommand); |
|
110 |
|
111 /** |
|
112 * Returns a rectangle slice of the bio controls viewing area. |
|
113 * It is used by the CMsgEditorView class for scrolling the screen. |
|
114 * @return The position relative to the bio control's top left corner |
|
115 */ |
|
116 TRect CurrentLineRect() const; |
|
117 |
|
118 /** |
|
119 * Returns true if Focus change is possible down or up from this |
|
120 * from this control. |
|
121 * @param aDirection whether to query possibility to go up or down. |
|
122 * @return possibility to change the focus, ETrue or EFalse. |
|
123 */ |
|
124 TBool IsFocusChangePossible( TMsgFocusDirection aDirection ) const; |
|
125 |
|
126 /** |
|
127 * The container application obtains a header text from the |
|
128 * bio control. |
|
129 * @return Pointer to the buffer containing the header text. |
|
130 * Ownership is passed to the container. |
|
131 */ |
|
132 HBufC* HeaderTextL() const; |
|
133 |
|
134 /** |
|
135 * The application can get the option menu permissions using this |
|
136 * function. |
|
137 * @return The option menu permission flags. If the flag is off it |
|
138 * means that the option menu command is not recommended with this |
|
139 * Bio Control. |
|
140 */ |
|
141 TUint32 OptionMenuPermissionsL() const; |
|
142 |
|
143 /** |
|
144 * Get the virtual height of the control's content. |
|
145 * @return virtual height in pixels. |
|
146 */ |
|
147 TInt VirtualHeight(); |
|
148 |
|
149 /** |
|
150 * Get the position of invinsible cursor. |
|
151 * @return cursor position in pixels. |
|
152 */ |
|
153 TInt VirtualVisibleTop(); |
|
154 |
|
155 /** |
|
156 * Check if the cursor location is desired. |
|
157 * @param aLocation Desired cursor location. |
|
158 * @return ETrue if the cursor location is desired, |
|
159 * EFalse otherwise. |
|
160 */ |
|
161 TBool IsCursorLocation(TMsgCursorLocation aLocation) const; |
|
162 |
|
163 public: // from CCoeControl |
|
164 |
|
165 /** |
|
166 * Forwards key event to the correct child control. |
|
167 * @param aKeyEvent event from the parent. |
|
168 * @param aType event type. |
|
169 * @return EKeyWasConsumed if key was used, EKeyWasNotConsumed if not. |
|
170 */ |
|
171 TKeyResponse OfferKeyEventL( |
|
172 const TKeyEvent& aKeyEvent, |
|
173 TEventCode aType ); |
|
174 |
|
175 /** |
|
176 * Returns a control's a context sensitive help. |
|
177 * @param aHelpContext Help context. |
|
178 */ |
|
179 void GetHelpContext(TCoeHelpContext& aHelpContext) const; |
|
180 |
|
181 /** |
|
182 * Handles resource change events. |
|
183 */ |
|
184 void HandleResourceChange( TInt aType ); |
|
185 |
|
186 public: //from MMsgBioControlExtension |
|
187 |
|
188 TAny* BioControlExtension( TInt aExtensionId ); |
|
189 |
|
190 public: //from MMsgBioControlScrollExtension |
|
191 |
|
192 TInt ExtScrollL( TInt aPixelsToScroll, TMsgScrollDirection aDirection ); |
|
193 |
|
194 void ExtNotifyViewEvent( TMsgViewEvent aEvent, TInt aParam ); |
|
195 |
|
196 protected: // from CCoeControl |
|
197 |
|
198 /** |
|
199 * Get the count of the child controls. |
|
200 * @return Count of controls in this component. |
|
201 */ |
|
202 TInt CountComponentControls() const; |
|
203 |
|
204 /** |
|
205 * Get the pointer to the specified child control. |
|
206 * @param aIndex index of desired control. |
|
207 * @return pointer to component in question. |
|
208 */ |
|
209 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
210 |
|
211 /** |
|
212 * Called when size is changed. |
|
213 */ |
|
214 void SizeChanged(); |
|
215 |
|
216 /** |
|
217 * Called when focus is changed. |
|
218 * @param aDrawNow Flag for immediate update of screen (ignored). |
|
219 */ |
|
220 void FocusChanged( TDrawNow aDrawNow ); |
|
221 |
|
222 /** |
|
223 * Called when the component is created to set the parent window |
|
224 * component. |
|
225 * @param aContainer parent control. |
|
226 */ |
|
227 void SetContainerWindowL( const CCoeControl& aContainer ); |
|
228 |
|
229 private: // New |
|
230 |
|
231 /** |
|
232 * Constructor, hidden away from outsiders. |
|
233 */ |
|
234 CWmlBioControl(); |
|
235 |
|
236 /** |
|
237 * ConstuctL creates all the instances needed. |
|
238 */ |
|
239 void ConstructL(); |
|
240 |
|
241 /** |
|
242 * Constructor sets up member variables. |
|
243 * @param aObserver Reference to the owning editor (normally), so that |
|
244 * control can communicate with it when handling (menu) |
|
245 * commands. |
|
246 * @param aSession Pointer to session in Message Server. |
|
247 * Cannot be NULL for CWmlBioControl. |
|
248 * @param aId Message Server entry ID. |
|
249 * @param aIsEditor Whether the control is part of editor or viewer. |
|
250 * @param aFileName Name of the file if control is file based. Not used |
|
251 * for WML. |
|
252 */ |
|
253 CWmlBioControl( |
|
254 MMsgBioControlObserver& aObserver, |
|
255 CMsvSession* aSession, |
|
256 TMsvId aId, |
|
257 TMsgBioMode aIsEditor, |
|
258 const RFile* aFile); |
|
259 |
|
260 /** |
|
261 * Copy constructor |
|
262 * NOT USED, hidden from outsiders |
|
263 */ |
|
264 CWmlBioControl( const CWmlBioControl& aSource ); |
|
265 |
|
266 /** |
|
267 * Operator = |
|
268 * NOT USED, hidden from outsiders |
|
269 */ |
|
270 const CWmlBioControl& operator=( const CWmlBioControl& aSource ); |
|
271 |
|
272 private: // New |
|
273 |
|
274 /** |
|
275 * Read the data from the store. |
|
276 * @param aId Message server entry id. |
|
277 * @return a pointer to the array containing read obejcts. |
|
278 */ |
|
279 CArrayPtrSeg<CParsedField>* ReadStoreLC( |
|
280 const TMsvId aId ); |
|
281 |
|
282 /** |
|
283 * Read WAP Parser output into the iParsedFieldArray. |
|
284 * @param aReadStream reference to the opened readstream containing data. |
|
285 * @return pointer to the array containing the read objects. |
|
286 */ |
|
287 static CArrayPtrSeg<CParsedField>* InternalizeFieldDataL( |
|
288 RMsvReadStream& aReadStream ); |
|
289 |
|
290 /** |
|
291 * Updates the header text if necessary. |
|
292 */ |
|
293 void UpdateHeaderTextL() const; |
|
294 |
|
295 protected: // Data |
|
296 |
|
297 /// Richbio for displaying the received WAP APs/bookmarks. |
|
298 CRichBio* iRichBio; |
|
299 |
|
300 /// State factory object, owned. |
|
301 CWmlStateFactory* iStateFactory; |
|
302 |
|
303 private: |
|
304 |
|
305 /// Pointer to the CWmlItemEngine. |
|
306 CWmlItemEngine* iItemEngine; |
|
307 |
|
308 protected: // friend declarations |
|
309 |
|
310 /** |
|
311 * This class contains multiple states and |
|
312 * state pattern is used to control the transitions |
|
313 * between the states. States are defined friend classes |
|
314 * so that it's not needed to export the interface needed |
|
315 * to access all necessary information. |
|
316 */ |
|
317 friend class CWmlStateFactory; |
|
318 friend class CWmlState; |
|
319 friend class CWmlStateSingle; |
|
320 }; |
|
321 |
|
322 #endif // CWMLBIOCONTROL_H |
|
323 |
|
324 // End of file |