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 TUid AppUidL ()
TPictureCapability Capability ()
TDesC * Caption ()
void DetachFromStoreL ( TDetach )
IMPORT_C CApaDocument * DocumentL ( TBool )
void Draw ( CGraphicsContext &, const TPoint &, const TRect &, MGraphicsDeviceMap *)
void GetCropInTwips ( TMargins &)
void GetOriginalSizeInTwips ( 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 void RestoreL (const CStreamStore &, TStreamId )
TInt ScaleFactorHeight ()
TInt ScaleFactorWidth ()
void SetCropInTwips (const TMargins &)
IMPORT_C void SetFormatToGlassL ()
IMPORT_C void SetFormatToIconL ()
IMPORT_C void SetFormatToTemporaryIconL ( TBool )
void SetScaleFactor ( TInt , TInt )
TStreamId StoreL ( CStreamStore &)
Private Member Functions
CApaDoor ( RFs &, CApaProcess &)
CApaDoor ( RFs &, CApaDocument &, const TSize &)
TUid AppUidFromStreamL ()
void ConstructL ()
void CopyStoreL (const CEmbeddedStore &, RWriteStream &)
void ExternalizeL ( RWriteStream &)
void ExternalizeStateStreamL ( CStreamStore &, CStreamDictionary &)
TSize GlassDoorSize ()
void InternalizeStateStreamL (const CStreamStore &, const CStreamDictionary &, TSize )
CStreamDictionary * ReadStreamDictionaryLC (const CStreamStore &, TStreamId )
void RestoreDocL (const CPersistentStore &)
void RestoreDoorStateL (const CStreamStore &, const CStreamDictionary &)
void SetIconSizeInTwips ( TSize )
void StoreDocL ( 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 TUid AppUidL ( ) 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()

void ConstructL ( ) [private]

CopyStoreL(const CEmbeddedStore &, RWriteStream &)

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

Parameters

const CEmbeddedStore & aSourceStore
RWriteStream & aTargetStream

DetachFromStoreL(TDetach)

void DetachFromStoreL ( TDetach aDegree = EDetachFull ) [virtual]

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

CApaDocument::DetachFromStoreL()

Parameters

TDetach aDegree = EDetachFull Degree to which picture is detached.

DocumentL(TBool)

IMPORT_C CApaDocument * DocumentL ( TBool aCheckPassword = 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 = EFalse If 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 *)

void Draw ( 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 & aGc The graphics context.
const TPoint & aTopLeft The 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 & aClipRect A clipping rectangle.
MGraphicsDeviceMap * aMap The device map for the graphics device.

ExternalizeL(RWriteStream &)

void ExternalizeL ( 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 & aStream The write stream.

ExternalizeStateStreamL(CStreamStore &, CStreamDictionary &)

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

Parameters

CStreamStore & aStore
CStreamDictionary & aStreamDict

GetCropInTwips(TMargins &)

void GetCropInTwips ( 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 & aMargins The cropping margins, in twips.

GetOriginalSizeInTwips(TSize &)

void GetOriginalSizeInTwips ( TSize & aSize ) const [virtual]

Get the door's original size, in twips.

Parameters

TSize & aSize The 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)

void InternalizeStateStreamL ( const CStreamStore & aStore,
const CStreamDictionary & aStreamDict,
TSize aDefaultIconSize
) [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 & aFs A file server session.
CApaDocument & aDoc The document for which the door is to be created.
const TSize & aDefaultIconSizeInTwips The size of the door in twips.

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

IMPORT_C CApaDoor * NewL ( RFs & aFs,
const CStreamStore & aStore,
TStreamId aStreamId,
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 & aFs A file server session.
CApaDocument & aDoc The document for which the door is to be created.
const TSize & aDefaultIconSizeInTwips The size of the door in twips.

ReadStreamDictionaryLC(const CStreamStore &, TStreamId)

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

Parameters

const CStreamStore & aStore
TStreamId aStreamId

RestoreDocL(const CPersistentStore &)

void RestoreDocL ( const CPersistentStore & aStore ) [private]

Parameters

const CPersistentStore & aStore

RestoreDoorStateL(const CStreamStore &, const CStreamDictionary &)

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

Parameters

const CStreamStore & aStore
const CStreamDictionary & streamDic

RestoreL(const CStreamStore &, TStreamId)

IMPORT_C void RestoreL ( const CStreamStore & aStore,
TStreamId aHeadStreamId
)

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 & aStore The store from which the embedded document is to be restored.
TStreamId aHeadStreamId The 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 &)

void SetCropInTwips ( 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 & aMargins The cropping margins, in twips.

SetFormatToGlassL()

IMPORT_C void SetFormatToGlassL ( )

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 void SetFormatToIconL ( )

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 void SetFormatToTemporaryIconL ( TBool aEnabled = 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 = ETrue If 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)

void SetIconSizeInTwips ( TSize aSize ) [private]

Parameters

TSize aSize

SetScaleFactor(TInt, TInt)

void SetScaleFactor ( TInt aScaleFactorWidth,
TInt aScaleFactorHeight
) [virtual]

Sets the door's scale factors.

Parameters

TInt aScaleFactorWidth The width scale factor, in percent.
TInt aScaleFactorHeight The height scale factor, in percent.

StoreDocL(CPersistentStore &)

void StoreDocL ( 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 & aStore The 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]