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