startupservices/startupanimation/sanimengine/inc/sanimpluginctrl.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 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:  Declaration of CSAnimPluginCtrl class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef SANIMPLUGINCTRL_H
       
    20 #define SANIMPLUGINCTRL_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 class CSAnimPlugin;
       
    25 
       
    26 /**
       
    27 *  Active object in control of one CSAnimPlugin object.
       
    28 *
       
    29 *  @lib None
       
    30 *  @since S60 3.2
       
    31 */
       
    32 NONSHARABLE_CLASS( CSAnimPluginCtrl ) : public CActive
       
    33     {
       
    34 
       
    35 public:
       
    36 
       
    37     /**
       
    38     * Constructs a CSAnimPluginCtrl object.
       
    39     *
       
    40     * @since S60 3.2
       
    41     *
       
    42     * @param aFileName Name of the file to load with the plug-in.
       
    43     * @param aIfUid Identifies the interface the plug-in must implement.
       
    44     * @param Construction parameters for ECom.
       
    45     * @return The new object
       
    46     */
       
    47     static CSAnimPluginCtrl* NewL(
       
    48         const TDesC& aFileName,
       
    49         const TUint32 aIfUid,
       
    50         TAny* aConstructionParameters );
       
    51 
       
    52     /**
       
    53     * Destructor.
       
    54     *
       
    55     * @since S60 3.2
       
    56     */
       
    57     virtual ~CSAnimPluginCtrl();
       
    58 
       
    59     /**
       
    60     * Load the file with the plug-in.
       
    61     *
       
    62     * @since S60 3.2
       
    63     *
       
    64     * @param aFs Fileserver reference.
       
    65     * @param aCallBack Identifies a call-back function to call when loading is
       
    66     * complete.
       
    67     */
       
    68     void Load( RFs& aFs, const TCallBack& aCallBack );
       
    69 
       
    70     /**
       
    71     * Start the plug-in.
       
    72     *
       
    73     * @since S60 3.2
       
    74     *
       
    75     * @param aCallBack Identifies a call-back function to call when the plug-in
       
    76     * has finished.
       
    77     */
       
    78     void Start( const TCallBack& aCallBack );
       
    79 
       
    80     /**
       
    81     * Return a success code of the last activity (Load/Start).
       
    82     *
       
    83     * @since S60 3.2
       
    84     *
       
    85     * @return KErrNone or one of the Symbian error codes.
       
    86     */
       
    87     TInt SuccessCode() const;
       
    88 
       
    89     /**
       
    90     * Get a reference to the plug-in object.
       
    91     *
       
    92     * @since S60 3.2
       
    93     *
       
    94     * @return A reference to the plug-in object.
       
    95     */
       
    96     CSAnimPlugin& Plugin();
       
    97 
       
    98 protected:
       
    99 
       
   100     /**
       
   101     * From CActive.
       
   102     * Implements cancellation of an outstanding request.
       
   103     *
       
   104     * @since S60 3.2
       
   105     */
       
   106     virtual void DoCancel();
       
   107 
       
   108     /**
       
   109     * From CActive.
       
   110     * Handles an active object's request completion event.
       
   111     * Never leaves.
       
   112     *
       
   113     * @since S60 3.2
       
   114     */
       
   115     virtual void RunL();
       
   116 
       
   117 private:
       
   118 
       
   119     /**
       
   120     * First phase constructor.
       
   121     *
       
   122     * @since S60 3.2
       
   123     */
       
   124     CSAnimPluginCtrl();
       
   125 
       
   126     /**
       
   127     * Second phase constructor.
       
   128     *
       
   129     * @since S60 3.2
       
   130     *
       
   131     * @param aFileName Name of the file to load with the plug-in.
       
   132     * @param aIfUid Identifies the interface the plug-in must implement.
       
   133     * @param Construction parameters for ECom.
       
   134     */
       
   135     void ConstructL(
       
   136         const TDesC& aFileName,
       
   137         const TUint32 aIfUid,
       
   138         TAny* aConstructionParameters );
       
   139 
       
   140     /**
       
   141     * Extract the extension part from the file name, and return it.
       
   142     *
       
   143     * @since S60 3.2
       
   144     *
       
   145     * @param aFileName File name.
       
   146     * @param aExtension On return, will contain the extension part of the file
       
   147     * name.
       
   148     */
       
   149     void GetExtension( const TDesC& aFileName, TDes& aExtension );
       
   150 
       
   151     /**
       
   152     * Find a plug-in which supports the given file extension and load it.
       
   153     *
       
   154     * @since S60 3.2
       
   155     *
       
   156     * @param aExtension The file extension which the plug-in must support.
       
   157     * @param aIfUid Identifies the interface the plug-in must implement.
       
   158     * @param Construction parameters for ECom.
       
   159     */
       
   160     void FindPluginByExtensionL(
       
   161         const TDesC& aExtension,
       
   162         const TUint32 aIfUid,
       
   163         TAny* aConstructionParameters );
       
   164 
       
   165 private:
       
   166 
       
   167     /** Copy constructor. */
       
   168     CSAnimPluginCtrl( const CSAnimPluginCtrl& );
       
   169     /** Assignment operator. */
       
   170     CSAnimPluginCtrl& operator=( const CSAnimPluginCtrl& );
       
   171 
       
   172 private: // data
       
   173 
       
   174     /** Identifies the file to load with the plug-in. Owned. May not be NULL. */
       
   175     HBufC* iFileName;
       
   176 
       
   177     /** The plug-in object to control. Owned. May not be NULL. */
       
   178     CSAnimPlugin* iPlugin;
       
   179 
       
   180     /** Plug-in identifier in ECom. */
       
   181     TUid iDtorIDKey;
       
   182 
       
   183     /** Call-back function to call when action completes. */
       
   184     TCallBack iCallBack;
       
   185 
       
   186     /** Identifies the success/failure of the last activity. */
       
   187     TInt iSuccessCode;
       
   188 
       
   189     /** Updated to ETrue after Load has successfully completed. */
       
   190     TBool iReadyToStart;
       
   191 
       
   192     };
       
   193 
       
   194 #endif // SANIMPLUGINCTRL_H