phonebookui/Phonebook2/Presentation/inc/CPbk2ImageManagerImpl.h
branchRCL_3
changeset 63 f4a778e096c2
child 64 c1e8ba0c2b16
equal deleted inserted replaced
62:5b6f26637ad3 63:f4a778e096c2
       
     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: 
       
    15 *     Class CPbk2ImageManager implementation classes.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CPBK2IMAGEMANAGERIMPL_H
       
    21 #define CPBK2IMAGEMANAGERIMPL_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "CPbk2ImageManager.h"
       
    25 #include "VPbkFieldType.hrh" // TVPbkFieldStorageType
       
    26 
       
    27 // CONSTANTS
       
    28 // Size of thumbnail images stored to contacts
       
    29 #define KPbk2PersonalImageSize TSize(150,150)
       
    30 
       
    31 //  FORWARD DECLARATIONS
       
    32 class MPbk2ImageGetObserver;
       
    33 class MPbk2ImageSetObserver;
       
    34 class CVPbkContactManager;
       
    35 class MVPbkBaseContactField;
       
    36 
       
    37 
       
    38 // CLASS DECLARATION
       
    39 /**
       
    40  * Abstract thumbnail reader interface.
       
    41  */
       
    42 class MPbk2ImageReader : 
       
    43         public MPbk2ImageOperation
       
    44     {
       
    45     public:  // Interface
       
    46         /**
       
    47          * Starts reading a thumbnail from the contact specified at creation
       
    48          * time.
       
    49          * @param aParameters Optional parameters for the thumbnail.
       
    50          * 
       
    51          * @see TPbkImageLoadParameters
       
    52          */
       
    53         virtual void StartReadL
       
    54             (const TPbk2ImageManagerParams* aParameters = NULL) =0;
       
    55 
       
    56         /**
       
    57          * Cancels reading operation.
       
    58          */
       
    59         virtual void CancelRead() =0;
       
    60     };
       
    61 
       
    62 
       
    63 /**
       
    64  * Abstract thumbnail image writer interface.
       
    65  */
       
    66 class MPbk2ImageWriter : 
       
    67         public MPbk2ImageOperation
       
    68     {
       
    69     public:  // Interface
       
    70         /**
       
    71          * Starts writing a bitmap to the contact.
       
    72          *
       
    73          * @param aBitmap   bitmap to save to contact.
       
    74          */
       
    75         virtual void StartWriteL(const CFbsBitmap& aBitmap) =0;
       
    76 
       
    77         /**
       
    78          * Starts writing an image buffer to the contact.
       
    79          *
       
    80          * @param aBuffer   image buffer to save to contact.
       
    81          */
       
    82         virtual void StartWriteL(const TDesC8& aBuffer) =0;
       
    83 
       
    84         /**
       
    85          * Starts writing a file image to the contact.
       
    86          *
       
    87          * @param aFileName   file image to save to contact.
       
    88          */
       
    89         virtual void StartWriteL(const TDesC& aFileName) = 0;
       
    90 
       
    91         /**
       
    92          * Cancels writing operation.
       
    93          */
       
    94         virtual void CancelWrite() =0;
       
    95     };
       
    96 
       
    97 
       
    98 /**
       
    99  * Factory class for creating concrete MPbk2ImageReader and 
       
   100  * MPbk2ImageWriter instances.
       
   101  */
       
   102 class Pbk2ImageOperationFactory
       
   103     {
       
   104     public:
       
   105         /**
       
   106          * Creates a concrete image reader object based on the type of 
       
   107          * the thumbnail field in the contact.
       
   108          *
       
   109          * @param aContactManager Contact manager
       
   110          * @param aContact  contact to get thumbnail from.
       
   111          * @param aObserver observer to notify about progress of the operation.
       
   112          * @param aFieldType  Phonebook field type of fetched image.
       
   113          * Default field type is EPbkFieldIdThumbnailImage.
       
   114          * @return  thumbnail reader object or NULL if aContact contains no
       
   115          *          thumbnail.
       
   116          */
       
   117         static MPbk2ImageReader* CreateReaderLC
       
   118             (CVPbkContactManager& aContactManager,
       
   119             const MVPbkBaseContact& aContact,
       
   120             MPbk2ImageGetObserver& aObserver,
       
   121             const MVPbkFieldType& aFieldType);
       
   122 
       
   123         /**
       
   124          * Creates a concrete writer object based on the type of the thumbnail
       
   125          * field in the contact or in global field typing. 
       
   126          *
       
   127          * @param aContactManager Contact manager
       
   128          * @param aContact      contact to write thumbnail to.
       
   129          * @param aObserver     observer to notify about progress of the 
       
   130          *                      operation.
       
   131          * @param aFieldType  Phonebook field type of fetched image.
       
   132          * Default field type is EPbkFieldIdThumbnailImage.         
       
   133          * @return  thumbnail writer object.
       
   134          */
       
   135         static MPbk2ImageWriter* CreateWriterLC
       
   136             (CVPbkContactManager& aContactManager,
       
   137             MVPbkStoreContact& aContact, 
       
   138             MPbk2ImageSetObserver& aObserver,
       
   139             const MVPbkFieldType& aFieldType);
       
   140 
       
   141         /**
       
   142          * Returns true if aStorageType is supported for thumbnail field.
       
   143          *
       
   144          * @param aField    Contact field 
       
   145          * @return ETrue if field is supported, other EFalse
       
   146          */
       
   147         static TBool SupportedStorageType(const MVPbkBaseContactField* aField);
       
   148 
       
   149     private:
       
   150         /// Namespace class, constructor not implemented.
       
   151         Pbk2ImageOperationFactory();
       
   152     };
       
   153 
       
   154 #endif // CPBK2IMAGEMANAGERIMPL_H
       
   155 
       
   156 // End of File