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