|
1 /* |
|
2 * Copyright (c) 2005-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: MAiContentObserver implementation for XML UI controller |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CONTENTRENDERER_H |
|
20 #define C_CONTENTRENDERER_H |
|
21 |
|
22 // System includes |
|
23 #include <e32base.h> |
|
24 #include <e32hashtab.h> |
|
25 |
|
26 // User includes |
|
27 #include "aicontentobserver.h" |
|
28 #include "xnproperty.h" |
|
29 |
|
30 // Forward declarations |
|
31 class TXnUiEngineAppIf; |
|
32 class CXnNodeAppIf; |
|
33 class CGulIcon; |
|
34 class MAiFwEventHandler; |
|
35 class CHsContentPublisher; |
|
36 class THsPublisherInfo; |
|
37 |
|
38 namespace AiUtility |
|
39 { |
|
40 class CContentPriorityMap; |
|
41 } |
|
42 |
|
43 namespace AiXmlUiController |
|
44 { |
|
45 class CActiveTransactionStack; |
|
46 class CTransactionFactoryImpl; |
|
47 class MTransactionElement; |
|
48 class MTransaction; |
|
49 class CAppUi; |
|
50 class CXmlNodeIdGenerator; |
|
51 class CCssPropertyMap; |
|
52 class CPolicyEvaluator; |
|
53 class TAiPolicyElement; |
|
54 } |
|
55 |
|
56 namespace AiXmlUiController |
|
57 { |
|
58 |
|
59 /** |
|
60 * @ingroup group_xmluicontroller |
|
61 * |
|
62 * CContentRenderer renders the content of the content publisher plug-ins |
|
63 * |
|
64 * @lib AiXmlUiMain |
|
65 */ |
|
66 class CContentRenderer : public CBase, |
|
67 public MAiContentObserver |
|
68 { |
|
69 public: |
|
70 // Constructors and destructor |
|
71 |
|
72 static CContentRenderer* NewL( CAppUi& aAppUi ); |
|
73 |
|
74 ~CContentRenderer(); |
|
75 |
|
76 public: |
|
77 // New functions |
|
78 |
|
79 /** |
|
80 * Sets event handler. |
|
81 * |
|
82 * @param aFwEventHandler the event handler to use. |
|
83 */ |
|
84 void SetEventHandler( MAiFwEventHandler& aFwEventHandler ); |
|
85 |
|
86 /** |
|
87 * Cleans all content items published by aPlugin. |
|
88 */ |
|
89 void CleanPluginFromUi( CHsContentPublisher& aPlugin ); |
|
90 |
|
91 public: |
|
92 // from MAiContentObserver |
|
93 |
|
94 /** |
|
95 * @see MAiContentObserver |
|
96 */ |
|
97 TInt StartTransaction( TInt aTxId ); |
|
98 |
|
99 /** |
|
100 * @see MAiContentObserver |
|
101 */ |
|
102 TInt Commit( TInt aTxId ); |
|
103 |
|
104 /** |
|
105 * @see MAiContentObserver |
|
106 */ |
|
107 TInt CancelTransaction( TInt aTxId ); |
|
108 |
|
109 /** |
|
110 * @see MAiContentObserver |
|
111 */ |
|
112 TBool CanPublish( CHsContentPublisher& aPlugin, |
|
113 TInt aContent, TInt aIndex ); |
|
114 |
|
115 /** |
|
116 * @see MAiContentObserver |
|
117 */ |
|
118 TInt Publish( CHsContentPublisher& aPlugin, |
|
119 TInt aContent, TInt aResource, TInt aIndex ); |
|
120 |
|
121 /** |
|
122 * @see MAiContentObserver |
|
123 */ |
|
124 TInt Publish( CHsContentPublisher& aPlugin, |
|
125 TInt aContent, const TDesC16& aText, TInt aIndex ); |
|
126 |
|
127 /** |
|
128 * @see MAiContentObserver |
|
129 */ |
|
130 TInt Publish( CHsContentPublisher& aPlugin, |
|
131 TInt aContent, const TDesC8& aBuf, TInt aIndex ); |
|
132 |
|
133 /** |
|
134 * @see MAiContentObserver |
|
135 */ |
|
136 TInt Publish( CHsContentPublisher& aPlugin, |
|
137 TInt aContent, RFile& aFile, TInt aIndex ); |
|
138 |
|
139 /** |
|
140 * @see MAiContentObserver |
|
141 */ |
|
142 TInt Clean( CHsContentPublisher& aPlugin, |
|
143 TInt aContent, TInt aIndex ); |
|
144 |
|
145 /** |
|
146 * @see MAiContentObserver |
|
147 */ |
|
148 TAny* Extension( TUid aUid ); |
|
149 |
|
150 /** |
|
151 * @see MAiContentObserver |
|
152 */ |
|
153 TBool RequiresSubscription( |
|
154 const THsPublisherInfo& aPublisherInfo ) const; |
|
155 |
|
156 /** |
|
157 * @see MAiContentObserver |
|
158 */ |
|
159 TInt SetProperty( CHsContentPublisher& aPlugin, |
|
160 const TDesC8& aElementId, const TDesC8& aPropertyName, |
|
161 const TDesC8& aPropertyValue ); |
|
162 |
|
163 /** |
|
164 * @see MAiContentObserver |
|
165 */ |
|
166 TInt SetProperty( CHsContentPublisher& aPlugin, |
|
167 const TDesC8& aElementId, const TDesC8& aPropertyName, |
|
168 const TDesC8& aPropertyValue, |
|
169 MAiContentObserver::TValueType aValueType ); |
|
170 |
|
171 private: |
|
172 // Constructors |
|
173 |
|
174 /** |
|
175 * C++ default constructor |
|
176 */ |
|
177 CContentRenderer( CAppUi& aAppUi ); |
|
178 |
|
179 /** |
|
180 * 2nd phase constructor |
|
181 */ |
|
182 void ConstructL(); |
|
183 |
|
184 private: |
|
185 // New functions |
|
186 |
|
187 void DoStartTransactionL( TInt aTxId ); |
|
188 |
|
189 TInt CanPublishL( CHsContentPublisher& aPlugin, |
|
190 TInt aContent, TInt aIndex ); |
|
191 |
|
192 TInt DoPublishL( CHsContentPublisher& aPlugin, |
|
193 TInt aContent, TInt aResource, TInt aIndex ); |
|
194 |
|
195 TInt DoPublishL( CHsContentPublisher& aPlugin, |
|
196 TInt aContent, const TDesC16& aText, TInt aIndex ); |
|
197 |
|
198 TInt DoPublishL( CHsContentPublisher& aPlugin, |
|
199 TInt aContent, const TDesC8& aBuf, TInt aIndex ); |
|
200 |
|
201 TInt DoPublishL( CHsContentPublisher& aPlugin, |
|
202 TInt aContent, RFile& aFile, TInt aIndex ); |
|
203 |
|
204 TInt DoCleanL( CHsContentPublisher& aPlugin, |
|
205 TInt aContent, TInt aIndex ); |
|
206 |
|
207 void SetImmediateMode( TBool aImmediateMode ); |
|
208 |
|
209 TBool IsImmediateMode() const; |
|
210 |
|
211 void ProcessTransactionElementL( |
|
212 MTransactionElement* aElement ); |
|
213 |
|
214 CXnNodeAppIf* FindNodeByClassL( |
|
215 const TDesC& aCid, TInt aIndex, const TDesC8& aNs ); |
|
216 |
|
217 CXnNodeAppIf* FindNodeByIdL( |
|
218 const TDesC& aCid, const TDesC& aNs = KNullDesC ); |
|
219 |
|
220 CXnNodeAppIf* FindNodeByIdL( |
|
221 const TDesC8& aCid, const TDesC8& aNs = KNullDesC8 ); |
|
222 |
|
223 TInt PublishIconL( CHsContentPublisher& aPlugin, |
|
224 const TDesC& aCid, CGulIcon* aIcon, TInt aIndex, |
|
225 CXnNodeAppIf* aResource = NULL ); |
|
226 |
|
227 TInt PublishDataL( CHsContentPublisher& aPlugin, |
|
228 const TDesC& aCid, const TDesC8& aData, |
|
229 const TDesC8& aContentType, TInt aIndex, |
|
230 CXnNodeAppIf* aResource = NULL ); |
|
231 |
|
232 TBool AllowPublishByPriority( |
|
233 CXnNodeAppIf& aUiElement, TInt aNewPriority ) const; |
|
234 |
|
235 void StartContentRefresh(); |
|
236 |
|
237 TInt RefreshContentL( HBufC* aUiElementId, TInt aOldPriority ); |
|
238 |
|
239 static TInt RefreshContentCallback( TAny* aContentRenderer ); |
|
240 |
|
241 void SendRefreshContentEventL(); |
|
242 |
|
243 TBool IsParentNewsticker( CXnNodeAppIf& aTarget ); |
|
244 |
|
245 void ProcessContentChangesL( MTransaction& aTr ); |
|
246 void ProcessContentChangeL( TAiPolicyElement& aElement ); |
|
247 |
|
248 TInt SetPropertyL( CHsContentPublisher& aPlugin, |
|
249 const TDesC8& aElementId, const TDesC8& aPropertyName, |
|
250 const TDesC8& aPropertyValue, MAiContentObserver::TValueType aValueType ); |
|
251 |
|
252 CXnDomPropertyValue::TPrimitiveValueType DomPropertyValueType( |
|
253 MAiContentObserver::TValueType aValueType ); |
|
254 |
|
255 private: |
|
256 // data |
|
257 |
|
258 /** Transaction stack, Owned. */ |
|
259 CActiveTransactionStack* iStack; |
|
260 /** Factory for transacations, Owned. */ |
|
261 CTransactionFactoryImpl* iFactory; |
|
262 /** Immediate mode flag, Owned. */ |
|
263 TBool iImmediateMode; |
|
264 /** AppUI, Not owned. */ |
|
265 CAppUi& iAppUi; |
|
266 /** Node lookup id generator, Owned. */ |
|
267 CXmlNodeIdGenerator* iNodeIdGenerator; |
|
268 /** Content priority map, Owned. */ |
|
269 AiUtility::CContentPriorityMap* iContentPriorityMap; |
|
270 /** Map of refreshable ui elements. */ |
|
271 RPtrHashMap< TDesC, TInt > iRefreshableUiElements; |
|
272 /** Timer for asynchronous content refreshing, Owned. */ |
|
273 CPeriodic* iTimer; |
|
274 /** Fw event handler, Not owned. */ |
|
275 MAiFwEventHandler* iFwEventHandler; |
|
276 /** CSS property map, Owned. */ |
|
277 CCssPropertyMap* iPropertyMap; |
|
278 /** Publishing policy evaluator, Owned. */ |
|
279 CPolicyEvaluator* iPolicyEvaluator; |
|
280 }; |
|
281 |
|
282 } // namespace AiXmlUiController |
|
283 |
|
284 #endif // C_CONTENTRENDERER_H |
|
285 |
|
286 // End of File |