|
1 /* |
|
2 * Copyright (c) 2010 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef WRTDATAPLUGINOBSERVER_H |
|
20 #define WRTDATAPLUGINOBSERVER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 #include <aicontentobserver.h> |
|
26 |
|
27 |
|
28 // CLASS DECLARATION |
|
29 |
|
30 /** |
|
31 * CWrtDataPluginObserver |
|
32 * |
|
33 */ |
|
34 class CWrtDataPluginObserver : public CBase, public MAiContentObserver |
|
35 { |
|
36 public: |
|
37 // Constructors and destructor |
|
38 |
|
39 /** |
|
40 * Destructor. |
|
41 */ |
|
42 ~CWrtDataPluginObserver(); |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 */ |
|
47 static CWrtDataPluginObserver* NewL(); |
|
48 |
|
49 /** |
|
50 * Two-phased constructor. |
|
51 */ |
|
52 static CWrtDataPluginObserver* NewLC(); |
|
53 |
|
54 |
|
55 public: // from MAiContentObserver |
|
56 // new functions |
|
57 |
|
58 /** |
|
59 * Invoked by the plug-in to inform that it initiates content publishing |
|
60 * transaction. |
|
61 * |
|
62 * @param aTxId - transaction Id |
|
63 * @return - Possible return values: |
|
64 * - KErrNone - transaction is started. |
|
65 * - KErrNotSupported - UI Controller does not support transactions, |
|
66 * meaning that content will be rendered every time when Publish |
|
67 * is called. |
|
68 */ |
|
69 virtual TInt StartTransaction( TInt aTxId ); |
|
70 |
|
71 /** |
|
72 * Invoked by the plug-in to request framework that content publishing |
|
73 * transaction must be finalized and content should be rendered to the |
|
74 * screen. |
|
75 * |
|
76 * @param aTxId - transaction Id |
|
77 * @return - Possible return values: |
|
78 * - KErrNone - transaction is over. |
|
79 * - KErrNotSupported - UI Controller does not support transactions, |
|
80 * meaning that content will be rendered every time when Publish |
|
81 * is called. |
|
82 * - KErrNotFound - transaction with matching id has not been |
|
83 * started. |
|
84 * - Any of the system-wide error codes in case of resource allocation failure. |
|
85 */ |
|
86 virtual TInt Commit( TInt aTxId ); |
|
87 |
|
88 /** |
|
89 * Invoked by plug-in to indicate that content publishing transaction |
|
90 * must be cancelled. |
|
91 * |
|
92 * @param aTxId - transaction Id |
|
93 * @return - Possible return values: |
|
94 * - KErrNone - transaction is cancelled. |
|
95 * - KErrNotSupported - UI Controller does not support transactions, |
|
96 * meaning that content will be rendered every time when Publish |
|
97 * is called. |
|
98 * - KErrNotFound - transaction with matching id has not been |
|
99 * started. |
|
100 */ |
|
101 virtual TInt CancelTransaction( TInt aTxId ); |
|
102 |
|
103 /** |
|
104 * Invoked by plug-in to test if the specified content can be published. |
|
105 * |
|
106 * @param aPlugin - Plug-in interface implementation. |
|
107 * @param aContent - identification of content selector, MUST correspond |
|
108 * single content selector supported by plug-in. The framework |
|
109 * utilizes the selector id to match for cid and MIME type. |
|
110 * @param aIndex - index of the content item. |
|
111 * @return ETrue - if content could be published; EFalse otherwise. |
|
112 */ |
|
113 virtual TBool CanPublish( CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex ); |
|
114 |
|
115 /** |
|
116 * Invoked by the plug-in to inform that content identified by reference |
|
117 * aResource must be published to UI control\element identified by selector |
|
118 * aContent. |
|
119 * |
|
120 * @param aPlugin - Plug-in interface implementation. |
|
121 * @param aContent - identification of content selector, MUST correspond |
|
122 * single content selector supported by plug-in. The framework |
|
123 * utilizes the selector id to match for cid and MIME type. |
|
124 * @param aResource - identification of content reference, MUST correspond |
|
125 * single content reference supported by plug-in. The framework |
|
126 * utilizes the reference if to match for cid and MIME type of the |
|
127 * content supplied with in UI definition. |
|
128 * @param aIndex - index of the content item. |
|
129 * @return - Possible return values: |
|
130 * - KErrNone - if content is published. |
|
131 * - KErrNotSupported - if content selector is not supported by |
|
132 * current UI definition. |
|
133 * - KErrNotFound - if content reference is not found in current |
|
134 * UI definition. |
|
135 */ |
|
136 virtual TInt Publish( CHsContentPublisher& aPlugin, TInt aContent, TInt aResource, TInt aIndex ); |
|
137 |
|
138 /** |
|
139 * Invoked by the plug-in to inform that textual content provided within |
|
140 * parameter aText must be published to UI control\element identified by |
|
141 * selector aContent. |
|
142 * |
|
143 * @param aPlugin - Plug-in interface implementation. |
|
144 * @param aContent - identification of content selector, MUST correspond |
|
145 * single content selector supported by plug-in. The framework |
|
146 * utilizes the selector id to match for cid and MIME type. |
|
147 * @param aText - Textual content in UNICODE. |
|
148 * @param aIndex - index of the content item. |
|
149 * @return - Possible return values: |
|
150 * - KErrNone - if content is published. |
|
151 * - KErrNotSupported - if content selector is not supported by |
|
152 * current UI definition. |
|
153 * - KErrNotFound - if content reference is not found in current |
|
154 * UI definition. |
|
155 * - KErrArgument - if content cannot be published to UI element, |
|
156 * e.g. MIME type mismatch. |
|
157 */ |
|
158 virtual TInt Publish( CHsContentPublisher& aPlugin, TInt aContent, const TDesC16& aText, TInt aIndex ); |
|
159 |
|
160 /** |
|
161 * Invoked by the plug-in to inform that content provided within buffer |
|
162 * aBuf must be published to UI control\element identified by selector |
|
163 * aContent. |
|
164 * |
|
165 * @param aPlugin - Plug-in interface implementation. |
|
166 * @param aContent - identification of content selector, MUST correspond |
|
167 * single content selector supported by plug-in. The framework |
|
168 * utilizes the selector id to match for cid and MIME type. |
|
169 * @param aBuf - instance of content. |
|
170 * @param aIndex - index of the content item. |
|
171 * @return - Possible return values: |
|
172 * - KErrNone - if content is published. |
|
173 * - KErrNotSupported - if content selector is not supported by |
|
174 * current UI definition. |
|
175 * - KErrNotFound - if content reference is not found in current |
|
176 * UI definition. |
|
177 * - KErrArgument - if content cannot be published to UI element, |
|
178 * e.g. MIME type mismatch. |
|
179 */ |
|
180 virtual TInt Publish( CHsContentPublisher& aPlugin, TInt aContent, const TDesC8& aBuf, TInt aIndex ); |
|
181 |
|
182 |
|
183 /** |
|
184 * Invoked by the plug-in to inform that content from file handle aFile |
|
185 * must be published to UI control\element identified by selector aContent. |
|
186 * |
|
187 * @param aPlugin - Plug-in interface implementation. |
|
188 * @param aContent - identification of content selector, MUST correspond |
|
189 * single content selector supported by plug-in. The framework |
|
190 * utilizes the selector id to match for cid and MIME type. |
|
191 * @param aFile - file handle from where content can be obtained by UI |
|
192 * framework. |
|
193 * @param aIndex - index of the content item. |
|
194 * @return - Possible return values: |
|
195 * - KErrNone - if content is published. |
|
196 * - KErrNotSupported - if content selector is not supported by |
|
197 * current UI definition. |
|
198 * - KErrNotFound - if content reference is not found in current |
|
199 * UI definition. |
|
200 * - KErrArgument - if content cannot be published to UI element, |
|
201 * e.g. MIME type mismatch. |
|
202 */ |
|
203 virtual TInt Publish( CHsContentPublisher& aPlugin, TInt aContent, RFile& aFile, TInt aIndex ); |
|
204 |
|
205 /** |
|
206 * Invoked by the plug-in to inform that content must be cleaned in UI |
|
207 * control\element identified by selector aContent. |
|
208 * |
|
209 * @param aPlugin - Plug-in interface implementation. |
|
210 * @param aContent - identification of content selector, MUST correspond |
|
211 * single content selector supported by plug-in. The framework |
|
212 * utilizes the selector id to match for cid and MIME type. |
|
213 * @param aIndex - index of the content item. |
|
214 * @return - Possible return values: |
|
215 * - KErrNone - if content is published. |
|
216 * - KErrNotSupported - if content selector is not supported by |
|
217 * current UI definition. |
|
218 * - KErrNotFound - if content reference is not found in current |
|
219 * UI definition. |
|
220 */ |
|
221 virtual TInt Clean( CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex ); |
|
222 |
|
223 /** |
|
224 * Returns interface extension. Not used in S60 3.2 release. |
|
225 * |
|
226 * @param aUid - UID of the extension interface to access. |
|
227 * @return the extension interface. Actual type depends on the passed aUid |
|
228 * argument. |
|
229 */ |
|
230 virtual TAny* Extension( TUid aUid ); |
|
231 |
|
232 /** |
|
233 * Invoked by the plugin factory |
|
234 * |
|
235 * @param aPublsiherInfo Publisher which requires subscription |
|
236 * @return ETrue if subsription is needed, EFalse otherwise |
|
237 */ |
|
238 virtual TBool RequiresSubscription( const THsPublisherInfo& aPublisherInfo ) const; |
|
239 |
|
240 /** |
|
241 * Invoked by the plug-in to change the property value of a specific content. |
|
242 * value type must be string. |
|
243 * @param aPlugin - Plug-in interface implementation. |
|
244 * @param aElementId - id of content selector, MUST correspond |
|
245 * single content supported by plug-in. The framework |
|
246 * utilizes the id to find in the plugin xml defintion. |
|
247 * @param aPropertyName - property name. |
|
248 * @param aPropertyValue - property value. |
|
249 * @return - Possible return values: |
|
250 * - KErrNone - if content reference found. |
|
251 * - KErrNotFound - if content reference is not found in current |
|
252 * plugin definition. |
|
253 * - KErrNotSupported - if content selector is not supported by |
|
254 * current plugin definition. |
|
255 */ |
|
256 virtual TInt SetProperty( CHsContentPublisher& aPlugin, |
|
257 const TDesC8& aElementId, |
|
258 const TDesC8& aPropertyName, |
|
259 const TDesC8& aPropertyValue ); |
|
260 |
|
261 /** |
|
262 * Invoked by the plug-in to change the property value of a specific content. |
|
263 * |
|
264 * @param aPlugin - Plug-in interface implementation. |
|
265 * @param aElementId - id of content selector, MUST correspond |
|
266 * single content supported by plug-in. The framework |
|
267 * utilizes the id to find in the plugin xml defintion. |
|
268 * @param aPropertyName - property name. |
|
269 * @param aPropertyValue - property value. |
|
270 * @param aValueType - value type. |
|
271 * @return - Possible return values: |
|
272 * - KErrNone - if content reference found. |
|
273 * - KErrNotFound - if content reference is not found in current |
|
274 * plugin definition. |
|
275 * - KErrNotSupported - if content selector is not supported by |
|
276 * current plugin definition. |
|
277 */ |
|
278 virtual TInt SetProperty( CHsContentPublisher& aPlugin, |
|
279 const TDesC8& aElementId, |
|
280 const TDesC8& aPropertyName, |
|
281 const TDesC8& aPropertyValue, |
|
282 MAiContentObserver::TValueType aValueType); |
|
283 |
|
284 |
|
285 private: |
|
286 |
|
287 /** |
|
288 * Constructor for performing 1st stage construction |
|
289 */ |
|
290 CWrtDataPluginObserver(); |
|
291 |
|
292 /** |
|
293 * EPOC default constructor for performing 2nd stage construction |
|
294 */ |
|
295 void ConstructL(); |
|
296 |
|
297 }; |
|
298 |
|
299 #endif // WRTDATAPLUGINOBSERVER_H |