imstutils/imconversationview/imcvuiapp/inc/cimcvmenuextensionmanager.h
changeset 0 5e5d6b214f4f
equal deleted inserted replaced
-1:000000000000 0:5e5d6b214f4f
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Class that provides extensions for options menu
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef     CIMCVMENUEXTENSIONMANAGER_H
       
    19 #define     CIMCVMENUEXTENSIONMANAGER_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32base.h>
       
    23 #include <e32const.h>
       
    24 #include <mimcvcommandmapper.h>
       
    25 #include <cimcvmenuextension.h>
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CEikMenuPane;
       
    31 class CIMCVCommandInfo;
       
    32 class CIMCVMenuExtension;
       
    33 
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38  *  
       
    39  *  This class provides extensions to options menu.
       
    40  *  
       
    41  *  @since S60 5.0
       
    42  */
       
    43 NONSHARABLE_CLASS( CIMCVMenuExtensionManager ) : public CBase,
       
    44                                               public MIMCVCommandMapper
       
    45     {
       
    46     public: // Constructor and destructor
       
    47 
       
    48         /**
       
    49          * Two-phased constructor.
       
    50          *
       
    51          * @param aServiceName, service name.
       
    52          * @param aExtensionFactory, extension factory
       
    53          */
       
    54         static CIMCVMenuExtensionManager* NewL(  );
       
    55 
       
    56         /**
       
    57          * Two-phased constructor.
       
    58          *
       
    59          * @param aServiceName, service name.
       
    60          * @param aExtensionFactory, extension factory
       
    61          */
       
    62         static CIMCVMenuExtensionManager* NewLC();
       
    63 
       
    64         /**
       
    65          * Standard C++ destructor
       
    66          */    
       
    67         ~CIMCVMenuExtensionManager();
       
    68     public: // from MCommandMapper
       
    69         /**
       
    70          *  Gets old original command ID which corresponds
       
    71          *  to the given new one
       
    72          *
       
    73          *  @param aPluginId  implementation ID for identification
       
    74          *  @param aNewCommand  New mapped command ID
       
    75          *  @param aOldCommand  On return old/original command ID
       
    76          *  @return KErrNone if mapping exist, otherwise KErrNotFound
       
    77          */
       
    78          TInt GetOldCommand( TInt32 aPluginId, TInt aNewCommand,
       
    79                                             TInt& aOldCommand ) const; 
       
    80          
       
    81          /**
       
    82           *  Gets new mapped command ID which corresponds
       
    83           *  to the given old one
       
    84           *
       
    85           *  @param aPluginId  implementation ID for identification
       
    86           *  @param aOldCommand Old/original command ID
       
    87           *  @param aNewCommand On return new mapped command ID
       
    88           *  @return KErrNone if mapping exist, otherwise KErrNotFound
       
    89           */
       
    90          TInt GetNewCommand(  TInt32 aPluginId,TInt aOldCommand,
       
    91                               TInt& aNewCommand ) const;
       
    92     public:
       
    93           /**
       
    94            * offers the menu pane of the ConversationView connected to this
       
    95            * extension.
       
    96            *
       
    97            * @param aPreviousId Menu command id after which the plugins menu
       
    98            *  should come.
       
    99            * @param aMenuPane Menu pane which will be filtered.
       
   100            * @param aServiceid service id
       
   101            */
       
   102            void OfferMenuPaneToPlugins
       
   103               (TInt aPreviousId, CEikMenuPane& aMenuPane,TUint aServiceId);
       
   104            
       
   105           /**
       
   106            * Handles ConversationView extension commands.
       
   107            *
       
   108            * @param aCommandId Command ID.
       
   109            *
       
   110            * @return ETrue if command was handled, otherwise EFalse.
       
   111            */
       
   112           TBool OfferHandleCommandToPlugins(TInt aCommandId);
       
   113           
       
   114           /**
       
   115            * Loads all the plugins
       
   116            */
       
   117           void LoadPluginL( );
       
   118           
       
   119           /**
       
   120            * Map the plugin command to Conversation view command
       
   121            */
       
   122           void MapCommandL(CIMCVMenuExtension& aMenuExtension, TInt32 aPluginId);
       
   123         
       
   124     private: // Implementation
       
   125 
       
   126         /**
       
   127          * Standard C++ constructor
       
   128          * @param aServiceName, service name.
       
   129          * @param aExtensionFactory, extension factory 
       
   130          */    
       
   131         CIMCVMenuExtensionManager( );
       
   132         
       
   133         /**
       
   134          * Performs the 2nd phase of construction.
       
   135          */             
       
   136         void ConstructL();        
       
   137     private:
       
   138         /**
       
   139          * Internal class used as a wrapper around a plugin
       
   140          * and its uid.
       
   141          */
       
   142         class CPluginInfo : public CBase
       
   143             {
       
   144             public: // Constructor & Destructor
       
   145                 CPluginInfo( CIMCVMenuExtension* aPlugin, TUid aUid );
       
   146                 ~CPluginInfo();
       
   147 
       
   148             public: // New functions
       
   149                 CIMCVMenuExtension& Plugin();
       
   150             private: // Data
       
   151                 CIMCVMenuExtension* iPlugin;
       
   152                 TUid iPluginUid;
       
   153             };
       
   154 
       
   155     private: // Data
       
   156         
       
   157         // New commands pool
       
   158         TInt iNewCommands;
       
   159 
       
   160         // takes ownership of the plugins
       
   161         RPointerArray<CPluginInfo> iPlugins;  
       
   162         
       
   163          // Array of command id mappings,Owned
       
   164         RPointerArray<CIMCVCommandInfo> iCommandIdMap; 
       
   165       
       
   166     };
       
   167 
       
   168 #endif // C_CVIMPSTUIVIEWMANAGER_H
       
   169 
       
   170 // End of file