|
1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * Clipart plugin's plugin class. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #include "ImageEditorClipartPlugin.h" |
|
22 #include "ImageEditorClipartControl.h" |
|
23 #include "ImageEditorPluginBaseDefs.h" |
|
24 #include "DrawUtils.h" |
|
25 #include "SystemParameters.h" |
|
26 |
|
27 // CONSTANTS |
|
28 _LIT (KPgnResourceFile, "clipart.rsc"); |
|
29 |
|
30 //============================================================================= |
|
31 EXPORT_C CImageEditorPluginBase * CreateImageEditorPlugin () |
|
32 { |
|
33 CImageEditorClipartPlugin * plugin = new (ELeave) CImageEditorClipartPlugin; |
|
34 CleanupStack::PushL(plugin); |
|
35 plugin->ConstructL(); |
|
36 CleanupStack::Pop(); // plugin |
|
37 return plugin; |
|
38 } |
|
39 |
|
40 //============================================================================= |
|
41 CImageEditorClipartPlugin::CImageEditorClipartPlugin () |
|
42 { |
|
43 |
|
44 } |
|
45 |
|
46 //============================================================================= |
|
47 void CImageEditorClipartPlugin::ConstructL () |
|
48 { |
|
49 CImageEditorPluginBase::ConstructL (KPgnResourcePath, KPgnResourceFile); |
|
50 } |
|
51 |
|
52 //============================================================================= |
|
53 CImageEditorClipartPlugin::~CImageEditorClipartPlugin () |
|
54 { |
|
55 iSysPars = NULL; |
|
56 ReleasePlugin(); |
|
57 } |
|
58 |
|
59 //============================================================================= |
|
60 TInt CImageEditorClipartPlugin::SetProperty ( |
|
61 TInt aPropertyId, |
|
62 TDesC & aPropertyValue |
|
63 ) |
|
64 { |
|
65 |
|
66 TLex parser; |
|
67 |
|
68 // Copy data |
|
69 switch (aPropertyId) |
|
70 { |
|
71 case KCapSystemParameters: |
|
72 { |
|
73 parser.Assign (aPropertyValue); |
|
74 TInt tempval = 0; |
|
75 parser.Val (tempval); |
|
76 iSysPars = (const CSystemParameters *)tempval; |
|
77 return KErrNone; |
|
78 } |
|
79 default: |
|
80 { |
|
81 return CImageEditorPluginBase::SetProperty (aPropertyId, aPropertyValue); |
|
82 } |
|
83 } |
|
84 } |
|
85 |
|
86 //============================================================================= |
|
87 TInt CImageEditorClipartPlugin::GetProperty ( |
|
88 TInt aPropertyId, |
|
89 TDes & aPropertyValue |
|
90 ) |
|
91 { |
|
92 // Clean buffer |
|
93 aPropertyValue.Zero(); |
|
94 |
|
95 // Copy data |
|
96 switch (aPropertyId) |
|
97 { |
|
98 case KCapParamStruct: |
|
99 { |
|
100 // Control found |
|
101 if (iControl) |
|
102 { |
|
103 aPropertyValue.Copy ( ((CImageEditorClipartControl *)iControl)->GetParam() ); |
|
104 return KErrNone; |
|
105 } |
|
106 |
|
107 // Control not found, return KErrNotReady |
|
108 else |
|
109 { |
|
110 return KErrNotReady; |
|
111 } |
|
112 } |
|
113 case KCapReadyToRender: |
|
114 { |
|
115 TBool readyToRender = EFalse; |
|
116 if ( iControl ) |
|
117 { |
|
118 readyToRender = ((CImageEditorClipartControl *)iControl)->IsReadyToRender(); |
|
119 } |
|
120 aPropertyValue.AppendNum ((TInt)readyToRender); |
|
121 return KErrNone; |
|
122 } |
|
123 case KCapIsSlowPlugin: |
|
124 { |
|
125 aPropertyValue.AppendNum ((TInt)ETrue); |
|
126 return KErrNone; |
|
127 } |
|
128 default: |
|
129 { |
|
130 return CImageEditorPluginBase::GetProperty (aPropertyId, aPropertyValue); |
|
131 } |
|
132 } |
|
133 } |
|
134 |
|
135 //============================================================================= |
|
136 TInt CImageEditorClipartPlugin::InitPluginL ( |
|
137 const TRect & aRect, |
|
138 CCoeControl * aParent, |
|
139 CCoeControl *& aPluginControl |
|
140 ) |
|
141 { |
|
142 // Delete previous control |
|
143 ReleasePlugin(); |
|
144 |
|
145 // Create the control |
|
146 iControl = CImageEditorClipartControl::NewL (aRect, aParent); |
|
147 aPluginControl = iControl; |
|
148 |
|
149 // Set system parameters |
|
150 ((CImageEditorClipartControl*)iControl)->SetSystemParameters (iSysPars); |
|
151 |
|
152 return KErrNone; |
|
153 } |
|
154 |
|
155 //============================================================================= |
|
156 void CImageEditorClipartPlugin::ProcessImageL (CEditorImage * /*aImage*/ ) |
|
157 { |
|
158 |
|
159 } |
|
160 |
|
161 //============================================================================= |
|
162 void CImageEditorClipartPlugin::ReleasePlugin () |
|
163 { |
|
164 delete iControl; |
|
165 iControl = 0; |
|
166 } |
|
167 |
|
168 |
|
169 // End of File |