|
1 /* |
|
2 * Copyright (c) 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: CCSXHXMLParseHandler class declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __CCSXHXMLPARSEHANDLER_H__ |
|
20 #define __CCSXHXMLPARSEHANDLER_H__ |
|
21 |
|
22 #include <coecntrl.h> // CCoeControl |
|
23 #include <MSenContentHandlerClient.h> |
|
24 #include <xml/taginfo.h> |
|
25 #include <xml/attribute.h> |
|
26 |
|
27 class CCSXHGenericTOC2; |
|
28 class CCSXHGenericTOC1; |
|
29 class CCSXHHtmlTOC1; |
|
30 class CCSXHHelpDataBase; |
|
31 class CCSXHHelpContentBase; |
|
32 class CCSXHHTMLContentParser; |
|
33 /** |
|
34 * @class CCSXHXMLParseHandler |
|
35 * This class is used retrive the data from XML file |
|
36 */ |
|
37 class CCSXHXMLParseHandler : public CBase, public MSenContentHandlerClient |
|
38 { |
|
39 public: |
|
40 /** |
|
41 * @function CCSXHXMLParseHandler |
|
42 * @since S60 3.2 |
|
43 * Construct a CCSXHXMLParseHandler |
|
44 * @param aCoeEnv - Control Environment |
|
45 */ |
|
46 CCSXHXMLParseHandler(CCoeEnv * aCoeEnv); |
|
47 |
|
48 virtual ~CCSXHXMLParseHandler(); |
|
49 /** |
|
50 * @function StartDocument |
|
51 * @since S60 3.2 |
|
52 * Receive notification of the beginning of a document. |
|
53 * @return KErrNone or some of the system-wide Symbian error codes |
|
54 */ |
|
55 TInt StartDocument(); |
|
56 /** |
|
57 * @function EndDocument |
|
58 * @since S60 3.2 |
|
59 * Receive notification of the end of a document. |
|
60 * @return KErrNone or some of the system-wide Symbian error codes |
|
61 */ |
|
62 TInt EndDocument(); |
|
63 |
|
64 /** |
|
65 * @function SetDataBasePtr |
|
66 * @since S60 3.2 |
|
67 * Sets DataBase Pointer |
|
68 */ |
|
69 void SetDataBasePtr(CCSXHHelpDataBase *aDataBase); |
|
70 /** |
|
71 * @function GetApplicationName |
|
72 * @since S60 3.2 |
|
73 * Get the Application Name from Meta.xml |
|
74 * @return Application Name |
|
75 */ |
|
76 TDesC& GetApplicationName(); |
|
77 |
|
78 TPtr GetFeatureIds(); |
|
79 |
|
80 protected: |
|
81 /** |
|
82 * @function SetAppNameFlagL |
|
83 * @since S60 3.2 |
|
84 * Set the Application Flag Based on local Name, ResourceID |
|
85 * @param alocalName - TagName read from XML file |
|
86 * ResourceId - Used to Retrive the TagName from resource file |
|
87 */ |
|
88 TBool SetAppNameFlag(const TDesC8 & alocalName,const TDesC& aAppTag); |
|
89 |
|
90 protected: |
|
91 TBuf<KMaxFileName> iApplicationName; |
|
92 HBufC* iFeatureIds; |
|
93 TBool iIsAppName; |
|
94 CCSXHHelpDataBase* iDataBase; |
|
95 CCoeEnv* iCoeEnv; |
|
96 |
|
97 }; |
|
98 |
|
99 |
|
100 /** |
|
101 * @class CCSXHXMLParseHandler_MetaFile |
|
102 * This class is used retrive the data from Meta.xml file |
|
103 */ |
|
104 class CCSXHXMLParseHandler_MasterMetaFile : public CCSXHXMLParseHandler |
|
105 { |
|
106 public: |
|
107 /** |
|
108 * @function NewL |
|
109 * @since S60 3.2 |
|
110 * Construct a CCSXHXMLParseHandler_IndexFile |
|
111 * @param aCoeEnv - Control Environment |
|
112 * @retrun a CCSXHXMLParseHandler_IndexFile pointer |
|
113 */ |
|
114 static CCSXHXMLParseHandler_MasterMetaFile* NewL(CCoeEnv * aCoeEnv); |
|
115 protected: |
|
116 /** |
|
117 * @function CCSXHXMLParseHandler_IndexFile |
|
118 * @since S60 3.2 |
|
119 * Construct a CCSXHXMLParseHandler_IndexFile |
|
120 * @param aCoeEnv - Control Environment |
|
121 */ |
|
122 CCSXHXMLParseHandler_MasterMetaFile(CCoeEnv * aCoeEnv); |
|
123 public: |
|
124 /** |
|
125 * @function StartElement |
|
126 * @since S60 3.2 |
|
127 * Receive notification of the beginning of an element |
|
128 * @param aURI - The Namespace URI, or the empty string |
|
129 if the element has no Namespace URI or |
|
130 if Namespace processing is not being performed. |
|
131 aLocalName - The local name (without prefix) |
|
132 aName - The qualified name |
|
133 apAttrs - The attributes attached to the element. |
|
134 If there are no attributes, it shall be |
|
135 an empty array.Namespaces declared in the current |
|
136 element will be located in the array also |
|
137 * @return KErrNone or some of the system-wide Symbian error codes |
|
138 */ |
|
139 TInt StartElement (const TDesC8 &aURI, const TDesC8 &aLocalName, |
|
140 const TDesC8 &aName, const RAttributeArray &apAttrs); |
|
141 /** |
|
142 * @function SetHtmlContentParserPtr |
|
143 * @since S60 3.2 |
|
144 * Set the pointer of the content parser |
|
145 * @param aParser - Pointer to an html content parser |
|
146 */ |
|
147 void SetHtmlContentParserPtr(CCSXHHTMLContentParser* aParser); |
|
148 |
|
149 private: |
|
150 /** |
|
151 * @function CreateTOC2ObjectsL |
|
152 * @since S60 3.2 |
|
153 * Create TOC2 objects for Html TOC2 |
|
154 * @param aAttributes - The attributes attached to the element. |
|
155 */ |
|
156 void CreateTOC1ObjectsL(const RAttributeArray & aAttributes); |
|
157 |
|
158 CCSXHHTMLContentParser *iParser; |
|
159 |
|
160 TInt iDrive; |
|
161 }; |
|
162 |
|
163 /** |
|
164 * @class CCSXHXMLParseHandler_MetaFile |
|
165 * This class is used retrive the data from Meta.xml file |
|
166 */ |
|
167 class CCSXHXMLParseHandler_MetaFile : public CCSXHXMLParseHandler |
|
168 { |
|
169 public: |
|
170 /** |
|
171 * @function CCSXHXMLParseHandler_MetaFile |
|
172 * @since S60 3.2 |
|
173 * Construct a CCSXHXMLParseHandler_MetaFile |
|
174 * @param aCoeEnv - Control Environment |
|
175 * @retrun a CCSXHXMLParseHandler_MetaFile pointer |
|
176 */ |
|
177 static CCSXHXMLParseHandler_MetaFile* NewL(CCoeEnv * aCoeEnv); |
|
178 protected: |
|
179 /** |
|
180 * @function CCSXHXMLParseHandler_MetaFile |
|
181 * @since S60 3.2 |
|
182 * Construct a CCSXHXMLParseHandler_MetaFile |
|
183 * @param aCoeEnv - Control Environment |
|
184 */ |
|
185 CCSXHXMLParseHandler_MetaFile(CCoeEnv * aCoeEnv); |
|
186 public: |
|
187 /** |
|
188 * @function StartElement |
|
189 * @since S60 3.2 |
|
190 * Receive notification of the beginning of an element |
|
191 * @param aURI - The Namespace URI, or the empty string |
|
192 if the element has no Namespace URI or |
|
193 if Namespace processing is not being performed. |
|
194 aLocalName - The local name (without prefix) |
|
195 aName - The qualified name |
|
196 apAttrs - The attributes attached to the element. |
|
197 If there are no attributes, it shall be |
|
198 an empty array.Namespaces declared in the current |
|
199 element will be located in the array also |
|
200 * @return KErrNone or some of the system-wide Symbian error codes |
|
201 */ |
|
202 TInt StartElement (const TDesC8 &aURI, const TDesC8 &aLocalName, |
|
203 const TDesC8 &aName, const RAttributeArray &apAttrs); |
|
204 /** |
|
205 * @function EndElement |
|
206 * @since S60 3.2 |
|
207 * Receive notification of the end of an element |
|
208 * @param aURI - The Namespace URI, or the empty string |
|
209 if the element has no Namespace URI or |
|
210 if Namespace processing is not being performed. |
|
211 aLocalName - The local name (without prefix) |
|
212 aName - The qualified name |
|
213 * @return KErrNone or some of the system-wide Symbian error codes |
|
214 */ |
|
215 TInt EndElement ( const TDesC8 &aURI,const TDesC8 &aLocalName,const TDesC8 &aName); |
|
216 /** |
|
217 * @function Characters |
|
218 * @since S60 3.2 |
|
219 * Receive notification inside an element |
|
220 * @param aBuff - The characters. |
|
221 * aStart - The start position in the character buffer. |
|
222 * aLength - The number of characters to use from the character buffer. |
|
223 * @return KErrNone or some of the system-wide Symbian error codes |
|
224 */ |
|
225 TInt Characters (const TDesC8 &aBuff, const TInt aStart, |
|
226 const TInt aLength); |
|
227 }; |
|
228 |
|
229 class CCSXHXMLParseHandler_IndexFile : public CCSXHXMLParseHandler |
|
230 { |
|
231 public: |
|
232 /** |
|
233 * @function NewL |
|
234 * @since S60 3.2 |
|
235 * Construct a CCSXHXMLParseHandler_IndexFile |
|
236 * @param aCoeEnv - Control Environment |
|
237 * @retrun a CCSXHXMLParseHandler_IndexFile pointer |
|
238 */ |
|
239 static CCSXHXMLParseHandler_IndexFile* NewL(CCoeEnv * aCoeEnv); |
|
240 protected: |
|
241 /** |
|
242 * @function CCSXHXMLParseHandler_IndexFile |
|
243 * @since S60 3.2 |
|
244 * Construct a CCSXHXMLParseHandler_IndexFile |
|
245 * @param aCoeEnv - Control Environment |
|
246 */ |
|
247 CCSXHXMLParseHandler_IndexFile(CCoeEnv * aCoeEnv); |
|
248 public: |
|
249 /** |
|
250 * @function StartElement |
|
251 * @since S60 3.2 |
|
252 * Receive notification of the beginning of an element |
|
253 * @param aURI - The Namespace URI, or the empty string |
|
254 if the element has no Namespace URI or |
|
255 if Namespace processing is not being performed. |
|
256 aLocalName - The local name (without prefix) |
|
257 aName - The qualified name |
|
258 apAttrs - The attributes attached to the element. |
|
259 If there are no attributes, it shall be |
|
260 an empty array.Namespaces declared in the current |
|
261 element will be located in the array also |
|
262 * @return KErrNone or some of the system-wide Symbian error codes |
|
263 */ |
|
264 TInt StartElement (const TDesC8 &aURI, const TDesC8 &aLocalName, |
|
265 const TDesC8 &aName, const RAttributeArray &apAttrs); |
|
266 /** |
|
267 * @function SetArray |
|
268 * @since S60 3.2 |
|
269 * Get the pointer & fill the contents from Index.xml |
|
270 * @param aHTMLlist - Pointer to an Array |
|
271 */ |
|
272 void SetArray(RPointerArray<CCSXHHelpContentBase> *aHTMLlist); |
|
273 /** |
|
274 * @function SetGenericTOC1Object |
|
275 * @since S60 3.2 |
|
276 * Set GenericTOC1 Object |
|
277 * @param aParent - Generic TOC1 Object |
|
278 */ |
|
279 void SetGenericTOC1Object(CCSXHGenericTOC1& aParent); |
|
280 /** |
|
281 * @function SetPath |
|
282 * @since S60 3.2 |
|
283 * Set Html file path |
|
284 * @param aFilePath - Set Html file path |
|
285 */ |
|
286 void SetPath(const TDesC& aFilePath); |
|
287 |
|
288 void SetHtmlContentParserPtr(CCSXHHTMLContentParser* aParser); |
|
289 private: |
|
290 /** |
|
291 * @function CreateTOC2ObjectsL |
|
292 * @since S60 3.2 |
|
293 * Create TOC2 objects for Html TOC2 |
|
294 * @param aAttributes - The attributes attached to the element. |
|
295 */ |
|
296 void CreateTOC2ObjectsL(const RAttributeArray & aAttributes); |
|
297 TBuf<KMaxFileName> iCompressString,iHTMLPageName,iFilePath; |
|
298 RPointerArray<CCSXHHelpContentBase>* iTOC2Array; |
|
299 CCSXHGenericTOC1* iParent; |
|
300 CCSXHHTMLContentParser *iParser; |
|
301 }; |
|
302 |
|
303 |
|
304 class CCSXHXMLParseHandler_Kywd : public CCSXHXMLParseHandler |
|
305 { |
|
306 public: |
|
307 /** |
|
308 * @function NewL |
|
309 * @since S60 3.2 |
|
310 * Construct a CCSXHXMLParseHandler_Kywd |
|
311 * @param aCoeEnv - Control Environment |
|
312 * @retrun a CCSXHXMLParseHandler_Kywd pointer |
|
313 */ |
|
314 static CCSXHXMLParseHandler_Kywd* NewL(CCoeEnv * aCoeEnv); |
|
315 protected: |
|
316 /** |
|
317 * @function CCSXHXMLParseHandler_Kywd |
|
318 * @since S60 3.2 |
|
319 * Construct a CCSXHXMLParseHandler_Kywd |
|
320 * @param aCoeEnv - Control Environment |
|
321 */ |
|
322 CCSXHXMLParseHandler_Kywd(CCoeEnv * aCoeEnv); |
|
323 public: |
|
324 /** |
|
325 * @function StartElement |
|
326 * @since S60 3.2 |
|
327 * Receive notification of the beginning of an element |
|
328 * @param aURI - The Namespace URI, or the empty string |
|
329 if the element has no Namespace URI or |
|
330 if Namespace processing is not being performed. |
|
331 aLocalName - The local name (without prefix) |
|
332 aName - The qualified name |
|
333 apAttrs - The attributes attached to the element. |
|
334 If there are no attributes, it shall be |
|
335 an empty array.Namespaces declared in the current |
|
336 element will be located in the array also |
|
337 * @return KErrNone or some of the system-wide Symbian error codes |
|
338 */ |
|
339 TInt StartElement (const TDesC8 &aURI, const TDesC8 &aLocalName, |
|
340 const TDesC8 &aName, const RAttributeArray &apAttrs); |
|
341 /** |
|
342 * @function EndElement |
|
343 * @since S60 3.2 |
|
344 * Receive notification of the end of an element |
|
345 * @param aURI - The Namespace URI, or the empty string |
|
346 if the element has no Namespace URI or |
|
347 if Namespace processing is not being performed. |
|
348 aLocalName - The local name (without prefix) |
|
349 aName - The qualified name |
|
350 * @return KErrNone or some of the system-wide Symbian error codes |
|
351 */ |
|
352 TInt EndElement ( const TDesC8 &aURI,const TDesC8 &aLocalName,const TDesC8 &aName); |
|
353 /** |
|
354 * @function Characters |
|
355 * @since S60 3.2 |
|
356 * Receive notification inside an element |
|
357 * @param aBuff - The characters. |
|
358 * aStart - The start position in the character buffer. |
|
359 * aLength - The number of characters to use from the character buffer. |
|
360 * @return KErrNone or some of the system-wide Symbian error codes |
|
361 */ |
|
362 TInt Characters (const TDesC8 &aBuff, const TInt aStart, |
|
363 const TInt aLength); |
|
364 |
|
365 /** |
|
366 * @function SetTOC1Title |
|
367 * @since S60 3.2 |
|
368 * Set TOC1 Name |
|
369 * @param aName - TOC1 Name |
|
370 */ |
|
371 void SetTOC1Title(const TDesC& aName); |
|
372 /** |
|
373 * @function SetCurrentHtmlToc1 |
|
374 * @since S60 3.2 |
|
375 * Set HtmlTOC1 Object |
|
376 * @param aCurrentHtmlToc1 - Pointyer to HtmlTOC1 Object |
|
377 */ |
|
378 void SetCurrentHtmlToc1(CCSXHHtmlTOC1 *aCurrentHtmlToc1); |
|
379 /** |
|
380 * @function SetIsTOC2 |
|
381 * @since S60 3.2 |
|
382 * Set the flag if parsing in order to get TOC2 Objects, EFalse otherwise |
|
383 * @param aCurrentHtmlToc1 - Pointer to HtmlTOC1 Object |
|
384 */ |
|
385 void SetIsTOC2(TBool aFlag); |
|
386 |
|
387 /** |
|
388 * @function SetPath |
|
389 * @since S60 3.2 |
|
390 * Set Html file path |
|
391 * @param aFilePath - Set Html file path |
|
392 */ |
|
393 void SetPath(const TDesC& aFilePath); |
|
394 |
|
395 void SetHtmlContentParserPtr(CCSXHHTMLContentParser* aParser); |
|
396 |
|
397 private: |
|
398 /** |
|
399 * @function CreateTOC2ObjectsforKeywordSearch |
|
400 * @since S60 3.2 |
|
401 * Get the Info In order to Create TOC2 objects for Html Keyword |
|
402 * @param aName - TagName |
|
403 * aAttrs - The attributes attached to the element. |
|
404 */ |
|
405 void CreateTOC2ObjectsforKeywordSearch(const TDesC8 &aName,const RAttributeArray& aAttrs); |
|
406 /** |
|
407 * @function CreateTOC2ObjectsforKeywordSearchL |
|
408 * @since S60 3.2 |
|
409 * Creates TOC2 objects for Html Keyword And Insert into Database |
|
410 */ |
|
411 void CreateAndInsertKywdL(); |
|
412 TBuf<KMaxFileName> iHTMLPageName,iKeywordSearchTOC2TitleName; |
|
413 TBuf<KMaxFileName> iTOC1Name,iFilePath; |
|
414 CCSXHHtmlTOC1 *iCurrentHtmlToc1; |
|
415 TBool iIsTargetName,iIsTOC2View; |
|
416 CCSXHHTMLContentParser* iParser; |
|
417 }; |
|
418 |
|
419 class CCSXHXMLParseHandler_MasterKywd : public CCSXHXMLParseHandler |
|
420 { |
|
421 public: |
|
422 /** |
|
423 * @function NewL |
|
424 * @since S60 3.2 |
|
425 * Construct a CCSXHXMLParseHandler_Kywd |
|
426 * @param aCoeEnv - Control Environment |
|
427 * @retrun a CCSXHXMLParseHandler_Kywd pointer |
|
428 */ |
|
429 static CCSXHXMLParseHandler_MasterKywd* NewL(CCoeEnv * aCoeEnv); |
|
430 protected: |
|
431 /** |
|
432 * @function CCSXHXMLParseHandler_Kywd |
|
433 * @since S60 3.2 |
|
434 * Construct a CCSXHXMLParseHandler_Kywd |
|
435 * @param aCoeEnv - Control Environment |
|
436 */ |
|
437 CCSXHXMLParseHandler_MasterKywd(CCoeEnv * aCoeEnv); |
|
438 |
|
439 public: |
|
440 /** |
|
441 * @function StartElement |
|
442 * @since S60 3.2 |
|
443 * Receive notification of the beginning of an element |
|
444 * @param aURI - The Namespace URI, or the empty string |
|
445 if the element has no Namespace URI or |
|
446 if Namespace processing is not being performed. |
|
447 aLocalName - The local name (without prefix) |
|
448 aName - The qualified name |
|
449 apAttrs - The attributes attached to the element. |
|
450 If there are no attributes, it shall be |
|
451 an empty array.Namespaces declared in the current |
|
452 element will be located in the array also |
|
453 * @return KErrNone or some of the system-wide Symbian error codes |
|
454 */ |
|
455 TInt StartElement (const TDesC8 &aURI, const TDesC8 &aLocalName, |
|
456 const TDesC8 &aName, const RAttributeArray &apAttrs); |
|
457 /** |
|
458 * @function CreateTOC1ObjectsL |
|
459 * @since S60 3.2 |
|
460 * Create TOC1 objects for Keywords |
|
461 * @param aAttributes - The attributes attached to the element. |
|
462 */ |
|
463 void CreateTOC1ObjectsL(const RAttributeArray& aAttributes); |
|
464 |
|
465 /** |
|
466 * @function SetCurrentHtmlToc1 |
|
467 * @since S60 3.2 |
|
468 * Set HtmlTOC1 Object |
|
469 * @param aCurrentHtmlToc1 - Pointyer to HtmlTOC1 Object |
|
470 */ |
|
471 void SetCurrentHtmlToc1(CCSXHHtmlTOC1 *aCurrentHtmlToc1); |
|
472 |
|
473 /** |
|
474 * @function SetHtmlContentParserPtr |
|
475 * @since S60 3.2 |
|
476 * Set the pointer of the content parser |
|
477 * @param aParser - Pointer to an html content parser |
|
478 */ |
|
479 void SetHtmlContentParserPtr(CCSXHHTMLContentParser* aParser); |
|
480 |
|
481 |
|
482 private: |
|
483 CCSXHHtmlTOC1 *iCurrentHtmlToc1; |
|
484 CCSXHHTMLContentParser *iParser; |
|
485 }; |
|
486 #endif |