|
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: |
|
15 * MMS Viewer Document class |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef MMSVIEWERDOCUMENT_H |
|
22 #define MMSVIEWERDOCUMENT_H |
|
23 |
|
24 |
|
25 // INCLUDES |
|
26 #include <gmxmlparser.h> |
|
27 #include <gmxmldocument.h> |
|
28 #include <msvapi.h> // CMsvEntry |
|
29 #include <MsgEditorDocument.h> // CMsgEditorDocument |
|
30 #include <mmsclient.h> |
|
31 #include <unidatamodel.h> // ->SmilModel() |
|
32 #include <unismillist.h> |
|
33 #include <unidatautils.h> |
|
34 #include <unismilmodel.h> |
|
35 #include <uniobject.h> |
|
36 #include "MmsMtmUi.h" // IsUpload() |
|
37 |
|
38 #include <mmsvattachmentmanager.h> |
|
39 |
|
40 // CONSTANTS |
|
41 _LIT( KUniUtilsMbmFile, "uniutils.mbm" ); |
|
42 |
|
43 // MACROS |
|
44 |
|
45 // DATA TYPES |
|
46 |
|
47 enum TMmsFeatures |
|
48 { |
|
49 EMmsFeatureHelp = 0x0001, |
|
50 EMmsFeatureDrmFull = 0x0002, |
|
51 EMmsFeatureSVK = 0x0004, |
|
52 EMmsFeatureUpload = 0x0008, |
|
53 EMmsFeatureDeliveryStatus = 0x0010, |
|
54 EMmsFeatureAudioMessaging = 0x0020, |
|
55 EMmsFeatureRestrictedReply = 0x0040 |
|
56 }; |
|
57 |
|
58 |
|
59 // FUNCTION PROTOTYPES |
|
60 |
|
61 // FORWARD DECLARATIONS |
|
62 class CMsvAttachment; |
|
63 class CMmsClientMtm; |
|
64 class CMmsMtmUi; |
|
65 class RFs; |
|
66 |
|
67 |
|
68 // CLASS DECLARATION |
|
69 |
|
70 class MMmsDocumentObserver |
|
71 { |
|
72 public: |
|
73 virtual void InitializeReady( TInt aParseResult, TInt aError ) = 0; |
|
74 }; |
|
75 |
|
76 /** |
|
77 * CMmsViewerDocument, base class for editor and viewer application document |
|
78 * classes. The document is part of the Symbian OS application framework. |
|
79 */ |
|
80 class CMmsViewerDocument : public CMsgEditorDocument, |
|
81 public MUniDataModelObserver |
|
82 |
|
83 { |
|
84 public: // Constructors and destructor |
|
85 |
|
86 /** |
|
87 * Two-phased constructor. |
|
88 * @param aApp A CEikApplication reference |
|
89 */ |
|
90 static CMmsViewerDocument* NewL( CEikApplication& aApp ); |
|
91 |
|
92 /** |
|
93 * Destructor. |
|
94 */ |
|
95 virtual ~CMmsViewerDocument(); |
|
96 |
|
97 public: // New functions |
|
98 |
|
99 /** |
|
100 * InitializeL |
|
101 * Load attachments info from store to attachment array |
|
102 */ |
|
103 void InitializeL( MMmsDocumentObserver& aObserver ); |
|
104 |
|
105 /** |
|
106 * MessageSize |
|
107 * Calculates message size according to TS 23.140 v5.5.0. |
|
108 * @return size in bytes |
|
109 */ |
|
110 TInt MessageSize( ); |
|
111 |
|
112 /** |
|
113 * Checks whether the message is generated from a received error response. |
|
114 * A message is considered "error response message" if it does not have any |
|
115 * files but does have an error response text. |
|
116 * |
|
117 * Notice: This method must not be called before InitializeL. |
|
118 * |
|
119 * @return ETrue, message is an "error response message" |
|
120 * EFalse, message is an ordinary message. |
|
121 */ |
|
122 TBool ErrorResponseMessage(); |
|
123 |
|
124 |
|
125 public: // Virtuals from CMsgEditorDocument |
|
126 |
|
127 /** |
|
128 * DefaultMsgFolder |
|
129 * Returns default folder for new messages. |
|
130 * @return ID of the Drafts folder. |
|
131 */ |
|
132 TMsvId DefaultMsgFolder() const; |
|
133 |
|
134 /** |
|
135 * DefaultMsgService |
|
136 * From CMsgEditorDocument |
|
137 * Returns default message service used by application |
|
138 * @return TMsvId KMsvLocalServiceIndexEntryId. |
|
139 */ |
|
140 TMsvId DefaultMsgService() const; |
|
141 |
|
142 /** |
|
143 * EntryChangedL |
|
144 * From CMsgEditorDocument |
|
145 * Called after entry is changed by BaseEditor SetEntry Function. |
|
146 * From MsgEditorDocument |
|
147 */ |
|
148 void EntryChangedL(); |
|
149 |
|
150 public: // From CMsgEditorDocument |
|
151 |
|
152 /* |
|
153 * Mtm |
|
154 * Accessor (Overrides baseeditor) |
|
155 * Returns CMmsClientMtm reference correctly casted from CBaseMtm |
|
156 * @param None |
|
157 * @return Reference to documents CMmsClientMtm |
|
158 */ |
|
159 CMmsClientMtm& Mtm(); |
|
160 |
|
161 /* |
|
162 * MtmUiL |
|
163 * Accessor (Overrides baseeditor) |
|
164 * Returns CMmsMtmUi reference correctly casted from CBaseMtmUi |
|
165 * @param None |
|
166 * @return Reference to documents CMmsMtmUi |
|
167 */ |
|
168 CMmsMtmUi& MtmUiL(); |
|
169 |
|
170 public: // From MMsgAttachmentModelObserver |
|
171 |
|
172 /** |
|
173 * From MMsgAttachmentModelObserver |
|
174 */ |
|
175 RFile GetAttachmentFileL( TMsvAttachmentId aId ); |
|
176 |
|
177 public: |
|
178 |
|
179 /** |
|
180 * ParseFileCompleteL |
|
181 * Call back function used to inform client of Parser when RunL function completes |
|
182 */ |
|
183 void ParseFileCompleteL(); |
|
184 |
|
185 public: // inlines |
|
186 |
|
187 /** |
|
188 * DataModel |
|
189 * Accessor. |
|
190 * Get handle to container class CUniDataUtils that owns instances |
|
191 * of CMsgMediaResolver, CMmsConformance, CUniDataUtils, CUniObjectList, |
|
192 * CUniSmilList and CUniSmilModelDataModel |
|
193 * @return reference to uni data utils |
|
194 */ |
|
195 inline CUniDataModel& DataModel( ) const; |
|
196 |
|
197 /** |
|
198 * Current slide of the model where document is indexing. |
|
199 * @return Index of the current slide. |
|
200 */ |
|
201 inline TInt CurrentSlide(); |
|
202 |
|
203 /** |
|
204 * Sets current slide of the message. |
|
205 * @param aSlideNum - Index of the slide. |
|
206 */ |
|
207 inline void SetCurrentSlide( TInt aSlideNum ); |
|
208 |
|
209 /** |
|
210 * Returns SMIL type of the message. |
|
211 * @return Possible return values are: |
|
212 * -EMmsSmil |
|
213 * -ETemplateSmil |
|
214 * -E3GPPSmil |
|
215 * ( - ENoSmil is mapped to EMmsSmil = |
|
216 * ( - EMultipleSmil is mapped to EMmsSmil ) |
|
217 */ |
|
218 inline TUniSmilType SmilType(); |
|
219 |
|
220 /** |
|
221 * SmilModel |
|
222 * Accessor. |
|
223 * Get handle to smilmodel |
|
224 * @return reference to smilmodel |
|
225 */ |
|
226 inline CUniSmilModel* SmilModel() const; |
|
227 |
|
228 /** |
|
229 * DataUtils |
|
230 * Accessor. |
|
231 * Get handle to to msicellaneous utility functions of CUnitDataUtils |
|
232 * @return reference to uni data utils |
|
233 */ |
|
234 inline CUniDataUtils* DataUtils() const; |
|
235 |
|
236 /** |
|
237 * Returns object list owned by the model. Object list includes all |
|
238 * attachments that are referenced from the SMIL part (or if there is no |
|
239 * SMIL part attachments that are of supported media type). |
|
240 * |
|
241 * @return reference to the object list. |
|
242 */ |
|
243 inline CUniObjectList* ObjectList() const; |
|
244 |
|
245 /** |
|
246 * Returns attachment list owned by the model. Attachment list includes all |
|
247 * attachments that are NOT referenced from the SMIL part. |
|
248 * |
|
249 * @return reference to the attachment list. |
|
250 */ |
|
251 inline CUniObjectList* AttachmentList() const; |
|
252 |
|
253 /** |
|
254 * Returns SMIL list owned by the model. SMIL list includes all |
|
255 * attachments that are of type "application/smil". |
|
256 * |
|
257 * @return reference to the SMIL attachment list. |
|
258 */ |
|
259 inline CUniSmilList* SmilList() const; |
|
260 |
|
261 /* |
|
262 * Accessor |
|
263 * |
|
264 * @return creation mode |
|
265 */ |
|
266 inline TInt CreationMode() const; |
|
267 |
|
268 /* |
|
269 * Accessor |
|
270 * |
|
271 * @return maximum message size in bytes |
|
272 */ |
|
273 inline TUint32 MaxMessageSize() const; |
|
274 |
|
275 /* |
|
276 * Accessor |
|
277 * |
|
278 * @return parse result from CUniSmilModel::ParseL() |
|
279 */ |
|
280 inline TInt ParseResult() const; |
|
281 |
|
282 /** |
|
283 * Check if the message is an "MMS Upload" message |
|
284 * |
|
285 * @return ETrue, message is an "MMS Upload" message |
|
286 * EFalse, otherwise |
|
287 */ |
|
288 inline TBool IsUpload() const; |
|
289 |
|
290 inline RFile GetAttachmentFileL( CUniObject& aUniObject ); |
|
291 |
|
292 /* |
|
293 * New function added to avoid problem in deleting message |
|
294 * with drm protected image. |
|
295 * Be careful to call this function. Viewer application should |
|
296 * be in the very end of its life span. |
|
297 */ |
|
298 inline void DeleteModel( ); |
|
299 |
|
300 protected: // From CMsgEditorDocument |
|
301 |
|
302 /** |
|
303 * Creates new attachment model object. |
|
304 * From CMsgEditorDocument |
|
305 */ |
|
306 CMsgAttachmentModel* CreateNewAttachmentModelL( TBool aReadOnly ); |
|
307 |
|
308 /** |
|
309 * CreateNewL |
|
310 * From CMsgEditorDocument |
|
311 * Needs to be implemented but not in use in mms viewer |
|
312 */ |
|
313 TMsvId CreateNewL(TMsvId aService, TMsvId aDestFolder); |
|
314 |
|
315 protected: // New functions |
|
316 |
|
317 /** |
|
318 * C++ constructor. |
|
319 * @param aApp A CEikApplication reference |
|
320 */ |
|
321 CMmsViewerDocument( CEikApplication& aApp ); |
|
322 |
|
323 /** |
|
324 * By default Symbian OS constructor is private. |
|
325 */ |
|
326 void ConstructL(); |
|
327 |
|
328 /** |
|
329 * Creates a new CMmsTestViewreAppUi |
|
330 * @return a pointer to CMmsViewerAppUi |
|
331 */ |
|
332 CEikAppUi* CreateAppUiL(); |
|
333 |
|
334 /** |
|
335 * To prevent default-constructor... |
|
336 */ |
|
337 CMmsViewerDocument( ); |
|
338 |
|
339 /*** |
|
340 * From MUniDataModelObserver |
|
341 */ |
|
342 void RestoreReady( TInt aParseResult, TInt aError ); |
|
343 |
|
344 private: // New Functions |
|
345 |
|
346 protected: // data |
|
347 |
|
348 RFs iFs; |
|
349 CUniDataModel* iDataModel; |
|
350 |
|
351 TUniSmilType iSmilType; |
|
352 TInt iCurrentSlide; |
|
353 TUint32 iMaxMessageSize; |
|
354 TInt iCreationMode; |
|
355 TInt iOrigAttachmentCount; |
|
356 |
|
357 MMmsDocumentObserver* iObserver; |
|
358 TInt iParseResult; |
|
359 }; |
|
360 |
|
361 #include "UniMmsViewerDocument.inl" |
|
362 |
|
363 #endif // MMSVIEWERDOCUMENT_H |
|
364 |
|
365 // End of file |