|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Phonebook contact item field embedded thumbnail reader. |
|
16 * Reads an database-embedded picture from a field. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef __CPbkEmbeddedThumbnail_H__ |
|
22 #define __CPbkEmbeddedThumbnail_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #include "CPbkThumbnailReaderBase.h" |
|
26 #include "CPbkThumbnailWriterBase.h" |
|
27 |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class TPbkContactItemField; |
|
31 class TPbkImageLoadParameters; |
|
32 class CPbkFFSCheck; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * Phonebook contact item field embedded thumbnail reader. |
|
38 * Reads an database-embedded picture from a field. |
|
39 */ |
|
40 NONSHARABLE_CLASS(CPbkEmbeddedThumbnailReader) : |
|
41 public CPbkThumbnailReaderBase |
|
42 { |
|
43 public: // interface |
|
44 /** |
|
45 * Creates a new instance of this class. |
|
46 * |
|
47 * @param aField field to read the thumbnail from. |
|
48 * @param aObserver observer to notify about progress of this |
|
49 * operation. |
|
50 */ |
|
51 static CPbkEmbeddedThumbnailReader* NewLC |
|
52 (const TPbkContactItemField& aField, |
|
53 MPbkThumbnailGetObserver& aObserver); |
|
54 |
|
55 /** |
|
56 * Destructor. Cancels any previously executing read operation and |
|
57 * destroys this object. |
|
58 */ |
|
59 ~CPbkEmbeddedThumbnailReader(); |
|
60 |
|
61 public: // from MPbkThumbnailReader |
|
62 void StartReadL(const TPbkImageLoadParameters* aParameters = NULL); |
|
63 |
|
64 private: // implementation |
|
65 CPbkEmbeddedThumbnailReader |
|
66 (const TPbkContactItemField& aField, |
|
67 MPbkThumbnailGetObserver& aObserver); |
|
68 void ConstructL(); |
|
69 |
|
70 private: // data members |
|
71 /// Ref: Contact item field |
|
72 const TPbkContactItemField& iField; |
|
73 }; |
|
74 |
|
75 |
|
76 /** |
|
77 * Phonebook contact item field embedded thumbnail reader. |
|
78 * Reads an database-embedded thumbnail image from a field. |
|
79 */ |
|
80 NONSHARABLE_CLASS(CPbkEmbeddedThumbnailImageReader) : |
|
81 public CPbkThumbnailImageReaderBase |
|
82 { |
|
83 public: // Interface |
|
84 /** |
|
85 * Creates a new instance of this class. |
|
86 * |
|
87 * @param aField field to read the thumbnail image from. |
|
88 * @param aObserver observer to notify about progress of this |
|
89 * operation. |
|
90 * @return new instance of this class. |
|
91 */ |
|
92 static CPbkEmbeddedThumbnailImageReader* NewLC |
|
93 (const TPbkContactItemField& aField, |
|
94 MPbkThumbnailGetImageObserver& aObserver); |
|
95 |
|
96 /** |
|
97 * Destructor. Cancels any previously executing read operation and |
|
98 * destroys this object. |
|
99 */ |
|
100 ~CPbkEmbeddedThumbnailImageReader(); |
|
101 |
|
102 public: // From CPbkThumbnailImageReaderBase |
|
103 void DoStartReadL(const TPbkImageLoadParameters* aParameters = NULL); |
|
104 MPbkImageData* CreateImageDataLC(); |
|
105 |
|
106 private: // Implementation |
|
107 CPbkEmbeddedThumbnailImageReader |
|
108 (const TPbkContactItemField& aField, |
|
109 MPbkThumbnailGetImageObserver& aObserver); |
|
110 void ConstructL(); |
|
111 const TDesC8& ImageBuffer() const; |
|
112 |
|
113 private: // data members |
|
114 /// Ref: Contact item field |
|
115 const TPbkContactItemField& iField; |
|
116 }; |
|
117 |
|
118 |
|
119 /** |
|
120 * Phonebook contact item field embedded thumbnail writer. |
|
121 * Writes an database-embedded picture to a field. |
|
122 */ |
|
123 NONSHARABLE_CLASS(CPbkEmbeddedThumbnailWriter) : |
|
124 public CPbkThumbnailWriterBase |
|
125 { |
|
126 public: // interface |
|
127 /** |
|
128 * Creates a new instance of this class. |
|
129 * |
|
130 * @param aField field to write the thumbnail to. |
|
131 * @param aObserver observer to notify about progress of this |
|
132 * operation. |
|
133 */ |
|
134 static CPbkEmbeddedThumbnailWriter* NewLC |
|
135 (TPbkContactItemField& aField, |
|
136 MPbkThumbnailSetObserver& aObserver); |
|
137 |
|
138 /** |
|
139 * Destructor. |
|
140 */ |
|
141 ~CPbkEmbeddedThumbnailWriter(); |
|
142 |
|
143 private: // from CPbkThumbnailWriterBase |
|
144 CImageEncoder* CreateImageWriterL(); |
|
145 void StoreImageL(const MPbkImageData& aImageData); |
|
146 void StoreImageL(CImageEncoder& aImageWriter); |
|
147 void DoCancel(); |
|
148 TSize ImageSize() const; |
|
149 |
|
150 private: // implementation |
|
151 CPbkEmbeddedThumbnailWriter |
|
152 (TPbkContactItemField& aField, |
|
153 MPbkThumbnailSetObserver& aObserver); |
|
154 void ConstructL(); |
|
155 |
|
156 private: // data members |
|
157 /// Ref: Contact item field |
|
158 TPbkContactItemField& iField; |
|
159 /// Own: image buffer |
|
160 HBufC8* iBitmapBlob; |
|
161 /// Own: Critical memory level checker |
|
162 CPbkFFSCheck* iFFSCheck; |
|
163 }; |
|
164 |
|
165 #endif // __CPbkEmbeddedThumbnail_H__ |
|
166 |
|
167 // End of File |