csxhelp/HelpEngine/src/CSXHLegacyTOC1.cpp
changeset 0 1f04cf54edd8
child 11 326673dff2bf
equal deleted inserted replaced
-1:000000000000 0:1f04cf54edd8
       
     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:  CCSXHLegacyTOC1 class definition
       
    15 *
       
    16 */
       
    17 
       
    18 #include "CSXHLegacyTOC1.h"
       
    19 #include "CSXHViewIDs.h"
       
    20 #include "CSXHLegacyContentParser.h"
       
    21 #include "CSXHHelpDataBase.h"
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 CCSXHLegacyTOC1* CCSXHLegacyTOC1::NewL(const TDesC& aName)
       
    26     {
       
    27     CCSXHLegacyTOC1* self = CCSXHLegacyTOC1::NewLC(aName);
       
    28     CleanupStack::Pop(self);
       
    29     return self;
       
    30     }
       
    31 
       
    32 CCSXHLegacyTOC1* CCSXHLegacyTOC1::NewLC(const TDesC& aName)
       
    33     {
       
    34     CCSXHLegacyTOC1* self = new(ELeave) CCSXHLegacyTOC1(aName);
       
    35     CleanupStack::PushL(self);
       
    36     return self;
       
    37     }
       
    38 
       
    39 CCSXHLegacyTOC1::CCSXHLegacyTOC1(const TDesC& aName) :
       
    40 CCSXHGenericTOC1(aName)
       
    41     {//No implementation required
       
    42     }
       
    43 
       
    44 TUid CCSXHLegacyTOC1::GetViewID() const
       
    45     {
       
    46     return KCSXHToc2ViewID;
       
    47     }
       
    48     
       
    49 CCSXHHelpContentBase* CCSXHLegacyTOC1::GetContextTopic(const TDesC& aContextName)
       
    50     {
       
    51     TBool resetChildList = EFalse;
       
    52     if(iChildList ==NULL)
       
    53         {
       
    54         InitChildList();//Generates child list if required.     
       
    55         resetChildList = ETrue;
       
    56         }
       
    57         
       
    58     TInt count =    iChildList->Count();
       
    59     CCSXHHelpContentBase* toc2 = NULL;
       
    60     for(TInt i=0;i<count;++i )
       
    61         {
       
    62         toc2 = (*iChildList)[i];
       
    63         if(toc2->GetName().Compare(aContextName) == 0)
       
    64             return toc2;//Child list should not be reset
       
    65         }
       
    66     if(resetChildList)
       
    67         ResetChildList();
       
    68     return NULL;    
       
    69     }
       
    70 
       
    71 void CCSXHLegacyTOC1::InitChildList()
       
    72     {
       
    73     if(iChildList != NULL)
       
    74         return;
       
    75     ConstructChildList();
       
    76     
       
    77     TRAP_IGNORE(CCSXHHelpDataBase::GetInstance()->
       
    78     GetLegacyParser()->GenerateTOC2ListL(*this,iChildList));
       
    79     }
       
    80