epoc32/include/apamdr.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/apamdr.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/apamdr.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,202 @@
     1.4 -apamdr.h
     1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +#ifndef __APAMDR_H__
    1.21 +#define __APAMDR_H__
    1.22 +
    1.23 +#if !defined(__E32STD_H__)
    1.24 +#include <e32std.h>
    1.25 +#endif
    1.26 +#if !defined(__E32BASE_H__)
    1.27 +#include <e32base.h>
    1.28 +#endif
    1.29 +#if !defined(__GDI_H__)
    1.30 +#include <gdi.h>
    1.31 +#endif
    1.32 +#if !defined(__APADBASE_H__)
    1.33 +#include <apadbase.h>
    1.34 +#endif
    1.35 +
    1.36 +// classes defined:
    1.37 +class TApaModelDoorFactory;
    1.38 +class CApaModelDoor;
    1.39 +class CApaModelHeader;
    1.40 +class MApaModelHeaderFactory;
    1.41 +//
    1.42 +// classes referenced:
    1.43 +class RReadStream;
    1.44 +class RWriteStream;
    1.45 +class CStreamStore;
    1.46 +class CStreamDictionary;
    1.47 +class CEmbeddedStore;
    1.48 +class TApaAppIdentifier;
    1.49 +//
    1.50 +
    1.51 +
    1.52 +class TApaModelDoorFactory : public MPictureFactory
    1.53 +// Recognizes KUidPictureTypeDoor and creates CApaModelDoor pictures
    1.54 +/** A factory class for instantiating and restoring an application's door using 
    1.55 +the application's model. 
    1.56 +
    1.57 +@publishedAll 
    1.58 +@released */
    1.59 +	{
    1.60 +public:
    1.61 +	IMPORT_C TApaModelDoorFactory(const MApaModelHeaderFactory* aFactory);
    1.62 +	//
    1.63 +	// from MPictureFactory
    1.64 +	IMPORT_C void NewPictureL(TPictureHeader& aPictureHeader,const CStreamStore& aPictureStore)const; // used to create CApaDoor's during document restore only 
    1.65 +private:
    1.66 +	const MApaModelHeaderFactory* iHeaderFactory;
    1.67 +	TInt iTApaModelDoorFactory_Reserved1;
    1.68 +	};
    1.69 +
    1.70 +
    1.71 +class CApaModelDoor : public CApaDoorBase
    1.72 +/** A persistent representation of a door that also acts as a wrapper around an 
    1.73 +application's model.
    1.74 +
    1.75 +The class allows embedded data to be manipulated without requiring the whole 
    1.76 +associated application. 
    1.77 +
    1.78 +@publishedAll 
    1.79 +@released */
    1.80 +	{
    1.81 +public:
    1.82 +	IMPORT_C static CApaModelDoor* NewL(CApaModelHeader* aHeader);
    1.83 +	IMPORT_C static CApaModelDoor* NewLC(CApaModelHeader* aHeader);
    1.84 +	IMPORT_C static CApaModelDoor* NewL(const CStreamStore& aStore,TStreamId aHeadStreamId,const MApaModelHeaderFactory* aFactory);
    1.85 +	//
    1.86 +	/** Gets the application model wrapper object.
    1.87 +	
    1.88 +	@return A pointer to the application model wrapper object. */
    1.89 +	inline CApaModelHeader* ModelHeader() { return iModelHeader; }
    1.90 +	
    1.91 +	/** Sets the format of the door.
    1.92 +	
    1.93 +	@param aFormat The format for the graphical representation of the embedded 
    1.94 +	document. */
    1.95 +	inline void SetFormat(TFormat aFormat) { iFormat = aFormat; }
    1.96 +	//
    1.97 +	IMPORT_C TStreamId StoreL(CStreamStore& aStore) const;
    1.98 +	IMPORT_C void RestoreL(const CStreamStore& aStore,TStreamId aHeadStreamId,const MApaModelHeaderFactory* aFactory);
    1.99 +	//
   1.100 +	IMPORT_C ~CApaModelDoor();
   1.101 +	//
   1.102 +	// from CPicture
   1.103 +	IMPORT_C void DetachFromStoreL(TDetach /*aDegree*/=EDetachFull); //lint !e1735 Virtual function has default parameter - Inherited from CPicture, must be fixed there
   1.104 +	IMPORT_C void ExternalizeL(RWriteStream& aStream)const;
   1.105 +	IMPORT_C void Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,MGraphicsDeviceMap* aMap)const; 
   1.106 +	IMPORT_C void GetOriginalSizeInTwips(TSize& aSize)const;
   1.107 +	IMPORT_C void SetScaleFactor(TInt aScaleFactorWidth,TInt aScaleFactorHeight); 
   1.108 +	IMPORT_C TInt ScaleFactorWidth()const; 
   1.109 +	IMPORT_C TInt ScaleFactorHeight()const;
   1.110 +	//
   1.111 +private:
   1.112 +	CApaModelDoor();
   1.113 +	CApaModelDoor(CApaModelHeader* aHeader);
   1.114 +	//
   1.115 +	static CStreamDictionary* ReadStreamDictionaryLC(const CStreamStore& aSourceStore,TStreamId aStreamId);
   1.116 +	static void CopyStoreL(const CEmbeddedStore& aSourceStore,RWriteStream& aTargetStream);
   1.117 +	void InternalizeModelL(const MApaModelHeaderFactory& aFactory);
   1.118 +	//
   1.119 +	// from CApaDoorBase
   1.120 +	TSize GlassDoorSize()const;
   1.121 +private:
   1.122 +	CApaModelHeader* iModelHeader;
   1.123 +	CEmbeddedStore* iStore;
   1.124 +	TSize iScaleFactor;
   1.125 +	CBufSeg* iStoreHost; // the host for the embedded store, if the door has been detached from its originating store
   1.126 +	};
   1.127 +
   1.128 +
   1.129 +class CApaModelHeader : public CBase
   1.130 +// Abstract wrapper for an applications model - used for file format conversion etc
   1.131 +/** An interface class that acts as a wrapper for an application model.
   1.132 +
   1.133 +This is also known as an application model header.
   1.134 +
   1.135 +The class provides the knowledge for internalizing and externalizing an application 
   1.136 +model's data. An instance of the class is used by CApaModelDoor.
   1.137 +
   1.138 +A concrete implementation of the class must be supplied by the application 
   1.139 +model (not the application UI). An instance of the class is constructed by 
   1.140 +a factory object that implements the MApaModelHeaderFactory interface; the 
   1.141 +factory object is also supplied by the application model (not the application 
   1.142 +UI).
   1.143 +
   1.144 +@publishedAll
   1.145 +@released
   1.146 +@see CApaModelDoor
   1.147 +@see TApaModelDoorFactory
   1.148 +@see MApaModelHeaderFactory */
   1.149 +	{
   1.150 +public:
   1.151 +	/** Stores the model and its components in the specified store.
   1.152 +	
   1.153 +	@param aStore The store in which the model's components are to be stored.
   1.154 +	@param aDict The stream dictionary into which stream IDs and associated UIDs 
   1.155 +	are put. */
   1.156 +	virtual void StoreL(CStreamStore& aStore,CStreamDictionary& aDict) const=0;
   1.157 +	/** Gets the identity of the application associated with the application model.
   1.158 +	
   1.159 +	@return The application identity. */
   1.160 +	virtual TApaAppIdentifier AppId()const=0;
   1.161 +	/** Restores the model to the specified degree.
   1.162 +	
   1.163 +	An implementation of this function should propagate this call to all components 
   1.164 +	of the model.
   1.165 +	
   1.166 +	@param aDegree The degree to which restoration is needed. */
   1.167 +	virtual void DetachFromStoreL(CPicture::TDetach aDegree)=0;
   1.168 +protected:
   1.169 +	IMPORT_C CApaModelHeader();
   1.170 +private:
   1.171 +	IMPORT_C virtual void Reserved_1();
   1.172 +	IMPORT_C virtual void Reserved_2();
   1.173 +private:
   1.174 +	TInt iCApaModelHeader_Reserved1;
   1.175 +	};
   1.176 +
   1.177 +
   1.178 +
   1.179 +class MApaModelHeaderFactory
   1.180 +/** An interface class that applications implement to construct an application model 
   1.181 +wrapper object, also known as the application model header.
   1.182 +
   1.183 +@publishedAll
   1.184 +@released
   1.185 +@see CApaModelHeader */
   1.186 +	{
   1.187 +public:	
   1.188 +	/** Creates and returns an application model wrapper object.
   1.189 +	
   1.190 +	@param aStore The store containing model data.
   1.191 +	@param aDict The stream dictionary. 
   1.192 +	@param aAppId The application's identity held as a stream in the application's 
   1.193 +	store
   1.194 +	@return A pointer to the new application model wrapper object. */
   1.195 +	virtual CApaModelHeader* NewHeaderL(const CStreamStore& aStore,const CStreamDictionary& aDict,const TApaAppIdentifier& aAppId)const=0;
   1.196 +protected:
   1.197 +	IMPORT_C MApaModelHeaderFactory();
   1.198 +private:
   1.199 +	IMPORT_C virtual void MApaModelHeaderFactory_Reserved1();
   1.200 +	IMPORT_C virtual void MApaModelHeaderFactory_Reserved2();
   1.201 +private:
   1.202 +	TInt iMApaModelHeaderFactory_Reserved1;
   1.203 +	};
   1.204 +
   1.205 +
   1.206 +#endif