phonebookui/Phonebook2/inc/CPbk2UIExtensionManager.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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:  Phonebook 2 UI extension manager.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2UIEXTENSIONMANAGER_H
       
    20 #define CPBK2UIEXTENSIONMANAGER_H
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <e32base.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CPbk2UIExtensionLoader;
       
    27 class CPbk2UIExtensionMenuManager;
       
    28 class MPbk2UIExtensionFactory;
       
    29 class CPbk2ViewGraph;
       
    30 class MPbk2UIExtensionIconSupport;
       
    31 class CEikMenuPane;
       
    32 class CPbk2AppViewBase;
       
    33 class MPbk2ContactUiControl;
       
    34 class CPbk2ThinUIExtensionLoader;
       
    35 class CPbk2UIExtensionConfigurationObserver;
       
    36 class TCoeHelpContext;
       
    37 class CPbk2ApplicationServices;
       
    38 
       
    39 /**
       
    40  * Phonebook 2 UI extension manager.
       
    41  * Singleton class.
       
    42  * Responsible for:
       
    43  * - creating extension loaders, extension menu manager and extension factory
       
    44  * - applying extension view graph changes
       
    45  * - managing menu pane initialisation provided by extension menu manager
       
    46  * - retrieving help context provided by extension plugins
       
    47  */
       
    48 class CPbk2UIExtensionManager : public CBase
       
    49     {
       
    50     public: // Interface
       
    51         /**
       
    52          * Returns the instance of this class or instantiates it
       
    53          * if it has not already been created.
       
    54          *
       
    55          * @return  The singleton instance of this class.
       
    56          */
       
    57         IMPORT_C static CPbk2UIExtensionManager* InstanceL();
       
    58 
       
    59         /**
       
    60          * Returns the extension factory. If no instance exists yet
       
    61          * it is created.
       
    62          *
       
    63          * @return  The extension factory.
       
    64          */
       
    65         IMPORT_C MPbk2UIExtensionFactory* FactoryL();
       
    66 
       
    67         /**
       
    68          * Applies the extension view graph changes to the Phonebook 2
       
    69          * view graph. The extension changes are loaded from extension
       
    70          * resources.
       
    71          *
       
    72          * @param aViewGraph    The view graph to modify.
       
    73          */
       
    74         IMPORT_C void ApplyExtensionViewGraphChangesL(
       
    75                 CPbk2ViewGraph& aViewGraph );
       
    76 
       
    77         /**
       
    78          * Returns the extension icon support API. UI extensions can add
       
    79          * icons to icon container and to different icon arrays defining
       
    80          * iconInformation in extension's PHONEBOOK2_EXTENSION_INFORMATION
       
    81          * resource structure.
       
    82          *
       
    83          * @return  Extension manager's icon support interface.
       
    84          */
       
    85         IMPORT_C MPbk2UIExtensionIconSupport& IconSupportL();
       
    86 
       
    87         /**
       
    88          * Lets extensions to filter the menu pane. Menu filtering can
       
    89          * be done in two different ways.
       
    90          *
       
    91          * 1) Static filtering.
       
    92          *    It's not needed to load the extension dll to do this.
       
    93          *    Menus are filtered according to menu definitions in
       
    94          *    PHONEBOOK2_EXTENSION_INFORMATION of the extension's resource.
       
    95          *    Use menuFilteringFlags field of the
       
    96          *    PHONEBOOK2_EXTENSION_MENU_RESOURCE to set visibility flags.
       
    97          *
       
    98          * 2) Dynamic filtering.
       
    99          *    If flags are not enough it's possible to do an ECom plugin
       
   100          *    that is always loaded by the extension framework.
       
   101          *    The interface UID is of the plugin is
       
   102          *    KPbk2ThinUiExtensionInterfaceUID and the base class is
       
   103          *    CPbk2UIExtensionThinPlugin.
       
   104          *    Use KPbk2ThinUiExtensionDefaultDataString in default_data
       
   105          *    field.
       
   106          *
       
   107          * @param aResourceId   Resource id of the menu pane.
       
   108          * @param aMenuPane     Reference to the menu pane.
       
   109          * @param aViewBase     The view where the filtering takes place.
       
   110          * @param aControl      Contact UI control.
       
   111          */
       
   112         IMPORT_C void DynInitMenuPaneL(
       
   113                 TInt aResourceId,
       
   114                 CEikMenuPane* aMenuPane,
       
   115                 CPbk2AppViewBase& aViewBase,
       
   116                 MPbk2ContactUiControl& aControl );
       
   117 
       
   118         /**
       
   119          * Gets help context from the extensions.
       
   120          *
       
   121          * @param aContext      The extension help context.
       
   122          * @param aView         Application view from where the help
       
   123          *                      is displayed.
       
   124          * @param aUiControl    Contact UI control.
       
   125          * @return  ETrue if help context was found.
       
   126          */
       
   127         IMPORT_C TBool GetHelpContextL(
       
   128                 TCoeHelpContext& aContext,
       
   129                 const CPbk2AppViewBase& aView,
       
   130                 MPbk2ContactUiControl& aUiControl );
       
   131 
       
   132         /**
       
   133          * Returns the menu manager.
       
   134          *
       
   135          * @return  Menu manager.
       
   136          */
       
   137         CPbk2UIExtensionMenuManager& MenuManager() const;
       
   138 
       
   139         /**
       
   140          * Pushes this object to the cleanup stack for releasing.
       
   141          */
       
   142         inline void PushL();
       
   143 
       
   144     private: // Release interface
       
   145         friend void Release(
       
   146                 CPbk2UIExtensionManager* aObj );
       
   147         virtual void DoRelease();
       
   148         static void CleanupRelease(
       
   149                 TAny* aObj );
       
   150 
       
   151     private: // Implementation
       
   152         CPbk2UIExtensionManager();
       
   153         ~CPbk2UIExtensionManager();
       
   154         void ConstructL();
       
   155         void IncRef();
       
   156         TInt DecRef();
       
   157 
       
   158     private: // Data
       
   159         /// Own: Reference count
       
   160         TInt iRefCount;
       
   161         /// Own: UI extension menu manager
       
   162         CPbk2UIExtensionMenuManager* iMenuManager;
       
   163         /// Own: UI extension loader
       
   164         CPbk2UIExtensionLoader* iExtensionLoader;
       
   165         /// Own: UI extension factory
       
   166         MPbk2UIExtensionFactory* iExtensionFactory;
       
   167         /// Own: UI extension icon support
       
   168         MPbk2UIExtensionIconSupport* iIconSupport;
       
   169         /// Own: Thin UI extension loader
       
   170         CPbk2ThinUIExtensionLoader* iThinExtensionLoader;
       
   171         /// Own: Handles the updating of the store property array
       
   172         CPbk2UIExtensionConfigurationObserver* iStoreConfigurationObserver;
       
   173         /// Own: Application services
       
   174         CPbk2ApplicationServices* iAppServices;
       
   175 
       
   176     };
       
   177 
       
   178 // INLINE IMPLEMENTATION
       
   179 
       
   180 // --------------------------------------------------------------------------
       
   181 // Release
       
   182 // --------------------------------------------------------------------------
       
   183 //
       
   184 inline void Release( CPbk2UIExtensionManager* aObj )
       
   185     {
       
   186     if ( aObj )
       
   187         {
       
   188         aObj->DoRelease();
       
   189         }
       
   190     }
       
   191 
       
   192 // --------------------------------------------------------------------------
       
   193 // CPbk2UIExtensionManager::PushL
       
   194 // --------------------------------------------------------------------------
       
   195 //
       
   196 inline void CPbk2UIExtensionManager::PushL()
       
   197     {
       
   198     CleanupStack::PushL( TCleanupItem( CleanupRelease, this ) );
       
   199     }
       
   200 
       
   201 // --------------------------------------------------------------------------
       
   202 // CPbk2UIExtensionManager::CleanupRelease
       
   203 // --------------------------------------------------------------------------
       
   204 //
       
   205 inline void CPbk2UIExtensionManager::CleanupRelease( TAny* aObj )
       
   206     {
       
   207     Release( static_cast<CPbk2UIExtensionManager*>( aObj ) );
       
   208     }
       
   209 
       
   210 #endif // CPBK2UIEXTENSIONMANAGER_H
       
   211 
       
   212 // End of File