williamr@4: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@4: // All rights reserved. williamr@4: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@4: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: // williamr@4: // Initial Contributors: williamr@4: // Nokia Corporation - initial contribution. williamr@4: // williamr@4: // Contributors: williamr@4: // williamr@4: // Description: williamr@4: // The main startup of the AppArc server williamr@4: // williamr@4: // apaapp.h williamr@4: // williamr@4: williamr@4: #ifndef __APAAPP_H__ williamr@4: #define __APAAPP_H__ williamr@4: williamr@4: #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS williamr@4: #if !defined(__APAID_PARTNER_H__) williamr@4: #include "apaidpartner.h" williamr@4: #endif williamr@4: #endif //SYMBIAN_ENABLE_SPLIT_HEADERS williamr@4: #include williamr@4: #include williamr@4: #include williamr@4: #include williamr@4: williamr@4: class CApaApplication; williamr@4: class CApaDocument; williamr@4: class CApaProcess; williamr@4: class CDictionaryStore; williamr@4: class CImplementationInformation; williamr@4: class CApaAppServer; williamr@4: williamr@4: williamr@4: /** Defines the basic behaviour for applications. williamr@4: williamr@4: The class defines the basic twin roles of an application class as a factory williamr@4: that creates concrete document objects, and as a supplier of utility functions williamr@4: not specific to any particular instance of a document. For example, returning williamr@4: an application's caption, or accessing its .ini file. williamr@4: williamr@4: The class is derived from by the UI framework and is further derived from williamr@4: by the UI application. williamr@4: williamr@4: @publishedAll williamr@4: @released williamr@4: @see CEikApplication */ williamr@4: class CApaApplication : public CBase williamr@4: // base class for applications; allows creation of documents & file stores + display of app icon and name. williamr@4: { williamr@4: public: williamr@4: /** Completes construction of this application object. williamr@4: williamr@4: The function is called after an instance of a derived class has been successfully williamr@4: created using the ordinal 1 function of the application DLL. williamr@4: williamr@4: After calling this function, an application can create document objects. williamr@4: williamr@4: An implementation of this function is supplied by the UI framework. williamr@4: williamr@4: @see CEikApplication */ williamr@4: virtual void PreDocConstructL() = 0; // call once before creating document williamr@4: williamr@4: /** Creates a document object. williamr@4: williamr@4: The function is called by the application process when a new document is required. williamr@4: The application process adds the new document to its list of documents. williamr@4: williamr@4: An implementation of this function is supplied by the UI framework. williamr@4: williamr@4: @param aProcess A pointer to the process associated with the application. williamr@4: @return A pointer to the newly created document. williamr@4: @see CApaProcess::AddNewDocumentL() */ williamr@4: virtual CApaDocument* CreateDocumentL(CApaProcess* aProcess) = 0; williamr@4: williamr@4: /** Gets the application specific UID. williamr@4: williamr@4: The UID is used to differentiate between UI applications. williamr@4: williamr@4: An implementation of this function must be supplied by the UI application. williamr@4: williamr@4: @return The application specific UID. */ williamr@4: virtual TUid AppDllUid() const = 0; williamr@4: public: // utility functions williamr@4: IMPORT_C static TInt GenerateFileName(RFs& aFs, TFileName& aRootName); williamr@4: IMPORT_C CDictionaryStore* OpenIniFileL(RFs& aFs) const; williamr@4: williamr@4: /** Opens the .ini file associated with the application, constructs the dictionary williamr@4: store object, returns a pointer to it and puts the pointer onto the cleanupstack. williamr@4: williamr@4: The .ini file must be created, if it does not already exist. williamr@4: williamr@4: An implementation of this function is supplied by the UI framework. williamr@4: williamr@4: @param aFs Handle to a file server session williamr@4: @return A pointer to the dictionary store object that represents the application's .ini file. williamr@4: @see CEikApplication */ williamr@4: virtual CDictionaryStore* OpenIniFileLC(RFs& aFs) const = 0; williamr@4: public: // enquiry functions williamr@4: IMPORT_C virtual TFileName AppFullName() const; // returns the full path and name of the app williamr@4: /** Returns the capabilities of the application. williamr@4: williamr@4: Application capability information is represented by an instance of a TApaAppCapability williamr@4: object wrapped in a packaged modifiable buffer descriptor. williamr@4: williamr@4: The function is called from a number of places within the application framework. williamr@4: williamr@4: An implementation of this function is supplied by the UI framework. williamr@4: williamr@4: @param aInfo A packaged modifiable buffer descriptor (a TPckgBuf), encapsulating williamr@4: a TApaAppCapability object. williamr@4: @see CEikApplication williamr@4: @see TApaAppCapability williamr@4: @see TPckgBuf */ williamr@4: virtual void Capability(TDes8& aInfo) const = 0; williamr@4: public: // accessor function williamr@4: IMPORT_C TFileName DllName() const; williamr@4: IMPORT_C ~CApaApplication(); williamr@4: IMPORT_C virtual void NewAppServerL(CApaAppServer*& aAppServer); williamr@4: protected: williamr@4: IMPORT_C CApaApplication(); williamr@4: public: // internal use only williamr@4: void SetAppFileNameRef(const RBuf& aFileName); williamr@4: private: williamr@4: IMPORT_C virtual void CApaApplication_Reserved1(); williamr@4: IMPORT_C virtual void CApaApplication_Reserved2(); williamr@4: private: williamr@4: const RBuf* iAppFileNameRef; // not owned williamr@4: TUid iEComDtorKey; williamr@4: // friend class CApaProcess; williamr@4: friend class TApaApplicationFactory; // so that it can access iDtorKey williamr@4: private: williamr@4: TInt iCApaApplication_Reserved1; williamr@4: }; williamr@4: williamr@4: williamr@4: /** Encapsulates the functionality of creating an application, whether it be via a factory function williamr@4: or an ECOM plugin. Instances of this class can usually be created implicitly when required as williamr@4: function parameters - just specify the function pointer, ECOM plugin UID or CImplementationInformation williamr@4: reference. williamr@4: williamr@4: @publishedAll williamr@4: @released williamr@4: @see CApaProcess williamr@4: @see EikStart */ williamr@4: class TApaApplicationFactory williamr@4: { williamr@4: public: williamr@4: typedef CApaApplication* (*TFunction)(); williamr@4: public: williamr@4: IMPORT_C TApaApplicationFactory(); williamr@4: IMPORT_C TApaApplicationFactory(TFunction aFunction); williamr@4: IMPORT_C TApaApplicationFactory(const CImplementationInformation& aEmbeddedApplicationInformation); williamr@4: IMPORT_C TApaApplicationFactory(TUid aEmbeddedApplicationUid); williamr@4: CApaApplication* CreateApplicationL() const; williamr@4: HBufC* AppFileNameL() const; williamr@4: TUid AppFileUid() const; williamr@4: private: williamr@4: enum TType williamr@4: { williamr@4: ETypeFunction, // if iType is this, iData is a TFunction williamr@4: ETypeEmbeddedApplicationInformation, // if iType is this, iData is an ECOM CImplementationInformation williamr@4: ETypeEmbeddedApplicationUid // if iType is this, iData is an ECOM implementation TUid williamr@4: }; williamr@4: private: williamr@4: static CApaApplication* CreateEmbeddedApplicationL(TUid aUid); williamr@4: static HBufC* EmbeddedApplicationDisplayNameLC(TUid aUid); williamr@4: static HBufC* FullAppFileNameL(const TDesC& aAppName); williamr@4: static void CleanupImplementationArray(TAny* aImplementationArray); williamr@4: private: williamr@4: TType iType; williamr@4: TUint iData; williamr@4: mutable CApaApplication* iApplication; // used to be iSpare1 williamr@4: TInt iSpare2; williamr@4: }; williamr@4: williamr@4: williamr@4: #endif // __APAAPP_H__