csxhelp/HelpEngine/src/CSXHHTMLContentParser.cpp
branchRCL_3
changeset 32 b69cc3efe785
parent 11 91bbff48ea9c
equal deleted inserted replaced
22:e3a25416bf1f 32:b69cc3efe785
    78         {
    78         {
    79         toc1 = iDuplicateHelpTopicList[i];
    79         toc1 = iDuplicateHelpTopicList[i];
    80         delete toc1;
    80         delete toc1;
    81         }
    81         }
    82     iDuplicateHelpTopicList.Reset();    
    82     iDuplicateHelpTopicList.Reset();    
    83 	iDuplicateHelpTopicList.Close();
    83     iDuplicateHelpTopicList.Close();
    84 	
    84     
    85     // Closes the array and frees all memory allocated to the array.
    85     // Closes the array and frees all memory allocated to the array.
    86    // iSupportedFeatures.Close();
    86    // iSupportedFeatures.Close();
    87     
    87     
    88     delete iSupportedInputLanguages;
    88     delete iSupportedInputLanguages;
    89     delete iFeatureManager_FeatureIds;
    89     delete iFeatureManager_FeatureIds;
   184     
   184     
   185     ClearReader();
   185     ClearReader();
   186     }
   186     }
   187 
   187 
   188 TBool CCSXHHTMLContentParser::GetHTMLContentPathForDriveL(TBuf<KMaxFileName>* aContentDrive,CCoeEnv *aCoeEnv)
   188 TBool CCSXHHTMLContentParser::GetHTMLContentPathForDriveL(TBuf<KMaxFileName>* aContentDrive,CCoeEnv *aCoeEnv)
   189 	{
   189     {
   190     // get the path to language level
   190     // get the path to language level
   191     // Input: aContentDrive == C or E or Z
   191     // Input: aContentDrive == C or E or Z
   192     // Output: aContentDrive == C:\\resource\\xhtml\\01\\ (or Z:\\resource\\xhtml\\31\\)
   192     // Output: aContentDrive == C:\\resource\\xhtml\\01\\ (or Z:\\resource\\xhtml\\31\\)
   193     //
   193     //
   194 	aContentDrive->Append(KXhtmlFolder);
   194     aContentDrive->Append(KXhtmlFolder);
   195 	TInt len = aContentDrive->Length();
   195     TInt len = aContentDrive->Length();
   196 	RFs& FileSession = aCoeEnv->FsSession();
   196     RFs& FileSession = aCoeEnv->FsSession();
   197 	RArray<TLanguage> langs;
   197     RArray<TLanguage> langs;
   198    	BaflUtils::GetDowngradePathL(FileSession,User::Language(),langs);
   198        BaflUtils::GetDowngradePathL(FileSession,User::Language(),langs);
   199     		
   199             
   200     for(int i = 0; i < langs.Count(); ++i)
   200     for(int i = 0; i < langs.Count(); ++i)
   201     	{
   201         {
   202     	TLanguage lang = langs[i];
   202         TLanguage lang = langs[i];
   203     	//TSW Error: UKAL-6YL72P
   203         //TSW Error: UKAL-6YL72P
   204     	//Tool chain uses full symbian language id in 
   204         //Tool chain uses full symbian language id in 
   205     	//the directory name, which is not detected by help application.
   205         //the directory name, which is not detected by help application.
   206     	//
   206         //
   207     	if(lang < 10)
   207         if(lang < 10)
   208             {
   208             {
   209             aContentDrive->AppendNumFixedWidth(lang,EDecimal,2);
   209             aContentDrive->AppendNumFixedWidth(lang,EDecimal,2);
   210             }
   210             }
   211         else
   211         else
   212             {
   212             {
   213             aContentDrive->AppendNum(lang);
   213             aContentDrive->AppendNum(lang);
   214             }
   214             }
   215     	
   215         
   216     	aContentDrive->Append(KFwdSlash);
   216         aContentDrive->Append(KFwdSlash);
   217     	if(BaflUtils::PathExists(FileSession,*aContentDrive))
   217         if(BaflUtils::PathExists(FileSession,*aContentDrive))
   218     		{
   218             {
   219     		langs.Reset();
   219             langs.Reset();
   220     		return ETrue;
   220             return ETrue;
   221     		}
   221             }
   222     	else
   222         else
   223     		{
   223             {
   224     		aContentDrive->Delete((len-1),aContentDrive->Length()-len);
   224             aContentDrive->Delete((len-1),aContentDrive->Length()-len);
   225     		}	
   225             }    
   226     	}
   226         }
   227     	langs.Reset();
   227         langs.Reset();
   228     	return EFalse;
   228         return EFalse;
   229 	}
   229     }
   230     
   230     
   231 TBool CCSXHHTMLContentParser::HandleMasterMetaFileL(CCSXHHelpDataBase* aDataBase, 
   231 TBool CCSXHHTMLContentParser::HandleMasterMetaFileL(CCSXHHelpDataBase* aDataBase, 
   232                         TChar& aDrive, MSenContentHandlerClient *aPrevHandler)											   
   232                         TChar& aDrive, MSenContentHandlerClient *aPrevHandler)                                               
   233     {
   233     {
   234     RFs& FileSession = iCoeEnv->FsSession();
   234     RFs& FileSession = iCoeEnv->FsSession();
   235     TBuf<KMaxFileName> masterFile;
   235     TBuf<KMaxFileName> masterFile;
   236 
   236 
   237     iIndexing->GetPrivatePath( masterFile );
   237     iIndexing->GetPrivatePath( masterFile );
   259 
   259 
   260     return ETrue;
   260     return ETrue;
   261     }
   261     }
   262 
   262 
   263 TBool CCSXHHTMLContentParser::IsRedirectedL(CCSXHHelpDataBase *aDataBase, 
   263 TBool CCSXHHTMLContentParser::IsRedirectedL(CCSXHHelpDataBase *aDataBase, 
   264 		                      const TDesC &aPath, TUid &aUid, TCoeContextName &aContextName)											   
   264                               const TDesC &aPath, TUid &aUid, TCoeContextName &aContextName)                                               
   265     {
   265     {
   266     RFs& FileSession = iCoeEnv->FsSession();
   266     RFs& FileSession = iCoeEnv->FsSession();
   267     TBuf<KMaxFileName> redirectFile( aPath );
   267     TBuf<KMaxFileName> redirectFile( aPath );
   268     redirectFile.Append( KRedirectFile );
   268     redirectFile.Append( KRedirectFile );
   269     TBool result = EFalse;
   269     TBool result = EFalse;
   277         CleanupStack::PushL( XMLParser );      
   277         CleanupStack::PushL( XMLParser );      
   278         InitializeReaderL( XMLParser );
   278         InitializeReaderL( XMLParser );
   279         // ParseL is not in async
   279         // ParseL is not in async
   280         iXmlReader->ParseL( FileSession, redirectFile );
   280         iXmlReader->ParseL( FileSession, redirectFile );
   281         if ( XMLParser->IsTargetPathFound() )
   281         if ( XMLParser->IsTargetPathFound() )
   282         	{
   282             {
   283             TBuf<KMaxFileName>& targetContextName = XMLParser->TargetContextName();
   283             TBuf<KMaxFileName>& targetContextName = XMLParser->TargetContextName();
   284             if ( targetContextName.Length() <= aContextName.MaxLength() )
   284             if ( targetContextName.Length() <= aContextName.MaxLength() )
   285             	{
   285                 {
   286         	    aUid = XMLParser->TargetUid();
   286                 aUid = XMLParser->TargetUid();
   287         	    aContextName = targetContextName;
   287                 aContextName = targetContextName;
   288         	    result = ETrue;
   288                 result = ETrue;
   289                 }
   289                 }
   290         	}
   290             }
   291         CleanupStack::PopAndDestroy( XMLParser );
   291         CleanupStack::PopAndDestroy( XMLParser );
   292         ClearReader();
   292         ClearReader();
   293         }
   293         }
   294 
   294 
   295     return result;
   295     return result;
   312     XMLParser->SetPath(lookupindexfile);
   312     XMLParser->SetPath(lookupindexfile);
   313     lookupindexfile.Append(KIndexFile);              
   313     lookupindexfile.Append(KIndexFile);              
   314  
   314  
   315     if(BaflUtils::FileExists(FileSession,lookupindexfile))
   315     if(BaflUtils::FileExists(FileSession,lookupindexfile))
   316         iXmlReader->ParseL (FileSession,lookupindexfile);
   316         iXmlReader->ParseL (FileSession,lookupindexfile);
   317 	
   317     
   318 	TBuf<KMaxFileName>HelpContentName(toc1->GetName());
   318     TBuf<KMaxFileName>HelpContentName(toc1->GetName());
   319 	int toc1Count = iDuplicateHelpTopicList.Count();
   319     int toc1Count = iDuplicateHelpTopicList.Count();
   320 	
   320     
   321  	for(int i=0;i < toc1Count;i++)
   321      for(int i=0;i < toc1Count;i++)
   322 	    {    
   322         {    
   323 	    CCSXHHtmlTOC1* temptoc1 = iDuplicateHelpTopicList[i];
   323         CCSXHHtmlTOC1* temptoc1 = iDuplicateHelpTopicList[i];
   324 	        
   324             
   325 	    if(temptoc1->GetName().CompareF(HelpContentName) == 0)
   325         if(temptoc1->GetName().CompareF(HelpContentName) == 0)
   326 		    {    
   326             {    
   327 		    TBuf<KMaxFileName> lookup;
   327             TBuf<KMaxFileName> lookup;
   328 		    temptoc1->GetHelpFileL(lookup);
   328             temptoc1->GetHelpFileL(lookup);
   329 		    XMLParser->SetPath(lookup);
   329             XMLParser->SetPath(lookup);
   330 		    lookup.Append(KIndexFile);              
   330             lookup.Append(KIndexFile);              
   331 		 
   331          
   332 		    if(BaflUtils::FileExists(FileSession,lookup))
   332             if(BaflUtils::FileExists(FileSession,lookup))
   333 		        iXmlReader->ParseL (FileSession,lookup);
   333                 iXmlReader->ParseL (FileSession,lookup);
   334 		    }
   334             }
   335 	    }
   335         }
   336     
   336     
   337     CleanupStack::PopAndDestroy(XMLParser);
   337     CleanupStack::PopAndDestroy(XMLParser);
   338     ClearReader();
   338     ClearReader();
   339     }       
   339     }       
   340         
   340         
   341 TAny* CCSXHHTMLContentParser::GetTopicContentL(CCSXHGenericTOC2* aTopic)
   341 TAny* CCSXHHTMLContentParser::GetTopicContentL(CCSXHGenericTOC2* aTopic)
   342     {
   342     {
   343     CCSXHHtmlTOC2* topic = STATIC_CAST(CCSXHHtmlTOC2*,aTopic);
   343     CCSXHHtmlTOC2* topic = STATIC_CAST(CCSXHHtmlTOC2*,aTopic);
   344     TBuf<KMaxFileName> htmlFile;
   344     TBuf<KMaxFileName> htmlFile;
   345 	topic->GetHtmlFileName(htmlFile);
   345     topic->GetHtmlFileName(htmlFile);
   346     return GetContentsFromFileL(htmlFile,iCoeEnv,iFeatureControl);
   346     return GetContentsFromFileL(htmlFile,iCoeEnv,iFeatureControl);
   347     }
   347     }
   348     
   348     
   349 
   349 
   350 void CCSXHHTMLContentParser::ScanAndParseXMLfileToCreateTOC1ObjectL(RFs& FileSession,
   350 void CCSXHHTMLContentParser::ScanAndParseXMLfileToCreateTOC1ObjectL(
   351                                                                  CDirScan* scanner,
   351         RFs& FileSession,
   352                                                                  CCSXHHelpDataBase* aDataBase,
   352         CDirScan* scanner,
   353                                                                  const TInt& aDrive,
   353         CCSXHHelpDataBase* aDataBase,
   354                                                                  CCSXHXMLParseHandler_MetaFile* XMLParser
   354         const TInt& aDrive,
   355                                                                   )
   355         CCSXHXMLParseHandler_MetaFile* XMLParser
   356     {
   356         )
   357      CDir* entryList = NULL;
   357     {
       
   358     CDir* entryList = NULL;
   358     scanner->NextL(entryList);
   359     scanner->NextL(entryList);
   359     if(!entryList)
   360     if (!entryList)
       
   361         {
   360         return;
   362         return;
       
   363         }
   361  
   364  
   362     CleanupStack::PushL(entryList);
   365     CleanupStack::PushL(entryList);
   363     TInt entryCount = entryList->Count();           
   366     
   364          
   367     TInt entryCount = entryList->Count();     
   365     TInt ROMDrive;
   368     TInt ROMDrive;
   366     RFs::CharToDrive( PathInfo::RomRootPath()[0], ROMDrive );
   369     RFs::CharToDrive(PathInfo::RomRootPath()[0], ROMDrive);
   367     
       
   368     TBuf<KMaxFileName> lookup;
   370     TBuf<KMaxFileName> lookup;
   369     
   371 
   370 
   372     while (entryCount--)
   371     while(entryCount--)
   373         {
   372         {
   374         TEntry entry = (*entryList)[entryCount];
   373         TEntry entry=(*entryList)[entryCount];
       
   374         
   375         
   375         //Clear the previous values
   376         //Clear the previous values
   376         lookup.Delete(0,lookup.Length());
   377         lookup.Delete(0, lookup.Length());
   377         
       
   378         lookup.Append(scanner->FullPath());
   378         lookup.Append(scanner->FullPath());
   379         lookup.Append(entry.iName); 
   379         lookup.Append(entry.iName); 
   380         lookup.Append(KFwdSlash);
   380         lookup.Append(KFwdSlash);
   381         lookup.Append(KMetaFile);
   381         lookup.Append(KMetaFile);
   382         
   382         
   383         //Check whether a file exists        
   383         //Check whether a file exists        
   384         if(!BaflUtils::FileExists(FileSession,lookup))
   384         if (!BaflUtils::FileExists(FileSession,lookup))
   385             continue;
   385             continue;
   386         
   386         
   387         TRAPD(parserResult,iXmlReader->ParseL (FileSession,lookup ));
   387         TRAPD(parserResult, iXmlReader->ParseL(FileSession, lookup));
   388         if(parserResult == KErrNone)
   388         if (parserResult == KErrNone)
   389             {
   389             {
   390 			if(CheckFeatureIDL(XMLParser->GetFeatureIds()))
   390             if (CheckFeatureIDL(XMLParser->GetFeatureIds()))
   391             	{            
   391                 {            
   392             	if(!IsAppUIdPresentAlready(entry.iName))
   392                 if (!IsAppUIdPresentAlready(entry.iName))
   393 					{
   393                     {
   394 					CCSXHHtmlTOC1* CategoryObj = NULL;
   394                     TBool isRomBased = EFalse;
   395 		            TBool duplicateToc = EFalse;
   395                     TInt32 priority = XMLParser->Priority();
   396 		            
   396                     
   397 		            TInt32 priority = XMLParser->Priority();
   397                     // Now we take a walk if it's application helps (priority == 0)
   398 		            // Now we take a walk if it's application helps (priority == 0)
   398                     if ((priority != 0) 
   399 		           
   399                         && ((aDrive == ROMDrive) || IsRomBasedContentL(FileSession, entry.iName)))
   400 		            if ( (priority != 0) 
   400                         {
   401 		            	&& ( ( aDrive == ROMDrive ) || IsRomBasedContentL( FileSession, entry.iName ) ) )
   401                         if (priority < KHighestPriority)
   402 		                {
   402                             {
   403 		                if ( priority < KHighestPriority )
   403                             priority = KHighestPriority;
   404 		                	{
   404                             }
   405 		                    priority = KHighestPriority;
   405                         else if (priority > KLowestPriority)
   406 		                	}
   406                             {
   407 		                else if ( priority > KLowestPriority )
   407                             priority = KLowestPriority;
   408 		                	{
   408                             }
   409 		                    priority = KLowestPriority;
   409                         
   410 		                	}
   410                         isRomBased = ETrue;
   411 		                
   411                         }
   412 		                CategoryObj = CCSXHHtmlTOC1::NewL(
   412                     else 
   413 		                		           XMLParser->GetApplicationName(),entry.iName,aDrive, 
   413                         {
   414 		                		           KCSXHToc2ViewID, priority);
   414                         priority = 0;
   415 		                if(CategoryObj && aDataBase->GetMainTopics()->InsertChildWithPriority(CategoryObj,EFalse))
   415                         }
   416 		            	    iHtmlTOC1List.Append(CategoryObj);//Keep a local copy 
   416                     
   417 		                else
   417                     CCSXHHtmlTOC1* categoryObj = CCSXHHtmlTOC1::NewL(XMLParser->GetApplicationName(), entry.iName, aDrive, 
   418 		                    duplicateToc = ETrue;
   418                             isRomBased ? KCSXHToc2ViewID : KCSXHToc2AppHelpsViewID, priority);
   419 		                }
   419                     if (!categoryObj->IsValid())
   420 		            else 
   420                         {
   421 		           		{
   421                         delete categoryObj;
   422 		           		CategoryObj = CCSXHHtmlTOC1::NewL(
   422                         }
   423 		           		                    XMLParser->GetApplicationName(),entry.iName, aDrive, 
   423                     else
   424 		           		                    KCSXHToc2AppHelpsViewID, 0);
   424                         {
   425 		           		               
   425                         CleanupStack::PushL(categoryObj);
   426 		           		if(CategoryObj && aDataBase->GetAppHelpsTopics()->InsertChild(CategoryObj,EFalse))
   426                         if (isRomBased)
   427 		                                    iHtmlTOC1List.Append(CategoryObj);//Keep a local copy 
   427                             {
   428 		           		else
   428                             if (aDataBase->GetMainTopics()->InsertChildWithPriority(categoryObj, EFalse))
   429 		           		    duplicateToc = ETrue;
   429                                 {
   430 		           		}
   430                                 iHtmlTOC1List.AppendL(categoryObj);
   431 		            if ( CategoryObj )
   431                                 }
   432 		            	{
   432                             else
   433 		                iIndexing->RuntimeGenerateIndexL( *CategoryObj, XMLParser->GetFeatureIds() );
   433                                 {
   434 
   434                                 iDuplicateHelpTopicList.AppendL(categoryObj);
   435                         if( duplicateToc )
   435                                 }
   436                         	{
   436                             }
   437                             iDuplicateHelpTopicList.Append(CategoryObj);
   437                         else
   438                         	}
   438                             {
   439 		            	}
   439                             if (aDataBase->GetAppHelpsTopics()->InsertChild(categoryObj, EFalse))
   440 		            }
   440                                 {
   441             	}         
   441                                 iHtmlTOC1List.AppendL(categoryObj);
       
   442                                 }
       
   443                             else
       
   444                                 {
       
   445                                 iDuplicateHelpTopicList.AppendL(categoryObj);
       
   446                                 }
       
   447                             }
       
   448                         
       
   449                         iIndexing->RuntimeGenerateIndexL(*categoryObj, XMLParser->GetFeatureIds());
       
   450                         CleanupStack::Pop(categoryObj);
       
   451                         }
       
   452                     }
       
   453                 }         
   442             }
   454             }
   443         }       
   455         }       
   444 
   456 
   445     CleanupStack::PopAndDestroy(entryList);
   457     CleanupStack::PopAndDestroy(entryList);
   446     }
   458     }
       
   459 
   447 TBool CCSXHHTMLContentParser::IsRomBasedContentL( RFs& FileSession, const TDesC &aUid )
   460 TBool CCSXHHTMLContentParser::IsRomBasedContentL( RFs& FileSession, const TDesC &aUid )
   448     {
   461     {
   449 #ifdef __WINSCW__
   462 #ifdef __WINSCW__
   450     return ETrue;
   463     return ETrue;
   451 #endif
   464 #endif
   452     
   465     
   453 	TBool result = EFalse;
   466     TBool result = EFalse;
   454 	CDirScan* scanner=CDirScan::NewLC(FileSession);
   467     CDirScan* scanner=CDirScan::NewLC(FileSession);
   455 	TBuf<KMaxFileName> rootDir;
   468     TBuf<KMaxFileName> rootDir;
   456 	rootDir.Append( 'z' );
   469     rootDir.Append( 'z' );
   457 	        	
   470                 
   458 	if( GetHTMLContentPathForDriveL( &rootDir,iCoeEnv ) )
   471     if( GetHTMLContentPathForDriveL( &rootDir,iCoeEnv ) )
   459 		{
   472         {
   460 	    scanner->SetScanDataL(rootDir,KEntryAttDir|KEntryAttMatchExclusive,
   473         scanner->SetScanDataL(rootDir,KEntryAttDir|KEntryAttMatchExclusive,
   461 	                                    ESortByName|EAscending, CDirScan::EScanDownTree);
   474                                         ESortByName|EAscending, CDirScan::EScanDownTree);
   462         CDir* entryList = NULL;
   475         CDir* entryList = NULL;
   463         scanner->NextL(entryList);
   476         scanner->NextL(entryList);
   464     
   477     
   465         if ( !entryList )
   478         if ( !entryList )
   466         	{
   479             {
   467             CleanupStack::PopAndDestroy( scanner );
   480             CleanupStack::PopAndDestroy( scanner );
   468             return EFalse;
   481             return EFalse;
   469         	}
   482             }
   470  
   483  
   471         TInt entryCount = entryList->Count();           
   484         TInt entryCount = entryList->Count();           
   472     
   485     
   473         while ( entryCount-- )
   486         while ( entryCount-- )
   474             {
   487             {
   475             TEntry entry=(*entryList)[entryCount]; 
   488             TEntry entry=(*entryList)[entryCount]; 
   476             if ( ( entry.iName ).CompareC(aUid) == 0 )
   489             if ( ( entry.iName ).CompareC(aUid) == 0 )
   477         	    {
   490                 {
   478                 result = ETrue;
   491                 result = ETrue;
   479             	break;
   492                 break;
   480         	    }
   493                 }
   481             }
   494             }
   482         delete entryList;
   495         delete entryList;
   483 		}
   496         }
   484     
   497     
   485     CleanupStack::PopAndDestroy( scanner );
   498     CleanupStack::PopAndDestroy( scanner );
   486  
   499  
   487     return result;
   500     return result;
   488     }
   501     }
   489     
   502     
   490 void CCSXHHTMLContentParser::InsertHTMLToc1L(
   503 void CCSXHHTMLContentParser::InsertHTMLToc1L(
   491             const TDesC &appUidName,const TDesC &appName, 
   504         const TDesC& aAppUidName,
   492             const TInt& aDrive , CCSXHHelpDataBase* aDataBase, 
   505         const TDesC& aAppName, 
   493             const TDesC &FeatureIds, TInt32 aPriority )
   506         const TInt& aDrive,
   494     {
   507         CCSXHHelpDataBase* aDataBase, 
   495 	if(CheckFeatureIDL(FeatureIds))
   508         const TDesC& aFeatureIds, 
   496 	    {
   509         TInt32 aPriority
   497 	    if(!IsAppUIdPresentAlready(appUidName)) 
   510         )
   498             {    
   511     {
   499             CCSXHHtmlTOC1* CategoryObj = NULL;
   512     if (CheckFeatureIDL(aFeatureIds))
   500             TBool duplicateToc = EFalse;
   513         {
       
   514         if (!IsAppUIdPresentAlready(aAppUidName)) 
       
   515             {
   501             // Now we take a walk if it's application helps (priority == 0)
   516             // Now we take a walk if it's application helps (priority == 0)
   502             if ( aPriority == 0 )
   517             CCSXHHtmlTOC1* categoryObj = CCSXHHtmlTOC1::NewL(aAppName,aAppUidName, aDrive,
       
   518                     aPriority == 0 ? KCSXHToc2AppHelpsViewID : KCSXHToc2ViewID, aPriority);
       
   519             
       
   520             if (categoryObj->IsValid())
   503                 {
   521                 {
   504                 CategoryObj = CCSXHHtmlTOC1::NewL(appName,appUidName,aDrive,
   522                 CleanupStack::PushL(categoryObj);
   505                 		                          KCSXHToc2AppHelpsViewID,aPriority);
   523                 if (aPriority == 0)
   506                 // Hardcode EDriveZ as ROM drive, need to be runtime check?
   524                     {
   507                 if(CategoryObj && aDataBase->GetAppHelpsTopics()->InsertChild(CategoryObj,EFalse))
   525                     if (aDataBase->GetAppHelpsTopics()->InsertChild(categoryObj, EFalse))
   508                     iHtmlTOC1List.Append(CategoryObj);//Keep a local copy 
   526                         {
       
   527                         iHtmlTOC1List.AppendL(categoryObj);
       
   528                         }
       
   529                     else
       
   530                         {
       
   531                         iDuplicateHelpTopicList.AppendL(categoryObj);
       
   532                         }
       
   533                     }
   509                 else
   534                 else
   510                     duplicateToc = ETrue;
   535                     {
       
   536                     if (aDataBase->GetMainTopics()->InsertChildWithPriority(categoryObj, EFalse))
       
   537                         {
       
   538                         iHtmlTOC1List.AppendL(categoryObj); //Keep a local copy*/
       
   539                         }
       
   540                     else
       
   541                         {
       
   542                         iDuplicateHelpTopicList.AppendL(categoryObj);
       
   543                         }
       
   544                     }
       
   545                 CleanupStack::Pop(categoryObj);
   511                 }
   546                 }
   512             else
   547             else
   513                 {
   548                 {
   514                 CategoryObj = CCSXHHtmlTOC1::NewL(appName,appUidName,aDrive,
   549                 delete categoryObj;
   515                 		                          KCSXHToc2ViewID,aPriority);
   550                 }                    
   516                 if(CategoryObj && aDataBase->GetMainTopics()->InsertChildWithPriority(CategoryObj,EFalse))
   551             }
   517                     iHtmlTOC1List.Append(CategoryObj);//Keep a local copy*/ 
   552         }    
   518                 else
       
   519                     duplicateToc = ETrue;
       
   520                 }
       
   521 
       
   522             if( CategoryObj && duplicateToc )  
       
   523                 iDuplicateHelpTopicList.Append(CategoryObj);			    	
       
   524 		    }
       
   525 	    }	
       
   526     }
   553     }
   527     
   554     
   528 HBufC8* CCSXHHTMLContentParser::GetContentsFromFileL(const TDesC& htmlFile,CCoeEnv* aCoeEnv,
   555 HBufC8* CCSXHHTMLContentParser::GetContentsFromFileL(const TDesC& htmlFile,CCoeEnv* aCoeEnv,
   529 			RFeatureControl& aFeatureControl) 
   556             RFeatureControl& aFeatureControl) 
   530     {
   557     {
   531     RFs& fileSession = aCoeEnv->FsSession();        
   558     RFs& fileSession = aCoeEnv->FsSession();        
   532     TInt SlashPosition = htmlFile.LocateReverse('\\');    
   559     TInt SlashPosition = htmlFile.LocateReverse('\\');    
   533     TBuf<KMaxFileName>* CompressedFile = new (ELeave) TBuf<KMaxFileName>; 
   560     TBuf<KMaxFileName>* CompressedFile = new (ELeave) TBuf<KMaxFileName>; 
   534     CleanupStack::PushL(CompressedFile); //1
   561     CleanupStack::PushL(CompressedFile); //1
   559     const TBuf<KMaxFileName>*Fname;
   586     const TBuf<KMaxFileName>*Fname;
   560     TBuf<KMaxFileName> *HtmlFileName = new (ELeave) TBuf<KMaxFileName>;
   587     TBuf<KMaxFileName> *HtmlFileName = new (ELeave) TBuf<KMaxFileName>;
   561     CleanupStack::PushL(HtmlFileName); //4
   588     CleanupStack::PushL(HtmlFileName); //4
   562     HtmlFileName->Copy(htmlFile.Mid(SlashPosition+1));
   589     HtmlFileName->Copy(htmlFile.Mid(SlashPosition+1));
   563     for(nCount=0;member!=NULL;nCount++)
   590     for(nCount=0;member!=NULL;nCount++)
   564     	{    	 
   591         {         
   565     	 Fname = member->Name();    
   592          Fname = member->Name();    
   566 	     if(Fname->Compare(*HtmlFileName)==0 )
   593          if(Fname->Compare(*HtmlFileName)==0 )
   567 	    	{
   594             {
   568 	    	break;
   595             break;
   569 	    	}	    
   596             }        
   570 	    delete member;	
   597         delete member;    
   571     	member = members->NextL();    	
   598         member = members->NextL();        
   572     	}
   599         }
   573 
   600 
   574 	if(NULL == member)
   601     if(NULL == member)
   575 		{
   602         {
   576 		CleanupStack::PopAndDestroy(HtmlFileName);
   603         CleanupStack::PopAndDestroy(HtmlFileName);
   577 		CleanupStack::PopAndDestroy(members);
   604         CleanupStack::PopAndDestroy(members);
   578 	    CleanupStack::PopAndDestroy(zipFile);
   605         CleanupStack::PopAndDestroy(zipFile);
   579 	    CleanupStack::PopAndDestroy(CompressedFile);
   606         CleanupStack::PopAndDestroy(CompressedFile);
   580 	    
   607         
   581 	    HBufC8* buffer = GetContentsFromHTMLFileL(htmlFile,aCoeEnv);
   608         HBufC8* buffer = GetContentsFromHTMLFileL(htmlFile,aCoeEnv);
   582 	    return MergeCssAndHTMLContentL(buffer,CssContent);
   609         return MergeCssAndHTMLContentL(buffer,CssContent);
   583 	    }
   610         }
   584 		
   611         
   585     CleanupStack::PushL(member);//5
   612     CleanupStack::PushL(member);//5
   586     RZipFileMemberReaderStream* stream;
   613     RZipFileMemberReaderStream* stream;
   587     zipFile->GetInputStreamL(member, stream);
   614     zipFile->GetInputStreamL(member, stream);
   588     CleanupStack::PushL(stream);//6
   615     CleanupStack::PushL(stream);//6
   589         
   616         
   622     Master_kywdPath->Append(PathInfo::RomRootPath().Left(1));
   649     Master_kywdPath->Append(PathInfo::RomRootPath().Left(1));
   623     GetHTMLContentPathForDriveL(Master_kywdPath,iCoeEnv);
   650     GetHTMLContentPathForDriveL(Master_kywdPath,iCoeEnv);
   624     Master_kywdPath->Append(KMasterKywdFile);
   651     Master_kywdPath->Append(KMasterKywdFile);
   625     
   652     
   626     if(BaflUtils::FileExists(FileSession,*Master_kywdPath))
   653     if(BaflUtils::FileExists(FileSession,*Master_kywdPath))
   627     	{    	
   654         {        
   628         TRAP_IGNORE(iXmlReader->ParseL(FileSession,*Master_kywdPath ));
   655         TRAP_IGNORE(iXmlReader->ParseL(FileSession,*Master_kywdPath ));
   629         bMasterKeywordFilePresent = ETrue;
   656         bMasterKeywordFilePresent = ETrue;
   630     	}    
   657         }    
   631     
   658     
   632     //KMasterKywdFile;
   659     //KMasterKywdFile;
   633     CleanupStack::PopAndDestroy(Master_kywdPath);
   660     CleanupStack::PopAndDestroy(Master_kywdPath);
   634     CleanupStack::PopAndDestroy(XMLParser_MasterKywd);
   661     CleanupStack::PopAndDestroy(XMLParser_MasterKywd);
   635     ClearReader();	
   662     ClearReader();    
   636     
   663     
   637     return bMasterKeywordFilePresent;
   664     return bMasterKeywordFilePresent;
   638     }
   665     }
   639     
   666     
   640 void CCSXHHTMLContentParser::GenerateKywdTOC1ListL(CCSXHHelpDataBase* aDataBase)
   667 void CCSXHHTMLContentParser::GenerateKywdTOC1ListL(CCSXHHelpDataBase* aDataBase)
   669         return;
   696         return;
   670     
   697     
   671     CCSXHXMLParseHandler_Kywd* XMLParser = CCSXHXMLParseHandler_Kywd::NewL(iCoeEnv);
   698     CCSXHXMLParseHandler_Kywd* XMLParser = CCSXHXMLParseHandler_Kywd::NewL(iCoeEnv);
   672     CleanupStack::PushL(XMLParser);      
   699     CleanupStack::PushL(XMLParser);      
   673     InitializeReaderL(XMLParser);
   700     InitializeReaderL(XMLParser);
   674 	
   701     
   675     int toc1Count = TOC1HtmlList->Count();
   702     int toc1Count = TOC1HtmlList->Count();
   676     CCSXHHtmlTOC1* toc1;
   703     CCSXHHtmlTOC1* toc1;
   677 
   704 
   678     RFs& FileSession = iCoeEnv->FsSession();
   705     RFs& FileSession = iCoeEnv->FsSession();
   679     
   706     
   701     CleanupStack::PopAndDestroy(XMLParser);  
   728     CleanupStack::PopAndDestroy(XMLParser);  
   702     ClearReader();
   729     ClearReader();
   703     }
   730     }
   704     
   731     
   705 CCSXHHelpContentBase* CCSXHHTMLContentParser::GetContextTopicL( 
   732 CCSXHHelpContentBase* CCSXHHTMLContentParser::GetContextTopicL( 
   706 		CCSXHHelpDataBase *aDataBase, 
   733         CCSXHHelpDataBase *aDataBase, 
   707 		TUid &aUid, 
   734         TUid &aUid, 
   708 		TCoeContextName &aContextName
   735         TCoeContextName &aContextName
   709 		)
   736         )
   710     {
   737     {
   711     TBuf<KMaxFileName> path;
   738     TBuf<KMaxFileName> path;
   712     TInt32 toc1Count = iHtmlTOC1List.Count();
   739     TInt32 toc1Count = iHtmlTOC1List.Count();
   713     TInt32 dupToc1Count = iDuplicateHelpTopicList.Count();
   740     TInt32 dupToc1Count = iDuplicateHelpTopicList.Count();
   714     CCSXHHtmlTOC1 *toc1 = NULL;
   741     CCSXHHtmlTOC1 *toc1 = NULL;
   720         toc1 = iHtmlTOC1List[i];
   747         toc1 = iHtmlTOC1List[i];
   721         if ( aUid == toc1->GetAppUid() )
   748         if ( aUid == toc1->GetAppUid() )
   722             {
   749             {
   723             toc1->GetHelpFileL( path );
   750             toc1->GetHelpFileL( path );
   724             if ( IsRedirectedL( aDataBase, path, aUid, aContextName ) )
   751             if ( IsRedirectedL( aDataBase, path, aUid, aContextName ) )
   725             	{
   752                 {
   726                 redirected = ETrue;
   753                 redirected = ETrue;
   727             	}
   754                 }
   728             else
   755             else
   729             	{
   756                 {
   730                 return toc1->GetContextTopic( aContextName );
   757                 return toc1->GetContextTopic( aContextName );
   731             	}
   758                 }
   732             break;
   759             break;
   733             }
   760             }
   734         }
   761         }
   735     
   762     
   736     if ( !redirected )
   763     if ( !redirected )
   737         {
   764         {
   738         for ( TInt32 i = 0; i < dupToc1Count; ++i )
   765         for ( TInt32 i = 0; i < dupToc1Count; ++i )
   739             {
   766             {
   740     	    toc1 = iDuplicateHelpTopicList[i];
   767             toc1 = iDuplicateHelpTopicList[i];
   741     	    if ( aUid == toc1->GetAppUid() )
   768             if ( aUid == toc1->GetAppUid() )
   742     	        {
   769                 {
   743     	        toc1->GetHelpFileL( path );
   770                 toc1->GetHelpFileL( path );
   744     	        if ( IsRedirectedL( aDataBase, path, aUid, aContextName ) )
   771                 if ( IsRedirectedL( aDataBase, path, aUid, aContextName ) )
   745     	            {
   772                     {
   746     	            redirected = ETrue;
   773                     redirected = ETrue;
   747     	            }
   774                     }
   748     	        else
   775                 else
   749     	            {
   776                     {
   750     	            temptoc1 = GetCorrespondingTOC1FromMainArray(toc1->GetName());        		
   777                     temptoc1 = GetCorrespondingTOC1FromMainArray(toc1->GetName());                
   751     	            return temptoc1->GetContextTopic( aContextName );
   778                     return temptoc1->GetContextTopic( aContextName );
   752     	            }
   779                     }
   753     	        }
   780                 }
   754             }
   781             }
   755         }
   782         }
   756     	
   783         
   757     if ( redirected )
   784     if ( redirected )
   758     	{
   785         {
   759     	for ( TInt32 i = 0; i < toc1Count; ++i )
   786         for ( TInt32 i = 0; i < toc1Count; ++i )
   760     	    {
   787             {
   761     	    toc1 = iHtmlTOC1List[i];
   788             toc1 = iHtmlTOC1List[i];
   762     	    if ( aUid == toc1->GetAppUid() )
   789             if ( aUid == toc1->GetAppUid() )
   763     	        {    
   790                 {    
   764     	        return toc1->GetContextTopic( aContextName );
   791                 return toc1->GetContextTopic( aContextName );
   765     	        }
   792                 }
   766     	    }
   793             }
   767     	
   794         
   768     	for ( TInt32 i = 0; i < dupToc1Count; ++i )
   795         for ( TInt32 i = 0; i < dupToc1Count; ++i )
   769     	    {
   796             {
   770     	    toc1 = iDuplicateHelpTopicList[i];
   797             toc1 = iDuplicateHelpTopicList[i];
   771     	    if ( aUid == toc1->GetAppUid() )
   798             if ( aUid == toc1->GetAppUid() )
   772     	        {
   799                 {
   773     	    	temptoc1 = GetCorrespondingTOC1FromMainArray( toc1->GetName() );        		
   800                 temptoc1 = GetCorrespondingTOC1FromMainArray( toc1->GetName() );                
   774     	    	return temptoc1->GetContextTopic( aContextName );
   801                 return temptoc1->GetContextTopic( aContextName );
   775     	    	}
   802                 }
   776     	    }
   803             }
   777     	}
   804         }
   778         
   805         
   779     return NULL;
   806     return NULL;
   780     }
   807     }
   781     
   808     
   782 CCSXHHelpContentBase* CCSXHHTMLContentParser::GetHtmlTopicForUrlL(const TDesC& aUrl)
   809 CCSXHHelpContentBase* CCSXHHTMLContentParser::GetHtmlTopicForUrlL(const TDesC& aUrl)
   783     {
   810     {
   784     CCSXHHelpContentBase* tocobj = GetObjectBasedonUrlL(iHtmlTOC1List,aUrl,ETrue);
   811     CCSXHHelpContentBase* tocobj = GetObjectBasedonUrlL(iHtmlTOC1List,aUrl,ETrue);
   785     
   812     
   786     if(NULL == tocobj)
   813     if(NULL == tocobj)
   787     	tocobj = GetObjectBasedonUrlL(iDuplicateHelpTopicList,aUrl,EFalse);
   814         tocobj = GetObjectBasedonUrlL(iDuplicateHelpTopicList,aUrl,EFalse);
   788     
   815     
   789 	return tocobj;    	
   816     return tocobj;        
   790     }
   817     }
   791 
   818 
   792 CCSXHHelpContentBase* CCSXHHTMLContentParser::GetObjectBasedonUrlL(RPointerArray<CCSXHHtmlTOC1>& aTOC1ObjectsArray,
   819 CCSXHHelpContentBase* CCSXHHTMLContentParser::GetObjectBasedonUrlL(RPointerArray<CCSXHHtmlTOC1>& aTOC1ObjectsArray,
   793 		const TDesC& aUrl, TBool aMainArrayList)    
   820         const TDesC& aUrl, TBool aMainArrayList)    
   794     {
   821     {
   795         /*For URLs of form 
   822         /*For URLs of form 
   796         file:://<Drive Name>:/system/xhtml/<Lang ID>/<App UID>/Html name
   823         file:://<Drive Name>:/system/xhtml/<Lang ID>/<App UID>/Html name
   797       We can have help topics for other cases, help topic objects not possible   
   824       We can have help topics for other cases, help topic objects not possible   
   798     */
   825     */
   819             {
   846             {
   820             TFileName fileName;
   847             TFileName fileName;
   821             i = aUrl.LocateReverseF('/');
   848             i = aUrl.LocateReverseF('/');
   822             fileName = aUrl.Mid(i + 1);
   849             fileName = aUrl.Mid(i + 1);
   823             if(aMainArrayList)
   850             if(aMainArrayList)
   824             	temptoc1 = toc1;
   851                 temptoc1 = toc1;
   825             else
   852             else
   826             	temptoc1 = GetCorrespondingTOC1FromMainArray(toc1->GetName());	
   853                 temptoc1 = GetCorrespondingTOC1FromMainArray(toc1->GetName());    
   827             
   854             
   828             return temptoc1->GetHtmlTopicForFile(fileName);
   855             return temptoc1->GetHtmlTopicForFile(fileName);
   829             }
   856             }
   830         }
   857         }
   831     return NULL;	
   858     return NULL;    
   832     }
   859     }
   833 
   860 
   834 void CCSXHHTMLContentParser::GetHtmlFileL(CCoeEnv* coeEnv,const short& aDir,
   861 void CCSXHHTMLContentParser::GetHtmlFileL(CCoeEnv* coeEnv,const short& aDir,
   835                                             const TAppUid& aUid,TBuf<KMaxFileName>& aFileName)
   862                                             const TAppUid& aUid,TBuf<KMaxFileName>& aFileName)
   836     {
   863     {
   891         }    
   918         }    
   892     return EFalse;  
   919     return EFalse;  
   893     }
   920     }
   894 
   921 
   895 TBool CCSXHHTMLContentParser::GetHTMLToc1(const TDesC& aUid,CCSXHXMLParseHandler* aParser)
   922 TBool CCSXHHTMLContentParser::GetHTMLToc1(const TDesC& aUid,CCSXHXMLParseHandler* aParser)
   896 	{
   923     {
   897 	TUint AppId;
   924     TUint AppId;
   898 	
   925     
   899 	if(!aUid.Length())
   926     if(!aUid.Length())
   900 		return EFalse;
   927         return EFalse;
   901 
   928 
   902     TLex FolderUid(aUid.Mid(KOffset));
   929     TLex FolderUid(aUid.Mid(KOffset));
   903     FolderUid.Val(AppId,EHex);
   930     FolderUid.Val(AppId,EHex);
   904     TUid ApplicationUid = TUid::Uid((TInt)AppId);
   931     TUid ApplicationUid = TUid::Uid((TInt)AppId);
   905 	
   932     
   906 	int toc1Count = iHtmlTOC1List.Count();
   933     int toc1Count = iHtmlTOC1List.Count();
   907 	
   934     
   908     CCSXHHtmlTOC1* toc1;    
   935     CCSXHHtmlTOC1* toc1;    
   909     for(int i = 0; i < toc1Count; ++i)
   936     for(int i = 0; i < toc1Count; ++i)
   910         {
   937         {
   911         toc1 = iHtmlTOC1List[i];
   938         toc1 = iHtmlTOC1List[i];
   912         if(ApplicationUid == toc1->GetAppUid())
   939         if(ApplicationUid == toc1->GetAppUid())
   913         	{
   940             {
   914         	STATIC_CAST(CCSXHXMLParseHandler_MasterKywd*,aParser)->SetCurrentHtmlToc1(toc1); 
   941             STATIC_CAST(CCSXHXMLParseHandler_MasterKywd*,aParser)->SetCurrentHtmlToc1(toc1); 
   915         	return ETrue;
   942             return ETrue;
   916         	}            
   943             }            
   917         }
   944         }
   918 	
   945     
   919 	toc1Count = iDuplicateHelpTopicList.Count();	        
   946     toc1Count = iDuplicateHelpTopicList.Count();            
   920 	for(int i = 0; i < toc1Count; ++i)
   947     for(int i = 0; i < toc1Count; ++i)
   921         {
   948         {
   922         toc1 = iDuplicateHelpTopicList[i];
   949         toc1 = iDuplicateHelpTopicList[i];
   923         if(ApplicationUid == toc1->GetAppUid())
   950         if(ApplicationUid == toc1->GetAppUid())
   924         	{
   951             {
   925         	STATIC_CAST(CCSXHXMLParseHandler_MasterKywd*,aParser)->SetCurrentHtmlToc1(toc1); 
   952             STATIC_CAST(CCSXHXMLParseHandler_MasterKywd*,aParser)->SetCurrentHtmlToc1(toc1); 
   926         	return ETrue;
   953             return ETrue;
   927         	}            
   954             }            
   928         }
   955         }
   929                 
   956                 
   930     return EFalse;  
   957     return EFalse;  
   931 	}
   958     }
   932 
   959 
   933 //To get Corresponding toc1 from main array.
   960 //To get Corresponding toc1 from main array.
   934 CCSXHHtmlTOC1* CCSXHHTMLContentParser::GetCorrespondingTOC1FromMainArray(const TDesC& aApplicationName)
   961 CCSXHHtmlTOC1* CCSXHHTMLContentParser::GetCorrespondingTOC1FromMainArray(const TDesC& aApplicationName)
   935 	{
   962     {
   936 	TInt toc1Count = iHtmlTOC1List.Count();
   963     TInt toc1Count = iHtmlTOC1List.Count();
   937 	CCSXHHtmlTOC1* toc1;
   964     CCSXHHtmlTOC1* toc1;
   938 	for(int i=0;i<toc1Count;++i)
   965     for(int i=0;i<toc1Count;++i)
   939 		{
   966         {
   940 		toc1 = iHtmlTOC1List[i];
   967         toc1 = iHtmlTOC1List[i];
   941 		if(toc1->GetName().CompareF(aApplicationName) == 0)
   968         if(toc1->GetName().CompareF(aApplicationName) == 0)
   942 			return toc1;
   969             return toc1;
   943 		}
   970         }
   944 	
   971     
   945     return NULL;
   972     return NULL;
   946 	}
   973     }
   947 
   974 
   948 //Check UId is already present in the list.	
   975 //Check UId is already present in the list.    
   949 TBool CCSXHHTMLContentParser::IsAppUIdPresentAlready(const TDesC& aUid)
   976 TBool CCSXHHTMLContentParser::IsAppUIdPresentAlready(const TDesC& aUid)
   950 	{
   977     {
   951 	TBool result = EFalse;
   978     TBool result = EFalse;
   952 	TInt toc1Count = iHtmlTOC1List.Count();
   979     TInt toc1Count = iHtmlTOC1List.Count();
   953 	CCSXHHtmlTOC1* toc1;
   980     CCSXHHtmlTOC1* toc1;
   954 	
   981     
   955 	TUint AppId;
   982     TUint AppId;
   956     TLex FolderUid(aUid.Mid(KOffset));
   983     TLex FolderUid(aUid.Mid(KOffset));
   957     FolderUid.Val(AppId,EHex);
   984     FolderUid.Val(AppId,EHex);
   958     TUid ApplicationUid = TUid::Uid((TInt)AppId);
   985     TUid ApplicationUid = TUid::Uid((TInt)AppId);
   959 	
   986     
   960 	for(int i=0;i<toc1Count;++i)
   987     for(int i=0;i<toc1Count;++i)
   961 		{
   988         {
   962 		toc1 = iHtmlTOC1List[i];
   989         toc1 = iHtmlTOC1List[i];
   963 		if(ApplicationUid == toc1->GetAppUid())
   990         if(ApplicationUid == toc1->GetAppUid())
   964 			{
   991             {
   965 			result = ETrue;
   992             result = ETrue;
   966 			break;
   993             break;
   967 			}			
   994             }            
   968 		}
   995         }
   969 		
   996         
   970 	toc1Count =    iDuplicateHelpTopicList.Count();	
   997     toc1Count =    iDuplicateHelpTopicList.Count();    
   971 	for(int i=0;i<toc1Count;++i)
   998     for(int i=0;i<toc1Count;++i)
   972 		{
   999         {
   973 		toc1 = iDuplicateHelpTopicList[i];
  1000         toc1 = iDuplicateHelpTopicList[i];
   974 		if(ApplicationUid == toc1->GetAppUid())
  1001         if(ApplicationUid == toc1->GetAppUid())
   975 			{
  1002             {
   976 			result = ETrue;
  1003             result = ETrue;
   977 			break;
  1004             break;
   978 			}
  1005             }
   979 		}		
  1006         }        
   980 		
  1007         
   981 	return result;	
  1008     return result;    
   982 
  1009 
   983 	}
  1010     }
   984 	
  1011     
   985 void CCSXHHTMLContentParser::ParseKeywdFileAndCreatekywdTOC1ObjectsL(
  1012 void CCSXHHTMLContentParser::ParseKeywdFileAndCreatekywdTOC1ObjectsL(
   986 		RPointerArray<CCSXHHtmlTOC1>& aTOC1ObjectsArray,
  1013         RPointerArray<CCSXHHtmlTOC1>& aTOC1ObjectsArray,
   987 		CCSXHXMLParseHandler_Kywd* XMLParser, TBool bMasterKeywordFilePresent)
  1014         CCSXHXMLParseHandler_Kywd* XMLParser, TBool bMasterKeywordFilePresent)
   988 	{
  1015     {
   989 	int toc1Count = aTOC1ObjectsArray.Count();
  1016     int toc1Count = aTOC1ObjectsArray.Count();
   990     CCSXHHtmlTOC1* toc1;
  1017     CCSXHHtmlTOC1* toc1;
   991      
  1018      
   992     TBuf<KMaxFileName>* lookup = new(ELeave)TBuf<KMaxFileName>;
  1019     TBuf<KMaxFileName>* lookup = new(ELeave)TBuf<KMaxFileName>;
   993     CleanupStack::PushL(lookup);//1
  1020     CleanupStack::PushL(lookup);//1
   994     
  1021     
   995     RFs& FileSession = iCoeEnv->FsSession();
  1022     RFs& FileSession = iCoeEnv->FsSession();
   996 	
  1023     
   997 	    for(int i = 0; i < toc1Count; ++i)
  1024         for(int i = 0; i < toc1Count; ++i)
   998         {
  1025         {
   999         toc1 = aTOC1ObjectsArray[i];
  1026         toc1 = aTOC1ObjectsArray[i];
  1000         
  1027         
  1001         if(bMasterKeywordFilePresent && toc1->IsROMDrive())
  1028         if(bMasterKeywordFilePresent && toc1->IsROMDrive())
  1002         	continue;
  1029             continue;
  1003         
  1030         
  1004         //Clear the previous values
  1031         //Clear the previous values
  1005         lookup->Delete(0,lookup->Length());
  1032         lookup->Delete(0,lookup->Length());
  1006         
  1033         
  1007         toc1->GetHelpFileL(*lookup);
  1034         toc1->GetHelpFileL(*lookup);
  1014         XMLParser->SetCurrentHtmlToc1(toc1);
  1041         XMLParser->SetCurrentHtmlToc1(toc1);
  1015         TRAP_IGNORE(iXmlReader->ParseL(FileSession,*lookup ));
  1042         TRAP_IGNORE(iXmlReader->ParseL(FileSession,*lookup ));
  1016         }
  1043         }
  1017 
  1044 
  1018     CleanupStack::PopAndDestroy(lookup);  
  1045     CleanupStack::PopAndDestroy(lookup);  
  1019 	}
  1046     }
  1020 
  1047 
  1021 //RUNTIME
  1048 //RUNTIME
  1022 void CCSXHHTMLContentParser::GetSupportedFeatureListL()
  1049 void CCSXHHTMLContentParser::GetSupportedFeatureListL()
  1023 	{
  1050     {
  1024 	RFeatureUidArray SupportedFeatures;	
  1051     RFeatureUidArray SupportedFeatures;    
  1025 	TInt err = iFeatureControl.Connect();
  1052     TInt err = iFeatureControl.Connect();
  1026 	if ( err == KErrNone )
  1053     if ( err == KErrNone )
  1027 		{
  1054         {
  1028          // ListSupportedFeatures() returns one of the Symbian error codes.
  1055          // ListSupportedFeatures() returns one of the Symbian error codes.
  1029          err = iFeatureControl.ListSupportedFeatures( SupportedFeatures );
  1056          err = iFeatureControl.ListSupportedFeatures( SupportedFeatures );
  1030 		 	
  1057              
  1031          // Remember to call CloseL after using RFeatureControl.
  1058          // Remember to call CloseL after using RFeatureControl.
  1032          // It disconnects the Feature Manager server.
  1059          // It disconnects the Feature Manager server.
  1033          iFeatureControl.Close();  
  1060          iFeatureControl.Close();  
  1034 		}
  1061         }
  1035 	//As per new req. add true, flase to id and create an array.
  1062     //As per new req. add true, flase to id and create an array.
  1036 	
  1063     
  1037 	iFeatureManager_FeatureIds = new (ELeave) CDesCArrayFlat(2); 
  1064     iFeatureManager_FeatureIds = new (ELeave) CDesCArrayFlat(2); 
  1038 	
  1065     
  1039 	TBuf<25>CurrFId;
  1066     TBuf<25>CurrFId;
  1040 	
  1067     
  1041 	for(TInt i=0;i<SupportedFeatures.Count();i++)
  1068     for(TInt i=0;i<SupportedFeatures.Count();i++)
  1042 		{
  1069         {
  1043 		CurrFId.Copy(KEmptyString);	
  1070         CurrFId.Copy(KEmptyString);    
  1044 		CurrFId.AppendNum(SupportedFeatures[i].iUid);
  1071         CurrFId.AppendNum(SupportedFeatures[i].iUid);
  1045 		iFeatureManager_FeatureIds->AppendL(CurrFId);
  1072         iFeatureManager_FeatureIds->AppendL(CurrFId);
  1046 		
  1073         
  1047 		CurrFId.Copy(KTrue_StringtoAppend);	
  1074         CurrFId.Copy(KTrue_StringtoAppend);    
  1048 		CurrFId.AppendNum(SupportedFeatures[i].iUid);
  1075         CurrFId.AppendNum(SupportedFeatures[i].iUid);
  1049 		iFeatureManager_FeatureIds->AppendL(CurrFId);
  1076         iFeatureManager_FeatureIds->AppendL(CurrFId);
  1050 		
  1077         
  1051 		CurrFId.Copy(KFalse_StringtoAppend);	
  1078         CurrFId.Copy(KFalse_StringtoAppend);    
  1052 		CurrFId.AppendNum(SupportedFeatures[i].iUid);
  1079         CurrFId.AppendNum(SupportedFeatures[i].iUid);
  1053 		iFeatureManager_FeatureIds->AppendL(CurrFId);		
  1080         iFeatureManager_FeatureIds->AppendL(CurrFId);        
  1054 		}
  1081         }
  1055 		
  1082         
  1056 	//Input Language variation changes
  1083     //Input Language variation changes
  1057 	//-----------------------------------------
  1084     //-----------------------------------------
  1058 	//Create an array with supported input language		
  1085     //Create an array with supported input language        
  1059 	CPtiEngine* ptiEngine = CPtiEngine::NewL();
  1086     CPtiEngine* ptiEngine = CPtiEngine::NewL();
  1060     CleanupStack::PushL( ptiEngine );
  1087     CleanupStack::PushL( ptiEngine );
  1061     
  1088     
  1062     CArrayFix<TInt>* languageCodeArray = new(ELeave)CArrayFixFlat<TInt>(2);
  1089     CArrayFix<TInt>* languageCodeArray = new(ELeave)CArrayFixFlat<TInt>(2);
  1063     
  1090     
  1064     ptiEngine->GetAvailableLanguagesL( languageCodeArray );
  1091     ptiEngine->GetAvailableLanguagesL( languageCodeArray );
  1065 	
  1092     
  1066 	TInt nCount = languageCodeArray->Count();
  1093     TInt nCount = languageCodeArray->Count();
  1067 	
  1094     
  1068 	iSupportedInputLanguages = new (ELeave) CDesCArrayFlat(2); 
  1095     iSupportedInputLanguages = new (ELeave) CDesCArrayFlat(2); 
  1069 	
  1096     
  1070 	//Codescanner gives error, if member variables are pushed.
  1097     //Codescanner gives error, if member variables are pushed.
  1071 	//CleanupStack::PushL( iSupportedInputLanguages );
  1098     //CleanupStack::PushL( iSupportedInputLanguages );
  1072     
  1099     
  1073     for(TInt i=0; i<nCount;i++)
  1100     for(TInt i=0; i<nCount;i++)
  1074     	{
  1101         {
  1075     	TInt languageCode = languageCodeArray->At(i);
  1102         TInt languageCode = languageCodeArray->At(i);
  1076     	TBuf<25>Currlang(_L("LANGUAGE_"));
  1103         TBuf<25>Currlang(_L("LANGUAGE_"));
  1077 		if(languageCode < 10)
  1104         if(languageCode < 10)
  1078 			Currlang.AppendNumFixedWidth(languageCode,EDecimal,2);
  1105             Currlang.AppendNumFixedWidth(languageCode,EDecimal,2);
  1079 		else
  1106         else
  1080 			Currlang.AppendNum(languageCode);
  1107             Currlang.AppendNum(languageCode);
  1081 		
  1108         
  1082 		iSupportedInputLanguages->AppendL(Currlang);
  1109         iSupportedInputLanguages->AppendL(Currlang);
  1083     	}
  1110         }
  1084     
  1111     
  1085     //CleanupStack::Pop(iSupportedInputLanguages);	
  1112     //CleanupStack::Pop(iSupportedInputLanguages);    
  1086     CleanupStack::PopAndDestroy( ptiEngine );
  1113     CleanupStack::PopAndDestroy( ptiEngine );
  1087     
  1114     
  1088     delete languageCodeArray;	
  1115     delete languageCodeArray;    
  1089     //-----------------------------------------
  1116     //-----------------------------------------
  1090     
  1117     
  1091     SupportedFeatures.Close();
  1118     SupportedFeatures.Close();
  1092 	}
  1119     }
  1093 	
  1120     
  1094 //RUNTIME
  1121 //RUNTIME
  1095 TBool CCSXHHTMLContentParser::CheckFeatureIDL(const TDesC& aFeatureIds)
  1122 TBool CCSXHHTMLContentParser::CheckFeatureIDL(const TDesC& aFeatureIds)
  1096 	{
  1123     {
  1097 	if(/*KHexPrefixLength == aFeatureIds.Length() &&*/ 
  1124     if(/*KHexPrefixLength == aFeatureIds.Length() &&*/ 
  1098 		KErrNotFound != aFeatureIds.Find(KDefaultFeatureIdStringTemp))
  1125         KErrNotFound != aFeatureIds.Find(KDefaultFeatureIdStringTemp))
  1099 		{
  1126         {
  1100 		return ETrue;
  1127         return ETrue;
  1101 		}
  1128         }
  1102 			
  1129             
  1103 	HBufC* Ids = HBufC::NewLC(aFeatureIds.Length());	
  1130     HBufC* Ids = HBufC::NewLC(aFeatureIds.Length());    
  1104 	TPtr CurrentFeatureIds = Ids->Des();	
  1131     TPtr CurrentFeatureIds = Ids->Des();    
  1105 	CurrentFeatureIds.Copy(aFeatureIds);
  1132     CurrentFeatureIds.Copy(aFeatureIds);
  1106 	CleanupStack::Pop(Ids);
  1133     CleanupStack::Pop(Ids);
  1107 		
  1134         
  1108 	CDesCArray* FeatureIdList = new (ELeave) CDesCArrayFlat(2); ;
  1135     CDesCArray* FeatureIdList = new (ELeave) CDesCArrayFlat(2); ;
  1109 	TInt EndPos = CurrentFeatureIds.Locate(' ');
  1136     TInt EndPos = CurrentFeatureIds.Locate(' ');
  1110 	
  1137     
  1111 	CleanupStack::PushL(FeatureIdList);
  1138     CleanupStack::PushL(FeatureIdList);
  1112 				
  1139                 
  1113     while (KErrNotFound != EndPos)
  1140     while (KErrNotFound != EndPos)
  1114         {
  1141         {
  1115 				FeatureIdList->AppendL(CurrentFeatureIds.Mid(0,EndPos));// FId_Val);	        
  1142                 FeatureIdList->AppendL(CurrentFeatureIds.Mid(0,EndPos));// FId_Val);            
  1116         CurrentFeatureIds = CurrentFeatureIds.Mid(EndPos+1);
  1143         CurrentFeatureIds = CurrentFeatureIds.Mid(EndPos+1);
  1117         EndPos = CurrentFeatureIds.Locate(' ') ;
  1144         EndPos = CurrentFeatureIds.Locate(' ') ;
  1118         }
  1145         }
  1119 
  1146 
  1120 	if(KErrNotFound == EndPos && 0!= CurrentFeatureIds.Length())
  1147     if(KErrNotFound == EndPos && 0!= CurrentFeatureIds.Length())
  1121 		{
  1148         {
  1122 		FeatureIdList->AppendL(CurrentFeatureIds);
  1149         FeatureIdList->AppendL(CurrentFeatureIds);
  1123 		}    
  1150         }    
  1124 	
  1151     
  1125 	CleanupStack::Pop(FeatureIdList); 
  1152     CleanupStack::Pop(FeatureIdList); 
  1126 	 
  1153      
  1127 	TInt position;		
  1154     TInt position;        
  1128 	if(KErrNone == FeatureIdList->Find(KDefaultFeatureIdString,position) || 
  1155     if(KErrNone == FeatureIdList->Find(KDefaultFeatureIdString,position) || 
  1129 	   KErrNone == FeatureIdList->Find(KDefaultFeatureIdStringTemp,position) )
  1156        KErrNone == FeatureIdList->Find(KDefaultFeatureIdStringTemp,position) )
  1130 		{
  1157         {
  1131 		delete FeatureIdList;
  1158         delete FeatureIdList;
  1132 		delete Ids;
  1159         delete Ids;
  1133 		return ETrue;
  1160         return ETrue;
  1134 		}
  1161         }
  1135 		
  1162         
  1136 	TInt nCount = FeatureIdList->MdcaCount();
  1163     TInt nCount = FeatureIdList->MdcaCount();
  1137 	
  1164     
  1138 	
  1165     
  1139 	//FeatureManager list contains all enabled featureIds, appended with true, and false.
  1166     //FeatureManager list contains all enabled featureIds, appended with true, and false.
  1140 	//New Req. text associated with true_featureId, should be displayed, if Id is enabled.
  1167     //New Req. text associated with true_featureId, should be displayed, if Id is enabled.
  1141 	//else, if featureId is disabled, text associated with false_featureId should be displayed. 
  1168     //else, if featureId is disabled, text associated with false_featureId should be displayed. 
  1142 	// 1. if featureId string contains "false" and it is not in the list, return ETrue.
  1169     // 1. if featureId string contains "false" and it is not in the list, return ETrue.
  1143 	// 2. if featureId string does not contain "false" and it is present in the list, return ETrue.
  1170     // 2. if featureId string does not contain "false" and it is present in the list, return ETrue.
  1144 	// 3. if featureId is part of input language, return ETrue.
  1171     // 3. if featureId is part of input language, return ETrue.
  1145 	for(TInt j=0;j < nCount;j++)
  1172     for(TInt j=0;j < nCount;j++)
  1146 		{
  1173         {
  1147 		if(
  1174         if(
  1148 			(KErrNotFound != FeatureIdList->MdcaPoint(j).Find(KFalseString) &&
  1175             (KErrNotFound != FeatureIdList->MdcaPoint(j).Find(KFalseString) &&
  1149 			KErrNone != iFeatureManager_FeatureIds->Find(FeatureIdList->MdcaPoint(j),position))||
  1176             KErrNone != iFeatureManager_FeatureIds->Find(FeatureIdList->MdcaPoint(j),position))||
  1150 		
  1177         
  1151 			(KErrNotFound == FeatureIdList->MdcaPoint(j).Find(KFalseString) &&
  1178             (KErrNotFound == FeatureIdList->MdcaPoint(j).Find(KFalseString) &&
  1152 			KErrNone == iFeatureManager_FeatureIds->Find(FeatureIdList->MdcaPoint(j),position)) ||
  1179             KErrNone == iFeatureManager_FeatureIds->Find(FeatureIdList->MdcaPoint(j),position)) ||
  1153 		
  1180         
  1154 			KErrNone == iSupportedInputLanguages->Find(FeatureIdList->MdcaPoint(j),position)
  1181             KErrNone == iSupportedInputLanguages->Find(FeatureIdList->MdcaPoint(j),position)
  1155 		)						
  1182         )                        
  1156 			{
  1183             {
  1157 			delete FeatureIdList;
  1184             delete FeatureIdList;
  1158 			delete Ids;
  1185             delete Ids;
  1159 			return ETrue;
  1186             return ETrue;
  1160 			}		
  1187             }        
  1161 		}
  1188         }
  1162 				
  1189                 
  1163 	delete Ids;		
  1190     delete Ids;        
  1164 	delete FeatureIdList;	
  1191     delete FeatureIdList;    
  1165 	return EFalse;		
  1192     return EFalse;        
  1166 	}	
  1193     }    
  1167 	
  1194     
  1168 HBufC8* CCSXHHTMLContentParser::CreateBufferForCSSContentL(RFeatureControl& aFeatureControl)
  1195 HBufC8* CCSXHHTMLContentParser::CreateBufferForCSSContentL(RFeatureControl& aFeatureControl)
  1169 	{	
  1196     {    
  1170 	RFeatureUidArray SupportedFeatures;
  1197     RFeatureUidArray SupportedFeatures;
  1171 	TInt err = aFeatureControl.Connect();
  1198     TInt err = aFeatureControl.Connect();
  1172 	if ( err == KErrNone )
  1199     if ( err == KErrNone )
  1173 		{
  1200         {
  1174          // ListSupportedFeatures() returns one of the Symbian error codes.
  1201          // ListSupportedFeatures() returns one of the Symbian error codes.
  1175          err = aFeatureControl.ListSupportedFeatures( SupportedFeatures );
  1202          err = aFeatureControl.ListSupportedFeatures( SupportedFeatures );
  1176 		 	
  1203              
  1177          // Remember to call CloseL after using RFeatureControl.
  1204          // Remember to call CloseL after using RFeatureControl.
  1178          // It disconnects the Feature Manager server.
  1205          // It disconnects the Feature Manager server.
  1179          aFeatureControl.Close();                    
  1206          aFeatureControl.Close();                    
  1180 		}
  1207         }
  1181 	
  1208     
  1182 		//Input Language variation changes
  1209         //Input Language variation changes
  1183 	//-----------------------------------------
  1210     //-----------------------------------------
  1184 
  1211 
  1185 	CPtiEngine* ptiEngine = CPtiEngine::NewL();
  1212     CPtiEngine* ptiEngine = CPtiEngine::NewL();
  1186     CleanupStack::PushL( ptiEngine );
  1213     CleanupStack::PushL( ptiEngine );
  1187 
  1214 
  1188     CArrayFix<TInt>* languageCodeArray = new(ELeave)CArrayFixFlat<TInt>(2);
  1215     CArrayFix<TInt>* languageCodeArray = new(ELeave)CArrayFixFlat<TInt>(2);
  1189 
  1216 
  1190     ptiEngine->GetAvailableLanguagesL( languageCodeArray );
  1217     ptiEngine->GetAvailableLanguagesL( languageCodeArray );
  1191     
  1218     
  1192 	TInt nInputLangCount = languageCodeArray->Count();
  1219     TInt nInputLangCount = languageCodeArray->Count();
  1193 	TInt nCount = SupportedFeatures.Count();	
  1220     TInt nCount = SupportedFeatures.Count();    
  1194 
  1221 
  1195 	HBufC8* CssContent = HBufC8::NewLC(nCount * KMaxUnits * 6 + nInputLangCount * 3 + 400);
  1222     HBufC8* CssContent = HBufC8::NewLC(nCount * KMaxUnits * 6 + nInputLangCount * 3 + 400);
  1196 	TPtr8 bufferPtr(CssContent->Des());
  1223     TPtr8 bufferPtr(CssContent->Des());
  1197 	
  1224     
  1198 	AppendStyleSheetContent_listitem(bufferPtr,nCount,SupportedFeatures,*languageCodeArray);
  1225     AppendStyleSheetContent_listitem(bufferPtr,nCount,SupportedFeatures,*languageCodeArray);
  1199 	AppendStyleSheetContent_paragraph(bufferPtr,nCount,SupportedFeatures,*languageCodeArray);
  1226     AppendStyleSheetContent_paragraph(bufferPtr,nCount,SupportedFeatures,*languageCodeArray);
  1200 	AppendStyleSheetContent_ahref(bufferPtr,nCount,SupportedFeatures,*languageCodeArray);
  1227     AppendStyleSheetContent_ahref(bufferPtr,nCount,SupportedFeatures,*languageCodeArray);
  1201 	AppendStyleSheetContent_none(bufferPtr,nCount,SupportedFeatures);	
  1228     AppendStyleSheetContent_none(bufferPtr,nCount,SupportedFeatures);    
  1202 		
  1229         
  1203 	SupportedFeatures.Close();				
  1230     SupportedFeatures.Close();                
  1204 	
  1231     
  1205 	CleanupStack::Pop(CssContent);	
  1232     CleanupStack::Pop(CssContent);    
  1206 	
  1233     
  1207 	//Input Language variation changes
  1234     //Input Language variation changes
  1208 	//-----------------------------------------
  1235     //-----------------------------------------
  1209 	CleanupStack::PopAndDestroy( ptiEngine );	
  1236     CleanupStack::PopAndDestroy( ptiEngine );    
  1210 
  1237 
  1211 	delete languageCodeArray;
  1238     delete languageCodeArray;
  1212 	//-----------------------------------------
  1239     //-----------------------------------------
  1213 
  1240 
  1214 	return CssContent;
  1241     return CssContent;
  1215 	}
  1242     }
  1216 	
  1243     
  1217 HBufC8* CCSXHHTMLContentParser::GetContentsFromHTMLFileL(const TDesC& htmlFile,CCoeEnv* aCoeEnv)
  1244 HBufC8* CCSXHHTMLContentParser::GetContentsFromHTMLFileL(const TDesC& htmlFile,CCoeEnv* aCoeEnv)
  1218 	{
  1245     {
  1219 	RFs& fsSession = aCoeEnv->FsSession();             
  1246     RFs& fsSession = aCoeEnv->FsSession();             
  1220 	RFile file; 
  1247     RFile file; 
  1221         
  1248         
  1222 	TInt err = file.Open(fsSession,htmlFile,EFileRead|EFileShareReadersOrWriters);
  1249     TInt err = file.Open(fsSession,htmlFile,EFileRead|EFileShareReadersOrWriters);
  1223     if(KErrNone == err)
  1250     if(KErrNone == err)
  1224 	    {
  1251         {
  1225 	    TInt FileSize;
  1252         TInt FileSize;
  1226 	    HBufC8* htmlFileContent = NULL;
  1253         HBufC8* htmlFileContent = NULL;
  1227 	    if(KErrNone == file.Size(FileSize))
  1254         if(KErrNone == file.Size(FileSize))
  1228 		    {
  1255             {
  1229 		    htmlFileContent = HBufC8::NewLC(FileSize);
  1256             htmlFileContent = HBufC8::NewLC(FileSize);
  1230 			TPtr8 PtrContent = htmlFileContent->Des();
  1257             TPtr8 PtrContent = htmlFileContent->Des();
  1231 	        
  1258             
  1232 		    file.Read(PtrContent);	
  1259             file.Read(PtrContent);    
  1233 		    CleanupStack::Pop(htmlFileContent);			    
  1260             CleanupStack::Pop(htmlFileContent);                
  1234 		    }		
  1261             }        
  1235 	    file.Close();
  1262         file.Close();
  1236 		return htmlFileContent;
  1263         return htmlFileContent;
  1237 		}
  1264         }
  1238 	else
  1265     else
  1239 		{		
  1266         {        
  1240 		return NULL;
  1267         return NULL;
  1241 		}
  1268         }
  1242 	}
  1269     }
  1243 	
  1270     
  1244 HBufC8* CCSXHHTMLContentParser::MergeCssAndHTMLContentL(HBufC8* aHTMLBuffer, HBufC8* aCssContent)
  1271 HBufC8* CCSXHHTMLContentParser::MergeCssAndHTMLContentL(HBufC8* aHTMLBuffer, HBufC8* aCssContent)
  1245 	{
  1272     {
  1246     TInt BufferLength=0;
  1273     TInt BufferLength=0;
  1247     if(aHTMLBuffer)
  1274     if(aHTMLBuffer)
  1248     	BufferLength = aHTMLBuffer->Size();
  1275         BufferLength = aHTMLBuffer->Size();
  1249     
  1276     
  1250     if(aCssContent)
  1277     if(aCssContent)
  1251     	BufferLength += aCssContent->Size();
  1278         BufferLength += aCssContent->Size();
  1252     
  1279     
  1253     HBufC8* Htmlbuffer = HBufC8::NewLC(BufferLength);
  1280     HBufC8* Htmlbuffer = HBufC8::NewLC(BufferLength);
  1254     
  1281     
  1255     TPtr8 HtmlbufferPtr(Htmlbuffer->Des());
  1282     TPtr8 HtmlbufferPtr(Htmlbuffer->Des());
  1256     
  1283     
  1257     if(aCssContent)
  1284     if(aCssContent)
  1258     	{
  1285         {
  1259     	HtmlbufferPtr.Copy(aCssContent->Des());
  1286         HtmlbufferPtr.Copy(aCssContent->Des());
  1260     	delete aCssContent;
  1287         delete aCssContent;
  1261     	}
  1288         }
  1262     	
  1289         
  1263     if(aHTMLBuffer)
  1290     if(aHTMLBuffer)
  1264 	    {
  1291         {
  1265 	    HtmlbufferPtr.Append(aHTMLBuffer->Des());
  1292         HtmlbufferPtr.Append(aHTMLBuffer->Des());
  1266 	    delete aHTMLBuffer;	
  1293         delete aHTMLBuffer;    
  1267 	    }
  1294         }
  1268     
  1295     
  1269     if(Htmlbuffer)
  1296     if(Htmlbuffer)
  1270     	CleanupStack::Pop(Htmlbuffer);
  1297         CleanupStack::Pop(Htmlbuffer);
  1271     
  1298     
  1272     return Htmlbuffer;	
  1299     return Htmlbuffer;    
  1273 	}
  1300     }
  1274 
  1301 
  1275 void CCSXHHTMLContentParser::AppendStyleSheetContent_listitem(TPtr8& abufferptr,TInt aFeatureIdCount,
  1302 void CCSXHHTMLContentParser::AppendStyleSheetContent_listitem(TPtr8& abufferptr,TInt aFeatureIdCount,
  1276 													RFeatureUidArray& aSupportedFeatures,
  1303                                                     RFeatureUidArray& aSupportedFeatures,
  1277 													CArrayFix<TInt>& alanguageCodeArray)
  1304                                                     CArrayFix<TInt>& alanguageCodeArray)
  1278 	{
  1305     {
  1279 	//List Items
  1306     //List Items
  1280 	//---------------------------------------------------------
  1307     //---------------------------------------------------------
  1281 	abufferptr.Copy(KCsstext_First);
  1308     abufferptr.Copy(KCsstext_First);
  1282 	
  1309     
  1283 	for(TInt i=0;i<aFeatureIdCount;++i)
  1310     for(TInt i=0;i<aFeatureIdCount;++i)
  1284 		{
  1311         {
  1285 		TBuf<KMaxFileName> FeatureId;
  1312         TBuf<KMaxFileName> FeatureId;
  1286 		FeatureId.Format(KtextFormat_true_l,aSupportedFeatures[i].iUid);
  1313         FeatureId.Format(KtextFormat_true_l,aSupportedFeatures[i].iUid);
  1287 		//FeatureId.Append(KComma);
  1314         //FeatureId.Append(KComma);
  1288 		abufferptr.Append(FeatureId);		
  1315         abufferptr.Append(FeatureId);        
  1289 		}
  1316         }
  1290 		
  1317         
  1291 	for(TInt i=0;i<alanguageCodeArray.Count();++i)
  1318     for(TInt i=0;i<alanguageCodeArray.Count();++i)
  1292 		{
  1319         {
  1293 		TBuf<KMaxFileName> FeatureId;
  1320         TBuf<KMaxFileName> FeatureId;
  1294 		if(alanguageCodeArray[i] < 10)
  1321         if(alanguageCodeArray[i] < 10)
  1295 			FeatureId.Format(KtextFormat_lang_0l,alanguageCodeArray[i]);
  1322             FeatureId.Format(KtextFormat_lang_0l,alanguageCodeArray[i]);
  1296 		else
  1323         else
  1297 			FeatureId.Format(KtextFormat_lang_l,alanguageCodeArray[i]);
  1324             FeatureId.Format(KtextFormat_lang_l,alanguageCodeArray[i]);
  1298 		
  1325         
  1299 		abufferptr.Append(FeatureId);		
  1326         abufferptr.Append(FeatureId);        
  1300 		}
  1327         }
  1301 		
  1328         
  1302 	abufferptr.Append(KDefaultFeatureId);		
  1329     abufferptr.Append(KDefaultFeatureId);        
  1303 	abufferptr.Append(KCsstext_displayp_li);		
  1330     abufferptr.Append(KCsstext_displayp_li);        
  1304 	abufferptr.Append(KCsstext_Last);
  1331     abufferptr.Append(KCsstext_Last);
  1305 	//---------------------------------------------------------
  1332     //---------------------------------------------------------
  1306 	}
  1333     }
  1307 
  1334 
  1308 void CCSXHHTMLContentParser::AppendStyleSheetContent_paragraph(TPtr8& abufferptr,TInt aFeatureIdCount,
  1335 void CCSXHHTMLContentParser::AppendStyleSheetContent_paragraph(TPtr8& abufferptr,TInt aFeatureIdCount,
  1309 													RFeatureUidArray& aSupportedFeatures,
  1336                                                     RFeatureUidArray& aSupportedFeatures,
  1310 													CArrayFix<TInt>& alanguageCodeArray)
  1337                                                     CArrayFix<TInt>& alanguageCodeArray)
  1311 	{
  1338     {
  1312 	//Paragraph
  1339     //Paragraph
  1313 	//---------------------------------------------------------
  1340     //---------------------------------------------------------
  1314 	abufferptr.Append(KCsstext_First);
  1341     abufferptr.Append(KCsstext_First);
  1315 	for(TInt i=0;i<aFeatureIdCount;++i)
  1342     for(TInt i=0;i<aFeatureIdCount;++i)
  1316 		{
  1343         {
  1317 		TBuf<KMaxFileName> FeatureId;
  1344         TBuf<KMaxFileName> FeatureId;
  1318 		FeatureId.Format(KtextFormat_true_b,aSupportedFeatures[i].iUid);
  1345         FeatureId.Format(KtextFormat_true_b,aSupportedFeatures[i].iUid);
  1319 		//FeatureId.Append(KComma);
  1346         //FeatureId.Append(KComma);
  1320 		
  1347         
  1321 		abufferptr.Append(FeatureId);		
  1348         abufferptr.Append(FeatureId);        
  1322 		}
  1349         }
  1323 		
  1350         
  1324 	for(TInt i=0;i<alanguageCodeArray.Count();++i)
  1351     for(TInt i=0;i<alanguageCodeArray.Count();++i)
  1325 		{
  1352         {
  1326 		TBuf<KMaxFileName> FeatureId;
  1353         TBuf<KMaxFileName> FeatureId;
  1327 		if(alanguageCodeArray[i] < 10)
  1354         if(alanguageCodeArray[i] < 10)
  1328 			FeatureId.Format(KtextFormat_lang_0b,alanguageCodeArray[i]);
  1355             FeatureId.Format(KtextFormat_lang_0b,alanguageCodeArray[i]);
  1329 		else
  1356         else
  1330 			FeatureId.Format(KtextFormat_lang_b,alanguageCodeArray[i]);
  1357             FeatureId.Format(KtextFormat_lang_b,alanguageCodeArray[i]);
  1331 		
  1358         
  1332 		abufferptr.Append(FeatureId);		
  1359         abufferptr.Append(FeatureId);        
  1333 		}
  1360         }
  1334 		
  1361         
  1335 	abufferptr.Append(KDefaultFeatureId);
  1362     abufferptr.Append(KDefaultFeatureId);
  1336 	abufferptr.Append(KCsstext_displayp_p);		
  1363     abufferptr.Append(KCsstext_displayp_p);        
  1337 	abufferptr.Append(KCsstext_Last);
  1364     abufferptr.Append(KCsstext_Last);
  1338 	
  1365     
  1339 	//---------------------------------------------------------
  1366     //---------------------------------------------------------
  1340 	}
  1367     }
  1341 
  1368 
  1342 void CCSXHHTMLContentParser::AppendStyleSheetContent_ahref(TPtr8& abufferptr,TInt aFeatureIdCount,
  1369 void CCSXHHTMLContentParser::AppendStyleSheetContent_ahref(TPtr8& abufferptr,TInt aFeatureIdCount,
  1343 												RFeatureUidArray& aSupportedFeatures,
  1370                                                 RFeatureUidArray& aSupportedFeatures,
  1344 												CArrayFix<TInt>& alanguageCodeArray)
  1371                                                 CArrayFix<TInt>& alanguageCodeArray)
  1345 	{
  1372     {
  1346 	//A href
  1373     //A href
  1347 	//---------------------------------------------------------
  1374     //---------------------------------------------------------
  1348 	abufferptr.Append(KCsstext_First);
  1375     abufferptr.Append(KCsstext_First);
  1349 	for(TInt i=0;i<aFeatureIdCount;++i)
  1376     for(TInt i=0;i<aFeatureIdCount;++i)
  1350 		{
  1377         {
  1351 		TBuf<KMaxFileName> FeatureId;
  1378         TBuf<KMaxFileName> FeatureId;
  1352 		FeatureId.Format(KtextFormat_true_a,aSupportedFeatures[i].iUid);		
  1379         FeatureId.Format(KtextFormat_true_a,aSupportedFeatures[i].iUid);        
  1353 		abufferptr.Append(FeatureId);		
  1380         abufferptr.Append(FeatureId);        
  1354 		}
  1381         }
  1355 	
  1382     
  1356 	for(TInt i=0;i<alanguageCodeArray.Count();++i)
  1383     for(TInt i=0;i<alanguageCodeArray.Count();++i)
  1357 		{
  1384         {
  1358 		TBuf<KMaxFileName> FeatureId;
  1385         TBuf<KMaxFileName> FeatureId;
  1359 		if(alanguageCodeArray[i] < 10)
  1386         if(alanguageCodeArray[i] < 10)
  1360 			FeatureId.Format(KtextFormat_lang_0a,alanguageCodeArray[i]);
  1387             FeatureId.Format(KtextFormat_lang_0a,alanguageCodeArray[i]);
  1361 		else
  1388         else
  1362 			FeatureId.Format(KtextFormat_lang_a,alanguageCodeArray[i]);
  1389             FeatureId.Format(KtextFormat_lang_a,alanguageCodeArray[i]);
  1363 		abufferptr.Append(FeatureId);		
  1390         abufferptr.Append(FeatureId);        
  1364 		}
  1391         }
  1365 		
  1392         
  1366 	abufferptr.Append(KDefaultFeatureId);
  1393     abufferptr.Append(KDefaultFeatureId);
  1367 	abufferptr.Append(KCsstext_displayp_a);		
  1394     abufferptr.Append(KCsstext_displayp_a);        
  1368 	abufferptr.Append(KCsstext_Last);
  1395     abufferptr.Append(KCsstext_Last);
  1369 	
  1396     
  1370 	//---------------------------------------------------------
  1397     //---------------------------------------------------------
  1371 	}
  1398     }
  1372 
  1399 
  1373 void CCSXHHTMLContentParser::AppendStyleSheetContent_none(TPtr8& abufferptr,TInt aFeatureIdCount,
  1400 void CCSXHHTMLContentParser::AppendStyleSheetContent_none(TPtr8& abufferptr,TInt aFeatureIdCount,
  1374 													RFeatureUidArray& aSupportedFeatures
  1401                                                     RFeatureUidArray& aSupportedFeatures
  1375 													)
  1402                                                     )
  1376 	{
  1403     {
  1377 	//False
  1404     //False
  1378 	//---------------------------------------------------------
  1405     //---------------------------------------------------------
  1379 	abufferptr.Append(KCsstext_First);
  1406     abufferptr.Append(KCsstext_First);
  1380 	for(TInt i=0;i<aFeatureIdCount;++i)
  1407     for(TInt i=0;i<aFeatureIdCount;++i)
  1381 		{
  1408         {
  1382 		TBuf<KMaxFileName> FeatureId;
  1409         TBuf<KMaxFileName> FeatureId;
  1383 		FeatureId.Format(KtextFormat_false,aSupportedFeatures[i].iUid,aSupportedFeatures[i].iUid,aSupportedFeatures[i].iUid);
  1410         FeatureId.Format(KtextFormat_false,aSupportedFeatures[i].iUid,aSupportedFeatures[i].iUid,aSupportedFeatures[i].iUid);
  1384 		abufferptr.Append(FeatureId);		
  1411         abufferptr.Append(FeatureId);        
  1385 		}
  1412         }
  1386 		
  1413         
  1387 	abufferptr.Append(KDefaultFeatureId);
  1414     abufferptr.Append(KDefaultFeatureId);
  1388 	abufferptr.Append(KCsstext_displayp_n);		
  1415     abufferptr.Append(KCsstext_displayp_n);        
  1389 	abufferptr.Append(KCsstext_Last);
  1416     abufferptr.Append(KCsstext_Last);
  1390 	
  1417     
  1391 	//---------------------------------------------------------
  1418     //---------------------------------------------------------
  1392 	}
  1419     }