|
1 /* |
|
2 * Copyright (c) 2007-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: image provider for image file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef HNATTRIMGPROVSVGIMAGE_H_ |
|
20 #define HNATTRIMGPROVSVGIMAGE_H_ |
|
21 |
|
22 #include "hnattrimgprovider.h" |
|
23 |
|
24 class CSvgEngineInterfaceImpl; |
|
25 |
|
26 /** |
|
27 * Image provider class for empty image. |
|
28 * Image provider specialization that loads image |
|
29 * from an image file path. |
|
30 * |
|
31 * @lib hnpresentationmodel |
|
32 * @since S60 5.0 |
|
33 * @ingroup group_hnpresentationmodel |
|
34 */ |
|
35 NONSHARABLE_CLASS( CHnAttrImgProvSvgImage ): |
|
36 public CHnAttrImgProvider, |
|
37 public MSvgRequestObserver |
|
38 { |
|
39 public: |
|
40 |
|
41 /** |
|
42 * Two-phase constructor. |
|
43 * |
|
44 * @since S60 5.0 |
|
45 * @param aFileName Image file name. |
|
46 * @return Fully constructed object. |
|
47 */ |
|
48 IMPORT_C static CHnAttrImgProvSvgImage* NewL( const TDesC& aFileName ); |
|
49 |
|
50 /** |
|
51 * Two-phase constructor. |
|
52 * |
|
53 * @since S60 5.0 |
|
54 * @param aFileName Image file name. |
|
55 * @return Fully constructed object. |
|
56 */ |
|
57 IMPORT_C static CHnAttrImgProvSvgImage* NewLC( const TDesC& aFileName ); |
|
58 |
|
59 /** |
|
60 * Virtual destructor. |
|
61 * |
|
62 * @since S60 5.0 |
|
63 */ |
|
64 virtual ~CHnAttrImgProvSvgImage(); |
|
65 |
|
66 /** |
|
67 * Gets icon. |
|
68 * |
|
69 * @since S60 5.0 |
|
70 * @param aDesiredSize Desired size of the icon. |
|
71 * @return Icon as a CGulIcon pointer. |
|
72 */ |
|
73 CGulIcon* GetIcon( TSize *aDesiredIconSize ); |
|
74 |
|
75 /** |
|
76 * Gets icon holder which contains the icon that GetIcon returns. |
|
77 * |
|
78 * @param aDesiredSize Desired size of the icon. |
|
79 * @return icon hoder that contains the icon (may return NULL). |
|
80 */ |
|
81 CHnIconHolder* GetIconHolder( TSize* aDesiredIconSize ); |
|
82 |
|
83 |
|
84 private: |
|
85 |
|
86 /** |
|
87 * Renders the icon. |
|
88 * |
|
89 * @since S60 5.0 |
|
90 * @param aDesiredSize Desired size of the icon. |
|
91 * @return Error code. |
|
92 */ |
|
93 TInt RenderIcon( TSize aDesiredIconSize ); |
|
94 |
|
95 /** |
|
96 * Defualt constructor. |
|
97 * |
|
98 * @since S60 5.0 |
|
99 */ |
|
100 CHnAttrImgProvSvgImage(); |
|
101 |
|
102 /** |
|
103 * Standard symbian 2nd phase constructor. |
|
104 * |
|
105 * @since S60 5.0 |
|
106 * @param aFileName Image file name. |
|
107 */ |
|
108 void ConstructL( const TDesC& aFileName ); |
|
109 |
|
110 public : //from MSvgRequestObserver |
|
111 |
|
112 /** |
|
113 * @see MSvgRequestObserver:UpdateScreen |
|
114 */ |
|
115 void UpdateScreen(); |
|
116 |
|
117 /** |
|
118 * @see MSvgRequestObserver:MSvgRequestObserver |
|
119 */ |
|
120 TBool ScriptCall( const TDesC& aScript, CSvgElementImpl* aCallerElement ); |
|
121 |
|
122 /** |
|
123 * @see MSvgRequestObserver:FetchImage |
|
124 */ |
|
125 TInt FetchImage( const TDesC& aUri, RFs& aSession, RFile& aFileHandle ); |
|
126 |
|
127 /** |
|
128 * @see MSvgRequestObserver:FetchFont |
|
129 */ |
|
130 TInt FetchFont( const TDesC& aUri, RFs& aSession, RFile& aFileHandle ); |
|
131 |
|
132 /** |
|
133 * @see MSvgRequestObserver:UpdatePresentation |
|
134 */ |
|
135 void UpdatePresentation(const TInt32& aNoOfAnimation); |
|
136 |
|
137 private: // data |
|
138 |
|
139 /** |
|
140 * Bitmap. Not Own. GulIcon takes ownership. |
|
141 */ |
|
142 CFbsBitmap* iBitmap; |
|
143 |
|
144 /** |
|
145 * Mask. Not Own. GulIcon takes ownership. |
|
146 */ |
|
147 CFbsBitmap* iMask; |
|
148 |
|
149 /** |
|
150 * Mask. Own. Dummy for the engine. |
|
151 */ |
|
152 CFbsBitmap* iDummyBitmap; |
|
153 |
|
154 /** |
|
155 * SVG Engine instance |
|
156 */ |
|
157 CSvgEngineInterfaceImpl* iSvgEngine; |
|
158 |
|
159 /** |
|
160 * Handle to the svg dom tree. |
|
161 */ |
|
162 TInt iHandle; |
|
163 |
|
164 }; |
|
165 |
|
166 #endif // HNATTRIMGPROVSVGIMAGE_H_ |
|
167 |