idlehomescreen/xmluicontroller/inc/transactionfactoryimpl.h
changeset 0 f72a12da539e
child 54 1b758917cafc
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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:  Transaction factory implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_TRANSACTIONFACTORYIMPL_H
       
    20 #define C_TRANSACTIONFACTORYIMPL_H
       
    21 
       
    22 
       
    23 #include <e32base.h>
       
    24 #include "transactionfactory.h"
       
    25 
       
    26 namespace AiUtility
       
    27     {
       
    28     class CContentPriorityMap;
       
    29     }
       
    30 
       
    31 namespace AiXmlUiController
       
    32 {
       
    33     
       
    34 class CTransaction;
       
    35 class CTransactionElement;
       
    36 class CCssPropertyMap;
       
    37 
       
    38 
       
    39 /**
       
    40 *  @ingroup group_xmluicontroller
       
    41 * 
       
    42 *  CTransactionFactoryImpl implements MTransactionFactory.
       
    43 *  It provides a recycling pool of transaction objects.
       
    44 *
       
    45 *  @lib AiXmlUiMain
       
    46 */
       
    47 class CTransactionFactoryImpl: public CBase, public MTransactionFactory
       
    48     {
       
    49 public:  // Constructors and destructor
       
    50     
       
    51     static CTransactionFactoryImpl*
       
    52         NewL( AiUtility::CContentPriorityMap& aContentPriorityMap,
       
    53               CCssPropertyMap& aPropertyMap );
       
    54     
       
    55     virtual ~CTransactionFactoryImpl();
       
    56 
       
    57 // Functions from MTransactionFactory
       
    58 
       
    59     MTransaction* CreateTransactionL( TInt aTxId );
       
    60     
       
    61     void ReleaseTransaction( MTransaction* aTransaction );
       
    62 
       
    63     MTransactionElement* CreateTextTransactionElementL( CXnNodeAppIf& aTarget,
       
    64                                                         const TDesC& aText,
       
    65                                                         TInt aPriority );
       
    66     
       
    67     MTransactionElement* CreateDataBufferTransactionElementL( 
       
    68                                                         CXnNodeAppIf& aTarget,
       
    69                                                         const TDesC8& aData,
       
    70                                                         TInt aPriority );
       
    71 
       
    72     MTransactionElement* CreateEmptyContentTransactionElementL( CXnNodeAppIf& aTarget,
       
    73                                                                 TInt aIndex );
       
    74 
       
    75     MTransactionElement* CreateImageTransactionElementL( CXnNodeAppIf& aTarget,
       
    76                                                          CGulIcon* aIcon,        
       
    77                                                          TInt aPriority );
       
    78     
       
    79     MTransactionElement* CreateImageTransactionElementL( CXnNodeAppIf& aTarget,
       
    80                                                          RFile& aFile,
       
    81                                                          TInt aPriority );
       
    82     
       
    83     /**
       
    84      * @param aTarget
       
    85      * @param aText new text
       
    86      * @param aPriority
       
    87      * @param aIndex Index of the news ticker element updated
       
    88      */
       
    89     MTransactionElement* CreateNewsTickerTransactionElementL( CXnNodeAppIf& aTarget,
       
    90                                                         const TDesC& aText,
       
    91                                                         TInt aPriority,
       
    92                                                         TInt aIndex );
       
    93     
       
    94     void ReleaseTransactionElement( MTransactionElement* aElement );
       
    95 
       
    96     TBool IsSupported( CXnNodeAppIf& aTarget, const TDesC8& aContentType );
       
    97 
       
    98 private: // Construction
       
    99 
       
   100     CTransactionFactoryImpl(
       
   101         AiUtility::CContentPriorityMap& aContentPriorityMap,
       
   102         CCssPropertyMap& aPropertyMap );
       
   103 
       
   104     void ConstructL();
       
   105     
       
   106     template<class T> T* NewInstanceL();
       
   107     
       
   108 // New methods    
       
   109     
       
   110     void DeleteTransactionList( TSglQue< CTransaction >& aList );
       
   111     
       
   112     void DeleteElementList( TSglQue< CTransactionElement >& aList );
       
   113                 
       
   114 private: // Data
       
   115     
       
   116     /**
       
   117      * List of available transactions.
       
   118      */
       
   119     TSglQue< CTransaction > iAvailableTransactions;
       
   120     
       
   121     /**
       
   122      * List of reserved transactions.
       
   123      */
       
   124     TSglQue< CTransaction > iReservedTransactions;
       
   125     
       
   126     /**
       
   127      * List of available transaction elements.
       
   128      */
       
   129     TSglQue< CTransactionElement > iAvailableElements;
       
   130     
       
   131     /**
       
   132      * List of reserved transaction elements.
       
   133      */
       
   134     TSglQue< CTransactionElement > iReservedElements;
       
   135     
       
   136     /**
       
   137      * Reference to UI controller's content priority map
       
   138      */
       
   139     AiUtility::CContentPriorityMap& iContentPriorityMap;
       
   140     
       
   141     /**
       
   142      * UI controller's CSS property map. Not own.
       
   143      */
       
   144     CCssPropertyMap& iPropertyMap;
       
   145     };
       
   146 
       
   147 } // namespace AiXmlUiController
       
   148 
       
   149 #endif      // C_TRANSACTIONFACTORYIMPL_H  
       
   150            
       
   151 //  End of File