|
1 /* |
|
2 * Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Tfx parser. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __TFXCONFIGPARSER__H__ |
|
20 #define __TFXCONFIGPARSER__H__ |
|
21 |
|
22 #include <xml/parser.h> |
|
23 #include <xml/contenthandler.h> |
|
24 #include <mtransitionservercontroller.h> |
|
25 #include <mtransitionserver.h> |
|
26 |
|
27 using namespace Xml; |
|
28 class CTFXConfigParser; |
|
29 |
|
30 const TInt KBaseSkinParserLeave = -1000; |
|
31 |
|
32 void StartSrvAndRegisterTransitionsL(const TDesC& aSkinExtensionFilename, |
|
33 MTransitionServer* aTransSrv, |
|
34 MTransitionServerController* aTransSrvCtrl, |
|
35 CTFXConfigParser* aConfigParser, |
|
36 TBool aSkipSrvStart = EFalse ); |
|
37 |
|
38 enum TTFxParserState |
|
39 { |
|
40 EStateParsingNone, |
|
41 EStateParsingFs, |
|
42 EStateParsingCtrl, |
|
43 EStateParsingList |
|
44 }; |
|
45 |
|
46 NONSHARABLE_CLASS(CTFxEffect) : public CBase |
|
47 { |
|
48 public: |
|
49 CTFxEffect(); |
|
50 ~CTFxEffect(); |
|
51 const TDesC& Name(); |
|
52 const TDesC& Filename(); |
|
53 TInt WantedTime(); |
|
54 TInt MinTime(); |
|
55 TInt CachePriority(); |
|
56 TInt PathIndex(); |
|
57 void SetName(const TDesC8& aName); |
|
58 void SetFilename(const TDesC8& aFilename); |
|
59 void SetWantedTime(const TDesC8& aTime); |
|
60 void SetMinTime(const TDesC8& aTime); |
|
61 void SetCachePriority(const TDesC8& aPriority); |
|
62 void SetPathIndex(TInt aIndex); |
|
63 void SetMaxCacheSize(TInt aSize); |
|
64 void SetMaxTransCacheSize(TInt aSize); |
|
65 TInt MaxCacheSize(); |
|
66 TInt MaxTransCacheSize(); |
|
67 private: |
|
68 HBufC* iName; |
|
69 HBufC* iFilename; |
|
70 TInt iWantedTime; |
|
71 TInt iMinTime; |
|
72 TInt iCachePriority; |
|
73 TInt iPathIndex; |
|
74 TInt iMaxCacheSize; |
|
75 TInt iMaxTransCacheSize; |
|
76 }; |
|
77 |
|
78 NONSHARABLE_CLASS(CTFxTransition) : public CBase |
|
79 { |
|
80 public: |
|
81 CTFxTransition(); |
|
82 ~CTFxTransition(); |
|
83 TInt ContextId(); |
|
84 const TDesC& EffectName(); |
|
85 const TUid Uid(); |
|
86 TInt Type(); |
|
87 void SetUid(const TDesC8& aUid); |
|
88 void SetContextId(const TDesC8& iId); |
|
89 void SetEffectNameL(const TDesC8& aEffect); |
|
90 void SetEffect(CTFxEffect* aEffect); |
|
91 void SetType(const TDesC8& aType ); |
|
92 CTFxEffect* Effect(); |
|
93 private: |
|
94 TInt iContextId; |
|
95 HBufC* iEffectName; |
|
96 TUid iUid; |
|
97 // not owned |
|
98 CTFxEffect* iEffect; |
|
99 TInt iType; |
|
100 }; |
|
101 |
|
102 NONSHARABLE_CLASS(CTFxCtrlTransition) : public CBase |
|
103 { |
|
104 public: |
|
105 CTFxCtrlTransition(); |
|
106 ~CTFxCtrlTransition(); |
|
107 const TUid ContextUid(); |
|
108 void SetContextUidL(const TDesC8& aUid); |
|
109 const TDesC& EffectName(); |
|
110 void SetEffectNameL(const TDesC8& aEffect); |
|
111 void SetActionStringL(const TDesC8& aActionStr); |
|
112 const TDesC& ActionString(); |
|
113 void SetActionL(const TDesC8& aAction); |
|
114 TInt Action(); |
|
115 CTFxEffect* Effect(); |
|
116 void SetEffect(CTFxEffect* aEffect); |
|
117 void SetKmlRegistrationStatus(TBool aStatus); |
|
118 TBool KmlRegistrationStatus(); |
|
119 private: |
|
120 HBufC* iEffectName; |
|
121 HBufC* iActionString; |
|
122 TInt iAction; |
|
123 TUid iContextUid; |
|
124 CTFxEffect* iEffect; |
|
125 TBool iKmlRegistrationStatus; |
|
126 }; |
|
127 |
|
128 NONSHARABLE_CLASS(CTFXConfigParser) : public CBase, public MContentHandler |
|
129 { |
|
130 public: |
|
131 enum TConfigFileType |
|
132 { |
|
133 EConfigFileUndefined, |
|
134 EConfigFileManifest, |
|
135 EConfigFileSel |
|
136 }; |
|
137 |
|
138 static CTFXConfigParser* NewL(); |
|
139 void ParseL(const TDesC& aFilename); |
|
140 ~CTFXConfigParser(); |
|
141 |
|
142 RPointerArray<CTFxTransition>* FsTransitionArrayL(); |
|
143 RPointerArray<CTFxCtrlTransition>* CtrlTransitionArrayL(); |
|
144 RPointerArray<CTFxTransition>* ListTransitionArrayL(); |
|
145 const TDesC& KmlBasePath(TInt aIndex); |
|
146 const TDesC& BaseSkinSelFile() const; |
|
147 |
|
148 // from contenthandler |
|
149 |
|
150 void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode); |
|
151 void OnEndDocumentL(TInt aErrorCode); |
|
152 void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode); |
|
153 void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode); |
|
154 void OnContentL(const TDesC8& aBytes, TInt aErrorCode); |
|
155 void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode); |
|
156 void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); |
|
157 void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); |
|
158 void OnSkippedEntityL(const RString& aName, TInt aErrorCode); |
|
159 void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode); |
|
160 void OnError(TInt aErrorCode); |
|
161 TAny* GetExtendedInterface(const TInt32 aUid); |
|
162 private: |
|
163 void OnMfStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode); |
|
164 void OnSelStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode); |
|
165 void OnMfEndElementL(const RTagInfo& aElement, TInt aErrorCode); |
|
166 void OnSelEndElementL(const RTagInfo& aElement, TInt aErrorCode); |
|
167 void SetMaxTransCacheSizeL(const TDesC8& aCacheSize); |
|
168 void SetMaxCacheSizeL(const TDesC8& aCacheSize); |
|
169 |
|
170 protected: |
|
171 CTFXConfigParser(); |
|
172 void ConstructL(); |
|
173 |
|
174 private: |
|
175 CParser* iParser; |
|
176 TConfigFileType iFileType; |
|
177 |
|
178 RPointerArray<CTFxEffect>* iFsEffectArray; |
|
179 CTFxEffect* iCurrentEffect; |
|
180 |
|
181 CTFxTransition* iCurrentTransition; |
|
182 CTFxCtrlTransition* iCurrentCtrlTransition; |
|
183 |
|
184 RPointerArray<CTFxTransition>* iFsTransitionArray; |
|
185 RPointerArray<CTFxCtrlTransition>* iCtrlTransitionArray; |
|
186 RPointerArray<CTFxTransition>* iListTransitionArray; |
|
187 RPointerArray<HBufC>* iEffectDefPathArray; |
|
188 |
|
189 TBool iManifestParsed; |
|
190 TBool iExtensionParsed; |
|
191 |
|
192 TTFxParserState iParserState; |
|
193 |
|
194 TInt iMaxCacheSize; |
|
195 TInt iMaxTransCacheSize; |
|
196 TFileName iBaseSkinSelFile; |
|
197 }; |
|
198 |
|
199 #endif |