epoc32/include/mw/eikdoc.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@2
    14
//
williamr@2
    15
williamr@2
    16
#ifndef __EIKDOC_H__
williamr@2
    17
#define __EIKDOC_H__
williamr@2
    18
williamr@2
    19
#include <apparc.h>
williamr@2
    20
#include <savenotf.h>
williamr@2
    21
williamr@4
    22
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
williamr@4
    23
#include <uikon/eikdefaulticondefs.h>
williamr@4
    24
#endif
williamr@4
    25
williamr@2
    26
class CEikAppUi;
williamr@2
    27
class CEikApplication;
williamr@2
    28
class CApaWindowGroupName;
williamr@2
    29
williamr@2
    30
williamr@2
    31
/** The base class for all GUI applications' documents. 
williamr@2
    32
williamr@2
    33
In file-based applications, the document represents the data that relates to a 
williamr@2
    34
particular instance of the application, and should handle storing and restoring 
williamr@2
    35
it. In all applications, whether file-based or not, the document is used to create 
williamr@2
    36
the application UI. 
williamr@2
    37
williamr@2
    38
A class derived from CEikDocument must be defined by each GUI application, and minimally 
williamr@2
    39
it must implement CreateAppUiL(). Note that UIs may implement their own document base class, 
williamr@2
    40
derived from CEikDocument, which applications may need to derive from instead. 
williamr@2
    41
williamr@2
    42
The document is created by the application's CreateDocumentL() function.
williamr@2
    43
williamr@2
    44
@publishedAll
williamr@2
    45
@released 
williamr@2
    46
@see CEikApplication::CreateDocumentL()
williamr@2
    47
@see CEikAppUi */
williamr@2
    48
class CEikDocument : public CApaDocument, public MSaveObserver
williamr@2
    49
	{
williamr@2
    50
public: // new functions
williamr@2
    51
	/** Constructs the application UI.
williamr@2
    52
	
williamr@2
    53
	This function is called by the UI framework during application start-up. It should 
williamr@2
    54
	only carry out first phase construction of the app UI, in other words, using new(ELeave). 
williamr@2
    55
	It should not call the app UI's ConstructL(), because the UI framework is responsible 
williamr@2
    56
	for this. Note also that the UI framework takes ownership of the app UI, so the 
williamr@2
    57
	document does not need to destroy it.
williamr@2
    58
williamr@2
    59
	@return A partially-constructed app UI object. */
williamr@2
    60
	virtual CEikAppUi* CreateAppUiL()=0;
williamr@2
    61
	IMPORT_C virtual CFileStore* OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs);
williamr@2
    62
	IMPORT_C void PrepareToEditL(MApaEmbeddedDocObserver* aObserver,TBool aReadOnly);
williamr@2
    63
	IMPORT_C void PrepareToEditL();
williamr@2
    64
	IMPORT_C void SetAppFileMode(TUint aMode);
williamr@2
    65
	IMPORT_C TUint AppFileMode() const;
williamr@2
    66
	IMPORT_C virtual void UpdateTaskNameL(CApaWindowGroupName* aWgName);
williamr@2
    67
	IMPORT_C const TApaAppCaption& AppCaption() const;
williamr@2
    68
	IMPORT_C void SetChanged(TBool aHasChanged);
williamr@2
    69
	IMPORT_C void SetEditStoreL(CStreamStore* aStore);
williamr@2
    70
	void SetEditStoreWithoutAppUiNotificationL(CStreamStore* aStore);
williamr@2
    71
	inline CStreamStore* EditStore() const;
williamr@2
    72
	IMPORT_C ~CEikDocument();
williamr@2
    73
public: // from MSaveObserver
williamr@2
    74
	IMPORT_C virtual void SaveL(MSaveObserver::TSaveType aSaveType);
williamr@2
    75
public: // from CApaDocument
williamr@2
    76
	IMPORT_C void NewDocumentL();
williamr@2
    77
	IMPORT_C CFileStore* CreateFileStoreLC(RFs& aFs,const TDesC& aFileName);
williamr@2
    78
	IMPORT_C void EditL(MApaEmbeddedDocObserver* aObserver,TBool aReadOnly=EFalse);
williamr@2
    79
	IMPORT_C void PrintL(const CStreamStore& aSourceStore);
williamr@2
    80
	IMPORT_C void SaveL();
williamr@2
    81
	IMPORT_C void StoreL(CStreamStore& aStore,CStreamDictionary& aStreamDic) const;
williamr@2
    82
	IMPORT_C void RestoreL(const CStreamStore& aStore,const CStreamDictionary& aStreamDic);
williamr@2
    83
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
williamr@2
    84
	IMPORT_C TBool IsEmpty() const;
williamr@2
    85
	IMPORT_C TBool HasChanged() const;
williamr@2
    86
	IMPORT_C virtual void ValidatePasswordL() const; // return EFalse if there *is* a password *and* the user doesn't get it right, ETrue otherwise (ie they get it right or there isn't one). Returns ETrue by default
williamr@2
    87
protected:
williamr@2
    88
	IMPORT_C CEikDocument();
williamr@2
    89
	IMPORT_C CEikDocument(CEikApplication& aApp);
williamr@2
    90
public:
williamr@2
    91
	IMPORT_C virtual void OpenFileL(CFileStore*& aFileStore, RFile& aFile);
williamr@2
    92
private:
williamr@2
    93
	void NullAppUi();
williamr@2
    94
	// reserved functions from CApaDocument
williamr@2
    95
	IMPORT_C virtual void Reserved_2();
williamr@2
    96
protected:
williamr@2
    97
	/** A pointer to the app UI which the document is associated with. */
williamr@2
    98
	CEikAppUi* iAppUi;
williamr@2
    99
	/** A pointer to the file store object which is used to edit the document. */
williamr@2
   100
	CStreamStore* iEditStore;
williamr@2
   101
private:
williamr@2
   102
	TBool iChanged;
williamr@2
   103
	TUint iAppFileMode;
williamr@2
   104
	friend class CEikAppUi;
williamr@2
   105
	};
williamr@2
   106
williamr@2
   107
/** A pointer to the application process associated with this document.
williamr@2
   108
williamr@2
   109
@publishedAll
williamr@2
   110
@released */
williamr@2
   111
#define iEikProcess ((CEikProcess*)Process())
williamr@2
   112
williamr@2
   113
/** A pointer to the application that created this document.
williamr@2
   114
williamr@2
   115
@publishedAll
williamr@2
   116
@released */
williamr@2
   117
#define iEikApplication ((CEikApplication*)Application())
williamr@2
   118
williamr@2
   119
/** Gets the file store object which is used to edit the document.
williamr@2
   120
williamr@2
   121
@return A pointer to the file store object which is used to edit the document. */
williamr@2
   122
inline CStreamStore* CEikDocument::EditStore() const
williamr@2
   123
	{ return(iEditStore); }
williamr@2
   124
williamr@2
   125
#endif	// __EIKDOC_H__
williamr@4
   126