1 apaflrec.h |
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #if !defined(__APAFLREC_H__) |
|
17 #define __APAFLREC_H__ |
|
18 |
|
19 #if !defined(__APADEF_H__) |
|
20 #include <apadef.h> |
|
21 #endif |
|
22 #if !defined(__APAID_H__) |
|
23 #include <apaid.h> |
|
24 #endif |
|
25 |
|
26 // classes defined: |
|
27 class MApaAppStarter; |
|
28 class CApaAppLocator; |
|
29 class CApaFileRecognizer; |
|
30 class CApaFileRecognizerType; |
|
31 class CFileRecognizerExtension; |
|
32 // |
|
33 // classes referenced: |
|
34 class TApaAppEntry; |
|
35 class CApaCommandLine; |
|
36 class RFs; |
|
37 // |
|
38 |
|
39 // KUidFileRecognizer is UID[1] for app recognizer dll's (UID[2] identifies a particular identifier) |
|
40 /** |
|
41 @publishedAll |
|
42 @released |
|
43 */ |
|
44 #ifdef _UNICODE |
|
45 #define KUidFileRecognizer KUidFileRecognizer16 |
|
46 #else |
|
47 #define KUidFileRecognizer KUidFileRecognizer8 |
|
48 #endif |
|
49 |
|
50 /** |
|
51 @publishedAll |
|
52 @deprecated |
|
53 */ |
|
54 const TInt KFileRecognizerUidValue8=0x1000013E; |
|
55 |
|
56 /** |
|
57 @publishedAll |
|
58 @deprecated |
|
59 */ |
|
60 const TUid KUidFileRecognizer8={KFileRecognizerUidValue8}; |
|
61 |
|
62 /** |
|
63 @publishedAll |
|
64 @released |
|
65 */ |
|
66 const TUid KUidFileRecognizer16={0x10003A37}; |
|
67 // |
|
68 |
|
69 |
|
70 class CApaAppLocator : public CBase |
|
71 /** |
|
72 @internalComponent |
|
73 */ |
|
74 { |
|
75 public: |
|
76 virtual TInt GetAppEntryByUid(TApaAppEntry& aAppEntry,TUid aAppUid)=0; |
|
77 virtual TInt GetAppCapabilityByUid(TDes8& aCapabilityBuf,TUid aAppUid)=0; |
|
78 }; |
|
79 |
|
80 |
|
81 |
|
82 class CApaFileRecognizer : public CBase |
|
83 /** |
|
84 @internalComponent |
|
85 @deprecated |
|
86 */ |
|
87 { |
|
88 public: |
|
89 // |
|
90 IMPORT_C CApaFileRecognizerType* RecognizeFileL(const TDesC& aFullFileName,const TUidType* aUidType=NULL); |
|
91 IMPORT_C CApaAppLocator* AppLocator() const; |
|
92 // |
|
93 IMPORT_C ~CApaFileRecognizer(); |
|
94 protected: |
|
95 IMPORT_C CApaFileRecognizer(RFs& aFs); |
|
96 IMPORT_C void AddFileRecognizerType(CApaFileRecognizerType* aFileRecognizerType); |
|
97 IMPORT_C TInt RemoveFileRecognizerType(const CApaFileRecognizerType* aFileRecognizerType); |
|
98 IMPORT_C void SetAppLocator(CApaAppLocator* aAppLocator); // should be called by child-classes eg during construction |
|
99 static inline void SetAppStarter(CApaFileRecognizerType* aRecognizer,MApaAppStarter* aAppStarter); |
|
100 IMPORT_C void DestroyRecognizerList(); |
|
101 protected: |
|
102 RFs& iFs; |
|
103 CApaAppLocator* iAppLocator; |
|
104 private: |
|
105 CApaFileRecognizerType *iFileRecognizerList; |
|
106 }; |
|
107 |
|
108 |
|
109 |
|
110 class MApaAppStarter |
|
111 /** An interface used by the Application Architecture server to start applications. |
|
112 |
|
113 CEikonEnv is derived from this class. |
|
114 |
|
115 @publishedPartner |
|
116 @released |
|
117 @see CEikonEnv */ |
|
118 { |
|
119 public: |
|
120 virtual TThreadId StartAppL(const CApaCommandLine& aCommandLine)=0; |
|
121 protected: |
|
122 IMPORT_C MApaAppStarter(); |
|
123 private: |
|
124 IMPORT_C virtual void MApaAppStarter_Reserved1(); |
|
125 IMPORT_C virtual void MApaAppStarter_Reserved2(); |
|
126 private: |
|
127 TInt iMApaAppStarter_Reserved1; |
|
128 }; |
|
129 |
|
130 |
|
131 |
|
132 class CApaFileRecognizerType : public CBase |
|
133 /** |
|
134 @publishedPartner |
|
135 @deprecated |
|
136 */ |
|
137 { |
|
138 public: |
|
139 enum TRecognizedType {EProgram,EDoc,EOtherFile,ENotRecognized}; |
|
140 public: |
|
141 virtual TThreadId RunL(TApaCommand aCommand,const TDesC* aDocFileName,const TDesC8* aTailEnd) const=0; |
|
142 inline TThreadId RunL(TApaCommand aCommand, const TDesC* aDocFileName) const; |
|
143 inline TThreadId RunL(TApaCommand aCommand) const; |
|
144 inline TUid AppUid()const; |
|
145 inline TUid TypeUid()const; |
|
146 inline TRecognizedType Type()const; |
|
147 IMPORT_C void Capability(TDes8& aCapabilityBuf)const; |
|
148 IMPORT_C void Lock(); |
|
149 IMPORT_C void Unlock(); |
|
150 protected: |
|
151 IMPORT_C CApaFileRecognizerType(); |
|
152 IMPORT_C ~CApaFileRecognizerType(); |
|
153 IMPORT_C TThreadId AppRunL(const CApaCommandLine& aCommandLine) const; |
|
154 private: |
|
155 inline void SetAppStarter(MApaAppStarter* aAppStarter); // must be called before AppRunL() |
|
156 virtual TRecognizedType DoRecognizeFileL(RFs& aFs,TUidType aUidType)=0; |
|
157 TRecognizedType RecognizeFileL(RFs& aFs,const TDesC& aFullFileName,TUidType aUidType); |
|
158 TBool Locked()const; |
|
159 IMPORT_C virtual void Reserved_1(); |
|
160 public: |
|
161 IMPORT_C static CApaFileRecognizerType* CreateFileRecognizerL(TUid aImplUid); |
|
162 protected: |
|
163 CApaFileRecognizer* iFileRecognizer; |
|
164 MApaAppStarter* iAppStarter; |
|
165 HBufC* iFullFileName; |
|
166 TUid iFileType; // type UID of the recognizer file (ie UID[1]) |
|
167 TUid iAppUid; // UID of the associated app (ie UID[2]) |
|
168 TRecognizedType iRecognizedType; |
|
169 TApaAppCapabilityBuf* iCapabilityBuf; |
|
170 private: |
|
171 CApaFileRecognizerType* iNext; |
|
172 TInt iLock; |
|
173 CFileRecognizerExtension* iFileRecognizerExtn; |
|
174 private: |
|
175 friend class CApaFileRecognizer; |
|
176 }; |
|
177 |
|
178 |
|
179 // |
|
180 // inlines |
|
181 // |
|
182 |
|
183 inline void CApaFileRecognizer::SetAppStarter(CApaFileRecognizerType* aRecognizer,MApaAppStarter* aAppStarter) |
|
184 { aRecognizer->SetAppStarter(aAppStarter); } |
|
185 |
|
186 inline void CApaFileRecognizerType::SetAppStarter(MApaAppStarter* aAppStarter) |
|
187 { iAppStarter = aAppStarter; } |
|
188 |
|
189 inline TUid CApaFileRecognizerType::AppUid() const |
|
190 { return iAppUid; } |
|
191 |
|
192 inline TUid CApaFileRecognizerType::TypeUid() const |
|
193 { return iFileType; } |
|
194 |
|
195 inline CApaFileRecognizerType::TRecognizedType CApaFileRecognizerType::Type()const |
|
196 { return iRecognizedType; } |
|
197 |
|
198 inline TThreadId CApaFileRecognizerType::RunL(TApaCommand aCommand, const TDesC* aDocFileName) const |
|
199 /** Calls RunL(TApaCommand,const TDesC*,const TDesC8*) with NULL as third parameter. |
|
200 @see CApaFileRecognizerType::RunL(TApaCommand,const TDesC*,const TDesC8*) */ |
|
201 { return RunL(aCommand, aDocFileName, NULL); } |
|
202 |
|
203 inline TThreadId CApaFileRecognizerType::RunL(TApaCommand aCommand) const |
|
204 /** Calls RunL(TApaCommand,const TDesC*,const TDesC8*) with NULL as second and third parameter. |
|
205 @see CApaFileRecognizerType::RunL(TApaCommand,const TDesC*,const TDesC8*) */ |
|
206 { return RunL(aCommand, NULL, NULL); } |
|
207 |
|
208 #endif |