Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: apparc.h
Link against: apparc.lib

Class CApaDocument

class CApaDocument : public CBase;

Description

Defines basic behaviour for documents.

This is the base class for all documents. A document contains the data associated with the application's content.

The class is derived from by the UI framework and is further derived from by the UI application.

Derivation

Members

Defined in CApaDocument:
Application(), CApaDocument(), CApaDocument(), Capability(), CreateFileStoreLC(), DetachFromStoreL(), EditL(), ExternalizeL(), GlassPictureL(), HasChanged(), IsEmpty(), NewDocumentL(), OpenFileL(), PrintL(), Process(), Reserved_2(), RestoreL(), SaveL(), StoreL(), TCapability, ValidatePasswordL(), iContainer, ~CApaDocument()

Inherited from CBase:
Delete(), Extension_(), operator new()


Construction and destruction


~CApaDocument()

virtual IMPORT_C ~CApaDocument();

Description

Destructor.

The implementation is empty.


CApaDocument()

protected: IMPORT_C CApaDocument();

Description

Constructor for CApaDocument


CApaDocument()

protected: IMPORT_C CApaDocument(CApaApplication &aApp, CApaProcess &aProcess);

Description

Constructs the document object with the specified application and process.

Derived classes must define and implement a constructor through which both the associated application and process can be specified. A typical implementation calls this constructor through a constructor initialization list.

Parameters

CApaApplication &aApp

The application.

CApaProcess &aProcess

The process.

[Top]


Member functions


NewDocumentL()

virtual void NewDocumentL()=0;

Description

Initialises a new, empty, document with a default setup.

This can be the main document or an embedded document. The function is called by the UI framework when it creates a default document file.

An implementation of this function must be supplied by the UI application.

If initialisation fails, the document must be left in the same state as it was before the function was called.


CreateFileStoreLC()

virtual CFileStore *CreateFileStoreLC(RFs &aFs, const TDesC &aFileName)=0;

Description

Creates and fully initialises a new filestore and stores the document into it, replacing any existing file of the same name.

The function should put the pointer to the filestore object onto the cleanup stack.

An implementation of this function is supplied by the UI framework.

Parameters

RFs &aFs

Handle to a file server session.

const TDesC &aFileName

The full path name of the file to be created.

Return value

CFileStore *

A pointer to the newly constructed file store.


GlassPictureL()

virtual IMPORT_C CPicture *GlassPictureL();

Description

Gets an object that can draw a representation of the document's content.

If the document supports being embedded as a glass door, then the UI application must provide an implementation for this function.

The default implementation raises an APPARC 8 panic.

Return value

CPicture *

A pointer to a glass door.


EditL()

virtual void EditL(MApaEmbeddedDocObserver *aContainer, TBool aReadOnly=EFalse)=0;

Description

Starts an editing session on an embedded document.

The function should cause the application's UI to be created and the document to be fully restored for editing.

An implementation of this function is supplied by the UI framework.

Parameters

MApaEmbeddedDocObserver *aContainer

This document's observer.

TBool aReadOnly

True, the document should be opened in read-only mode and should not persist any changes made to the content. False, the document can be opened in read/write mode; this is the default.


PrintL()

virtual void PrintL(const CStreamStore &aSourceStore)=0;

Description

Prints the document without a need for it to be open for editing.

Typically, this is called from a shell or a file manager type application that wants to print the document without opening it fully.

An empty implementation of this function is supplied by the UI framework.

The UI application can provide its own implementation.

Parameters

const CStreamStore &aSourceStore

A reference to the store containing the document.


SaveL()

virtual void SaveL()=0;

Description

Stores the document to the current file, commits the changes, and marks the document status as unchanged.

Typically, the function is called by the application when it implements a "Save" type menu option in its User Interface.

An implementation of this function is supplied by the UI framework. This is adequate for direct file store applications. Applications using a permanent file store model, need to provide their own implementation.

If the function leaves, an implementation should ensure that any changes made to the file are rolled back, leaving the file in the state it was in before the function was called.


StoreL()

virtual void StoreL(CStreamStore &aStore, CStreamDictionary &aStreamDic) const=0;

Description

Stores the document's content and state to the specified store, recording the identity of any headstreams created in the specified stream dictionary.

The store must be fully constructed before this function is called.

An empty implementation of this function is supplied by the UI framework. UI applications that need to persist any data must provide their own implementation.

If the function leaves, an implementation should ensure that the store and the stream dictionary are returned to the state they were in before the function was called.

Parameters

CStreamStore &aStore

The store into which document data is to be stored.

CStreamDictionary &aStreamDic

The stream dictionary into which stream IDs and associated UIDs are to be recorded.


RestoreL()

virtual void RestoreL(const CStreamStore &aStore, const CStreamDictionary &aStreamDic)=0;

Description

Restores the document's content and state from data persisted in the specified store.

An empty implementation of this function is supplied by the UI framework. UI applications that need to restore data must provide their own implementation.

If the function leaves, an implementation should ensure that the store and the stream dictionary are returned to the state they were in before the function was called.

Parameters

const CStreamStore &aStore

The store from which document data is to be restored.

const CStreamDictionary &aStreamDic

The stream dictionary containing stream IDs and associated UIDs.


DetachFromStoreL()

inline virtual void DetachFromStoreL(CPicture::TDetach=CPicture::EDetachFull);

Description

Restores the document to the extent that it does not need the store further.

A document only keeps a pointer to a store if it implements deferred loading. This also tells the document that any store pointer that it might have is just about to become invalid.

An empty implementation of this function is supplied by the UI framework. UI applications that support deferred loading or embedding should provide an implementation.

If a document supports embedding, then it should propagate the DetachFromStoreL() call on to all embedded objects that it contains.

If the function leaves, the operation should be aborted because the document has not successfully detached from the store. Continuing with the operation may leave the document in an unsafe state or cause user data to be lost.

Parameters

CPicture::TDetach


ExternalizeL()

virtual IMPORT_C void ExternalizeL(RWriteStream &aStream) const;

Description

Parameters

RWriteStream &aStream


IsEmpty()

virtual TBool IsEmpty() const=0;

Description

Tests whether the document is empty.

The UI framework provides a default implementation which always returns a true value.

The UI application can provide its own implementation. Typically, any application that has editable content should supply an implementation that acts according to the state of that content. Applications without associated document data need not supply an implementation.

Return value

TBool

True if the document is empty, false otherwise.


ValidatePasswordL()

virtual IMPORT_C void ValidatePasswordL() const;

Description

Checks the document password.

The default implementation is empty.

If a document is intended to be password protected, the UI application should provide an implementation that forces the user to enter the password and validate the input.

If the document is protected by a password and the password entered by the user is incorrect, the function should leave with KErrLocked, otherwise it should just return.


Capability()

virtual IMPORT_C TCapability Capability() const;

Description

Gets the document's capabilities.

Capabilities are encapsulated by an instance of a TCapability class, a public class defined inside this class.

The default implementation returns a default TCapability object, indicating that the document does not support any of the defined capabilities.

If a document does support one or more of the capabilities, it should override this function to return a suitably initialised object.

Return value

TCapability

The document's capabilities


Application()

inline CApaApplication *Application() const;

Description

Returns a pointer to the application that created the document.

Return value

CApaApplication *

A pointer to the document's associated application.


Process()

inline CApaProcess *Process() const;

Description

Returns a pointer to the application process associated with this document.

Return value

CApaProcess *

A pointer to the application process associated with this document.


HasChanged()

virtual TBool HasChanged() const=0;

Description

Tests whether the document has changed since it was last persisted.

An implementation of this function is supplied by the UI framework and need not be changed by the UI application.

Return value

TBool

True, if the document has changed since the last time that it was persisted, false, otherwise.


OpenFileL()

private: virtual IMPORT_C void OpenFileL(CFileStore *&aFileStore, RFile &aFile);

Description

Parameters

CFileStore *&aFileStore

RFile &aFile


Reserved_2()

private: virtual IMPORT_C void Reserved_2();

Description

[Top]


Member classes


Class TCapability

class TCapability;

Description

CApaDocument capabilities.

Members

Defined in CApaDocument::TCapability:
CanDrawGlass(), CanPrint(), SetCanDrawGlass(), SetCanPrint(), TCapability()

Construction and destruction


TCapability()

IMPORT_C TCapability();

Description

Constructs a default capability object.

All capabilities are marked as "not supported".

Member functions


CanDrawGlass()

inline TBool CanDrawGlass() const;

Description

Tests whether the document supports being embedded as a glass door.

Return value

TBool

True if embedding as a glass door is supported; false otherwise.


CanPrint()

inline TBool CanPrint() const;

Description

Tests whether the document supports being printed without using the full application UI.

Return value

TBool

True, if printing is supported; false, otherwise.


SetCanDrawGlass()

inline void SetCanDrawGlass();

Description

Sets the document as being capable of being embedded as a glass door.


SetCanPrint()

inline void SetCanPrint();

Description

Sets the document as being capable of being printed without using the full application UI.

[Top]


Member data


iContainer

protected: MApaEmbeddedDocObserver * iContainer;

Description