|
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: CCSXHHTMLContentParser class declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __CCSXHHTMLCONTENTPARSER_H__ |
|
20 #define __CCSXHHTMLCONTENTPARSER_H__ |
|
21 |
|
22 #include "CSXHGenericTOC1.h" |
|
23 #include <f32file.h> |
|
24 #include <barsc.h> |
|
25 #include <featurecontrol.h> |
|
26 |
|
27 |
|
28 class TAppUid; |
|
29 class CSenXmlReader; |
|
30 class CCSXHXMLParseHandler; |
|
31 class CCSXHHtmlTOC1; |
|
32 class CCSXHHelpDataBase; |
|
33 class CCSXHKywdTOC1; |
|
34 class CCoeEnv; |
|
35 class CCSXHHelpContentBase; |
|
36 class CCSXHGenericTOC2; |
|
37 class MSenContentHandlerClient; |
|
38 class CCSXHXMLParseHandler_Kywd; |
|
39 class CCSXHRuntimeIndexing; |
|
40 /** |
|
41 * CCSXHHTMLContentParser class. |
|
42 * This class is used to parse XML files & generate Html data |
|
43 * @lib euser.lib SenXml.lib XMLFRAMEWORK.lib ezip.lib HLPMODEL.LIB |
|
44 * @since 3.2 |
|
45 */ |
|
46 class CCSXHHTMLContentParser : public CBase |
|
47 { |
|
48 public: |
|
49 /** |
|
50 * @function NewL |
|
51 * @since S60 3.2 |
|
52 * Construct a CCSXHHTMLContentParser |
|
53 * and return a pointer to the created object |
|
54 * @param aCoeEnv - Control Environment |
|
55 * @return a CCSXHHTMLContentParser Pointer |
|
56 */ |
|
57 static CCSXHHTMLContentParser* NewL(CCoeEnv* aCoeEnv); |
|
58 /** |
|
59 * @function NewLC |
|
60 * @since S60 3.2 |
|
61 * Construct a CCSXHLegacyContentParser |
|
62 * and return a pointer to the created object using two phase construction |
|
63 * @param aCoeEnv - Control Environment |
|
64 * @return a CCSXHLegacyContentParser Pointer |
|
65 */ |
|
66 static CCSXHHTMLContentParser* NewLC(CCoeEnv *aCoeEnv); |
|
67 /** |
|
68 * @function GenerateTOC1ListL |
|
69 * @since S60 3.2 |
|
70 * Generate Html TOC1 Objects |
|
71 * @param aDataBase - Database class pointer |
|
72 */ void GenerateTOC1ListL(CCSXHHelpDataBase* aDataBase); |
|
73 /** |
|
74 * @function GenerateTOC2ListL |
|
75 * @since S60 3.2 |
|
76 * Generate Html TOC2 Objects |
|
77 * @param atoc1 - generic toc1 class pointer |
|
78 * aArray - Database class pointer's array pointer |
|
79 */ |
|
80 void GenerateTOC2ListL(CCSXHGenericTOC1& atoc1, RPointerArray<CCSXHHelpContentBase>* aArray); |
|
81 /** |
|
82 * @function GetTopicContentL |
|
83 * @since S60 3.2 |
|
84 * Get the Buffer for a selected toc2 |
|
85 * @param atoc2 - generic toc2 class pointer |
|
86 * @return pointer to a buffer |
|
87 */ |
|
88 TAny* GetTopicContentL(CCSXHGenericTOC2* atoc2); |
|
89 /** |
|
90 * @function GetContentsFromFileL |
|
91 * @since S60 3.2 |
|
92 * Get the Buffer from a html file |
|
93 * @param htmlFile - html file path |
|
94 * aCoeEnv - Control Environment |
|
95 * @return pointer to a buffer |
|
96 */ |
|
97 static HBufC8* GetContentsFromFileL(const TDesC& htmlFile,CCoeEnv* aCoeEnv,RFeatureControl &aFeatureControl); |
|
98 |
|
99 /** |
|
100 * @function GetHtmlFileL |
|
101 * @since S60 3.2 |
|
102 * Get the html file path |
|
103 * @param aCoeEnv - Control Environment |
|
104 * aDir - Directory |
|
105 * TAppUid - UID |
|
106 * aFileName - FileName(IN/OUT Argument) |
|
107 */ |
|
108 static void GetHtmlFileL(CCoeEnv* aCoeEnv,const short& aDir, |
|
109 const TAppUid& aUid,TBuf<KMaxFileName>& aFileName); |
|
110 /** |
|
111 * @function ~CCSXHHTMLContentParser |
|
112 * @since S60 3.2 |
|
113 * Destroy the object and release all memory objects |
|
114 */ |
|
115 ~CCSXHHTMLContentParser(); |
|
116 |
|
117 /** |
|
118 * @function GenerateKywdTOC1ListL |
|
119 * @since S60 3.2 |
|
120 * Generate Html Keyword TOC1 Objects |
|
121 * @param aDataBase - Database class pointer |
|
122 */ |
|
123 void GenerateKywdTOC1ListL(CCSXHHelpDataBase* aDataBase); |
|
124 /** |
|
125 * @function GenerateTOC2ListForKeywordSearchL |
|
126 * @since S60 3.2 |
|
127 * Generate Html Keyword TOC2 Objects |
|
128 * @param aDataBase - Database class pointer |
|
129 * @param akywdtoc1 - keyword toc1 class pointer |
|
130 */ |
|
131 void GenerateTOC2ListForKeywordSearchL(CCSXHHelpDataBase* aDataBase, |
|
132 CCSXHKywdTOC1* akywdtoc1); |
|
133 /** |
|
134 * @function GetContextTopic |
|
135 * @since S60 3.2 |
|
136 * Get the help Context object |
|
137 * @param aContext - Help context object |
|
138 * @return database class pointer |
|
139 */ |
|
140 CCSXHHelpContentBase* GetContextTopic(const TUid &aUid, const TDesC &contextName); |
|
141 /** |
|
142 * @function GetHtmlTopicForUrlL |
|
143 * @since S60 3.2 |
|
144 * Get the toc2 object in order to get Content |
|
145 * @param aurl - Full File Path |
|
146 * @return pointer to database |
|
147 */ |
|
148 CCSXHHelpContentBase* GetHtmlTopicForUrlL(const TDesC& aurl); |
|
149 |
|
150 /** |
|
151 * @function IsUidCategoryPresent |
|
152 * @since S60 3.2 |
|
153 * Check for Existance of Appication Uid |
|
154 * @param aUid - Application Uid |
|
155 * @return ETrue if exists, EFalse otherwise |
|
156 */ |
|
157 TBool IsUidCategoryPresent(const TUid& aUid); |
|
158 |
|
159 |
|
160 void InsertHTMLToc1L(const TDesC &appUidName,const TDesC &appName,const TInt& aDrive, |
|
161 CCSXHHelpDataBase* aDataBase,const TDesC &FeatureIds ); |
|
162 |
|
163 /** |
|
164 * @function GetHTMLToc1 |
|
165 * @since S60 3.2 |
|
166 * Get the HTML TOC1 object |
|
167 * @param aUid - Application Uid |
|
168 * aCurrentHtmlToc1 - HTMLTOC1 pointer |
|
169 * @return ETrue if present, EFalse otherwise |
|
170 */ |
|
171 TBool GetHTMLToc1(const TDesC& aUid,CCSXHXMLParseHandler* aParser); |
|
172 |
|
173 TBool CheckFeatureIDL(const TDesC& aFeatueIds); |
|
174 private: |
|
175 /** |
|
176 * @function CCSXHHTMLContentParser |
|
177 * @since S60 3.2 |
|
178 * Construct a CCSXHHTMLContentParser |
|
179 * @param aCoeEnv - Control Environment |
|
180 */ |
|
181 CCSXHHTMLContentParser(CCoeEnv* aCoeEnv); |
|
182 /** |
|
183 * @function InitializeReaderL |
|
184 * @since S60 3.2 |
|
185 * Create XMLParse Objects |
|
186 * @param aXMLParser - Pointer to XML parse Handler |
|
187 */ |
|
188 void InitializeReaderL(CCSXHXMLParseHandler* aXMLParser); |
|
189 /** |
|
190 * @function InitializeParserAndReaderL |
|
191 * @since S60 3.2 |
|
192 * Delete XMLParse Objects |
|
193 * @param aXMLParser - Pointer to XML parse Handler |
|
194 */ |
|
195 void ClearReader(); |
|
196 /** |
|
197 * @function ConstructL |
|
198 * @since S60 3.2 |
|
199 * perform the second phase construction |
|
200 */ |
|
201 void ConstructL(); |
|
202 /** |
|
203 * @function ScanAndParseXMLfileToCreateTOC1ObjectL |
|
204 * @since S60 3.2 |
|
205 * perform the second phase construction |
|
206 * @param aFileSession - FileSession |
|
207 * ascanner - CDirScan pointer |
|
208 * aDatabase - Database pointer |
|
209 * aDrive - Drive Number |
|
210 * aXMLParser - XMLParserhandler pointer |
|
211 */ |
|
212 void ScanAndParseXMLfileToCreateTOC1ObjectL(RFs& aFileSession,CDirScan* ascanner, |
|
213 CCSXHHelpDataBase* aDataBase, |
|
214 const TInt& aDrive,CCSXHXMLParseHandler* aXMLParser); |
|
215 /** |
|
216 * @function HandleMasterMetaFileL( |
|
217 * @since S60 3.2 |
|
218 * perform the second phase construction |
|
219 * @param aFileSession - FileSession |
|
220 * aDatabase - Database pointer |
|
221 * aRootDir - Root directory |
|
222 * aPrevHandler - Previous Content Handler |
|
223 * @return ETrue if handled, EFalse otherwise |
|
224 */ |
|
225 TBool HandleMasterMetaFileL(CCSXHHelpDataBase* aDataBase, |
|
226 TChar& aDrive, MSenContentHandlerClient *aPrevHandler); |
|
227 /** |
|
228 * @function HandleMasterKeywordFileL( |
|
229 * @since S60 3.2 |
|
230 * parse makster keywords file |
|
231 * @param aDatabase - Database pointer |
|
232 * @return ETrue if handled, EFalse otherwise |
|
233 */ TBool HandleMasterKeywordFileL(CCSXHHelpDataBase* aDataBase); |
|
234 |
|
235 |
|
236 static TBool GetHTMLContentPathForDriveL(TBuf<KMaxFileName>* aContentDrive,CCoeEnv *aCoeEnv); |
|
237 |
|
238 /** |
|
239 * @function IsAppUIdPresentAlready( |
|
240 * @since S60 3.2 |
|
241 * Check duplicate Uids |
|
242 * @param aUid - Application Uid |
|
243 * @return ETrue if dupicate is identified, EFalse otherwise |
|
244 */ |
|
245 TBool IsAppUIdPresentAlready(const TDesC& aUid); |
|
246 |
|
247 /** |
|
248 * @function GetCorrespondingTOC1FromMainArray( |
|
249 * @since S60 3.2 |
|
250 * Get TOC1 object from the main array, which is used to display Main topic view. |
|
251 * @param aApplicationName - Application Name |
|
252 * @return pointer to HTML toc1. |
|
253 */ |
|
254 CCSXHHtmlTOC1* GetCorrespondingTOC1FromMainArray(const TDesC& aApplicationName); |
|
255 |
|
256 /** |
|
257 * @function ParseKeywdFileAndCreatekywdTOC1Objects |
|
258 * @since S60 3.2 |
|
259 * Parse keyword.xml file and Create kywd TOC1 objects. |
|
260 * @param aTOC1ObjectsArray - Array of HTMLToc1Objects |
|
261 * XMLParser - pointer to XML parse handler. |
|
262 * bMasterKeywordFilePresent - Boolean parameter |
|
263 */ |
|
264 |
|
265 void ParseKeywdFileAndCreatekywdTOC1ObjectsL(RPointerArray<CCSXHHtmlTOC1>& aTOC1ObjectsArray, |
|
266 CCSXHXMLParseHandler_Kywd* XMLParser, TBool bMasterKeywordFilePresent); |
|
267 |
|
268 /** |
|
269 * @function ParseKeywdFileAndCreatekywdTOC1Objects |
|
270 * @since S60 3.2 |
|
271 * Parse keyword.xml file and Create kywd TOC1 objects. |
|
272 * @param aTOC1ObjectsArray - Array of HTMLToc1Objects |
|
273 * aUrl - html file path |
|
274 */ |
|
275 |
|
276 CCSXHHelpContentBase* CCSXHHTMLContentParser::GetObjectBasedonUrlL(RPointerArray<CCSXHHtmlTOC1>& aTOC1ObjectsArray, |
|
277 const TDesC& aUrl,TBool aMainArrayList); |
|
278 |
|
279 /** |
|
280 * @function GetSupportedFeatureListL |
|
281 * @since S60 3.2 |
|
282 * Get enabled featureIds in the current build |
|
283 */ |
|
284 void GetSupportedFeatureListL(); |
|
285 |
|
286 /** |
|
287 * @function CreateBufferForCSSContentL |
|
288 * @since S60 3.2 |
|
289 * Create CSS Content using enabled featureIds |
|
290 * @param aFeatureControl - RFeatureControl instance |
|
291 */ |
|
292 static HBufC8* CreateBufferForCSSContentL(RFeatureControl& aFeatureControl); |
|
293 |
|
294 /** |
|
295 * @function GetContentsFromHTMLFileL |
|
296 * @since S60 3.2 |
|
297 * Read the contents from HTML file |
|
298 * @param htmlFile - HTML file name |
|
299 * aCoeEnv - Control Environment |
|
300 */ |
|
301 |
|
302 static HBufC8* GetContentsFromHTMLFileL(const TDesC& htmlFile, CCoeEnv* aCoeEnv); |
|
303 |
|
304 /** |
|
305 * @function MergeCssAndHTMLContentL |
|
306 * @since S60 3.2 |
|
307 * Merge CSS and HTML Content |
|
308 * @param aHTMLBuffer - HTML file content |
|
309 * aCssContent - CSS content |
|
310 */ |
|
311 |
|
312 static HBufC8* MergeCssAndHTMLContentL(HBufC8* aHTMLBuffer, HBufC8* aCssContent); |
|
313 |
|
314 static void AppendStyleSheetContent_listitem(TPtr8& abufferptr,TInt aFeatureIdCount, |
|
315 RFeatureUidArray& aSupportedFeatures,CArrayFix<TInt>& alanguageCodeArray); |
|
316 static void AppendStyleSheetContent_paragraph(TPtr8& abufferptr,TInt aFeatureIdCount, |
|
317 RFeatureUidArray& aSupportedFeatures,CArrayFix<TInt>& alanguageCodeArray); |
|
318 static void AppendStyleSheetContent_ahref(TPtr8& abufferptr,TInt aFeatureIdCount, |
|
319 RFeatureUidArray& aSupportedFeatures,CArrayFix<TInt>& alanguageCodeArray); |
|
320 static void AppendStyleSheetContent_none(TPtr8& abufferptr,TInt aFeatureIdCount, |
|
321 RFeatureUidArray& aSupportedFeatures); |
|
322 private: |
|
323 CSenXmlReader *iXmlReader; |
|
324 |
|
325 //Store all the created HTML TOC1 objects for future reference. |
|
326 RPointerArray<CCSXHHtmlTOC1> iHtmlTOC1List,iDuplicateHelpTopicList; |
|
327 CCoeEnv *iCoeEnv; |
|
328 |
|
329 RFeatureUidArray iSupportedFeatures; |
|
330 RFeatureControl iFeatureControl; |
|
331 //Input Language variation changes |
|
332 CDesCArray* iSupportedInputLanguages; |
|
333 CDesCArray* iFeatureManager_FeatureIds; |
|
334 CCSXHRuntimeIndexing* iIndexing; |
|
335 |
|
336 }; |
|
337 |
|
338 #endif |