imagehandling_plat/thumbnailmanager_api/inc/thumbnailobjectsource.h
changeset 54 48dd0f169f0d
parent 42 2e2a89493e2b
equal deleted inserted replaced
42:2e2a89493e2b 54:48dd0f169f0d
     1 /*
       
     2 * Copyright (c) 2006-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:  Class for encapsulating the data source for objects.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef THUMBNAILOBJECTSOURCE_H
       
    20 #define THUMBNAILOBJECTSOURCE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <f32file.h>
       
    24 
       
    25 typedef TUint32 TThumbnailId;
       
    26 
       
    27 class CFbsBitmap;
       
    28 
       
    29 /**
       
    30  *  Object source for thumbnails.
       
    31  *
       
    32  *  Class for encapsulating the data source for objects.
       
    33  *
       
    34  *  @since S60 v5.0
       
    35  */
       
    36 NONSHARABLE_CLASS( CThumbnailObjectSource ): public CBase
       
    37     {
       
    38 public:
       
    39     /**
       
    40      * Construct a new CThumbnailObjectSource referring to an URI.
       
    41      * @param aUri      Object URI or a full path to a file in the file system.
       
    42      * @param aMimeType MIME type. Optional, but should be specified if known.
       
    43      * @since S60 v5.0
       
    44      * @return New CThumbnailObjectSource instance.
       
    45      */
       
    46     IMPORT_C static CThumbnailObjectSource* NewL( const TDesC& aUri, const
       
    47         TDesC& aMimeType = KNullDesC );
       
    48 
       
    49     /**
       
    50      * Construct a new CThumbnailObjectSource referring to an URI.
       
    51      * @param aUri      Object URI or a full path to a file in the file system.
       
    52      * @param aMimeType MIME type. Optional, but should be specified if known.
       
    53      * @since S60 v5.0
       
    54      * @return New CThumbnailObjectSource instance.
       
    55      */
       
    56     IMPORT_C static CThumbnailObjectSource* NewLC( const TDesC& aUri, const
       
    57         TDesC& aMimeType = KNullDesC );
       
    58 
       
    59     /**
       
    60      * Construct a new CThumbnailObjectSource referring to a file handle.
       
    61      * The file handle must refer to an open file and it must remain
       
    62      * valid until this object source is deleted.
       
    63      *
       
    64      * @param aFile     File handle.
       
    65      * @param aMimeType MIME type. Optional, but should be specified if known.
       
    66      * @since S60 v5.0
       
    67      * @return New CThumbnailObjectSource instance.
       
    68      */
       
    69     IMPORT_C static CThumbnailObjectSource* NewL( const RFile64& aFile, const
       
    70         TDesC& aMimeType = KNullDesC );
       
    71 
       
    72     /**
       
    73      * Construct a new CThumbnailObjectSource referring to a file handle.
       
    74      * The file handle must refer to an open file and it must remain
       
    75      * valid until this object source is deleted.
       
    76      *
       
    77      * @param aFile     File handle.
       
    78      * @param aMimeType MIME type. Optional, but should be specified if known.
       
    79      * @since S60 v5.0
       
    80      * @return New CThumbnailObjectSource instance.
       
    81      */
       
    82     IMPORT_C static CThumbnailObjectSource* NewLC( const RFile64& aFile, const
       
    83         TDesC& aMimeType = KNullDesC );
       
    84 
       
    85     /**
       
    86      * Destructor
       
    87      *
       
    88      * @since S60 v5.0
       
    89      */
       
    90     virtual ~CThumbnailObjectSource();
       
    91 
       
    92 public:
       
    93 
       
    94     /**
       
    95      * Returns file handle.
       
    96      *
       
    97      * @since S60 v5.0
       
    98      * @return reference to file handle
       
    99      */
       
   100     IMPORT_C RFile64& FileHandle();
       
   101 
       
   102     /**
       
   103      * Returns source uri.
       
   104      *
       
   105      * @since S60 v5.0
       
   106      * @return uri
       
   107      */
       
   108     IMPORT_C const TDesC& Uri();
       
   109 
       
   110 private:
       
   111 
       
   112     /**
       
   113      * C++ default constructor
       
   114      *
       
   115      * @since S60 v5.0
       
   116      */
       
   117     CThumbnailObjectSource();
       
   118 
       
   119     /**
       
   120      * Symbian 2nd phase constructor can leave.
       
   121      *
       
   122      * @since S60 v5.0
       
   123      * @param aUri Object URI or a full path to a file in the file system.
       
   124      * @param aMimeType MIME type. Optional, but should be specified if known.
       
   125      */
       
   126     void ConstructL( const TDesC& aUri, const TDesC& aMimeType );
       
   127 
       
   128     /**
       
   129      * Symbian 2nd phase constructor can leave.
       
   130      *
       
   131      * @since S60 v5.0
       
   132      * @param aFile File handle.
       
   133      * @param aMimeType MIME type. Optional, but should be specified if known.
       
   134      */
       
   135     void ConstructL( const RFile64& aFile, const TDesC& aMimeType );
       
   136 
       
   137     /**
       
   138      * Symbian 2nd phase constructor can leave.
       
   139      *
       
   140      * @since S60 v5.0
       
   141      * @param aURI URI.
       
   142      * @param aMimeType MimeType.
       
   143      * @param aThumbnailId ThumbnailId
       
   144      */
       
   145     void ConstructL( const TDesC& aUri, const TDesC& aMimeType, TThumbnailId aThumbnailId );
       
   146 
       
   147     /**
       
   148      * Symbian 2nd phase constructor can leave.
       
   149      *
       
   150      * @since S60 v5.0
       
   151      * @param aBitmap Bitmap.
       
   152      * @param aURI URI.
       
   153      */   
       
   154     void ConstructL( CFbsBitmap* aBitmap, const TDesC& aUri );
       
   155 
       
   156     /**
       
   157      * Symbian 2nd phase constructor can leave.
       
   158      *
       
   159      * @since S60 v5.0
       
   160      * @param aBuffer Buffer.
       
   161      * @param aMimeType MIME type. Optional, but should be specified if known.
       
   162      * @param aURI URI.
       
   163      */
       
   164     void ConstructL( TDesC8* aBuffer, const TDesC& aMimeType, const TDesC& aUri );    
       
   165     
       
   166     /**
       
   167      * Symbian 2nd phase constructor can leave.
       
   168      *
       
   169      * @since Symbian^3
       
   170      * @param aUri Object URI or a full path to a file in the file system.
       
   171      * @param aTargetUri      For linking the thumbnail to a different URI.
       
   172      * @param aMimeType MIME type. Optional, but should be specified if known.
       
   173      */
       
   174     void ConstructL( const TDesC& aUri, const TDesC& aTargetUri, const TDesC& aMimeType );
       
   175     
       
   176 private:
       
   177     // data
       
   178 
       
   179     /**
       
   180      * File
       
   181      */
       
   182     RFile64 iFile;
       
   183 
       
   184     /**
       
   185      * Uri
       
   186      */
       
   187     HBufC* iUri; // own
       
   188 
       
   189     /**
       
   190      * Mime type
       
   191      */
       
   192     HBufC8* iMimeType; // own
       
   193     
       
   194     /**
       
   195      * Buffer
       
   196      */
       
   197     TDesC8* iBuffer; // own
       
   198     
       
   199     /**
       
   200      * Bitmap
       
   201      */
       
   202     CFbsBitmap* iBitmap; // own
       
   203     
       
   204     /**
       
   205      * ThumbnailId
       
   206      */    
       
   207     TThumbnailId iThumbnailId; //own
       
   208     
       
   209     /**
       
   210      * Uri
       
   211      */
       
   212     HBufC* iTargetUri; // own
       
   213 	
       
   214 public:
       
   215 	    
       
   216     /**
       
   217      * Construct a new CThumbnailObjectSource referring to a buffer 
       
   218      * containing an image.
       
   219      *
       
   220      * @param aBuffer   Buffer.
       
   221      * @param aUri      Object URI or a full path to a file in the file system.
       
   222      * @since S60 v5.0
       
   223      * @return New CThumbnailObjectSource instance.
       
   224      */    
       
   225     IMPORT_C static CThumbnailObjectSource* NewL( CFbsBitmap*  aBitmap, const TDesC& aUri );
       
   226 
       
   227     /**
       
   228      * Construct a new CThumbnailObjectSource referring to a buffer 
       
   229      * containing an image.
       
   230      *
       
   231      * @param aFile     File handle.
       
   232      * @param aUri      Object URI or a full path to a file in the file system.
       
   233      * @since S60 v5.0
       
   234      * @return New CThumbnailObjectSource instance.
       
   235      */        
       
   236     IMPORT_C static CThumbnailObjectSource* NewLC( CFbsBitmap*  aBitmap, const TDesC& aUri );
       
   237  
       
   238     /**
       
   239      * Construct a new CThumbnailObjectSource referring to a buffer 
       
   240      * containing an image.
       
   241      *
       
   242      * @param aBuffer   Buffer.
       
   243      * @param aUri      Object URI or a full path to a file in the file system.
       
   244      * @since S60 v5.0
       
   245      * @return New CThumbnailObjectSource instance.
       
   246      */       
       
   247     IMPORT_C static CThumbnailObjectSource* NewL( TDesC8* aBuffer,  TDesC& aMimeType, 
       
   248         const TDesC& aUri );
       
   249     
       
   250     /**
       
   251      * Construct a new CThumbnailObjectSource referring to a buffer 
       
   252      * containing an image.
       
   253      *
       
   254      * @param aBuffer   Buffer.
       
   255      * @param aMimeType MIME type. Optional, but should be specified if known.
       
   256      * @param aUri      Object URI or a full path to a file in the file system.
       
   257      * @since S60 v5.0
       
   258      * @return New CThumbnailObjectSource instance.
       
   259      */       
       
   260     IMPORT_C static CThumbnailObjectSource* NewLC( TDesC8* aBuffer,  TDesC& aMimeType, 
       
   261         const TDesC& aUri);
       
   262 
       
   263     /**
       
   264      * Construct a new CThumbnailObjectSource referring to an URI.
       
   265      * @param aUri      Object URI or a full path to a file in the file system.
       
   266      * @param aMimeType MIME type. Optional, but should be specified if known.
       
   267      * @since S60 v5.0
       
   268      * @return New CThumbnailObjectSource instance.
       
   269      */
       
   270     IMPORT_C static CThumbnailObjectSource* NewL( const TDesC& aUri, 
       
   271         TThumbnailId aThumbnailId = 0, const TDesC& aMimeType = KNullDesC );
       
   272 
       
   273     /**
       
   274      * Construct a new CThumbnailObjectSource referring to an URI.
       
   275      * @param aUri      Object URI or a full path to a file in the file system.
       
   276      * @param aMimeType MIME type. Optional, but should be specified if known.
       
   277      * @since S60 v5.0
       
   278      * @return New CThumbnailObjectSource instance.
       
   279      */
       
   280     IMPORT_C static CThumbnailObjectSource* NewLC( const TDesC& aUri,
       
   281         TThumbnailId aThumbnailId = 0, const TDesC& aMimeType = KNullDesC );
       
   282     	 
       
   283     /**
       
   284      * Returns source buffer.
       
   285      *
       
   286      * @since S60 v5.0
       
   287      * @return buffer
       
   288      */  
       
   289     IMPORT_C TDesC8* Buffer();
       
   290     
       
   291     /**
       
   292      * Gets ownership of buffer from source object.
       
   293      * After that Buffer() returns NULL.
       
   294      *
       
   295      * @since S60 v5.0
       
   296      * @return buffer
       
   297      */
       
   298     IMPORT_C TDesC8* GetBufferOwnership();
       
   299     
       
   300     /**
       
   301      * Gets MIME type.
       
   302      *
       
   303      * @since S60 v5.0
       
   304      * @return MIME type
       
   305      */   
       
   306     IMPORT_C const TDesC8& MimeType();
       
   307     
       
   308     /**
       
   309      * Gets ThumbnailId.
       
   310      *
       
   311      * @since S60 v5.0
       
   312      * @return ThumbnailId 
       
   313      */     
       
   314     IMPORT_C TThumbnailId Id(); 	    
       
   315     
       
   316     /**
       
   317      * Returns source bitmap.
       
   318      *
       
   319      * @since S60 v5.0
       
   320      * @return bitmap
       
   321      */  
       
   322     IMPORT_C CFbsBitmap* Bitmap();
       
   323     
       
   324     /**
       
   325      * Gets ownership of bitmap from source object.
       
   326      * After that Bitmap() returns NULL.
       
   327      *
       
   328      * @since S60 v5.0
       
   329      * @return bitmap
       
   330      */
       
   331     IMPORT_C CFbsBitmap* GetBitmapOwnership();
       
   332     
       
   333     /**
       
   334      * Construct a new CThumbnailObjectSource referring to an URI.
       
   335      * @param aUri      Object URI or a full path to a file in the file system.
       
   336      * @param aTargetUri      For linking the thumbnail to a different URI.
       
   337      * @param aMimeType MIME type. Optional, but should be specified if known.
       
   338      * @since Symbian^3
       
   339      * @return New CThumbnailObjectSource instance.
       
   340      */
       
   341     IMPORT_C static CThumbnailObjectSource* NewL( const TDesC& aUri, 
       
   342             const TDesC& aTargetUri, const TDesC& aMimeType );
       
   343 
       
   344     /**
       
   345      * Construct a new CThumbnailObjectSource referring to an URI.
       
   346      * @param aUri      Object URI or a full path to a file in the file system.
       
   347      * @param aTargetUri      For linking the thumbnail to a different URI.
       
   348      * @param aMimeType MIME type. 
       
   349      * @since Symbian^3
       
   350      * @return New CThumbnailObjectSource instance.
       
   351      */
       
   352     IMPORT_C static CThumbnailObjectSource* NewLC( const TDesC& aUri, 
       
   353             const TDesC& aTargetUri, const TDesC& aMimeType );
       
   354     
       
   355     /**
       
   356      * Returns target uri.
       
   357      *
       
   358      * @since Symbian^3
       
   359      * @return uri
       
   360      */
       
   361     IMPORT_C const TDesC& TargetUri();
       
   362 };
       
   363 
       
   364 #endif // THUMBNAILOBJECTSOURCE_H