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