|
1 /* |
|
2 * Copyright (c) 2006,2007 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: CUniEditorOperation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __UNIEDITOROPERATION_H |
|
21 #define __UNIEDITOROPERATION_H |
|
22 |
|
23 // INCLUDES |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <f32file.h> |
|
27 |
|
28 #include "UniEditorDocument.h" |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 // MACROS |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 |
|
36 // DATA TYPES |
|
37 |
|
38 enum TUniEditorOperationType |
|
39 { |
|
40 EUniEditorOperationChangeSlide, |
|
41 EUniEditorOperationInsert, |
|
42 EUniEditorOperationLaunch, |
|
43 EUniEditorOperationPreview, |
|
44 EUniEditorOperationSave, |
|
45 EUniEditorOperationProcessImage, |
|
46 EUniEditorOperationSend, |
|
47 EUniEditorOperationSendUi, |
|
48 EUniEditorOperationSetSender, |
|
49 EUniEditorOperationVCard, |
|
50 EUniEditorOperationConvertVideo, |
|
51 EUniEditorOperationProcessText |
|
52 }; |
|
53 |
|
54 enum TUniEditorOperationEvent |
|
55 { |
|
56 EUniEditorOperationProcessing, |
|
57 EUniEditorOperationComplete, |
|
58 EUniEditorOperationError, |
|
59 // Cancel is called for active operation |
|
60 EUniEditorOperationCancel |
|
61 }; |
|
62 |
|
63 enum TUniEditorOperationQuery |
|
64 { |
|
65 EMEOQueryGuidedInsertLarge, |
|
66 EMEOQueryGuidedObject |
|
67 }; |
|
68 |
|
69 enum TUniEditorOperationErrors |
|
70 { |
|
71 EUniInsertUserGuidedAbort = 1, |
|
72 EUniInsertTooBig, |
|
73 EUniInsertNotSupported, |
|
74 EUniInsertSlideChangeFailed, |
|
75 KUniLaunchAbortPresRestricted, |
|
76 KUniLaunchPresGuided, |
|
77 EUniProcessImgOutOfMemory, |
|
78 EUniProcessImgOutOfDisk, |
|
79 EUniProcessImgNotFound, |
|
80 EUniProcessImgNonConformant, |
|
81 EUniProcessImgCorrupted, |
|
82 EUniProcessImgUserAbort, |
|
83 EUniProcessImgCouldNotScale, |
|
84 EUniProcessImgScalingFailed, |
|
85 EUniProcessImgCompressFailed, |
|
86 EUniProcessImgCompressSuccessful, |
|
87 EUniConvertVidOutOfMemory, |
|
88 EUniConvertVidOutOfDisk, |
|
89 EUniConvertVidNotFound, |
|
90 EUniConvertVidNonConformant, |
|
91 EUniConvertVidCorrupted, |
|
92 EUniConvertVidUserAbort, |
|
93 EUniConvertVidFailed, |
|
94 EUniConvertVidSuccessful, |
|
95 EUniSendUiForbidden, |
|
96 EUniSendUiCorrupted, |
|
97 EUniSendUiUnsupported, |
|
98 EUniSendUiTooBig, |
|
99 EUniEditorExit // when RunL in CMmsEditorLaunchOperation fails |
|
100 }; |
|
101 |
|
102 |
|
103 |
|
104 // FUNCTION PROTOTYPES |
|
105 |
|
106 // CLASS DECLARATION |
|
107 |
|
108 class MUniEditorOperationObserver |
|
109 { |
|
110 public: |
|
111 |
|
112 /** |
|
113 * Notifies operation event |
|
114 */ |
|
115 virtual void EditorOperationEvent( TUniEditorOperationType aOperation, |
|
116 TUniEditorOperationEvent aEvent ) = 0; |
|
117 |
|
118 /** |
|
119 * Notifies operation query event. |
|
120 */ |
|
121 virtual TBool EditorOperationQuery( TUniEditorOperationType aOperation, |
|
122 TUniEditorOperationQuery aQuery ) = 0; |
|
123 }; |
|
124 |
|
125 /** |
|
126 * CUniEditorOperation |
|
127 * |
|
128 * @since 3.2 |
|
129 */ |
|
130 class CUniEditorOperation : public CActive, |
|
131 public MUniEditorOperationObserver |
|
132 { |
|
133 public: // New methods |
|
134 |
|
135 /** |
|
136 * Destructor |
|
137 */ |
|
138 virtual ~CUniEditorOperation(); |
|
139 |
|
140 /** |
|
141 * Returns error code array |
|
142 * @return Array of error codes |
|
143 */ |
|
144 virtual CArrayFixFlat<TInt>* GetErrors(); |
|
145 |
|
146 protected: // From base classes |
|
147 |
|
148 /** |
|
149 * From CActive |
|
150 */ |
|
151 TInt RunError( TInt aError ); |
|
152 |
|
153 /** |
|
154 * From CActive. |
|
155 */ |
|
156 void DoCancel(); |
|
157 |
|
158 protected: // New methods |
|
159 |
|
160 /** |
|
161 * Constructor. |
|
162 */ |
|
163 CUniEditorOperation( MUniEditorOperationObserver& aObserver, |
|
164 CUniEditorDocument& aDocument, |
|
165 RFs& aFs, |
|
166 TUniEditorOperationType aOperationType ); |
|
167 |
|
168 /** |
|
169 * 2nd phase constructor. |
|
170 */ |
|
171 void BaseConstructL(); |
|
172 |
|
173 /** |
|
174 * CompleteSelf |
|
175 */ |
|
176 void CompleteSelf( TInt aError ); |
|
177 |
|
178 /** |
|
179 * Set error code to error code array |
|
180 * |
|
181 * @param TInt error code |
|
182 */ |
|
183 void SetError( TInt aError ); |
|
184 |
|
185 /** |
|
186 * Resets error code array |
|
187 */ |
|
188 void ResetErrors(); |
|
189 |
|
190 /** |
|
191 * 1) Saves the error status into error code array, if aError != KErrNone. |
|
192 * 2) reports the observer of the error |
|
193 * 3) returns the error code. |
|
194 * @return 0, operation can be continued |
|
195 * otherwise, error status of CActive operation |
|
196 * |
|
197 */ |
|
198 TInt SetErrorAndReport( TInt aError ); |
|
199 |
|
200 /** |
|
201 * Writes into trace log current operation and state |
|
202 */ |
|
203 void PrintOperationAndState(); |
|
204 |
|
205 /** |
|
206 * Sets operation pending. |
|
207 */ |
|
208 void SetPending(); |
|
209 |
|
210 /** |
|
211 * Completes operation |
|
212 */ |
|
213 void CompleteOperation( TInt aError ); |
|
214 |
|
215 /** |
|
216 * Implements cancellation of an outstanding operations. |
|
217 * |
|
218 * This function is called as part of the UniEditor operation cancelling. |
|
219 * |
|
220 * It must call the appropriate cancel function offered by the active object's |
|
221 * asynchronous service provider. Also open resource handles should be closed. |
|
222 * |
|
223 * DoCancelCleanup() must not wait for event completion; this is handled by Cancel(). |
|
224 * |
|
225 * @see CActive::DoCancel |
|
226 */ |
|
227 virtual void DoCancelCleanup() = 0; |
|
228 |
|
229 /** |
|
230 * Notifies operation event |
|
231 * Default implementation performs cancel operation handling |
|
232 * and forwards all other events to HandleOperationEvent function. |
|
233 * |
|
234 * @see MUniEditorOperationObserver::EditorOperationEvent |
|
235 */ |
|
236 void EditorOperationEvent( TUniEditorOperationType aOperation, |
|
237 TUniEditorOperationEvent aEvent ); |
|
238 |
|
239 /** |
|
240 * Notifies operation query event. |
|
241 * Default implementation forwards the request to operation observer. |
|
242 * |
|
243 * @note Derived class can overwrite this implementation if needed. |
|
244 * |
|
245 * @see MUniEditorOperationObserver::EditorOperationQuery |
|
246 */ |
|
247 TBool EditorOperationQuery( TUniEditorOperationType aOperation, |
|
248 TUniEditorOperationQuery aQuery ); |
|
249 |
|
250 /** |
|
251 * Called from EditorOperationEvent to handle operation event. |
|
252 * Default implementation only completes the operation so operation with child operations |
|
253 * must overwrite this function to perform error handling. |
|
254 * |
|
255 * @param aOperation Completed operation. |
|
256 */ |
|
257 virtual void HandleOperationEvent( TUniEditorOperationType aOperation, |
|
258 TUniEditorOperationEvent aEvent ); |
|
259 |
|
260 protected: // data |
|
261 |
|
262 MUniEditorOperationObserver& iObserver; |
|
263 CUniEditorDocument& iDocument; |
|
264 RFs& iFs; |
|
265 CArrayFixFlat<TInt>* iErrors; |
|
266 TUniEditorOperationType iOperationType; |
|
267 |
|
268 TInt iOperationState; |
|
269 }; |
|
270 |
|
271 #endif // __UNIEDITOROPERATION_H |
|
272 |
|
273 // End of file |
|
274 |