1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
10 // |
10 // |
11 // Contributors: |
11 // Contributors: |
12 // |
12 // |
13 // Description: |
13 // Description: |
|
14 // apgdoor.h |
14 // |
15 // |
15 |
16 |
16 #ifndef __APGDOOR_H__ |
17 #ifndef __APGDOOR_H__ |
17 #define __APGDOOR_H__ |
18 #define __APGDOOR_H__ |
18 |
19 |
19 #if !defined(__E32STD_H__) |
|
20 #include <e32std.h> |
20 #include <e32std.h> |
21 #endif |
|
22 #if !defined(__E32BASE_H__) |
|
23 #include <e32base.h> |
21 #include <e32base.h> |
24 #endif |
|
25 #if !defined(__S32STD_H__) |
|
26 #include <s32std.h> |
22 #include <s32std.h> |
27 #endif |
|
28 #if !defined(__GDI_H__) |
|
29 #include <gdi.h> |
23 #include <gdi.h> |
30 #endif |
|
31 #if !defined(__APPARC_H__) |
|
32 #include <apparc.h> |
24 #include <apparc.h> |
33 #endif |
|
34 #if !defined(__APADBASE_H__) |
|
35 #include <apadbase.h> |
25 #include <apadbase.h> |
36 #endif |
|
37 |
26 |
|
27 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
38 /** |
28 /** |
39 @internalAll |
29 @internalAll |
40 */ |
30 */ |
41 #ifdef _UNICODE |
31 const TUid KUidApaDoorDocStream={0x10003A35}; |
42 #define KUidApaDoorDocStream KUidApaDoorDocStream16 |
|
43 #else |
|
44 #define KUidApaDoorDocStream KUidApaDoorDocStream8 |
|
45 #endif |
|
46 |
32 |
47 /** |
33 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
48 @internalComponent |
34 // classes referenced |
49 @deprecated |
35 class CEmbeddedStore; |
50 */ |
|
51 const TUid KUidApaDoorDocStream8={0x10000144}; |
|
52 |
36 |
53 /** |
|
54 @internalComponent |
|
55 */ |
|
56 const TUid KUidApaDoorDocStream16={0x10003A35}; |
|
57 |
|
58 // classes defined: |
|
59 class CApaDoor; |
|
60 class TApaPictureFactory; |
|
61 // |
|
62 // classes referenced: |
|
63 class CEmbeddedStore; |
|
64 // |
|
65 |
|
66 class CApaDoor : public CApaDoorBase |
|
67 /** A wrapper for an embedded document that can be displayed in a user interface |
37 /** A wrapper for an embedded document that can be displayed in a user interface |
68 as an icon or a glass door. |
38 as an icon or a glass door. |
69 |
39 |
70 @publishedAll |
40 @publishedAll |
71 @released */ |
41 @released */ |
|
42 class CApaDoor : public CApaDoorBase |
72 { |
43 { |
73 public: |
44 public: |
74 IMPORT_C static CApaDoor* NewLC(RFs& aFs, CApaDocument& aDoc,const TSize& aDefaultIconSizeInTwips); // call to create a new door in iconic format - restoration is achieved with TApaPictureFactory |
45 IMPORT_C static CApaDoor* NewLC(RFs& aFs, CApaDocument& aDoc,const TSize& aDefaultIconSizeInTwips); // call to create a new door in iconic format - restoration is achieved with TApaPictureFactory |
75 IMPORT_C static CApaDoor* NewL(RFs& aFs, CApaDocument& aDoc,const TSize& aDefaultIconSizeInTwips); // call to create a new door in iconic format - restoration is achieved with TApaPictureFactory |
46 IMPORT_C static CApaDoor* NewL(RFs& aFs, CApaDocument& aDoc,const TSize& aDefaultIconSizeInTwips); // call to create a new door in iconic format - restoration is achieved with TApaPictureFactory |
76 IMPORT_C static CApaDoor* NewL(RFs& aFs, const CStreamStore& aStore,TStreamId aStreamId,CApaProcess& aProcess); // restoring constructor called by TApaPictureFactory |
47 IMPORT_C static CApaDoor* NewL(RFs& aFs, const CStreamStore& aStore,TStreamId aStreamId,CApaProcess& aProcess); // restoring constructor called by TApaPictureFactory |
77 // |
48 |
78 IMPORT_C void SetFormatToIconL(); |
49 IMPORT_C void SetFormatToIconL(); |
79 IMPORT_C void SetFormatToGlassL(); |
50 IMPORT_C void SetFormatToGlassL(); |
80 IMPORT_C void SetFormatToTemporaryIconL(TBool aEnabled=ETrue); |
51 IMPORT_C void SetFormatToTemporaryIconL(TBool aEnabled=ETrue); |
81 // |
52 |
82 IMPORT_C CApaDocument* DocumentL(TBool aCheckPassword=EFalse); // returns a pointer to the doc, restoring it if necessary. Checks password if required. |
53 IMPORT_C CApaDocument* DocumentL(TBool aCheckPassword=EFalse); // returns a pointer to the doc, restoring it if necessary. Checks password if required. |
83 inline TDesC* Caption()const; |
54 inline TDesC* Caption()const; |
84 IMPORT_C TUid AppUidL()const; |
55 IMPORT_C TUid AppUidL()const; |
85 // |
|
86 // persistence methods |
56 // persistence methods |
87 IMPORT_C void RestoreL(const CStreamStore& aStore,TStreamId aHeadStreamId); |
57 IMPORT_C void RestoreL(const CStreamStore& aStore,TStreamId aHeadStreamId); |
88 TStreamId StoreL(CStreamStore& aStore) const; |
58 TStreamId StoreL(CStreamStore& aStore) const; |
89 // |
59 |
90 IMPORT_C ~CApaDoor(); |
60 IMPORT_C ~CApaDoor(); |
91 // |
61 public: // from CPicture |
92 // from CPicture |
62 void Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect, MGraphicsDeviceMap* aMap)const; // draws according to current iPicFormat |
93 void Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect, |
|
94 MGraphicsDeviceMap* aMap)const; // draws according to current iPicFormat |
|
95 void DetachFromStoreL(TDetach aDegree=EDetachFull); //lint !e1735 Virtual function has default parameter - Must use the same default as declared by CPicture |
63 void DetachFromStoreL(TDetach aDegree=EDetachFull); //lint !e1735 Virtual function has default parameter - Must use the same default as declared by CPicture |
96 void GetOriginalSizeInTwips(TSize& aSize)const; |
64 void GetOriginalSizeInTwips(TSize& aSize)const; |
97 void SetScaleFactor(TInt aScaleFactorWidth,TInt aScaleFactorHeight); |
65 void SetScaleFactor(TInt aScaleFactorWidth,TInt aScaleFactorHeight); |
98 void SetCropInTwips(const TMargins& aMargins); |
66 void SetCropInTwips(const TMargins& aMargins); |
99 TPictureCapability Capability() const; |
67 TPictureCapability Capability() const; |
102 TInt ScaleFactorHeight() const; |
70 TInt ScaleFactorHeight() const; |
103 private: |
71 private: |
104 CApaDoor(RFs& aFs, CApaProcess& aProcess); |
72 CApaDoor(RFs& aFs, CApaProcess& aProcess); |
105 CApaDoor(RFs& aFs, CApaDocument& aDoc,const TSize& aDefaultIconSizeInTwips); |
73 CApaDoor(RFs& aFs, CApaDocument& aDoc,const TSize& aDefaultIconSizeInTwips); |
106 void ConstructL(); |
74 void ConstructL(); |
107 // |
75 |
108 void SetIconSizeInTwips(TSize aSize); // for use of factory |
76 void SetIconSizeInTwips(TSize aSize); // for use of factory |
109 // |
77 |
110 void StoreDocL(CPersistentStore& aStore)const; |
78 void StoreDocL(CPersistentStore& aStore)const; |
111 void RestoreDocL(const CPersistentStore& aStore); |
79 void RestoreDocL(const CPersistentStore& aStore); |
112 void RestoreDoorStateL(const CStreamStore& aStore,const CStreamDictionary& streamDic); |
80 void RestoreDoorStateL(const CStreamStore& aStore,const CStreamDictionary& streamDic); |
113 static CStreamDictionary* ReadStreamDictionaryLC(const CStreamStore& aStore,TStreamId aStreamId); |
81 static CStreamDictionary* ReadStreamDictionaryLC(const CStreamStore& aStore,TStreamId aStreamId); |
114 static void CopyStoreL(const CEmbeddedStore& aSourceStore,RWriteStream& aTargetStream); |
82 static void CopyStoreL(const CEmbeddedStore& aSourceStore,RWriteStream& aTargetStream); |
115 void ExternalizeStateStreamL(CStreamStore& aStore,CStreamDictionary& aStreamDict)const; |
83 void ExternalizeStateStreamL(CStreamStore& aStore,CStreamDictionary& aStreamDict)const; |
116 void InternalizeStateStreamL(const CStreamStore& aStore,const CStreamDictionary& aStreamDict,TSize aDefaultIconSize); |
84 void InternalizeStateStreamL(const CStreamStore& aStore,const CStreamDictionary& aStreamDict,TSize aDefaultIconSize); |
117 // |
85 |
118 // required so CPicture's can be swizzled |
86 // required so CPicture's can be swizzled |
119 void ExternalizeL(RWriteStream& aStream)const; |
87 void ExternalizeL(RWriteStream& aStream)const; |
120 // from CApaDoorBase |
88 private: // from CApaDoorBase |
121 virtual TSize GlassDoorSize()const; |
89 TSize GlassDoorSize()const; |
122 TUid AppUidFromStreamL() const; |
90 TUid AppUidFromStreamL() const; |
123 private: |
91 private: |
124 RFs& iFs; |
92 RFs& iFs; |
125 HBufC* iAppCaption; // name of the app used to create the embedded object |
93 HBufC* iAppCaption; // name of the app used to create the embedded object |
126 CApaProcess* iApaProcess; |
94 CApaProcess* iApaProcess; |
127 CApaDocument* iApaDoc; |
95 CApaDocument* iApaDoc; |
128 CPicture* iPicture; // the current view of the door, either iconic or glass |
96 CPicture* iPicture; // the current view of the door, either iconic or glass |
129 CEmbeddedStore* iStore; // store containing the doc |
97 CEmbeddedStore* iStore; // store containing the doc |
130 CBufSeg* iStoreHost; // the host for the embedded store, if the door has been detached from its originating store |
98 CBufSeg* iStoreHost; // the host for the embedded store, if the door has been detached from its originating store |
131 __MUTABLE TSize iIconSizeInTwips; |
99 mutable TSize iIconSizeInTwips; |
132 // |
100 private: |
133 friend class TApaPictureFactory; |
101 friend class TApaPictureFactory; |
134 }; |
102 }; |
135 |
103 |
136 |
104 |
137 class TApaPictureFactory : public MPictureFactory |
|
138 // Recognizes KUidPictureTypeDoor and creates CApaDoor pictures |
|
139 /** A factory class for instantiating and restoring an application's door. |
105 /** A factory class for instantiating and restoring an application's door. |
140 |
106 |
141 A door factory object is constructed by the UI environment and can be accessed |
107 A door factory object is constructed by the UI environment and can be accessed |
142 by calling CEikonEnv::PictureFactory(). |
108 by calling CEikonEnv::PictureFactory(). |
143 |
109 |
144 @publishedAll |
110 @publishedAll |
145 @released |
111 @released |
146 @see CEikonEnv::PictureFactory() |
112 @see CEikonEnv::PictureFactory() |
147 @see CApaDoor */ |
113 @see CApaDoor */ |
|
114 class TApaPictureFactory : public MPictureFactory |
|
115 // Recognizes KUidPictureTypeDoor and creates CApaDoor pictures |
148 { |
116 { |
149 public: |
117 public: |
150 IMPORT_C TApaPictureFactory(CApaProcess* aAppProcess); |
118 IMPORT_C TApaPictureFactory(CApaProcess* aAppProcess); |
151 inline void SetIconSize(TSize aIconSizeInTwips); |
119 inline void SetIconSize(TSize aIconSizeInTwips); |
152 // |
120 public: // from MPictureFactory |
153 // from MPictureFactory |
|
154 IMPORT_C void NewPictureL(TPictureHeader& aPictureHeader,const CStreamStore& aPictureStore)const; // used to create CApaDoor's during document restore only |
121 IMPORT_C void NewPictureL(TPictureHeader& aPictureHeader,const CStreamStore& aPictureStore)const; // used to create CApaDoor's during document restore only |
155 protected: |
122 protected: |
156 IMPORT_C TApaPictureFactory(); |
123 IMPORT_C TApaPictureFactory(); |
157 |
|
158 private: |
124 private: |
159 CApaProcess* iApaProcess; |
125 CApaProcess* iApaProcess; |
160 TSize iIconSize; |
126 TSize iIconSize; |
161 TInt iSpare; |
127 TInt iSpare; |
162 }; |
128 }; |
163 |
129 |
164 |
|
165 // |
130 // |
166 // inlines |
131 // inlines |
167 // |
132 // |
168 |
133 |
|
134 /** Gets the name of the application with which the embedded document is associated. |
|
135 @return A pointer to a descriptor containing the name of the application. */ |
169 inline TDesC* CApaDoor::Caption()const |
136 inline TDesC* CApaDoor::Caption()const |
170 /** Gets the name of the application with which the embedded document is associated. |
|
171 |
|
172 @return A pointer to a descriptor containing the name of the application. */ |
|
173 { return iAppCaption; } |
137 { return iAppCaption; } |
174 |
138 |
|
139 /** Sets the size of the icon. |
|
140 @param aIconSizeInTwips The size of the icon, in twips. */ |
175 inline void TApaPictureFactory::SetIconSize(TSize aIconSizeInTwips) |
141 inline void TApaPictureFactory::SetIconSize(TSize aIconSizeInTwips) |
176 /** Sets the size of the icon. |
|
177 |
|
178 @param aIconSizeInTwips The size of the icon, in twips. */ |
|
179 { iIconSize = aIconSizeInTwips; } |
142 { iIconSize = aIconSizeInTwips; } |
180 |
143 |
181 #endif |
144 #endif // __APGDOOR_H__ |