localisation/apparchitecture/inc/APPARC.H
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     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"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __APPARC_H__
       
    17 #define __APPARC_H__
       
    18 
       
    19 #if !defined(__E32STD_H__)
       
    20 #include <e32std.h>
       
    21 #endif
       
    22 #if !defined(__E32BASE_H__)
       
    23 #include <e32base.h>
       
    24 #endif
       
    25 #if !defined(__F32FILE_H__)
       
    26 #include <f32file.h>
       
    27 #endif
       
    28 #if !defined(__GDI_H__)
       
    29 #include <gdi.h>
       
    30 #endif
       
    31 #if !defined(__APADEF_H__)
       
    32 #include <apadef.h>
       
    33 #endif
       
    34 #if !defined(__APAID_H__)
       
    35 #include <apaid.h>
       
    36 #endif
       
    37 
       
    38 // classes defined:
       
    39 class CApaApplication;
       
    40 class CApaDocument;
       
    41 class CApaProcess;
       
    42 class MApaEmbeddedDocObserver;
       
    43 //
       
    44 // classes referenced:
       
    45 class CApaDll;
       
    46 class CApaExe;
       
    47 class RFile;
       
    48 class RReadStream;
       
    49 class RWriteStream;
       
    50 class CFileStore;
       
    51 class CPersistentStore;
       
    52 class CStreamDictionary;
       
    53 class CDictionaryStore;
       
    54 class TApaAppHolderInfo;
       
    55 class CImplementationInformation;
       
    56 class TApaApplicationFactory;
       
    57 class CApaAppHolder;
       
    58 class CApaAppServer;
       
    59 
       
    60 /** Creates an application interface object.
       
    61 
       
    62 Provides the basic roles of an application class as a factory that
       
    63 creates concrete document objects, and supplies utility functions 
       
    64 not specific to any particular instance of a document.
       
    65 
       
    66 @publishedAll
       
    67 @released
       
    68 */
       
    69 typedef CApaApplication* (*CreateCApaApplication)();
       
    70 
       
    71 
       
    72 // CApaApplication
       
    73 
       
    74 class CApaApplication : public CBase
       
    75 // base class for applications; allows creation of documents & file stores + display of app icon and name.
       
    76 /** Defines the basic behaviour for applications.
       
    77 
       
    78 The class defines the basic twin roles of an application class as a factory 
       
    79 that creates concrete document objects, and as a supplier of utility functions 
       
    80 not specific to any particular instance of a document. For example, returning 
       
    81 an application's caption, or accessing its .ini file.
       
    82 
       
    83 The class is derived from by the UI framework and is further derived from 
       
    84 by the UI application.
       
    85 
       
    86 @publishedAll 
       
    87 @released 
       
    88 @see CEikApplication */
       
    89 	{
       
    90 public:
       
    91 	/** Completes construction of this application object.
       
    92 	
       
    93 	The function is called after an instance of a derived class has been successfully 
       
    94 	created using the ordinal 1 function of the application DLL.
       
    95 	
       
    96 	After calling this function, an application can create document objects.
       
    97 	
       
    98 	An implementation of this function is supplied by the UI framework.
       
    99 	
       
   100 	@see CEikApplication */
       
   101 	virtual void PreDocConstructL()=0; // call once before creating document
       
   102 	
       
   103 	/** Creates a document object.
       
   104 	
       
   105 	The function is called by the application process when a new document is required. 
       
   106 	The application process adds the new document to its list of documents.
       
   107 	
       
   108 	An implementation of this function is supplied by the UI framework.
       
   109 	
       
   110 	@param aProcess A pointer to the process associated with the application.
       
   111 	@return A pointer to the newly created document.
       
   112 	@see CApaProcess::AddNewDocumentL() */
       
   113 	virtual CApaDocument* CreateDocumentL(CApaProcess* aProcess)=0;
       
   114 	
       
   115 	/** Gets the application specific UID.
       
   116 	
       
   117 	The UID is used to differentiate between UI applications.
       
   118 	
       
   119 	An implementation of this function must be supplied by the UI application.
       
   120 	
       
   121 	@return The application specific UID. */
       
   122 	virtual TUid AppDllUid()const=0;
       
   123 	
       
   124 	//
       
   125 	// utility functions
       
   126 	IMPORT_C static TInt GenerateFileName(RFs& aFs,TFileName& aRootName);
       
   127 	IMPORT_C CDictionaryStore* OpenIniFileL(RFs& aFs)const;
       
   128 	
       
   129 	/** Opens the .ini file associated with the application, constructs the dictionary 
       
   130 	store object, returns a pointer to it and puts the pointer onto the cleanupstack.
       
   131 	
       
   132 	The .ini file must be created, if it does not already exist.
       
   133 	
       
   134 	An implementation of this function is supplied by the UI framework.
       
   135 	
       
   136 	@param aFs Handle to a file server session 
       
   137 	@return A pointer to the dictionary store object that represents the application's 
       
   138 	.ini file. 
       
   139 	@see CEikApplication */
       
   140 	virtual CDictionaryStore* OpenIniFileLC(RFs& aFs)const=0;
       
   141 	//
       
   142 	// enquiry functions
       
   143 	IMPORT_C virtual TFileName AppFullName()const; // returns the full path and name of the app
       
   144 	/** Returns the capabilities of the application.
       
   145 	
       
   146 	Application capability information is represented by an instance of a TApaAppCapability 
       
   147 	object wrapped in a packaged modifiable buffer descriptor.
       
   148 	
       
   149 	The function is called from a number of places within the application framework.
       
   150 	
       
   151 	An implementation of this function is supplied by the UI framework.
       
   152 	
       
   153 	@param aInfo A packaged modifiable buffer descriptor (a TPckgBuf), encapsulating 
       
   154 	a TApaAppCapability object. 
       
   155 	@see CEikApplication
       
   156 	@see TApaAppCapability
       
   157 	@see TPckgBuf */
       
   158 	virtual void Capability(TDes8& aInfo)const=0;
       
   159 	//
       
   160 	// accessor function
       
   161 	IMPORT_C TFileName DllName()const;
       
   162 	
       
   163 	IMPORT_C ~CApaApplication();
       
   164 
       
   165 	// formerly a reserved virtual, Reserved_1()
       
   166 	IMPORT_C virtual void NewAppServerL(CApaAppServer*& aAppServer);
       
   167 protected:
       
   168 	IMPORT_C CApaApplication();
       
   169 	
       
   170 	IMPORT_C virtual void CApaApplication_Reserved1();
       
   171 	IMPORT_C virtual void CApaApplication_Reserved2();
       
   172 
       
   173 private:
       
   174 	CApaAppHolder* iAppHolder;  // the CApaAppHolder that owns me
       
   175 	TUid iDtorKey;	//	TInt iSpare;
       
   176 	friend class CApaAppHolder;
       
   177 	friend class CApaProcess;
       
   178 	friend class TApaApplicationFactory; // so that it can access iDtorKey
       
   179 	
       
   180 private:
       
   181 	TInt iCApaApplication_Reserved1;
       
   182 	};
       
   183 
       
   184 class CApaDocument : public CBase
       
   185 // base class for documents; allows insertion of glass doors.
       
   186 /** Defines basic behaviour for documents.
       
   187 
       
   188 This is the base class for all documents. A document contains the data associated 
       
   189 with the application's content.
       
   190 
       
   191 The class is derived from by the UI framework and is further derived from 
       
   192 by the UI application.
       
   193 
       
   194 @publishedAll 
       
   195 @released
       
   196 @see CEikDocument */
       
   197 	{
       
   198 public:
       
   199 	class TCapability
       
   200 	/** CApaDocument capabilities.*/
       
   201 		{
       
   202 	public:
       
   203 		IMPORT_C TCapability();
       
   204 		//
       
   205 		inline TBool CanDrawGlass()const;
       
   206 		inline TBool CanPrint()const;
       
   207 		inline void SetCanDrawGlass();
       
   208 		inline void SetCanPrint();
       
   209 		//
       
   210 	private:
       
   211 		enum {
       
   212 			ECanDrawGlass	=0x01,
       
   213 			ECanPrint		=0x02
       
   214 			};
       
   215 	private:
       
   216 		TUint iCapability;
       
   217 		TInt TCapability_Reserved1;
       
   218 		};
       
   219 	//
       
   220 public:
       
   221 	// document instantiation functions
       
   222 	/** Initialises a new, empty, document with a default setup.
       
   223 	
       
   224 	This can be the main document or an embedded document. The function is called 
       
   225 	by the UI framework when it creates a default document file.
       
   226 	
       
   227 	An implementation of this function must be supplied by the UI application.
       
   228 	
       
   229 	If initialisation fails, the document must be left in the same state as it 
       
   230 	was before the function was called. */
       
   231 	virtual void NewDocumentL()=0; // builds a new embedded or main document without loading from a store (may create the content from eg code or a template file).
       
   232 	
       
   233 	/** Creates and fully initialises a new filestore and stores the document into it, 
       
   234 	replacing any existing file of the same name.
       
   235 	
       
   236 	The function should put the pointer to the filestore object onto the cleanup 
       
   237 	stack.
       
   238 	
       
   239 	An implementation of this function is supplied by the UI framework.
       
   240 	
       
   241 	@param aFs Handle to a file server session. 
       
   242 	@param aFileName The full path name of the file to be created. 
       
   243 	@return A pointer to the newly constructed file store. 
       
   244 	@see CEikDocument */
       
   245 	virtual CFileStore* CreateFileStoreLC(RFs& aFs,const TDesC& aFileName)=0; // creates a file for a document and stores itself to that store (store should be put on cleanup stack).
       
   246 	//
       
   247 	// interaction functions
       
   248 	IMPORT_C virtual CPicture* GlassPictureL(); // Does nothing by default, override to return handle to glass picture.
       
   249 	
       
   250 	/** Starts an editing session on an embedded document.
       
   251 	
       
   252 	The function should cause the application's UI to be created and the document 
       
   253 	to be fully restored for editing.
       
   254 	
       
   255 	An implementation of this function is supplied by the UI framework.
       
   256 	
       
   257 	@param aContainer This document's observer.
       
   258 	@param aReadOnly True, the document should be opened in read-only mode and 
       
   259 	should not persist any changes made to the content. False, the document can 
       
   260 	be opened in read/write mode; this is the default. 
       
   261 	@see CEikDocument */
       
   262 	virtual void EditL(MApaEmbeddedDocObserver* aContainer,TBool aReadOnly=EFalse)=0; // Edit the document in the context of the container's environment. If aContainer is null, edit as the main document
       
   263 	
       
   264 	/** Prints the document without a need for it to be open for editing.
       
   265 	
       
   266 	Typically, this is called from a shell or a file manager type application 
       
   267 	that wants to print the document without opening it fully.
       
   268 	
       
   269 	An empty implementation of this function is supplied by the UI framework.
       
   270 	
       
   271 	The UI application can provide its own implementation.
       
   272 	
       
   273 	@param aSourceStore A reference to the store containing the document. 
       
   274 	@see CEikDocument */
       
   275 	virtual void PrintL(const CStreamStore& aSourceStore)=0; // default print parameters, assume print context supplied by environment
       
   276 	//
       
   277 	// persistence functions
       
   278 
       
   279 	/** Stores the document to the current file, commits the changes, and marks the 
       
   280 	document status as unchanged.
       
   281 	
       
   282 	Typically, the function is called by the application when it implements a 
       
   283 	"Save" type menu option in its User Interface.
       
   284 	
       
   285 	An implementation of this function is supplied by the UI framework. This is 
       
   286 	adequate for direct file store applications. Applications using a permanent 
       
   287 	file store model, need to provide their own implementation.
       
   288 	
       
   289 	If the function leaves, an implementation should ensure that any changes made 
       
   290 	to the file are rolled back, leaving the file in the state it was in before 
       
   291 	the function was called.
       
   292 	
       
   293 	@see CEikDocument */
       
   294 	virtual void SaveL()=0; // save the doc to the file in the custody of iAppProcess. This fn should be called by any "Save" menu option. store->Commit() should be called within it.	
       
   295 	/** Stores the document's content and state to the specified store, recording the 
       
   296 	identity of any headstreams created in the specified stream dictionary.
       
   297 	
       
   298 	The store must be fully constructed before this function is called.
       
   299 	
       
   300 	An empty implementation of this function is supplied by the UI framework. 
       
   301 	UI applications that need to persist any data must provide their own implementation.
       
   302 	
       
   303 	If the function leaves, an implementation should ensure that the store and 
       
   304 	the stream dictionary are returned to the state they were in before the function 
       
   305 	was called.
       
   306 	
       
   307 	@param aStore The store into which document data is to be stored. 
       
   308 	@param aStreamDic The stream dictionary into which stream IDs and associated 
       
   309 	UIDs are to be recorded. 
       
   310 	@see CEikDocument */
       
   311 	virtual void StoreL(CStreamStore& aStore,CStreamDictionary& aStreamDic) const=0; // store to aStore, lodging the headstream in aStreamDic
       
   312 	
       
   313 	/** Restores the document's content and state from data persisted in the specified 
       
   314 	store.
       
   315 	
       
   316 	An empty implementation of this function is supplied by the UI framework. 
       
   317 	UI applications that need to restore data must provide their own implementation.
       
   318 	
       
   319 	If the function leaves, an implementation should ensure that the store and 
       
   320 	the stream dictionary are returned to the state they were in before the function 
       
   321 	was called.
       
   322 	
       
   323 	@param aStore The store from which document data is to be restored. 
       
   324 	@param aStreamDic The stream dictionary containing stream IDs and associated 
       
   325 	UIDs. 
       
   326 	@see CEikDocument */
       
   327 	virtual void RestoreL(const CStreamStore& aStore,const CStreamDictionary& aStreamDic)=0; // restore from aStore using aStreamDic
       
   328 	
       
   329 	/** Restores the document to the extent that it does not need the store
       
   330 	further.
       
   331 
       
   332 	A document only keeps a pointer to a store if it implements deferred
       
   333 	loading. This also tells the document that any store pointer that it
       
   334 	might have is just about to become invalid.
       
   335 	
       
   336 	An empty implementation of this function is supplied by the UI framework. 
       
   337 	UI applications that support deferred loading or embedding should provide an
       
   338 	implementation.
       
   339 	
       
   340 	If a document supports embedding, then it should
       
   341 	propagate the DetachFromStoreL() call on to all embedded objects that
       
   342 	it contains.
       
   343 	
       
   344 	If the function leaves, the operation should be aborted
       
   345 	because the document has not successfully detached from the store.
       
   346 	Continuing with the operation may leave the document in an unsafe
       
   347 	state or cause user data to be lost.
       
   348 
       
   349 	@param aDegree The degree of detachment required. */
       
   350 	virtual void DetachFromStoreL(CPicture::TDetach /*aDegree*/=CPicture::EDetachFull) {} // supply an implementation if you support deferred loading or embedding
       
   351 
       
   352 	IMPORT_C virtual void ExternalizeL(RWriteStream& aStream)const;
       
   353 	//
       
   354 	// enquiry functions
       
   355 	
       
   356 	/** Tests whether the document is empty.
       
   357 	
       
   358 	The UI framework provides a default implementation which always returns a 
       
   359 	true value.
       
   360 	
       
   361 	The UI application can provide its own implementation. Typically, any application 
       
   362 	that has editable content should supply an implementation that acts according 
       
   363 	to the state of that content. Applications without associated document data 
       
   364 	need not supply an implementation.
       
   365 	
       
   366 	@return True if the document is empty, false otherwise. 
       
   367 	@see CEikDocument */
       
   368 	virtual TBool IsEmpty()const=0; // return ETrue if the document is empty
       
   369 	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
       
   370 	
       
   371 	IMPORT_C virtual TCapability Capability()const; // returns "cant do anything" by default
       
   372 	inline CApaApplication* Application()const;
       
   373 	inline CApaProcess* Process()const;
       
   374 	
       
   375 	/** Tests whether the document has changed since it was last persisted.
       
   376 	
       
   377 	An implementation of this function is supplied by the UI framework and need 
       
   378 	not be changed by the UI application.
       
   379 	
       
   380 	@return True, if the document has changed since the last time that it was 
       
   381 	persisted, false, otherwise.
       
   382 	@see CEikDocument */
       
   383 	virtual TBool HasChanged()const =0;
       
   384 	//
       
   385 	IMPORT_C virtual ~CApaDocument();
       
   386 protected:
       
   387 	IMPORT_C CApaDocument();
       
   388 	IMPORT_C CApaDocument(CApaApplication& aApp,CApaProcess& aProcess);
       
   389 private:
       
   390 	IMPORT_C virtual void OpenFileL(CFileStore*& aFileStore, RFile& aFile); // was previously Reserved_1
       
   391 	// Reserved virtual functions...
       
   392 	IMPORT_C virtual void Reserved_2();
       
   393 protected:
       
   394 	MApaEmbeddedDocObserver* iContainer; // null unless this is an embedded object currently being edited
       
   395 private:
       
   396 	CApaApplication* iApplication; // the doc's associated application
       
   397 	CApaProcess* iApaProcess;
       
   398 	TInt iSpare;
       
   399 	};
       
   400 
       
   401 
       
   402 
       
   403 class TApaApplicationFactory
       
   404 /** Encapsulates the functionality of creating an application, whether it be via a factory function
       
   405 or an ECOM plugin. Instances of this class can usually be created implicitly when required as
       
   406 function parameters - just specify the function pointer, ECOM plugin UID or CImplementationInformation
       
   407 reference.
       
   408 
       
   409 @publishedAll
       
   410 @released
       
   411 @see CApaProcess
       
   412 @see EikStart */
       
   413 	{
       
   414 public:
       
   415 	typedef CApaApplication* (*TFunction)();
       
   416 public:
       
   417 	IMPORT_C TApaApplicationFactory();
       
   418 	IMPORT_C TApaApplicationFactory(TFunction aFunction);
       
   419 	IMPORT_C TApaApplicationFactory(const CImplementationInformation& aEmbeddedApplicationInformation);
       
   420 	IMPORT_C TApaApplicationFactory(TUid aEmbeddedApplicationUid);
       
   421 	CApaApplication* CreateApplicationL() const;
       
   422 	HBufC* AppFileNameL() const;
       
   423 	TUid AppFileUid() const;
       
   424 private:
       
   425 	enum TType
       
   426 		{
       
   427 		ETypeFunction,							// if iType is this, iData is a TFunction
       
   428 		ETypeEmbeddedApplicationInformation,	// if iType is this, iData is an ECOM CImplementationInformation
       
   429 		ETypeEmbeddedApplicationUid				// if iType is this, iData is an ECOM implementation TUid
       
   430 		};
       
   431 private:
       
   432 	static CApaApplication* CreateEmbeddedApplicationL(TUid aUid);
       
   433 	static HBufC* EmbeddedApplicationDisplayNameLC(TUid aUid);
       
   434 	static HBufC* FullAppFileNameL(const TDesC& aAppName);
       
   435 	static void CleanupImplementationArray(TAny* aImplementationArray);
       
   436 private:
       
   437 	TType iType;
       
   438 	TUint iData;
       
   439 	mutable CApaApplication* iApplication; // used to be iSpare1
       
   440 	TInt iSpare2;
       
   441 	};
       
   442 
       
   443 class CApaParentProcessMonitor;
       
   444 
       
   445 class CApaProcess : public CBase
       
   446 /** Maintains a list of documents and all of the potentially shared resources used 
       
   447 by documents.
       
   448 
       
   449 This includes the application DLLs. The class also supplies utility functions 
       
   450 that provide the basic structure for persisted document files.
       
   451 
       
   452 The class deals with the loading of application DLLs and manages the creation 
       
   453 and destruction of application (CApaApplication) objects and document (CApaDocument) 
       
   454 objects.
       
   455 
       
   456 The class is derived from by the UI framework and further derivation by the 
       
   457 UI application is not necessary unless it needs to add extra utility functions 
       
   458 for the use of applications.
       
   459 
       
   460 @publishedAll
       
   461 @released
       
   462 @see CApaApplication
       
   463 @see CApaDocument */
       
   464 	{
       
   465 public:
       
   466 	IMPORT_C static CApaProcess* NewL(const RFs& aFs);
       
   467 	IMPORT_C void ResetL();
       
   468 	//
       
   469 	// static utility functions
       
   470 	IMPORT_C static CStreamDictionary* ReadRootStreamLC(RFs& aFs,CFileStore*& aStore,const TDesC& aDocFullFileName,TUint aFileMode); // opens aDocFileName as aStore and returns the stream dictionary contained in its root stream on the cleanup stack
       
   471 	IMPORT_C static CStreamDictionary* ReadRootStreamLC(CFileStore*& aStore, const RFile& aFile);
       
   472 	IMPORT_C static void WriteRootStreamL(CPersistentStore& aStore,CStreamDictionary& aStreamDic,const CApaApplication& aApp);
       
   473 	IMPORT_C static void WriteRootStreamL(CPersistentStore& aStore,CStreamDictionary& aStreamDic,const TApaAppIdentifier& aAppId);
       
   474 	IMPORT_C static TApaAppIdentifier ReadAppIdentifierL(const CStreamStore& aStore,const CStreamDictionary& aStreamDic);
       
   475 	IMPORT_C static void WriteAppIdentifierL(CStreamStore& aStore,CStreamDictionary& aStreamDic,const TApaAppIdentifier& aAppId);
       
   476 	//
       
   477 	// document management
       
   478 	IMPORT_C CApaDocument* AddNewDocumentL(TApaApplicationFactory aApplicationFactory);
       
   479 	IMPORT_C CApaDocument* OpenNewDocumentL(CFileStore*& aStore,CStreamDictionary*& aStreamDic,const TDesC& aDocFullFileName,TUint aFileMode); // Open a file and restore the contained document
       
   480 	IMPORT_C void DestroyDocument(CApaDocument* aDoc); // Removes a doc (identified by the object) from the list and destroys it. Also removes the app and closes the AppDll if appropriate.
       
   481 	//
       
   482 	// setter functions
       
   483 	IMPORT_C void SetMainDocument(CApaDocument* aDocument);
       
   484 	IMPORT_C void SetMainDocFileName(const TDesC& aMainDocFileName); // panics if the descriptor is too long
       
   485 	IMPORT_C void SetMainDocFileNameL(const TDesC& aMainDocFileName);
       
   486 	//
       
   487 	// accessor functions
       
   488 	IMPORT_C TPtrC MainDocFileName()const;
       
   489 	inline RFs& FsSession()const;
       
   490 	inline CApaDocument* MainDocument()const;
       
   491 	//
       
   492 	IMPORT_C ~CApaProcess();
       
   493 protected:
       
   494 	IMPORT_C CApaProcess();
       
   495 	IMPORT_C CApaProcess(const RFs& aFs);
       
   496 	IMPORT_C void ConstructL();
       
   497 	IMPORT_C void ConstructL(TProcessId aParentProcessId);
       
   498 
       
   499 	IMPORT_C virtual void CApaProcess_Reserved1();
       
   500 	IMPORT_C virtual void CApaProcess_Reserved2();
       
   501 public:
       
   502 	static TInt IdleRemoveApplications(TAny* aThis);
       
   503 	void RemoveMarkedApplications();
       
   504 private:
       
   505 	CApaDll* AddAppDllL(const TDesC& aDllFullPath);
       
   506 	CApaExe* AddAppExeL(TApaApplicationFactory aApplicationFactory);
       
   507 	void RemoveApp(CApaAppHolder* aAppHolder);
       
   508 	CApaDocument* CreateDocL(CApaApplication* aApp);
       
   509 	CApaAppHolder* FindAppInListL(const TDesC& aAppFileName,TUid aUid)const; // returns NULL if not in list
       
   510 	void DeleteAllDocs();
       
   511 	void MarkApplicationForRemoval(const CApaApplication* aApp);
       
   512 	static void DoReadRootStreamL(CStreamDictionary& aStreamDictionary, const CFileStore& aStore);
       
   513 private:
       
   514 	CArrayFixFlat<TApaAppHolderInfo>* iAppList; // array of apps in use
       
   515 	CArrayFixFlat<CApaDocument*>* iDocList; // array of documents (1 main + n embedded)
       
   516 	CApaDocument* iMainDoc;
       
   517 	HBufC* iMainDocFileName;
       
   518 	RFs iFsSession; // file server session for doc store
       
   519 	CIdle* iApplicationRemover;
       
   520 	CApaParentProcessMonitor* iMonitor;
       
   521 	TInt iCApaProcess_Reserved1;
       
   522 	};
       
   523 
       
   524 
       
   525 class MApaEmbeddedDocObserver
       
   526 /** An interface class for handling the completion of the editing of an embedded 
       
   527 document.
       
   528 
       
   529 @publishedAll 
       
   530 @released
       
   531 @see CApaDocument::EditL() */
       
   532 	{
       
   533 public:
       
   534 	/** Defines the state of the embedded document on completion of editing. */
       
   535 	enum TExitMode {
       
   536 		/** Changes to the embedded document must be saved. */
       
   537 		EKeepChanges,
       
   538 		/** Reverts back to the saved version of the embedded document, i.e. reloads the 
       
   539 		whole document. */
       
   540 		ERevertToSaved,
       
   541 		/** No changes have been made to the embedded document. */
       
   542 		ENoChanges,
       
   543 		/** The embedded document is empty. */
       
   544 		EEmpty
       
   545 		};
       
   546 public:
       
   547 	/** Implements the required behaviour when the editing of an embedded document completes.
       
   548 	
       
   549 	@param aMode Indicates the state of the document. */
       
   550 	virtual void NotifyExit(TExitMode aMode)=0; // called on completion of editing of an embedded document
       
   551 protected:
       
   552 	IMPORT_C MApaEmbeddedDocObserver();
       
   553 private:
       
   554 	IMPORT_C virtual void MApaEmbeddedDocObserver_Reserved1();
       
   555 	IMPORT_C virtual void MApaEmbeddedDocObserver_Reserved2();
       
   556 private:
       
   557 	TInt iMApaEmbeddedDocObserver_Reserved1;
       
   558 	};
       
   559 
       
   560 
       
   561 //// inlines ////
       
   562 inline CApaApplication* CApaDocument::Application()const
       
   563 /** Returns a pointer to the application that created the document.
       
   564 
       
   565 @return A pointer to the document's associated application. */
       
   566 	{ return iApplication; }
       
   567 
       
   568 inline CApaProcess* CApaDocument::Process()const
       
   569 /** Returns a pointer to the application process associated with this document.
       
   570 
       
   571 @return A pointer to the application process associated with this document. */
       
   572 	{ return iApaProcess; }
       
   573 
       
   574 inline TBool CApaDocument::TCapability::CanDrawGlass()const
       
   575 /** Tests whether the document supports being embedded as a glass door.
       
   576 
       
   577 @return True if embedding as a glass door is supported; false otherwise. */
       
   578 	{ return iCapability&ECanDrawGlass; }
       
   579 
       
   580 inline TBool CApaDocument::TCapability::CanPrint()const
       
   581 /** Tests whether the document supports being printed without using the full application 
       
   582 UI.
       
   583 
       
   584 @return True, if printing is supported; false, otherwise. */
       
   585 	{ return iCapability&ECanPrint; }
       
   586 
       
   587 inline void CApaDocument::TCapability::SetCanDrawGlass()
       
   588 /** Sets the document as being capable of being embedded as a glass door. */
       
   589 	{ iCapability = iCapability|ECanDrawGlass; }
       
   590 
       
   591 inline void CApaDocument::TCapability::SetCanPrint()
       
   592 /** Sets the document as being capable of being printed without using the full application 
       
   593 UI. */
       
   594 	{ iCapability = iCapability|ECanPrint; }
       
   595 
       
   596 inline RFs& CApaProcess::FsSession()const
       
   597 /** Returns a handle to the file server session used by this application process.
       
   598 
       
   599 @return The file server session. */
       
   600 	{ return (RFs&)iFsSession; } //lint !e1536 Exposing low access member - Kept for backward BC
       
   601 
       
   602 inline CApaDocument* CApaProcess::MainDocument()const
       
   603 /** Returns a pointer to the main document.
       
   604 
       
   605 @return A pointer to the main document. */
       
   606 	{ return iMainDoc; }
       
   607 	
       
   608 #endif