imagingandcamerafws/imagingfws/ImageDisplay/src/ImageDisplayFramework.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Not for public use
       
    15 // These are internal structures used by the Image Display Library
       
    16 // 
       
    17 //
       
    18 
       
    19 #ifndef __IMAGEDISPLAYFRAMEWORK_H__
       
    20 #define __IMAGEDISPLAYFRAMEWORK_H__
       
    21 
       
    22 #include <ecom/ecom.h>
       
    23 
       
    24 #include "ImageDisplay.h"
       
    25 #include "ImageDisplayPlugin.h"
       
    26 
       
    27 /** @file
       
    28 	@internalComponent */
       
    29 
       
    30 /*
       
    31 @internalComponent
       
    32   
       
    33    Class used to shadow the descriptor supplying the image data.
       
    34    It maintains a flag to determine whether the descriptor contains a
       
    35    filename or the image data itself.
       
    36    This class is not for public use
       
    37   
       
    38  */
       
    39 
       
    40 class TImageParameterData
       
    41 	{
       
    42 public:
       
    43 	TImageParameterData();
       
    44 	void Reset();
       
    45 	void SetFilename(const TDesC& aFilenamePtr);
       
    46 	void SetData(const TDesC8& aData);
       
    47 	void SetFileHandle(RFile& aFileHandle);
       
    48 
       
    49 	void SetMimeType(const TDesC8& aMimeType);
       
    50 	void SetIntent(ContentAccess::TIntent aIntent);
       
    51 	void SetContentId(const TDesC& aContentId);
       
    52 	void SetImageType(TUid aImageType, TUid aImageSubType = KNullUid);
       
    53 	void SetEnableUI(TBool aEnableUI);
       
    54 
       
    55 	CImageDisplayPlugin::TImageSourceType ImageSourceType() const;
       
    56 	const TDesC& Filename() const;
       
    57 	const TDesC8& Data() const;
       
    58 	RFile& FileHandle() const;
       
    59 
       
    60 	ContentAccess::TIntent Intent() const;
       
    61 	const TDesC& ContentId() const;
       
    62 
       
    63 	const TDesC8& MimeType() const;
       
    64 	const TUid ImageType() const;
       
    65 	const TUid ImageSubType() const;
       
    66 	TBool IsDataTypeDefined() const;
       
    67 	TBool IsUIEnabled() const;
       
    68 
       
    69 private:
       
    70 	CImageDisplayPlugin::TImageSourceType iImageParameterDataFlag;
       
    71 	TPtrC iFilename;	// not owned
       
    72 	TPtrC8 iData;	// not owned
       
    73 	RFile* iFileHandle;// not owned
       
    74 	ContentAccess::TIntent iIntent;
       
    75 	TPtrC iContentId;
       
    76 	TPtrC8  iMimeType;	// not owned
       
    77 	TUid iImageType;
       
    78 	TUid iImageSubType;
       
    79 	TBool iEnableUI;
       
    80 	};
       
    81 
       
    82 /*
       
    83 @internalComponent
       
    84 
       
    85   Body of CImageDisplay
       
    86 
       
    87   This class is not for public use
       
    88 */
       
    89 class CImageDisplayFramework;
       
    90 NONSHARABLE_CLASS(CImageDisplayFramework) : public CBase
       
    91 	{
       
    92 	friend class CImageDisplay;
       
    93 	friend class CImageDisplayPlugin;
       
    94 
       
    95 private:
       
    96 
       
    97 	enum TImageDisplayInternalFlags
       
    98 		{
       
    99 		EFlagMaintainAspectRatio	=0x00000001,
       
   100 		EFlagSourceRectSet			=0x00000002
       
   101 		};
       
   102 
       
   103 	static CImageDisplayFramework* NewL(CImageDisplay& aHandle, MIclImageDisplayObserver& aCallback, RFs& aFs);
       
   104 	CImageDisplayFramework(CImageDisplay& aHandle, MIclImageDisplayObserver& aCallback, RFs& aFs);
       
   105 	~CImageDisplayFramework();
       
   106 	
       
   107 	// setter methods - called from client API (CImageDisplay)
       
   108 	void SetPluginUid(TUid aPluginUid);
       
   109 	TInt SetImageSource(const TMMSource& aImageSource);
       
   110 
       
   111 	void SetSourceMimeType(const TDesC8& aMIMEType);
       
   112 	void SetSourceImageType(TUid aImageType, TUid aImageSubType);
       
   113 	void SetSourceRect(const TRect& aRect);
       
   114 	void ResetSourceRect();
       
   115 	void SetSizeInPixels(const TSize& aDestinationSize, TBool aMaintainAspectRatio);
       
   116 	TInt SetOptions(TUint aOptions);
       
   117 	void SetDisplayMode(TDisplayMode aDisplayMode);
       
   118 
       
   119 	// getters called from client API
       
   120 	TInt ExtensionInterface(TUid aIFaceUid, TAny*& aIFacePtr);
       
   121 	void GetBitmap(const CFbsBitmap*& aBitmap, const CFbsBitmap*& aMask) const;
       
   122 	TBool ValidBitmap() const;
       
   123 	
       
   124 	// getter methods - called from plugin (CImageDisplayPlugin)
       
   125 	CImageDisplayPlugin::TImageSourceType SourceType() const;
       
   126 
       
   127 	const TDesC& SourceFilename() const;
       
   128 	RFile& SourceFileHandle() const;
       
   129 	const TDesC8& SourceData() const;
       
   130 	const TDesC8& SourceMimeType() const;
       
   131 	ContentAccess::TIntent SourceDataIntent() const;
       
   132 	const TDesC& SourceDataId() const;
       
   133 
       
   134 	const TUid SourceImageType() const;
       
   135 	const TUid SourceImageSubType() const;
       
   136 	TBool SourceRect(TRect& aRect) const;
       
   137 	const TSize& DestinationSizeInPixels() const;
       
   138 	TUint Options() const;
       
   139 	TBool MaintainAspectRatio() const;
       
   140 	TDisplayMode DisplayMode() const;
       
   141 	const CImageDisplay::RImageSizeArray& RecommendedImageSizes() const;
       
   142 	TUint ImageStatus() const;
       
   143 	TInt NumFrames(TInt& aNumFrames) const;
       
   144 
       
   145 	// callback methods - called from plugin (CImageDisplayPlugin)
       
   146 	void CallbackImageReady(const CFbsBitmap* aBitmap, TUint aStatus, const TRect& aUpdatedArea, TInt aError);
       
   147 
       
   148 	// "action" methods
       
   149 	void SetupL();
       
   150 	void Play();
       
   151 	void StopPlay();
       
   152 	void Reset();
       
   153 	void Pause();
       
   154 	
       
   155 		// "internal" methods called only from client API (CImageDisplay)
       
   156 	CImageDisplayPlugin* FileNewImplL(
       
   157 		const TDesC& aSourceFilename, 
       
   158 		const TUid aImageType, 
       
   159 		const TUid aImageSubType, 
       
   160 		const TUid aPluginUid);
       
   161 
       
   162 	CImageDisplayPlugin* FileHandleNewImplL(
       
   163 		RFile& aFileHandle, 
       
   164 		const TUid aImageType, 
       
   165 		const TUid aImageSubType, 
       
   166 		const TUid aPluginUid);
       
   167 
       
   168 	CImageDisplayPlugin* NewImplL(
       
   169 		const TDesC8& aMIMEType);
       
   170 
       
   171 	CImageDisplayPlugin* DataNewL(
       
   172 		const TDesC8& aSourceData, 
       
   173 		const TUid aImageType, 
       
   174 		const TUid aImageSubType, 
       
   175 		const TUid aPluginUid);
       
   176 
       
   177 	void MimeTypeGetDisplayerListL(
       
   178 		RImplInfoPtrArray& aDisplayerList, 
       
   179 		const TDesC8& aMIMEType);
       
   180 	void ImageTypeGetDisplayerListL(
       
   181 		RImplInfoPtrArray& aDisplayerList, 
       
   182 		const TDesC8& aImageHeader, 
       
   183 		const TUid aImageType, 
       
   184 		const TUid aImageSubType, 
       
   185 		const TUid aPluginUid);
       
   186 	void SuffixTypeGetDisplayerListL(
       
   187 		RImplInfoPtrArray& aDisplayerList, 
       
   188 		const TDesC& aFileName);
       
   189 	CImageDisplayPlugin* FindDisplayerNewL(
       
   190 		const RImplInfoPtrArray& aDisplayerList);
       
   191 
       
   192 	void DeletePlugin();
       
   193 	inline void SetFlag(TInt aFlag);
       
   194 	inline void ClearFlag(TInt aFlag);
       
   195 	inline TBool FlagSet(TInt aFlag) const;
       
   196 
       
   197 private:
       
   198 	CImageDisplay& iHandle;
       
   199 	MIclImageDisplayObserver& iCallback;
       
   200 	RFs& iFs;
       
   201 
       
   202 	TImageParameterData iSourceImage;
       
   203 
       
   204 	TSize iDestinationSize;
       
   205 
       
   206 	TUid iPluginUid;
       
   207 	
       
   208 	TDisplayMode iDisplayMode;
       
   209 
       
   210 	CImageDisplayPlugin* iPlugin;
       
   211 	TUint iOptions;
       
   212 
       
   213 	TRect iSourceRect;
       
   214 
       
   215 	TInt iFlags;
       
   216 	enum TFrameworkState 
       
   217 		{
       
   218 		EStateOpened=0, 
       
   219 		EStateConfigured, 
       
   220 		EStatePluginLoaded, 
       
   221 		EStateProcessing, 
       
   222 		EStatePaused
       
   223 		}			iState;
       
   224 	};
       
   225 
       
   226 
       
   227 #include "Imagedisplayframework.inl"
       
   228 
       
   229 #endif  // __IMAGEDISPLAYFRAMEWORK_H__
       
   230