csxhelp/HelpEngine/src/CSXHKywdTopics.cpp
branchRCL_3
changeset 18 cbffe13eac63
parent 0 1f04cf54edd8
equal deleted inserted replaced
17:12f60d9a73b3 18:cbffe13eac63
       
     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:  CCSXHKywdTopics class definition
       
    15 *
       
    16 */
       
    17 
       
    18 #include "CSXHKywdTopics.h"
       
    19 #include "CSXHHTMLContentParser.h"
       
    20 #include "CSXHHelpDataBase.h"
       
    21 #include "CSXHViewIDs.h"
       
    22 #include "csxhconstants.h"
       
    23 #include "CSXHKywdTOC1.h"
       
    24 
       
    25 #include <eikenv.h> 
       
    26 #include <e32base.h>
       
    27 
       
    28 //Implementation class. This class will be used when all the keywords has to be displayed   
       
    29 class MCSXHKywdTopicsBuilder : public MCSXHKywdBuilder
       
    30     {
       
    31     public:
       
    32     static MCSXHKywdTopicsBuilder* NewL()
       
    33         {
       
    34         MCSXHKywdTopicsBuilder* self = MCSXHKywdTopicsBuilder::NewLC();
       
    35         CleanupStack::Pop(self);
       
    36         return self;
       
    37         }
       
    38     static MCSXHKywdTopicsBuilder* NewLC()
       
    39         {
       
    40         MCSXHKywdTopicsBuilder* self = new(ELeave) MCSXHKywdTopicsBuilder();
       
    41         CleanupStack::PushL(self);
       
    42         return self;
       
    43         }
       
    44     
       
    45     void InsertKeywordL(CCSXHKywdTopics* aKwdTopics, const TDesC& aKwd,CCSXHHtmlTOC1*)
       
    46         {aKwdTopics->InsertKywdL(aKwd);}
       
    47     
       
    48     void InsertKeywordL(CCSXHKywdTopics* aKwdTopics, const TDesC& aKwd,const TInt&)
       
    49         {aKwdTopics->InsertKywdL(aKwd);}
       
    50     
       
    51     private:
       
    52     MCSXHKywdTopicsBuilder(){}
       
    53     };
       
    54 
       
    55     
       
    56 //Implementation class. This class will be used when user has selected a keyword and
       
    57 // wants to navigate to the search result view
       
    58 class MCSXHKywdSelectedItemBuilder : public MCSXHKywdBuilder
       
    59     {
       
    60     public:
       
    61     static MCSXHKywdSelectedItemBuilder* NewL(CCSXHKywdTOC1* aCurrentTopic)
       
    62         {
       
    63         MCSXHKywdSelectedItemBuilder* self = MCSXHKywdSelectedItemBuilder::NewLC(aCurrentTopic);
       
    64         CleanupStack::Pop(self);
       
    65         return self;
       
    66         }
       
    67     static MCSXHKywdSelectedItemBuilder* NewLC(CCSXHKywdTOC1* aCurrentTopic)
       
    68         {
       
    69         MCSXHKywdSelectedItemBuilder* self = new(ELeave) 
       
    70         	MCSXHKywdSelectedItemBuilder(aCurrentTopic);
       
    71         CleanupStack::PushL(self);
       
    72         return self;
       
    73         }
       
    74     void InsertKeywordL(CCSXHKywdTopics*, const TDesC& aKwd,CCSXHHtmlTOC1* aToc1) 
       
    75         {
       
    76         if(iCurrentTopic->GetName().Compare(aKwd) == 0)
       
    77             iCurrentTopic->AppendHtmlTOC1L(aToc1);
       
    78         }
       
    79     void InsertKeywordL(CCSXHKywdTopics*, const TDesC& aKwd,const TInt& aLegacyIndex)
       
    80         {
       
    81         if(iCurrentTopic->GetName().Compare(aKwd) == 0)
       
    82             iCurrentTopic->LegacyIndex() = aLegacyIndex;
       
    83         }
       
    84     
       
    85     private:
       
    86     MCSXHKywdSelectedItemBuilder(CCSXHKywdTOC1* aCurrentTopic)
       
    87                                 :iCurrentTopic(aCurrentTopic){}
       
    88     CCSXHKywdTOC1* iCurrentTopic;
       
    89     };
       
    90 
       
    91 // ---------------------------------------------------------
       
    92 // Items commented in header.
       
    93 // ---------------------------------------------------------
       
    94 CCSXHKywdTopics* CCSXHKywdTopics::NewL(const TApaAppCaption& aAppCaption)
       
    95     {
       
    96     CCSXHKywdTopics* self = CCSXHKywdTopics::NewLC(aAppCaption);
       
    97     CleanupStack::Pop(self);
       
    98     return self;
       
    99     }
       
   100 // ---------------------------------------------------------
       
   101 // Items commented in header.
       
   102 // ---------------------------------------------------------    
       
   103 CCSXHKywdTopics* CCSXHKywdTopics::NewLC(const TApaAppCaption& aAppCaption)
       
   104     {
       
   105     CCSXHKywdTopics* self = new(ELeave) CCSXHKywdTopics(aAppCaption);
       
   106     CleanupStack::PushL(self);
       
   107     return self;
       
   108     }
       
   109 // ---------------------------------------------------------
       
   110 // Items commented in header.
       
   111 // ---------------------------------------------------------    
       
   112 CCSXHKywdTopics::CCSXHKywdTopics(const TDesC& aName) : CCSXHGenericTOC1(aName)
       
   113     {}
       
   114 // ---------------------------------------------------------
       
   115 // Items commented in header.
       
   116 // ---------------------------------------------------------    
       
   117 CCSXHKywdTopics::~CCSXHKywdTopics()
       
   118     {
       
   119     if(iCurrentTopic)
       
   120         delete iCurrentTopic;
       
   121     }
       
   122 // ---------------------------------------------------------
       
   123 // Items commented in header.
       
   124 // ---------------------------------------------------------    
       
   125 TUid CCSXHKywdTopics::GetViewID() const
       
   126     {
       
   127     return KCSXHKywdToc1ViewID;
       
   128     }
       
   129 // ---------------------------------------------------------
       
   130 // Items commented in header.
       
   131 // ---------------------------------------------------------       
       
   132 void CCSXHKywdTopics::CopyChildListL(CDesCArray* aArray)    
       
   133     {
       
   134     iKywdTopics = aArray;
       
   135     MCSXHKywdTopicsBuilder* builder = NULL;
       
   136     builder = MCSXHKywdTopicsBuilder::NewL();
       
   137     CCSXHHelpDataBase::GetInstance()->FillKeywordTopicsL(builder);
       
   138     delete builder;
       
   139     }
       
   140 // ---------------------------------------------------------
       
   141 // Items commented in header.
       
   142 // ---------------------------------------------------------    
       
   143 void CCSXHKywdTopics::InsertKywdL(const TDesC& aKywd)
       
   144     {
       
   145     TBuf<KMaxFileName> child(KTabSpace);
       
   146     child.Append(aKywd);
       
   147     iKywdTopics->InsertIsqL(child);
       
   148     }
       
   149 // ---------------------------------------------------------
       
   150 // Items commented in header.
       
   151 // ---------------------------------------------------------    
       
   152 CCSXHHelpContentBase* CCSXHKywdTopics::GetChildL(const TDesC& aName)
       
   153     {
       
   154     if(iCurrentTopic)
       
   155         {
       
   156         delete iCurrentTopic;
       
   157         iCurrentTopic = NULL;
       
   158         }
       
   159         
       
   160     iCurrentTopic = CCSXHKywdTOC1::NewL(aName);
       
   161     
       
   162     MCSXHKywdSelectedItemBuilder* builder = NULL;
       
   163     builder = MCSXHKywdSelectedItemBuilder::NewL(iCurrentTopic);
       
   164 
       
   165     CCSXHHelpDataBase::GetInstance()->FillKeywordTopicsL(builder);
       
   166 
       
   167     delete builder;
       
   168     return iCurrentTopic;
       
   169     }
       
   170 // ---------------------------------------------------------
       
   171 // Items commented in header.
       
   172 // ---------------------------------------------------------    
       
   173 CCSXHKywdTOC1* CCSXHKywdTopics::GetSelectedTopic()
       
   174     {
       
   175     return iCurrentTopic;
       
   176     }
       
   177 
       
   178 
       
   179