CApaDoor Class Reference

class CApaDoor : public CApaDoorBase

A wrapper for an embedded document that can be displayed in a user interface as an icon or a glass door.

Inherits from

Public Member Functions
~CApaDoor()
IMPORT_C TUidAppUidL()
TPictureCapability Capability()
TDesC *Caption()
voidDetachFromStoreL(TDetach)
IMPORT_C CApaDocument *DocumentL(TBool)
voidDraw(CGraphicsContext &, const TPoint &, const TRect &, MGraphicsDeviceMap *)
voidGetCropInTwips(TMargins &)
voidGetOriginalSizeInTwips(TSize &)
IMPORT_C CApaDoor *NewL(RFs &, CApaDocument &, const TSize &)
IMPORT_C CApaDoor *NewL(RFs &, const CStreamStore &, TStreamId, CApaProcess &)
IMPORT_C CApaDoor *NewLC(RFs &, CApaDocument &, const TSize &)
IMPORT_C voidRestoreL(const CStreamStore &, TStreamId)
TInt ScaleFactorHeight()
TInt ScaleFactorWidth()
voidSetCropInTwips(const TMargins &)
IMPORT_C voidSetFormatToGlassL()
IMPORT_C voidSetFormatToIconL()
IMPORT_C voidSetFormatToTemporaryIconL(TBool)
voidSetScaleFactor(TInt, TInt)
TStreamId StoreL(CStreamStore &)
Private Member Functions
CApaDoor(RFs &, CApaProcess &)
CApaDoor(RFs &, CApaDocument &, const TSize &)
TUid AppUidFromStreamL()
voidConstructL()
voidCopyStoreL(const CEmbeddedStore &, RWriteStream &)
voidExternalizeL(RWriteStream &)
voidExternalizeStateStreamL(CStreamStore &, CStreamDictionary &)
TSize GlassDoorSize()
voidInternalizeStateStreamL(const CStreamStore &, const CStreamDictionary &, TSize)
CStreamDictionary *ReadStreamDictionaryLC(const CStreamStore &, TStreamId)
voidRestoreDocL(const CPersistentStore &)
voidRestoreDoorStateL(const CStreamStore &, const CStreamDictionary &)
voidSetIconSizeInTwips(TSize)
voidStoreDocL(CPersistentStore &)
Inherited Functions
CApaDoorBase::CApaDoorBase()
CApaDoorBase::ExternalizeBaseStreamL(CStreamStore &,CStreamDictionary &)const
CApaDoorBase::Format()const
CApaDoorBase::InternalizeBaseStreamL(const CStreamStore &,const CStreamDictionary &)
CApaDoorBase::LineBreakPossible(TUint,TBool,TBool)const
CApaDoorBase::NativePixelSize(TSize &)
CApaDoorBase::SetSource(TUid)
CApaDoorBase::Source()const
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
CPicture::AddCropInPixels(MGraphicsDeviceMap *,const TMargins &)
CPicture::CPicture()
CPicture::GetSizeInPixels(MGraphicsDeviceMap *,TSize &)const
CPicture::GetSizeInTwips(TSize &)const
CPicture::ResetToOriginal()
CPicture::SetSizeInPixels(MGraphicsDeviceMap *,const TSize &)
CPicture::SetSizeInTwips(const TSize &)
CPicture::~CPicture()
Inherited Enumerations
CApaDoorBase:TFormat
CPicture:TDetach
Private Attributes
CApaDocument *iApaDoc
CApaProcess *iApaProcess
HBufC *iAppCaption
RFs &iFs
TSize iIconSizeInTwips
CPicture *iPicture
CEmbeddedStore *iStore
CBufSeg *iStoreHost
Inherited Attributes
CApaDoorBase::iFormat
CApaDoorBase::iSource

Constructor & Destructor Documentation

CApaDoor(RFs &, CApaProcess &)

CApaDoor(RFs &aFs,
CApaProcess &aProcess
)[private]

Parameters

RFs & aFs
CApaProcess & aProcess

CApaDoor(RFs &, CApaDocument &, const TSize &)

CApaDoor(RFs &aFs,
CApaDocument &aDoc,
const TSize &aDefaultIconSizeInTwips
)[private]

Parameters

RFs & aFs
CApaDocument & aDoc
const TSize & aDefaultIconSizeInTwips

~CApaDoor()

IMPORT_C~CApaDoor()

Destructor.

Frees all resources owned by the object, prior to its destruction. In particular, it destroys the document, removing all references to it from the application process.

Member Functions Documentation

AppUidFromStreamL()

TUid AppUidFromStreamL()const [private]

AppUidL()

IMPORT_C TUidAppUidL()const

Gets the application specific UID associated with the embedded document.

Capability()

TPictureCapability Capability()const [virtual]

Gets the picture's capabilities.

These include whether it is scalable and croppable.

Caption()

TDesC *Caption()const [inline]

Gets the name of the application with which the embedded document is associated.

ConstructL()

voidConstructL()[private]

CopyStoreL(const CEmbeddedStore &, RWriteStream &)

voidCopyStoreL(const CEmbeddedStore &aSourceStore,
RWriteStream &aTargetStream
)[private, static]

Parameters

const CEmbeddedStore & aSourceStore
RWriteStream & aTargetStream

DetachFromStoreL(TDetach)

voidDetachFromStoreL(TDetachaDegree = EDetachFull)[virtual]

Detaches the door from its store, restoring any unrestored elements of the picture, if necessary.

CApaDocument::DetachFromStoreL()

Parameters

TDetach aDegree = EDetachFullDegree to which picture is detached.

DocumentL(TBool)

IMPORT_C CApaDocument *DocumentL(TBoolaCheckPassword = EFalse)

Returns a pointer to the embedded document represented by this wrapper.

If necessary, the document is restored from its embedded store.

Note that if the wrapper does not have a reference to the embedded document store, then the function raises a APGRFX 13 panic. Constructing this wrapper through a TApaPictureFactory or storing the embedded document through CApaDoor::StoreL() ensures that this wrapper has a reference to the embedded document store.

TApaPictureFactory CApaDoor::StoreL() CApaDocument::ValidatePasswordL()

Parameters

TBool aCheckPassword = EFalseIf ETrue, any password is checked before returning a pointer to the document. If EFalse, the password is not checked.

Draw(CGraphicsContext &, const TPoint &, const TRect &, MGraphicsDeviceMap *)

voidDraw(CGraphicsContext &aGc,
const TPoint &aTopLeft,
const TRect &aClipRect,
MGraphicsDeviceMap *aMap
)const [virtual]

Draws the door either as glass or as an icon depending on the format.

Parameters

CGraphicsContext & aGcThe graphics context.
const TPoint & aTopLeftThe co-ordinates where the top left corner pixel of the picture should be placed. Note that whether this is actually drawn depends on the clipping area defined.
const TRect & aClipRectA clipping rectangle.
MGraphicsDeviceMap * aMapThe device map for the graphics device.

ExternalizeL(RWriteStream &)

voidExternalizeL(RWriteStream &aStream)const [private, virtual]

Externalises the picture to a stream.

The presence of this function means that the standard templated stream operator<<() is available to externalise objects of this class.

A derived class must supply an implementation of this function.

Parameters

RWriteStream & aStreamThe write stream.

ExternalizeStateStreamL(CStreamStore &, CStreamDictionary &)

voidExternalizeStateStreamL(CStreamStore &aStore,
CStreamDictionary &aStreamDict
)const [private]

Parameters

CStreamStore & aStore
CStreamDictionary & aStreamDict

GetCropInTwips(TMargins &)

voidGetCropInTwips(TMargins &aMargins)const [virtual]

Gets the cropping margins of the door in twips.

These margins are relative to the original unscaled size of the picture.

Parameters

TMargins & aMarginsThe cropping margins, in twips.

GetOriginalSizeInTwips(TSize &)

voidGetOriginalSizeInTwips(TSize &aSize)const [virtual]

Get the door's original size, in twips.

Parameters

TSize & aSizeThe size, in twips.

GlassDoorSize()

TSize GlassDoorSize()const [private, virtual]

Returns the size of the glass door, in twips.

A concrete implementation of this function is provided by derived classes.

InternalizeStateStreamL(const CStreamStore &, const CStreamDictionary &, TSize)

voidInternalizeStateStreamL(const CStreamStore &aStore,
const CStreamDictionary &aStreamDict,
TSizeaDefaultIconSize
)[private]

Parameters

const CStreamStore & aStore
const CStreamDictionary & aStreamDict
TSize aDefaultIconSize

NewL(RFs &, CApaDocument &, const TSize &)

IMPORT_C CApaDoor *NewL(RFs &aFs,
CApaDocument &aDoc,
const TSize &aDefaultIconSizeInTwips
)[static]

Creates a new wrapper for the specified embedded document.

The door is of the specified size. The wrapper takes ownership of the document; if creation of the wrapper fails, the document object is destroyed.

Parameters

RFs & aFsA file server session.
CApaDocument & aDocThe document for which the door is to be created.
const TSize & aDefaultIconSizeInTwipsThe size of the door in twips.

NewL(RFs &, const CStreamStore &, TStreamId, CApaProcess &)

IMPORT_C CApaDoor *NewL(RFs &aFs,
const CStreamStore &aStore,
TStreamIdaStreamId,
CApaProcess &aProcess
)[static]

Parameters

RFs & aFs
const CStreamStore & aStore
TStreamId aStreamId
CApaProcess & aProcess

NewLC(RFs &, CApaDocument &, const TSize &)

IMPORT_C CApaDoor *NewLC(RFs &aFs,
CApaDocument &aDoc,
const TSize &aDefaultIconSizeInTwips
)[static]

Creates a new wrapper for the specified embedded document and places a pointer to it onto the cleanup stack.

The door is of the specified size. The wrapper takes ownership of the document; if creation of the wrapper fails, the document object is destroyed.

Parameters

RFs & aFsA file server session.
CApaDocument & aDocThe document for which the door is to be created.
const TSize & aDefaultIconSizeInTwipsThe size of the door in twips.

ReadStreamDictionaryLC(const CStreamStore &, TStreamId)

CStreamDictionary *ReadStreamDictionaryLC(const CStreamStore &aStore,
TStreamIdaStreamId
)[private, static]

Parameters

const CStreamStore & aStore
TStreamId aStreamId

RestoreDocL(const CPersistentStore &)

voidRestoreDocL(const CPersistentStore &aStore)[private]

Parameters

const CPersistentStore & aStore

RestoreDoorStateL(const CStreamStore &, const CStreamDictionary &)

voidRestoreDoorStateL(const CStreamStore &aStore,
const CStreamDictionary &streamDic
)[private]

Parameters

const CStreamStore & aStore
const CStreamDictionary & streamDic

RestoreL(const CStreamStore &, TStreamId)

IMPORT_C voidRestoreL(const CStreamStore &aStore,
TStreamIdaHeadStreamId
)

Restores the embedded document from the specified store.

The format of the door is set to iconic if the embedded document is password protected.

Parameters

const CStreamStore & aStoreThe store from which the embedded document is to be restored.
TStreamId aHeadStreamIdThe stream ID of the head stream for the embedded document. This stream contains the stream dictionary through which the embedded document and its door can be restored.

ScaleFactorHeight()

TInt ScaleFactorHeight()const [virtual]

Gets the door's height scale factor.

ScaleFactorWidth()

TInt ScaleFactorWidth()const [virtual]

Gets the door's width scale factor.

SetCropInTwips(const TMargins &)

voidSetCropInTwips(const TMargins &aMargins)[virtual]

Sets the cropping margins of a picture in twips.

These are relative to the original unscaled size of the picture.

Parameters

const TMargins & aMarginsThe cropping margins, in twips.

SetFormatToGlassL()

IMPORT_C voidSetFormatToGlassL()

Sets the format of the door to glass.

The function asks the document to create a fresh copy of the door and destroys any existing copy. If the process of creating the door completes without leaving, but returns a zero pointer, then the function raises an APGRFX 17 panic.

The function leaves with:

KErrNotSupported, if the document does not support being represented by a glass door.

KErrNotFound, if the application DLL cannot be found.

If the function leaves, the format remains unchanged.

CApaDocument::GlassPictureL()

SetFormatToIconL()

IMPORT_C voidSetFormatToIconL()

Sets the format of the door to iconic.

The application's icon is used, or, if this cannot be found, the default icon is used instead. The function leaves only if construction of the default icon object fails.

SetFormatToTemporaryIconL(TBool)

IMPORT_C voidSetFormatToTemporaryIconL(TBoolaEnabled = ETrue)

Switches the format of the door between temporarily iconic and glass.

If the door is iconic, then the function does nothing.

Parameters

TBool aEnabled = ETrueIf ETrue and the format is currently glass, then the format switches to temporarily iconic; this is the default. If EFalse and the format is currently temporarily iconic, then the format switches to glass.

SetIconSizeInTwips(TSize)

voidSetIconSizeInTwips(TSizeaSize)[private]

Parameters

TSize aSize

SetScaleFactor(TInt, TInt)

voidSetScaleFactor(TIntaScaleFactorWidth,
TIntaScaleFactorHeight
)[virtual]

Sets the door's scale factors.

Parameters

TInt aScaleFactorWidthThe width scale factor, in percent.
TInt aScaleFactorHeightThe height scale factor, in percent.

StoreDocL(CPersistentStore &)

voidStoreDocL(CPersistentStore &aStore)const [private]

Parameters

CPersistentStore & aStore

StoreL(CStreamStore &)

TStreamId StoreL(CStreamStore &aStore)const [virtual]

Stores the embedded document in the specified store as an embedded store.

This function saves the format of the door. It also stores the document, if the document exists in memory, otherwise, it simply copies the stream containing the embedded document into the specified store.

Parameters

CStreamStore & aStoreThe store into which the embedded document is to be stored.

Member Data Documentation

CApaDocument * iApaDoc

CApaDocument *iApaDoc[private]

CApaProcess * iApaProcess

CApaProcess *iApaProcess[private]

HBufC * iAppCaption

HBufC *iAppCaption[private]

RFs & iFs

RFs &iFs[private]

TSize iIconSizeInTwips

TSize iIconSizeInTwips[private]

CPicture * iPicture

CPicture *iPicture[private]

CEmbeddedStore * iStore

CEmbeddedStore *iStore[private]

CBufSeg * iStoreHost

CBufSeg *iStoreHost[private]