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