Location:
eikdoc.h
Link against: eikcore.lib
CEikDocument
Supported from 6.0
The base for all Uikon applications’ documents. A class
derived from CEikDocument
is used in each Uikon application. In
file-based applications, the document provides an intermediate layer between
the user interface, the model and the file the model will be stored in.
Non-file-based applications will only use a document to create the application
UI.
Each Uikon application should use a class derived from
CEikDocument
to represent its document. The derived class must
implement at least CreateAppUiL()
.
|
Defined in CEikDocument
:
AppCaption()
, AppFileMode()
, CEikDocument()
, CreateAppUiL()
, CreateFileStoreLC()
, EditL()
, EditStore()
, ExternalizeL()
, HasChanged()
, IsEmpty()
, NewDocumentL()
, OpenFileL()
, PrepareToEditL()
, PrintL()
, RestoreL()
, SaveL()
, SetAppFileMode()
, SetChanged()
, SetEditStoreL()
, StoreL()
, UpdateTaskNameL()
, iAppUi
, iEditStore
, ~CEikDocument()
Inherited from CApaDocument
:
Application()
,
Capability()
,
DetachFromStoreL()
,
GlassPictureL()
,
Process()
,
TCapability
,
ValidatePasswordL()
Inherited from CBase
:
operator new()
protected: CEikDocument(CEikApplication& aApp);
Default constructor
Allocates a new CEikDocument
and initialises its
references to its associated application and managing process.
|
~CEikDocument();
Destructor.
Releases any resources and storage acquired during this object’s construction phases.
The document object in a Uikon application framework is responsible for creating the application’s UI.
virtual CEikAppUi* CreateAppUiL() = 0;
Allocates the application UI.
Called by the application framework to create an instance of an application UI for this document and its associated application. The object returned is owned by the Uikon framework, and should not be deleted before the application terminates.
|
virtual CFileStore* OpenFileL(TBool aDoOpen, const TDesC& aFilename,RFs& aFs);
Called by the Uikon framework to open a file. If
aDoOpen
is ETrue
, this function attempts to open a
file for exclusive writes (EFileShareExclusive|EFileWrite
);
failing that, the function attempts to open the file for exclusive reads
(EFileRead|EFileShareReadersOnly
). If the file cannot be opened at
all when aDoOpen
is ETrue
, this function
Leave()
s.
If aDoOpen
is EFalse
, this function
attempts to create and open a new file for exclusive writes.
|
|
void NewDocumentL();
Called by the framework to initialise a new default document file. This occurs when the application is started without a file, and there is no existing default document file in the file system.
This function should set the document model and the default document to some default settings (for example, a default template file).
CFileStore* CreateFileStoreLC(RFs& aFs,const TDesC& aFileName);
Creates a new file store for a file. Creates a new file or
overwrites an existing one as necessary. A StoreL()
is performed
immediately.
|
|
TBool HasChanged() const;
Gets this document’s document-changed flag.
|
void SetChanged(TBool aHasChanged);
Sets this document’s document-changed flag.
|
TBool IsEmpty() const;
Tests whether this document contains any content. As the Uikon
implementation of this function simply returns ETrue
, any
applications which use documents to represent and store data should override
it.
This function is declared as virtual
in
CApaDocument
.
|
const TApaAppCaption& AppCaption() const;
Gets the associated application’s caption.
|
virtual void UpdateTaskNameL(CApaWindowGroupName* aWgName);
Updates the task name.
|
TUint AppFileMode() const;
Gets the file mode.
|
void SetAppFileMode(TUint aMode);
Sets the file mode
|
void SaveL();
Saves this document to its current direct file store. Marks the document as not having changed. This function is called by the framework when an application exits: the current state of the application’s document is saved to the currently opened file, and the application can then exit cleanly.
This function is declared virtual
in
CApaDocument
, and therefore may be overridden to provide custom
behaviour.
void StoreL(CStreamStore& aStore, CStreamDictionary& aStreamDic) const;
Stores the document’s content and state, recording the
identity of any headstreams created. The stream store to which data is saved,
aStore
, must be fully constructed before StoreL()
is
called.
The Uikon implementation of this function is empty. Applications that wish to persist any data must provide their own version.
|
void RestoreL(const CStreamStore& aStore, const CStreamDictionary& aStreamDic);
Restores this document from a stream store.
Sets the document’s state and content. Any existing data in the document will belost.
The Uikon implementation of this function is empty. Applications that wish to load any persisted data must provide their own version.
|
|
void ExternalizeL(RWriteStream& aStream) const;
Externalise.
The Uikon implementation of this function is blank, and it is never called by the framework.
|
void PrintL(const CStreamStore& aSourceStore);
Prints a document without opening it for editing first. It would typically be called from a shell or file manager application that wanted to print the document without opening it fully.
This function is empty. Applications that want to support printing should override this with a function that uses default print parameters.
|
void EditL(MApaEmbeddedDocObserver* aObserver,TBool aReadOnly=EFalse);
Starts an editing session on an embedded document. This causes the application’s UI to be created, and the document is fully restored for editing or viewing.
|
void PrepareToEditL(MApaEmbeddedDocObserver* aObserver, TBool aReadOnly);
Prepares an embedded document for editing.
|
void PrepareToEditL();
Prepares this document for editing by the user
An alias for PrepareToEditL(NULL, NULL)
;
CStreamStore* EditStore() const;
Gets the edit store.
|
void SetEditStoreL(CStreamStore* aStore);
Sets the edit store to aStore
.
|
CEikAppUi* iAppUi
Pointer to the application UI through which the user manipulates this document’s data.
CStreamStore* iEditStore
Pointer to the stream store set as the edit store.