epoc32/include/eikdoc.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __EIKDOC_H__
    17 #define __EIKDOC_H__
    18 
    19 #include <apparc.h>
    20 #include <savenotf.h>
    21 
    22 class CEikAppUi;
    23 class CEikApplication;
    24 class CApaWindowGroupName;
    25 
    26 
    27 /** The base class for all GUI applications' documents. 
    28 
    29 In file-based applications, the document represents the data that relates to a 
    30 particular instance of the application, and should handle storing and restoring 
    31 it. In all applications, whether file-based or not, the document is used to create 
    32 the application UI. 
    33 
    34 A class derived from CEikDocument must be defined by each GUI application, and minimally 
    35 it must implement CreateAppUiL(). Note that UIs may implement their own document base class, 
    36 derived from CEikDocument, which applications may need to derive from instead. 
    37 
    38 The document is created by the application's CreateDocumentL() function.
    39 
    40 @publishedAll
    41 @released 
    42 @see CEikApplication::CreateDocumentL()
    43 @see CEikAppUi */
    44 class CEikDocument : public CApaDocument, public MSaveObserver
    45 	{
    46 public: // new functions
    47 	/** Constructs the application UI.
    48 	
    49 	This function is called by the UI framework during application start-up. It should 
    50 	only carry out first phase construction of the app UI, in other words, using new(ELeave). 
    51 	It should not call the app UI's ConstructL(), because the UI framework is responsible 
    52 	for this. Note also that the UI framework takes ownership of the app UI, so the 
    53 	document does not need to destroy it.
    54 
    55 	@return A partially-constructed app UI object. */
    56 	virtual CEikAppUi* CreateAppUiL()=0;
    57 	IMPORT_C virtual CFileStore* OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs);
    58 	IMPORT_C void PrepareToEditL(MApaEmbeddedDocObserver* aObserver,TBool aReadOnly);
    59 	IMPORT_C void PrepareToEditL();
    60 	IMPORT_C void SetAppFileMode(TUint aMode);
    61 	IMPORT_C TUint AppFileMode() const;
    62 	IMPORT_C virtual void UpdateTaskNameL(CApaWindowGroupName* aWgName);
    63 	IMPORT_C const TApaAppCaption& AppCaption() const;
    64 	IMPORT_C void SetChanged(TBool aHasChanged);
    65 	IMPORT_C void SetEditStoreL(CStreamStore* aStore);
    66 	void SetEditStoreWithoutAppUiNotificationL(CStreamStore* aStore);
    67 	inline CStreamStore* EditStore() const;
    68 	IMPORT_C ~CEikDocument();
    69 public: // from MSaveObserver
    70 	IMPORT_C virtual void SaveL(MSaveObserver::TSaveType aSaveType);
    71 public: // from CApaDocument
    72 	IMPORT_C void NewDocumentL();
    73 	IMPORT_C CFileStore* CreateFileStoreLC(RFs& aFs,const TDesC& aFileName);
    74 	IMPORT_C void EditL(MApaEmbeddedDocObserver* aObserver,TBool aReadOnly=EFalse);
    75 	IMPORT_C void PrintL(const CStreamStore& aSourceStore);
    76 	IMPORT_C void SaveL();
    77 	IMPORT_C void StoreL(CStreamStore& aStore,CStreamDictionary& aStreamDic) const;
    78 	IMPORT_C void RestoreL(const CStreamStore& aStore,const CStreamDictionary& aStreamDic);
    79 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
    80 	IMPORT_C TBool IsEmpty() const;
    81 	IMPORT_C TBool HasChanged() const;
    82 	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
    83 protected:
    84 	IMPORT_C CEikDocument();
    85 	IMPORT_C CEikDocument(CEikApplication& aApp);
    86 public:
    87 	IMPORT_C virtual void OpenFileL(CFileStore*& aFileStore, RFile& aFile);
    88 private:
    89 	void NullAppUi();
    90 	// reserved functions from CApaDocument
    91 	IMPORT_C virtual void Reserved_2();
    92 protected:
    93 	/** A pointer to the app UI which the document is associated with. */
    94 	CEikAppUi* iAppUi;
    95 	/** A pointer to the file store object which is used to edit the document. */
    96 	CStreamStore* iEditStore;
    97 private:
    98 	TBool iChanged;
    99 	TUint iAppFileMode;
   100 	friend class CEikAppUi;
   101 	};
   102 
   103 /** A pointer to the application process associated with this document.
   104 
   105 @publishedAll
   106 @released */
   107 #define iEikProcess ((CEikProcess*)Process())
   108 
   109 /** A pointer to the application that created this document.
   110 
   111 @publishedAll
   112 @released */
   113 #define iEikApplication ((CEikApplication*)Application())
   114 
   115 /** The default size in twips of icons that represent embedded objects.
   116 
   117 @publishedPartner
   118 @released */
   119 #define KDefaultIconicDoorSize TSize(500,500)
   120 
   121 
   122 /** Gets the file store object which is used to edit the document.
   123 
   124 @return A pointer to the file store object which is used to edit the document. */
   125 inline CStreamStore* CEikDocument::EditStore() const
   126 	{ return(iEditStore); }
   127 
   128 #endif	// __EIKDOC_H__