messagingappbase/smartmessaging/msgeditorutils/inc/MsgBioControlFactory.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002 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:  
       
    15 *     Bio control factory.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef MSGBIOCONTROLFACTORY_H
       
    22 #define MSGBIOCONTROLFACTORY_H
       
    23 
       
    24 // INCLUDES 
       
    25 #include <e32base.h> // for CBase
       
    26 #include <msvstd.h>  // for TMsvId
       
    27 #include <mmsgbiocontrol.h>
       
    28 
       
    29 // CONSTANTS
       
    30 // MACROS
       
    31 // DATA TYPES
       
    32 // FUNCTION PROTOTYPES
       
    33 // FORWARD DECLARATIONS
       
    34 // FORWARD DECLARATIONS
       
    35 
       
    36 class CMsgBioControl;
       
    37 class MMsgBioControlObserver;
       
    38 class CBIODatabase;
       
    39 class RFs;
       
    40 class CMsvSession;
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45  * Bio control factory. Gets needed information from bif files.
       
    46  * Remember to keep the bio factory alive, and destroy it after destroying
       
    47  * the Bio Control. Do not call the bio control creation methods more than
       
    48  * once for a single instance of the factory.
       
    49  */
       
    50 class CMsgBioControlFactory : public CBase
       
    51     {
       
    52     public:
       
    53 
       
    54         /**
       
    55          * Two-phased constructor.
       
    56          */
       
    57         IMPORT_C static CMsgBioControlFactory* NewL();
       
    58 
       
    59         /**
       
    60          * Destructor
       
    61          */
       
    62         IMPORT_C ~CMsgBioControlFactory();
       
    63 
       
    64         /**
       
    65          * Creates a Bio control. This version reads the message from the
       
    66          * server. Do not call the bio control creation methods more than once
       
    67          * for a single instance of the factory.
       
    68          * @param aBioControlObserver Reference to the Bio control observer.
       
    69          * @param aBioMsgType The type of Bio message.
       
    70          * @param aEditorOrViewerMode Specifies whether the new Bio control
       
    71          *        will be in Editor or Viewer mode.
       
    72          * @param aId Id of the message.
       
    73          * @param aSession Handle to Message Server session. The ownership is
       
    74          * not transferred.
       
    75          * @return The newly created Bio control.
       
    76          * @exception EMEUErrArgument if aId or aSession is null or
       
    77          * aEditorOrViewerMode has invalid value.
       
    78          */
       
    79         IMPORT_C CMsgBioControl* CreateControlL(
       
    80             MMsgBioControlObserver& aBioControlObserver,
       
    81             const TUid& aBioMsgType,
       
    82             TMsgBioMode aEditorOrViewerMode,
       
    83             TMsvId aId,
       
    84             CMsvSession* aSession); ///no transfer of ownership
       
    85 
       
    86          /**
       
    87          * Creates a Bio Control. This version creates a file based Bio Control.
       
    88          * Do not call the bio control creation methods more than once for a
       
    89          * single instance of the factory.
       
    90          * @param aBioControlObserver Reference to the Bio control observer.
       
    91          * @param aBioMsgType The type of Bio message.
       
    92          * @param aEditorOrViewerMode Specifies whether the new Bio control
       
    93          *        will be in Editor or Viewer mode.
       
    94          * @param aFile The file handle
       
    95          * @return The newly created Bio Control.
       
    96          * @exception EMEUErrArgument if aEditorOrViewerMode has undefined
       
    97          * value
       
    98          */      
       
    99         IMPORT_C CMsgBioControl* CreateControlL(
       
   100             MMsgBioControlObserver& aBioControlObserver,
       
   101             const TUid& aBioMsgType,
       
   102             TMsgBioMode aEditorOrViewerMode,
       
   103             const RFile& aFile);           
       
   104 
       
   105     private:
       
   106         /**
       
   107          * Default constructor hidden away.
       
   108          */
       
   109         CMsgBioControlFactory();
       
   110 
       
   111         /**
       
   112          * Second phase constructor
       
   113          */
       
   114         void ConstructL();
       
   115 
       
   116         /**
       
   117          * This does the actual creating of the control.
       
   118          * @param aBioControlObserver Reference to the Bio control observer.
       
   119          * @param aBioMsgType The type of Bio message.
       
   120          * @param aEditorOrViewerMode Specifies whether the new Bio control
       
   121          *        will be in Editor or Viewer mode.
       
   122          * @param aId Id of the message.
       
   123          * @param aSession Handle to Message Server session.
       
   124          * @param aFile input file handle.
       
   125          * @return The newly created Bio control.
       
   126          */
       
   127         CMsgBioControl* DoCreateControlL(
       
   128             MMsgBioControlObserver& aBioControlObserver,
       
   129             const TUid& aBioMsgType,
       
   130             TMsgBioMode aEditorOrViewerMode,
       
   131             TMsvId aId,
       
   132             CMsvSession* aSession, //no transfer of ownership
       
   133             const RFile* aFile );
       
   134 
       
   135     private: // prohibited
       
   136 
       
   137         /**
       
   138          * Copy constructor hidden away.
       
   139          */
       
   140         CMsgBioControlFactory(const CMsgBioControlFactory& aSource);
       
   141 
       
   142         /**
       
   143          * Assignment operator hidden away.
       
   144          */
       
   145         const CMsgBioControlFactory& operator=(
       
   146             const CMsgBioControlFactory& aSource);
       
   147 
       
   148     private:
       
   149 
       
   150         /**
       
   151          * The library where the Bio control is located.
       
   152          */ 
       
   153         RLibrary    iControlDllLibrary;
       
   154 
       
   155         /**
       
   156          * File Server Session
       
   157          * It is opened during construction of factory, and closed during
       
   158          * destruction of factory.
       
   159          */
       
   160         RFs         iFs;
       
   161 
       
   162 
       
   163         /**
       
   164          * A filename for file based bio controls.
       
   165          */        
       
   166         TFileName   iFileName;
       
   167 
       
   168         };
       
   169 
       
   170 #endif // MSGBIOCONTROLFACTORY_H
       
   171 
       
   172 // End of file