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