|
1 /* |
|
2 * Copyright (c) 2005-2007 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 * Phonebook2 contact item field embedded thumbnail reader. |
|
16 * Reads an database-embedded picture from a field. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef CPBK2EMBEDDEDIMAGE_H |
|
22 #define CPBK2EMBEDDEDIMAGE_H |
|
23 |
|
24 // INCLUDES |
|
25 #include "CPbk2ImageReaderBase.h" |
|
26 #include "CPbk2ImageWriterBase.h" |
|
27 |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class MVPbkBaseContactField; |
|
31 class MVPbkStoreContactField; |
|
32 class TPbk2ImageManagerParams; |
|
33 class CVPbkContactManager; |
|
34 class MPbk2ImageData; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * Phonebook contact item field embedded thumbnail reader. |
|
40 * Reads a database-embedded picture from a field. |
|
41 */ |
|
42 NONSHARABLE_CLASS(CPbk2EmbeddedImageReader) : |
|
43 public CPbk2ImageReaderBase |
|
44 { |
|
45 public: // interface |
|
46 /** |
|
47 * Creates a new instance of this class. |
|
48 * |
|
49 * @param aField field to read the thumbnail from. |
|
50 * @param aObserver observer to notify about progress of this |
|
51 * operation. |
|
52 */ |
|
53 static CPbk2EmbeddedImageReader* NewLC( |
|
54 const MVPbkBaseContactField& aField, |
|
55 MPbk2ImageGetObserver& aObserver ); |
|
56 |
|
57 /** |
|
58 * Destructor. Cancels any previously executing read operation and |
|
59 * destroys this object. |
|
60 */ |
|
61 ~CPbk2EmbeddedImageReader(); |
|
62 |
|
63 public: // from MPbk2ImageReader |
|
64 void StartReadL(const TPbk2ImageManagerParams* aParameters = NULL); |
|
65 HBufC8* CreateImageDataLC(); |
|
66 |
|
67 private: // implementation |
|
68 CPbk2EmbeddedImageReader( |
|
69 const MVPbkBaseContactField& aField, |
|
70 MPbk2ImageGetObserver& aObserver ); |
|
71 void ConstructL(); |
|
72 const TDesC8& ImageBuffer() const; |
|
73 |
|
74 private: // data members |
|
75 /// Ref: Contact item field |
|
76 const MVPbkBaseContactField& iField; |
|
77 /// Own: Image buffer |
|
78 HBufC8* iImageBuffer; |
|
79 }; |
|
80 |
|
81 |
|
82 /** |
|
83 * Phonebook contact item field embedded thumbnail writer. |
|
84 * Writes a database-embedded picture to a field. |
|
85 */ |
|
86 NONSHARABLE_CLASS(CPbk2EmbeddedImageWriter) : |
|
87 public CPbk2ImageWriterBase |
|
88 { |
|
89 public: // interface |
|
90 /** |
|
91 * Creates a new instance of this class. |
|
92 * |
|
93 * @param aContactManager Contact manager |
|
94 * @param aField field to write the thumbnail to. |
|
95 * @param aObserver observer to notify about progress of this |
|
96 * operation. |
|
97 */ |
|
98 static CPbk2EmbeddedImageWriter* NewLC |
|
99 (CVPbkContactManager& aContactManager, |
|
100 MVPbkStoreContactField& aField, |
|
101 MPbk2ImageSetObserver& aObserver); |
|
102 |
|
103 /** |
|
104 * Destructor. |
|
105 */ |
|
106 ~CPbk2EmbeddedImageWriter(); |
|
107 |
|
108 private: // from CPbkThumbnailWriterBase |
|
109 CImageEncoder* CreateImageWriterL(); |
|
110 void StoreImageL(const MPbk2ImageData& aImageData); |
|
111 void StoreImageL(CImageEncoder& aImageWriter); |
|
112 void DoCancel(); |
|
113 TSize ImageSize() const; |
|
114 |
|
115 private: // implementation |
|
116 CPbk2EmbeddedImageWriter |
|
117 (CVPbkContactManager& aContactManager, |
|
118 MVPbkStoreContactField& aField, |
|
119 MPbk2ImageSetObserver& aObserver); |
|
120 void ConstructL(); |
|
121 TBool IsCodImageL() const; |
|
122 TBool IsSameFieldType(const MVPbkFieldType& aFieldType) const; |
|
123 private: // data members |
|
124 /// Ref: Contact manager |
|
125 CVPbkContactManager& iContactManager; |
|
126 /// Ref: Contact item field |
|
127 MVPbkStoreContactField& iField; |
|
128 /// Own: image buffer |
|
129 HBufC8* iBitmapBlob; |
|
130 |
|
131 }; |
|
132 |
|
133 #endif // CPBK2EMBEDDEDIMAGE_H |
|
134 |
|
135 // End of File |