localisation/apparchitecture/inc/APAMDR.H
branchSymbian3
changeset 57 b8d18c84f71c
parent 6 c108117318cb
equal deleted inserted replaced
56:aa99f2208aad 57:b8d18c84f71c
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     7 //
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
       
    14 // apamdr.h
    14 //
    15 //
    15 
    16 
    16 #ifndef __APAMDR_H__
    17 #ifndef __APAMDR_H__
    17 #define __APAMDR_H__
    18 #define __APAMDR_H__
    18 
    19 
    19 #if !defined(__E32STD_H__)
       
    20 #include <e32std.h>
    20 #include <e32std.h>
    21 #endif
       
    22 #if !defined(__E32BASE_H__)
       
    23 #include <e32base.h>
    21 #include <e32base.h>
    24 #endif
       
    25 #if !defined(__GDI_H__)
       
    26 #include <gdi.h>
    22 #include <gdi.h>
    27 #endif
       
    28 #if !defined(__APADBASE_H__)
       
    29 #include <apadbase.h>
    23 #include <apadbase.h>
    30 #endif
       
    31 
    24 
    32 // classes defined:
       
    33 class TApaModelDoorFactory;
       
    34 class CApaModelDoor;
       
    35 class CApaModelHeader;
       
    36 class MApaModelHeaderFactory;
       
    37 //
       
    38 // classes referenced:
       
    39 class RReadStream;
    25 class RReadStream;
    40 class RWriteStream;
    26 class RWriteStream;
    41 class CStreamStore;
    27 class CStreamStore;
    42 class CStreamDictionary;
    28 class CStreamDictionary;
    43 class CEmbeddedStore;
    29 class CEmbeddedStore;
    44 class TApaAppIdentifier;
    30 class TApaAppIdentifier;
    45 //
    31 class MApaModelHeaderFactory;
       
    32 class CApaModelHeader;
    46 
    33 
    47 
    34 
    48 class TApaModelDoorFactory : public MPictureFactory
       
    49 // Recognizes KUidPictureTypeDoor and creates CApaModelDoor pictures
       
    50 /** A factory class for instantiating and restoring an application's door using 
    35 /** A factory class for instantiating and restoring an application's door using 
    51 the application's model. 
    36 the application's model. 
    52 
    37 
    53 @publishedAll 
    38 @publishedAll 
    54 @released */
    39 @released */
       
    40 class TApaModelDoorFactory : public MPictureFactory
       
    41 // Recognizes KUidPictureTypeDoor and creates CApaModelDoor pictures
    55 	{
    42 	{
    56 public:
    43 public:
    57 	IMPORT_C TApaModelDoorFactory(const MApaModelHeaderFactory* aFactory);
    44 	IMPORT_C TApaModelDoorFactory(const MApaModelHeaderFactory* aFactory);
    58 	//
    45 public:	// from MPictureFactory
    59 	// from MPictureFactory
    46 	IMPORT_C void NewPictureL(TPictureHeader& aPictureHeader, const CStreamStore& aPictureStore) const; // used to create CApaDoor's during document restore only 
    60 	IMPORT_C void NewPictureL(TPictureHeader& aPictureHeader,const CStreamStore& aPictureStore)const; // used to create CApaDoor's during document restore only 
       
    61 private:
    47 private:
    62 	const MApaModelHeaderFactory* iHeaderFactory;
    48 	const MApaModelHeaderFactory* iHeaderFactory;
    63 	TInt iTApaModelDoorFactory_Reserved1;
    49 	TInt iTApaModelDoorFactory_Reserved1;
    64 	};
    50 	};
    65 
    51 
    66 
    52 
    67 class CApaModelDoor : public CApaDoorBase
       
    68 /** A persistent representation of a door that also acts as a wrapper around an 
    53 /** A persistent representation of a door that also acts as a wrapper around an 
    69 application's model.
    54 application's model.
    70 
    55 
    71 The class allows embedded data to be manipulated without requiring the whole 
    56 The class allows embedded data to be manipulated without requiring the whole 
    72 associated application. 
    57 associated application. 
    73 
    58 
    74 @publishedAll 
    59 @publishedAll 
    75 @released */
    60 @released */
       
    61 class CApaModelDoor : public CApaDoorBase
    76 	{
    62 	{
    77 public:
    63 public:
    78 	IMPORT_C static CApaModelDoor* NewL(CApaModelHeader* aHeader);
    64 	IMPORT_C static CApaModelDoor* NewL(CApaModelHeader* aHeader);
    79 	IMPORT_C static CApaModelDoor* NewLC(CApaModelHeader* aHeader);
    65 	IMPORT_C static CApaModelDoor* NewLC(CApaModelHeader* aHeader);
    80 	IMPORT_C static CApaModelDoor* NewL(const CStreamStore& aStore,TStreamId aHeadStreamId,const MApaModelHeaderFactory* aFactory);
    66 	IMPORT_C static CApaModelDoor* NewL(const CStreamStore& aStore, TStreamId aHeadStreamId, const MApaModelHeaderFactory* aFactory);
    81 	//
    67 
    82 	/** Gets the application model wrapper object.
    68 	/** Gets the application model wrapper object.
    83 	
    69 	
    84 	@return A pointer to the application model wrapper object. */
    70 	@return A pointer to the application model wrapper object. */
    85 	inline CApaModelHeader* ModelHeader() { return iModelHeader; }
    71 	inline CApaModelHeader* ModelHeader() { return iModelHeader; }
    86 	
    72 	
    87 	/** Sets the format of the door.
    73 	/** Sets the format of the door.
    88 	
    74 	
    89 	@param aFormat The format for the graphical representation of the embedded 
    75 	@param aFormat The format for the graphical representation of the embedded 
    90 	document. */
    76 	document. */
    91 	inline void SetFormat(TFormat aFormat) { iFormat = aFormat; }
    77 	inline void SetFormat(TFormat aFormat) { iFormat = aFormat; }
    92 	//
       
    93 	IMPORT_C TStreamId StoreL(CStreamStore& aStore) const;
    78 	IMPORT_C TStreamId StoreL(CStreamStore& aStore) const;
    94 	IMPORT_C void RestoreL(const CStreamStore& aStore,TStreamId aHeadStreamId,const MApaModelHeaderFactory* aFactory);
    79 	IMPORT_C void RestoreL(const CStreamStore& aStore,TStreamId aHeadStreamId,const MApaModelHeaderFactory* aFactory);
    95 	//
       
    96 	IMPORT_C ~CApaModelDoor();
    80 	IMPORT_C ~CApaModelDoor();
    97 	//
    81 public:	// from CPicture
    98 	// from CPicture
       
    99 	IMPORT_C void DetachFromStoreL(TDetach /*aDegree*/=EDetachFull); //lint !e1735 Virtual function has default parameter - Inherited from CPicture, must be fixed there
    82 	IMPORT_C void DetachFromStoreL(TDetach /*aDegree*/=EDetachFull); //lint !e1735 Virtual function has default parameter - Inherited from CPicture, must be fixed there
   100 	IMPORT_C void ExternalizeL(RWriteStream& aStream)const;
    83 	IMPORT_C void ExternalizeL(RWriteStream& aStream)const;
   101 	IMPORT_C void Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,MGraphicsDeviceMap* aMap)const; 
    84 	IMPORT_C void Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,MGraphicsDeviceMap* aMap)const; 
   102 	IMPORT_C void GetOriginalSizeInTwips(TSize& aSize)const;
    85 	IMPORT_C void GetOriginalSizeInTwips(TSize& aSize)const;
   103 	IMPORT_C void SetScaleFactor(TInt aScaleFactorWidth,TInt aScaleFactorHeight); 
    86 	IMPORT_C void SetScaleFactor(TInt aScaleFactorWidth,TInt aScaleFactorHeight); 
   104 	IMPORT_C TInt ScaleFactorWidth()const; 
    87 	IMPORT_C TInt ScaleFactorWidth()const; 
   105 	IMPORT_C TInt ScaleFactorHeight()const;
    88 	IMPORT_C TInt ScaleFactorHeight()const;
   106 	//
       
   107 private:
    89 private:
   108 	CApaModelDoor();
    90 	CApaModelDoor();
   109 	CApaModelDoor(CApaModelHeader* aHeader);
    91 	CApaModelDoor(CApaModelHeader* aHeader);
   110 	//
       
   111 	static CStreamDictionary* ReadStreamDictionaryLC(const CStreamStore& aSourceStore,TStreamId aStreamId);
    92 	static CStreamDictionary* ReadStreamDictionaryLC(const CStreamStore& aSourceStore,TStreamId aStreamId);
   112 	static void CopyStoreL(const CEmbeddedStore& aSourceStore,RWriteStream& aTargetStream);
    93 	static void CopyStoreL(const CEmbeddedStore& aSourceStore,RWriteStream& aTargetStream);
   113 	void InternalizeModelL(const MApaModelHeaderFactory& aFactory);
    94 	void InternalizeModelL(const MApaModelHeaderFactory& aFactory);
   114 	//
    95 private: // from CApaDoorBase
   115 	// from CApaDoorBase
       
   116 	TSize GlassDoorSize()const;
    96 	TSize GlassDoorSize()const;
   117 private:
    97 private:
   118 	CApaModelHeader* iModelHeader;
    98 	CApaModelHeader* iModelHeader;
   119 	CEmbeddedStore* iStore;
    99 	CEmbeddedStore* iStore;
   120 	TSize iScaleFactor;
   100 	TSize iScaleFactor;
   121 	CBufSeg* iStoreHost; // the host for the embedded store, if the door has been detached from its originating store
   101 	CBufSeg* iStoreHost; // the host for the embedded store, if the door has been detached from its originating store
   122 	};
   102 	};
   123 
   103 
   124 
   104 
   125 class CApaModelHeader : public CBase
       
   126 // Abstract wrapper for an applications model - used for file format conversion etc
   105 // Abstract wrapper for an applications model - used for file format conversion etc
   127 /** An interface class that acts as a wrapper for an application model.
   106 /** An interface class that acts as a wrapper for an application model.
   128 
   107 
   129 This is also known as an application model header.
   108 This is also known as an application model header.
   130 
   109 
   140 @publishedAll
   119 @publishedAll
   141 @released
   120 @released
   142 @see CApaModelDoor
   121 @see CApaModelDoor
   143 @see TApaModelDoorFactory
   122 @see TApaModelDoorFactory
   144 @see MApaModelHeaderFactory */
   123 @see MApaModelHeaderFactory */
       
   124 class CApaModelHeader : public CBase
   145 	{
   125 	{
   146 public:
   126 public:
   147 	/** Stores the model and its components in the specified store.
   127 	/** Stores the model and its components in the specified store.
   148 	
   128 	
   149 	@param aStore The store in which the model's components are to be stored.
   129 	@param aStore The store in which the model's components are to be stored.
   150 	@param aDict The stream dictionary into which stream IDs and associated UIDs 
   130 	@param aDict The stream dictionary into which stream IDs and associated UIDs 
   151 	are put. */
   131 	are put. */
   152 	virtual void StoreL(CStreamStore& aStore,CStreamDictionary& aDict) const=0;
   132 	virtual void StoreL(CStreamStore& aStore, CStreamDictionary& aDict) const = 0;
   153 	/** Gets the identity of the application associated with the application model.
   133 	/** Gets the identity of the application associated with the application model.
   154 	
   134 	
   155 	@return The application identity. */
   135 	@return The application identity. */
   156 	virtual TApaAppIdentifier AppId()const=0;
   136 	virtual TApaAppIdentifier AppId() const = 0;
   157 	/** Restores the model to the specified degree.
   137 	/** Restores the model to the specified degree.
   158 	
   138 	
   159 	An implementation of this function should propagate this call to all components 
   139 	An implementation of this function should propagate this call to all components 
   160 	of the model.
   140 	of the model.
   161 	
   141 	
   162 	@param aDegree The degree to which restoration is needed. */
   142 	@param aDegree The degree to which restoration is needed. */
   163 	virtual void DetachFromStoreL(CPicture::TDetach aDegree)=0;
   143 	virtual void DetachFromStoreL(CPicture::TDetach aDegree) = 0;
   164 protected:
   144 protected:
   165 	IMPORT_C CApaModelHeader();
   145 	IMPORT_C CApaModelHeader();
   166 private:
   146 private:
   167 	IMPORT_C virtual void Reserved_1();
   147 	IMPORT_C virtual void Reserved_1();
   168 	IMPORT_C virtual void Reserved_2();
   148 	IMPORT_C virtual void Reserved_2();
   169 private:
   149 private:
   170 	TInt iCApaModelHeader_Reserved1;
   150 	TInt iCApaModelHeader_Reserved1;
   171 	};
   151 	};
       
   152 	
   172 
   153 
   173 
       
   174 
       
   175 class MApaModelHeaderFactory
       
   176 /** An interface class that applications implement to construct an application model 
   154 /** An interface class that applications implement to construct an application model 
   177 wrapper object, also known as the application model header.
   155 wrapper object, also known as the application model header.
   178 
   156 
   179 @publishedAll
   157 @publishedAll
   180 @released
   158 @released
   181 @see CApaModelHeader */
   159 @see CApaModelHeader */
       
   160 class MApaModelHeaderFactory
   182 	{
   161 	{
   183 public:	
   162 public:	
   184 	/** Creates and returns an application model wrapper object.
   163 	/** Creates and returns an application model wrapper object.
   185 	
   164 	
   186 	@param aStore The store containing model data.
   165 	@param aStore The store containing model data.
   187 	@param aDict The stream dictionary. 
   166 	@param aDict The stream dictionary. 
   188 	@param aAppId The application's identity held as a stream in the application's 
   167 	@param aAppId The application's identity held as a stream in the application's 
   189 	store
   168 	store
   190 	@return A pointer to the new application model wrapper object. */
   169 	@return A pointer to the new application model wrapper object. */
   191 	virtual CApaModelHeader* NewHeaderL(const CStreamStore& aStore,const CStreamDictionary& aDict,const TApaAppIdentifier& aAppId)const=0;
   170 	virtual CApaModelHeader* NewHeaderL(const CStreamStore& aStore, const CStreamDictionary& aDict, const TApaAppIdentifier& aAppId) const = 0;
   192 protected:
   171 protected:
   193 	IMPORT_C MApaModelHeaderFactory();
   172 	IMPORT_C MApaModelHeaderFactory();
   194 private:
   173 private:
   195 	IMPORT_C virtual void MApaModelHeaderFactory_Reserved1();
   174 	IMPORT_C virtual void MApaModelHeaderFactory_Reserved1();
   196 	IMPORT_C virtual void MApaModelHeaderFactory_Reserved2();
   175 	IMPORT_C virtual void MApaModelHeaderFactory_Reserved2();