1.1 --- a/epoc32/include/apparc.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/apparc.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,608 @@
1.4 -apparc.h
1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// 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
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +#ifndef __APPARC_H__
1.21 +#define __APPARC_H__
1.22 +
1.23 +#if !defined(__E32STD_H__)
1.24 +#include <e32std.h>
1.25 +#endif
1.26 +#if !defined(__E32BASE_H__)
1.27 +#include <e32base.h>
1.28 +#endif
1.29 +#if !defined(__F32FILE_H__)
1.30 +#include <f32file.h>
1.31 +#endif
1.32 +#if !defined(__GDI_H__)
1.33 +#include <gdi.h>
1.34 +#endif
1.35 +#if !defined(__APADEF_H__)
1.36 +#include <apadef.h>
1.37 +#endif
1.38 +#if !defined(__APAID_H__)
1.39 +#include <apaid.h>
1.40 +#endif
1.41 +
1.42 +// classes defined:
1.43 +class CApaApplication;
1.44 +class CApaDocument;
1.45 +class CApaProcess;
1.46 +class MApaEmbeddedDocObserver;
1.47 +//
1.48 +// classes referenced:
1.49 +class CApaDll;
1.50 +class CApaExe;
1.51 +class RFile;
1.52 +class RReadStream;
1.53 +class RWriteStream;
1.54 +class CFileStore;
1.55 +class CPersistentStore;
1.56 +class CStreamDictionary;
1.57 +class CDictionaryStore;
1.58 +class TApaAppHolderInfo;
1.59 +class CImplementationInformation;
1.60 +class TApaApplicationFactory;
1.61 +class CApaAppHolder;
1.62 +class CApaAppServer;
1.63 +
1.64 +/** Creates an application interface object.
1.65 +
1.66 +Provides the basic roles of an application class as a factory that
1.67 +creates concrete document objects, and supplies utility functions
1.68 +not specific to any particular instance of a document.
1.69 +
1.70 +@publishedAll
1.71 +@released
1.72 +*/
1.73 +typedef CApaApplication* (*CreateCApaApplication)();
1.74 +
1.75 +
1.76 +// CApaApplication
1.77 +
1.78 +class CApaApplication : public CBase
1.79 +// base class for applications; allows creation of documents & file stores + display of app icon and name.
1.80 +/** Defines the basic behaviour for applications.
1.81 +
1.82 +The class defines the basic twin roles of an application class as a factory
1.83 +that creates concrete document objects, and as a supplier of utility functions
1.84 +not specific to any particular instance of a document. For example, returning
1.85 +an application's caption, or accessing its .ini file.
1.86 +
1.87 +The class is derived from by the UI framework and is further derived from
1.88 +by the UI application.
1.89 +
1.90 +@publishedAll
1.91 +@released
1.92 +@see CEikApplication */
1.93 + {
1.94 +public:
1.95 + /** Completes construction of this application object.
1.96 +
1.97 + The function is called after an instance of a derived class has been successfully
1.98 + created using the ordinal 1 function of the application DLL.
1.99 +
1.100 + After calling this function, an application can create document objects.
1.101 +
1.102 + An implementation of this function is supplied by the UI framework.
1.103 +
1.104 + @see CEikApplication */
1.105 + virtual void PreDocConstructL()=0; // call once before creating document
1.106 +
1.107 + /** Creates a document object.
1.108 +
1.109 + The function is called by the application process when a new document is required.
1.110 + The application process adds the new document to its list of documents.
1.111 +
1.112 + An implementation of this function is supplied by the UI framework.
1.113 +
1.114 + @param aProcess A pointer to the process associated with the application.
1.115 + @return A pointer to the newly created document.
1.116 + @see CApaProcess::AddNewDocumentL() */
1.117 + virtual CApaDocument* CreateDocumentL(CApaProcess* aProcess)=0;
1.118 +
1.119 + /** Gets the application specific UID.
1.120 +
1.121 + The UID is used to differentiate between UI applications.
1.122 +
1.123 + An implementation of this function must be supplied by the UI application.
1.124 +
1.125 + @return The application specific UID. */
1.126 + virtual TUid AppDllUid()const=0;
1.127 +
1.128 + //
1.129 + // utility functions
1.130 + IMPORT_C static TInt GenerateFileName(RFs& aFs,TFileName& aRootName);
1.131 + IMPORT_C CDictionaryStore* OpenIniFileL(RFs& aFs)const;
1.132 +
1.133 + /** Opens the .ini file associated with the application, constructs the dictionary
1.134 + store object, returns a pointer to it and puts the pointer onto the cleanupstack.
1.135 +
1.136 + The .ini file must be created, if it does not already exist.
1.137 +
1.138 + An implementation of this function is supplied by the UI framework.
1.139 +
1.140 + @param aFs Handle to a file server session
1.141 + @return A pointer to the dictionary store object that represents the application's
1.142 + .ini file.
1.143 + @see CEikApplication */
1.144 + virtual CDictionaryStore* OpenIniFileLC(RFs& aFs)const=0;
1.145 + //
1.146 + // enquiry functions
1.147 + IMPORT_C virtual TFileName AppFullName()const; // returns the full path and name of the app
1.148 + /** Returns the capabilities of the application.
1.149 +
1.150 + Application capability information is represented by an instance of a TApaAppCapability
1.151 + object wrapped in a packaged modifiable buffer descriptor.
1.152 +
1.153 + The function is called from a number of places within the application framework.
1.154 +
1.155 + An implementation of this function is supplied by the UI framework.
1.156 +
1.157 + @param aInfo A packaged modifiable buffer descriptor (a TPckgBuf), encapsulating
1.158 + a TApaAppCapability object.
1.159 + @see CEikApplication
1.160 + @see TApaAppCapability
1.161 + @see TPckgBuf */
1.162 + virtual void Capability(TDes8& aInfo)const=0;
1.163 + //
1.164 + // accessor function
1.165 + IMPORT_C TFileName DllName()const;
1.166 +
1.167 + IMPORT_C ~CApaApplication();
1.168 +
1.169 + // formerly a reserved virtual, Reserved_1()
1.170 + IMPORT_C virtual void NewAppServerL(CApaAppServer*& aAppServer);
1.171 +protected:
1.172 + IMPORT_C CApaApplication();
1.173 +
1.174 + IMPORT_C virtual void CApaApplication_Reserved1();
1.175 + IMPORT_C virtual void CApaApplication_Reserved2();
1.176 +
1.177 +private:
1.178 + CApaAppHolder* iAppHolder; // the CApaAppHolder that owns me
1.179 + TUid iDtorKey; // TInt iSpare;
1.180 + friend class CApaAppHolder;
1.181 + friend class CApaProcess;
1.182 + friend class TApaApplicationFactory; // so that it can access iDtorKey
1.183 +
1.184 +private:
1.185 + TInt iCApaApplication_Reserved1;
1.186 + };
1.187 +
1.188 +class CApaDocument : public CBase
1.189 +// base class for documents; allows insertion of glass doors.
1.190 +/** Defines basic behaviour for documents.
1.191 +
1.192 +This is the base class for all documents. A document contains the data associated
1.193 +with the application's content.
1.194 +
1.195 +The class is derived from by the UI framework and is further derived from
1.196 +by the UI application.
1.197 +
1.198 +@publishedAll
1.199 +@released
1.200 +@see CEikDocument */
1.201 + {
1.202 +public:
1.203 + class TCapability
1.204 + /** CApaDocument capabilities.*/
1.205 + {
1.206 + public:
1.207 + IMPORT_C TCapability();
1.208 + //
1.209 + inline TBool CanDrawGlass()const;
1.210 + inline TBool CanPrint()const;
1.211 + inline void SetCanDrawGlass();
1.212 + inline void SetCanPrint();
1.213 + //
1.214 + private:
1.215 + enum {
1.216 + ECanDrawGlass =0x01,
1.217 + ECanPrint =0x02
1.218 + };
1.219 + private:
1.220 + TUint iCapability;
1.221 + TInt TCapability_Reserved1;
1.222 + };
1.223 + //
1.224 +public:
1.225 + // document instantiation functions
1.226 + /** Initialises a new, empty, document with a default setup.
1.227 +
1.228 + This can be the main document or an embedded document. The function is called
1.229 + by the UI framework when it creates a default document file.
1.230 +
1.231 + An implementation of this function must be supplied by the UI application.
1.232 +
1.233 + If initialisation fails, the document must be left in the same state as it
1.234 + was before the function was called. */
1.235 + 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).
1.236 +
1.237 + /** Creates and fully initialises a new filestore and stores the document into it,
1.238 + replacing any existing file of the same name.
1.239 +
1.240 + The function should put the pointer to the filestore object onto the cleanup
1.241 + stack.
1.242 +
1.243 + An implementation of this function is supplied by the UI framework.
1.244 +
1.245 + @param aFs Handle to a file server session.
1.246 + @param aFileName The full path name of the file to be created.
1.247 + @return A pointer to the newly constructed file store.
1.248 + @see CEikDocument */
1.249 + 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).
1.250 + //
1.251 + // interaction functions
1.252 + IMPORT_C virtual CPicture* GlassPictureL(); // Does nothing by default, override to return handle to glass picture.
1.253 +
1.254 + /** Starts an editing session on an embedded document.
1.255 +
1.256 + The function should cause the application's UI to be created and the document
1.257 + to be fully restored for editing.
1.258 +
1.259 + An implementation of this function is supplied by the UI framework.
1.260 +
1.261 + @param aContainer This document's observer.
1.262 + @param aReadOnly True, the document should be opened in read-only mode and
1.263 + should not persist any changes made to the content. False, the document can
1.264 + be opened in read/write mode; this is the default.
1.265 + @see CEikDocument */
1.266 + 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
1.267 +
1.268 + /** Prints the document without a need for it to be open for editing.
1.269 +
1.270 + Typically, this is called from a shell or a file manager type application
1.271 + that wants to print the document without opening it fully.
1.272 +
1.273 + An empty implementation of this function is supplied by the UI framework.
1.274 +
1.275 + The UI application can provide its own implementation.
1.276 +
1.277 + @param aSourceStore A reference to the store containing the document.
1.278 + @see CEikDocument */
1.279 + virtual void PrintL(const CStreamStore& aSourceStore)=0; // default print parameters, assume print context supplied by environment
1.280 + //
1.281 + // persistence functions
1.282 +
1.283 + /** Stores the document to the current file, commits the changes, and marks the
1.284 + document status as unchanged.
1.285 +
1.286 + Typically, the function is called by the application when it implements a
1.287 + "Save" type menu option in its User Interface.
1.288 +
1.289 + An implementation of this function is supplied by the UI framework. This is
1.290 + adequate for direct file store applications. Applications using a permanent
1.291 + file store model, need to provide their own implementation.
1.292 +
1.293 + If the function leaves, an implementation should ensure that any changes made
1.294 + to the file are rolled back, leaving the file in the state it was in before
1.295 + the function was called.
1.296 +
1.297 + @see CEikDocument */
1.298 + 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.
1.299 + /** Stores the document's content and state to the specified store, recording the
1.300 + identity of any headstreams created in the specified stream dictionary.
1.301 +
1.302 + The store must be fully constructed before this function is called.
1.303 +
1.304 + An empty implementation of this function is supplied by the UI framework.
1.305 + UI applications that need to persist any data must provide their own implementation.
1.306 +
1.307 + If the function leaves, an implementation should ensure that the store and
1.308 + the stream dictionary are returned to the state they were in before the function
1.309 + was called.
1.310 +
1.311 + @param aStore The store into which document data is to be stored.
1.312 + @param aStreamDic The stream dictionary into which stream IDs and associated
1.313 + UIDs are to be recorded.
1.314 + @see CEikDocument */
1.315 + virtual void StoreL(CStreamStore& aStore,CStreamDictionary& aStreamDic) const=0; // store to aStore, lodging the headstream in aStreamDic
1.316 +
1.317 + /** Restores the document's content and state from data persisted in the specified
1.318 + store.
1.319 +
1.320 + An empty implementation of this function is supplied by the UI framework.
1.321 + UI applications that need to restore data must provide their own implementation.
1.322 +
1.323 + If the function leaves, an implementation should ensure that the store and
1.324 + the stream dictionary are returned to the state they were in before the function
1.325 + was called.
1.326 +
1.327 + @param aStore The store from which document data is to be restored.
1.328 + @param aStreamDic The stream dictionary containing stream IDs and associated
1.329 + UIDs.
1.330 + @see CEikDocument */
1.331 + virtual void RestoreL(const CStreamStore& aStore,const CStreamDictionary& aStreamDic)=0; // restore from aStore using aStreamDic
1.332 +
1.333 + /** Restores the document to the extent that it does not need the store
1.334 + further.
1.335 +
1.336 + A document only keeps a pointer to a store if it implements deferred
1.337 + loading. This also tells the document that any store pointer that it
1.338 + might have is just about to become invalid.
1.339 +
1.340 + An empty implementation of this function is supplied by the UI framework.
1.341 + UI applications that support deferred loading or embedding should provide an
1.342 + implementation.
1.343 +
1.344 + If a document supports embedding, then it should
1.345 + propagate the DetachFromStoreL() call on to all embedded objects that
1.346 + it contains.
1.347 +
1.348 + If the function leaves, the operation should be aborted
1.349 + because the document has not successfully detached from the store.
1.350 + Continuing with the operation may leave the document in an unsafe
1.351 + state or cause user data to be lost.
1.352 +
1.353 + @param aDegree The degree of detachment required. */
1.354 + virtual void DetachFromStoreL(CPicture::TDetach /*aDegree*/=CPicture::EDetachFull) {} // supply an implementation if you support deferred loading or embedding
1.355 +
1.356 + IMPORT_C virtual void ExternalizeL(RWriteStream& aStream)const;
1.357 + //
1.358 + // enquiry functions
1.359 +
1.360 + /** Tests whether the document is empty.
1.361 +
1.362 + The UI framework provides a default implementation which always returns a
1.363 + true value.
1.364 +
1.365 + The UI application can provide its own implementation. Typically, any application
1.366 + that has editable content should supply an implementation that acts according
1.367 + to the state of that content. Applications without associated document data
1.368 + need not supply an implementation.
1.369 +
1.370 + @return True if the document is empty, false otherwise.
1.371 + @see CEikDocument */
1.372 + virtual TBool IsEmpty()const=0; // return ETrue if the document is empty
1.373 + 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
1.374 +
1.375 + IMPORT_C virtual TCapability Capability()const; // returns "cant do anything" by default
1.376 + inline CApaApplication* Application()const;
1.377 + inline CApaProcess* Process()const;
1.378 +
1.379 + /** Tests whether the document has changed since it was last persisted.
1.380 +
1.381 + An implementation of this function is supplied by the UI framework and need
1.382 + not be changed by the UI application.
1.383 +
1.384 + @return True, if the document has changed since the last time that it was
1.385 + persisted, false, otherwise.
1.386 + @see CEikDocument */
1.387 + virtual TBool HasChanged()const =0;
1.388 + //
1.389 + IMPORT_C virtual ~CApaDocument();
1.390 +protected:
1.391 + IMPORT_C CApaDocument();
1.392 + IMPORT_C CApaDocument(CApaApplication& aApp,CApaProcess& aProcess);
1.393 +private:
1.394 + IMPORT_C virtual void OpenFileL(CFileStore*& aFileStore, RFile& aFile); // was previously Reserved_1
1.395 + // Reserved virtual functions...
1.396 + IMPORT_C virtual void Reserved_2();
1.397 +protected:
1.398 + MApaEmbeddedDocObserver* iContainer; // null unless this is an embedded object currently being edited
1.399 +private:
1.400 + CApaApplication* iApplication; // the doc's associated application
1.401 + CApaProcess* iApaProcess;
1.402 + TInt iSpare;
1.403 + };
1.404 +
1.405 +
1.406 +
1.407 +class TApaApplicationFactory
1.408 +/** Encapsulates the functionality of creating an application, whether it be via a factory function
1.409 +or an ECOM plugin. Instances of this class can usually be created implicitly when required as
1.410 +function parameters - just specify the function pointer, ECOM plugin UID or CImplementationInformation
1.411 +reference.
1.412 +
1.413 +@publishedAll
1.414 +@released
1.415 +@see CApaProcess
1.416 +@see EikStart */
1.417 + {
1.418 +public:
1.419 + typedef CApaApplication* (*TFunction)();
1.420 +public:
1.421 + IMPORT_C TApaApplicationFactory();
1.422 + IMPORT_C TApaApplicationFactory(TFunction aFunction);
1.423 + IMPORT_C TApaApplicationFactory(const CImplementationInformation& aEmbeddedApplicationInformation);
1.424 + IMPORT_C TApaApplicationFactory(TUid aEmbeddedApplicationUid);
1.425 + CApaApplication* CreateApplicationL() const;
1.426 + HBufC* AppFileNameL() const;
1.427 + TUid AppFileUid() const;
1.428 +private:
1.429 + enum TType
1.430 + {
1.431 + ETypeFunction, // if iType is this, iData is a TFunction
1.432 + ETypeEmbeddedApplicationInformation, // if iType is this, iData is an ECOM CImplementationInformation
1.433 + ETypeEmbeddedApplicationUid // if iType is this, iData is an ECOM implementation TUid
1.434 + };
1.435 +private:
1.436 + static CApaApplication* CreateEmbeddedApplicationL(TUid aUid);
1.437 + static HBufC* EmbeddedApplicationDisplayNameLC(TUid aUid);
1.438 + static HBufC* FullAppFileNameL(const TDesC& aAppName);
1.439 + static void CleanupImplementationArray(TAny* aImplementationArray);
1.440 +private:
1.441 + TType iType;
1.442 + TUint iData;
1.443 + mutable CApaApplication* iApplication; // used to be iSpare1
1.444 + TInt iSpare2;
1.445 + };
1.446 +
1.447 +class CApaParentProcessMonitor;
1.448 +
1.449 +class CApaProcess : public CBase
1.450 +/** Maintains a list of documents and all of the potentially shared resources used
1.451 +by documents.
1.452 +
1.453 +This includes the application DLLs. The class also supplies utility functions
1.454 +that provide the basic structure for persisted document files.
1.455 +
1.456 +The class deals with the loading of application DLLs and manages the creation
1.457 +and destruction of application (CApaApplication) objects and document (CApaDocument)
1.458 +objects.
1.459 +
1.460 +The class is derived from by the UI framework and further derivation by the
1.461 +UI application is not necessary unless it needs to add extra utility functions
1.462 +for the use of applications.
1.463 +
1.464 +@publishedAll
1.465 +@released
1.466 +@see CApaApplication
1.467 +@see CApaDocument */
1.468 + {
1.469 +public:
1.470 + IMPORT_C static CApaProcess* NewL(const RFs& aFs);
1.471 + IMPORT_C void ResetL();
1.472 + //
1.473 + // static utility functions
1.474 + 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
1.475 + IMPORT_C static CStreamDictionary* ReadRootStreamLC(CFileStore*& aStore, const RFile& aFile);
1.476 + IMPORT_C static void WriteRootStreamL(CPersistentStore& aStore,CStreamDictionary& aStreamDic,const CApaApplication& aApp);
1.477 + IMPORT_C static void WriteRootStreamL(CPersistentStore& aStore,CStreamDictionary& aStreamDic,const TApaAppIdentifier& aAppId);
1.478 + IMPORT_C static TApaAppIdentifier ReadAppIdentifierL(const CStreamStore& aStore,const CStreamDictionary& aStreamDic);
1.479 + IMPORT_C static void WriteAppIdentifierL(CStreamStore& aStore,CStreamDictionary& aStreamDic,const TApaAppIdentifier& aAppId);
1.480 + //
1.481 + // document management
1.482 + IMPORT_C CApaDocument* AddNewDocumentL(TApaApplicationFactory aApplicationFactory);
1.483 + IMPORT_C CApaDocument* OpenNewDocumentL(CFileStore*& aStore,CStreamDictionary*& aStreamDic,const TDesC& aDocFullFileName,TUint aFileMode); // Open a file and restore the contained document
1.484 + 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.
1.485 + //
1.486 + // setter functions
1.487 + IMPORT_C void SetMainDocument(CApaDocument* aDocument);
1.488 + IMPORT_C void SetMainDocFileName(const TDesC& aMainDocFileName); // panics if the descriptor is too long
1.489 + IMPORT_C void SetMainDocFileNameL(const TDesC& aMainDocFileName);
1.490 + //
1.491 + // accessor functions
1.492 + IMPORT_C TPtrC MainDocFileName()const;
1.493 + inline RFs& FsSession()const;
1.494 + inline CApaDocument* MainDocument()const;
1.495 + //
1.496 + IMPORT_C ~CApaProcess();
1.497 +protected:
1.498 + IMPORT_C CApaProcess();
1.499 + IMPORT_C CApaProcess(const RFs& aFs);
1.500 + IMPORT_C void ConstructL();
1.501 + IMPORT_C void ConstructL(TProcessId aParentProcessId);
1.502 +
1.503 + IMPORT_C virtual void CApaProcess_Reserved1();
1.504 + IMPORT_C virtual void CApaProcess_Reserved2();
1.505 +public:
1.506 + static TInt IdleRemoveApplications(TAny* aThis);
1.507 + void RemoveMarkedApplications();
1.508 +private:
1.509 + CApaDll* AddAppDllL(const TDesC& aDllFullPath);
1.510 + CApaExe* AddAppExeL(TApaApplicationFactory aApplicationFactory);
1.511 + void RemoveApp(CApaAppHolder* aAppHolder);
1.512 + CApaDocument* CreateDocL(CApaApplication* aApp);
1.513 + CApaAppHolder* FindAppInListL(const TDesC& aAppFileName,TUid aUid)const; // returns NULL if not in list
1.514 + void DeleteAllDocs();
1.515 + void MarkApplicationForRemoval(const CApaApplication* aApp);
1.516 + static void DoReadRootStreamL(CStreamDictionary& aStreamDictionary, const CFileStore& aStore);
1.517 +private:
1.518 + CArrayFixFlat<TApaAppHolderInfo>* iAppList; // array of apps in use
1.519 + CArrayFixFlat<CApaDocument*>* iDocList; // array of documents (1 main + n embedded)
1.520 + CApaDocument* iMainDoc;
1.521 + HBufC* iMainDocFileName;
1.522 + RFs iFsSession; // file server session for doc store
1.523 + CIdle* iApplicationRemover;
1.524 + CApaParentProcessMonitor* iMonitor;
1.525 + TInt iCApaProcess_Reserved1;
1.526 + };
1.527 +
1.528 +
1.529 +class MApaEmbeddedDocObserver
1.530 +/** An interface class for handling the completion of the editing of an embedded
1.531 +document.
1.532 +
1.533 +@publishedAll
1.534 +@released
1.535 +@see CApaDocument::EditL() */
1.536 + {
1.537 +public:
1.538 + /** Defines the state of the embedded document on completion of editing. */
1.539 + enum TExitMode {
1.540 + /** Changes to the embedded document must be saved. */
1.541 + EKeepChanges,
1.542 + /** Reverts back to the saved version of the embedded document, i.e. reloads the
1.543 + whole document. */
1.544 + ERevertToSaved,
1.545 + /** No changes have been made to the embedded document. */
1.546 + ENoChanges,
1.547 + /** The embedded document is empty. */
1.548 + EEmpty
1.549 + };
1.550 +public:
1.551 + /** Implements the required behaviour when the editing of an embedded document completes.
1.552 +
1.553 + @param aMode Indicates the state of the document. */
1.554 + virtual void NotifyExit(TExitMode aMode)=0; // called on completion of editing of an embedded document
1.555 +protected:
1.556 + IMPORT_C MApaEmbeddedDocObserver();
1.557 +private:
1.558 + IMPORT_C virtual void MApaEmbeddedDocObserver_Reserved1();
1.559 + IMPORT_C virtual void MApaEmbeddedDocObserver_Reserved2();
1.560 +private:
1.561 + TInt iMApaEmbeddedDocObserver_Reserved1;
1.562 + };
1.563 +
1.564 +
1.565 +//// inlines ////
1.566 +inline CApaApplication* CApaDocument::Application()const
1.567 +/** Returns a pointer to the application that created the document.
1.568 +
1.569 +@return A pointer to the document's associated application. */
1.570 + { return iApplication; }
1.571 +
1.572 +inline CApaProcess* CApaDocument::Process()const
1.573 +/** Returns a pointer to the application process associated with this document.
1.574 +
1.575 +@return A pointer to the application process associated with this document. */
1.576 + { return iApaProcess; }
1.577 +
1.578 +inline TBool CApaDocument::TCapability::CanDrawGlass()const
1.579 +/** Tests whether the document supports being embedded as a glass door.
1.580 +
1.581 +@return True if embedding as a glass door is supported; false otherwise. */
1.582 + { return iCapability&ECanDrawGlass; }
1.583 +
1.584 +inline TBool CApaDocument::TCapability::CanPrint()const
1.585 +/** Tests whether the document supports being printed without using the full application
1.586 +UI.
1.587 +
1.588 +@return True, if printing is supported; false, otherwise. */
1.589 + { return iCapability&ECanPrint; }
1.590 +
1.591 +inline void CApaDocument::TCapability::SetCanDrawGlass()
1.592 +/** Sets the document as being capable of being embedded as a glass door. */
1.593 + { iCapability = iCapability|ECanDrawGlass; }
1.594 +
1.595 +inline void CApaDocument::TCapability::SetCanPrint()
1.596 +/** Sets the document as being capable of being printed without using the full application
1.597 +UI. */
1.598 + { iCapability = iCapability|ECanPrint; }
1.599 +
1.600 +inline RFs& CApaProcess::FsSession()const
1.601 +/** Returns a handle to the file server session used by this application process.
1.602 +
1.603 +@return The file server session. */
1.604 + { return (RFs&)iFsSession; } //lint !e1536 Exposing low access member - Kept for backward BC
1.605 +
1.606 +inline CApaDocument* CApaProcess::MainDocument()const
1.607 +/** Returns a pointer to the main document.
1.608 +
1.609 +@return A pointer to the main document. */
1.610 + { return iMainDoc; }
1.611 +
1.612 +#endif