|
1 /* |
|
2 * Copyright (c) 2005-2006 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: SVGTopt proxy implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <AknUtils.h> // Files add recently |
|
20 #include <avkon.hrh> // Files add recently |
|
21 #include <SvgJavaInterfaceImpl.h> |
|
22 #include <utf.h> // Character conversion API |
|
23 #include <featmgr.h> |
|
24 #include "CM2GSVGProxy.h" |
|
25 |
|
26 M2G_NS_START |
|
27 |
|
28 // EXTERNAL DATA STRUCTURES |
|
29 |
|
30 // EXTERNAL FUNCTION PROTOTYPES |
|
31 |
|
32 // CONSTANTS |
|
33 |
|
34 // MACROS |
|
35 |
|
36 // LOCAL CONSTANTS AND MACROS |
|
37 |
|
38 // MODULE DATA STRUCTURES |
|
39 |
|
40 // LOCAL FUNCTION PROTOTYPES |
|
41 |
|
42 // FORWARD DECLARATIONS |
|
43 |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CM2GSVGProxy::NewL |
|
47 // ----------------------------------------------------------------------------- |
|
48 CM2GSVGProxy* CM2GSVGProxy::NewL() |
|
49 { |
|
50 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::NewL()"); |
|
51 CM2GSVGProxy* self = new(ELeave) CM2GSVGProxy; |
|
52 CleanupStack::PushL(self); |
|
53 self->ConstructL(); |
|
54 CleanupStack::Pop(); |
|
55 return self; |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CM2GSVGProxy::~CM2GSVGProxy |
|
60 // ----------------------------------------------------------------------------- |
|
61 CM2GSVGProxy::~CM2GSVGProxy() |
|
62 { |
|
63 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::~CM2GSVGProxy() - native SVGTopt: %d", iNative); |
|
64 if (iNative) |
|
65 { |
|
66 CloseContainers(); |
|
67 delete iNative; |
|
68 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::~CM2GSVGProxy() - native deleted"); |
|
69 iNative = NULL; |
|
70 } |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CM2GSVGProxy::AddCloseL |
|
75 // ----------------------------------------------------------------------------- |
|
76 void CM2GSVGProxy::AddCloseL(const TM2GSvgPathHandle& aPathHandle) |
|
77 { |
|
78 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddCloseL() - begin"); |
|
79 iNative->SvgPathAddClose(aPathHandle); |
|
80 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddCloseL() - end"); |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CM2GSVGProxy::AddCurveToL |
|
85 // ----------------------------------------------------------------------------- |
|
86 void CM2GSVGProxy::AddCurveToL( |
|
87 const TM2GSvgPathHandle& aPathHandle, |
|
88 const TM2GPathCurveData& aPathCurveData) |
|
89 { |
|
90 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddCurveToL() - begin"); |
|
91 iNative->SvgPathAddCurveTo( |
|
92 aPathHandle, |
|
93 aPathCurveData[ 0 ], aPathCurveData[ 1 ], // X1, Y1 |
|
94 aPathCurveData[ 2 ], aPathCurveData[ 3 ], // X2, Y2 |
|
95 aPathCurveData[ 4 ], aPathCurveData[ 5 ]); // X3, Y3 |
|
96 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddCurveToL() - end"); |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CM2GSVGProxy::AddLineToL |
|
101 // ----------------------------------------------------------------------------- |
|
102 void CM2GSVGProxy::AddLineToL( |
|
103 const TM2GSvgPathHandle& aPathHandle, |
|
104 const TReal32& aX, const TReal32& aY) |
|
105 { |
|
106 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddLineToL() - begin"); |
|
107 iNative->SvgPathAddLineTo(aPathHandle, aX, aY); |
|
108 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddLineToL() - end"); |
|
109 } |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // CM2GSVGProxy::AddMoveToL |
|
113 // ----------------------------------------------------------------------------- |
|
114 void CM2GSVGProxy::AddMoveToL( |
|
115 const TM2GSvgPathHandle& aPathHandle, |
|
116 const TReal32& aX, const TReal32& aY) |
|
117 { |
|
118 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddMoveToL() - begin"); |
|
119 iNative->SvgPathAddMoveTo(aPathHandle, aX, aY); |
|
120 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddMoveToL() - end"); |
|
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // CM2GSVGProxy::AddQuadToL |
|
125 // ----------------------------------------------------------------------------- |
|
126 void CM2GSVGProxy::AddQuadToL( |
|
127 const TM2GSvgPathHandle& aPathHandle, |
|
128 const TReal32& aX1, const TReal32& aY1, |
|
129 const TReal32& aX2, const TReal32& aY2) |
|
130 { |
|
131 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddQuadToL() - begin"); |
|
132 iNative->SvgPathAddQuadTo(aPathHandle, aX1, aY1, aX2, aY2); |
|
133 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddQuadToL() - end"); |
|
134 } |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // CM2GSVGProxy::AppendChildL |
|
138 // ----------------------------------------------------------------------------- |
|
139 void CM2GSVGProxy::AppendChildL( |
|
140 const TM2GSvgElementHandle& aElementHandle, |
|
141 const TM2GSvgElementHandle& aChildElementHandle) |
|
142 { |
|
143 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AppendChildL() - begin"); |
|
144 iNative->SvgElementAppendChild(aElementHandle, aChildElementHandle); |
|
145 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AppendChildL() - end"); |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CM2GSVGProxy::BeginElementAtL |
|
150 // ----------------------------------------------------------------------------- |
|
151 void CM2GSVGProxy::BeginElementAtL( |
|
152 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
153 const TM2GSvgElementHandle& aElementHandle, |
|
154 const TReal32& aOffset) |
|
155 { |
|
156 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::BeginElementAtL() offset:%f - begin", aOffset); |
|
157 iNative->SvgDocumentBeginElementAt( |
|
158 aDocumentHandle, aElementHandle, aOffset); |
|
159 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::BeginElementAtL() - end"); |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CM2GSVGProxy::CheckRemoveableL |
|
164 // ----------------------------------------------------------------------------- |
|
165 void CM2GSVGProxy::CheckRemoveableL( |
|
166 const TM2GSvgElementHandle& aElementHandle, |
|
167 TInt& aRemoveable) |
|
168 |
|
169 { |
|
170 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CheckRemoveableL() - begin"); |
|
171 aRemoveable = iNative->SvgElementCheckRemoveable(aElementHandle); |
|
172 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CheckRemoveableL() - end"); |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // CM2GSVGProxy::ClearSvgSurfaceL |
|
177 // ----------------------------------------------------------------------------- |
|
178 void CM2GSVGProxy::ClearSvgSurfaceL(const TM2GBitmapHandle& /* aSurfaceHandle */) |
|
179 { |
|
180 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::ClearSvgSurfaceL() - not supported"); |
|
181 User::Leave(KErrNotSupported); |
|
182 } |
|
183 |
|
184 // ----------------------------------------------------------------------------- |
|
185 // CM2GSVGProxy::CreateDocumentL |
|
186 // ----------------------------------------------------------------------------- |
|
187 void CM2GSVGProxy::CreateDocumentL(const TPtrC16& aData, TM2GSvgDocumentHandle& aDocumentHandle) |
|
188 { |
|
189 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreateDocumentL() - begin"); |
|
190 aDocumentHandle = M2G_INVALID_HANDLE; |
|
191 |
|
192 M2G_DEBUG_1("M2G_DEBUG: M2G_DEBUG: CM2GSVGProxy::CreateDocumentL(): content length=%d - call engine", aData.Length()); |
|
193 |
|
194 // Create document handle. Note: validity check is done in java side |
|
195 aDocumentHandle = iNative->SvgDocumentCreateL(aData); |
|
196 // Append document handle to the container |
|
197 if (iSvgDocuments.Find(aDocumentHandle) == KErrNotFound) |
|
198 { |
|
199 TRAPD(err, iSvgDocuments.Append(aDocumentHandle)); |
|
200 if (err != KM2GOk) |
|
201 { |
|
202 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::CreateDocumentL(), cannot add handle=%d, err=%d", aDocumentHandle, err); |
|
203 } |
|
204 } |
|
205 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::CreateDocumentL(), handle=%d, total document count=%d - end", aDocumentHandle, iSvgDocuments.Count()); |
|
206 } |
|
207 |
|
208 // ----------------------------------------------------------------------------- |
|
209 // CM2GSVGProxy::CreateElementNsL |
|
210 // ----------------------------------------------------------------------------- |
|
211 void CM2GSVGProxy::CreateElementNsL( |
|
212 const TM2GSvgAttrType& aType, |
|
213 const TM2GSvgDocumentHandle& /* aDocumentHandle */, |
|
214 TM2GSvgElementHandle& aElementHandle) |
|
215 { |
|
216 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreateElementNsL() - begin"); |
|
217 // Note: validity check is done in java side |
|
218 aElementHandle = iNative->SvgElementCreate(aType); |
|
219 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::CreateElementNsL() handle=%d - end", aElementHandle); |
|
220 } |
|
221 |
|
222 // ----------------------------------------------------------------------------- |
|
223 // CM2GSVGProxy::CreatePathL |
|
224 // ----------------------------------------------------------------------------- |
|
225 void CM2GSVGProxy::CreatePathL(TM2GSvgPathHandle& aPathHandle) |
|
226 { |
|
227 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreatePathL() - begin"); |
|
228 aPathHandle = iNative->SvgPathCreate(); |
|
229 if (aPathHandle == M2G_INVALID_HANDLE) |
|
230 { |
|
231 User::Leave(KM2GMemoryNotOk); |
|
232 } |
|
233 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreatePathL() - end"); |
|
234 } |
|
235 |
|
236 // ----------------------------------------------------------------------------- |
|
237 // CM2GSVGProxy::CreateSvgEngineL |
|
238 // ----------------------------------------------------------------------------- |
|
239 void CM2GSVGProxy::CreateSvgEngineL(TM2GSvgEngineHandle& aEngineHandle) |
|
240 { |
|
241 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreateSvgEngineL() - begin"); |
|
242 // Create engine handle |
|
243 aEngineHandle = iNative->SvgEngineCreate(); |
|
244 if (aEngineHandle == M2G_INVALID_HANDLE) |
|
245 { |
|
246 User::Leave(KM2GMemoryNotOk); |
|
247 } |
|
248 // Append engine handle to the container |
|
249 if (iSvgEngines.Find(aEngineHandle) == KErrNotFound) |
|
250 { |
|
251 TRAPD(err, iSvgEngines.Append(aEngineHandle)); |
|
252 if (err != KM2GOk) |
|
253 { |
|
254 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::CreateSvgEngineL(), cannot add handle=%d, err=%d", aEngineHandle, err); |
|
255 } |
|
256 } |
|
257 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::CreateSvgEngineL(), handle=%d, total engine count=%d - end", aEngineHandle, iSvgEngines.Count()); |
|
258 } |
|
259 |
|
260 // ----------------------------------------------------------------------------- |
|
261 // CM2GSVGProxy::CreateSvgSurfaceL |
|
262 // ----------------------------------------------------------------------------- |
|
263 TM2GBitmapHandle CM2GSVGProxy::CreateSvgSurfaceL(TInt /* aWidth */, TInt /* aHeight */) |
|
264 { |
|
265 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreateSvgSurfaceL() - not supported"); |
|
266 |
|
267 User::Leave(KErrNotSupported); |
|
268 |
|
269 return M2G_INVALID_HANDLE; |
|
270 } |
|
271 |
|
272 // ----------------------------------------------------------------------------- |
|
273 // CM2GSVGProxy::DeleteDocumentL |
|
274 // ----------------------------------------------------------------------------- |
|
275 void CM2GSVGProxy::DeleteDocumentL(const TM2GSvgDocumentHandle& aDocumentHandle) |
|
276 { |
|
277 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::DeleteDocumentL() native:%d, document:%d - begin", iNative, aDocumentHandle); |
|
278 TInt findResult = iSvgDocuments.Find(aDocumentHandle); |
|
279 if (findResult != KErrNotFound) |
|
280 { |
|
281 // Try to remove the handle from the container |
|
282 TRAPD(err, iSvgDocuments.Remove(findResult)); |
|
283 if (err != KM2GOk) |
|
284 { |
|
285 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::DeleteDocumentL(), cannot add handle=%d, err=%d", aDocumentHandle, err); |
|
286 } |
|
287 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteDocumentL() - container remove result=%d", err); |
|
288 // Delete the handle |
|
289 iNative->SvgDocumentDestroy(aDocumentHandle); |
|
290 } |
|
291 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteDocumentL() - total document count=%d - end", iSvgDocuments.Count()); |
|
292 } |
|
293 |
|
294 // ----------------------------------------------------------------------------- |
|
295 // CM2GSVGProxy::DeleteSvgEngineL |
|
296 // ----------------------------------------------------------------------------- |
|
297 void CM2GSVGProxy::DeleteSvgEngineL(const TM2GSvgEngineHandle& aEngineHandle) |
|
298 { |
|
299 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteSvgEngineL() engine:%d - begin", aEngineHandle); |
|
300 TInt findResult = iSvgEngines.Find(aEngineHandle); |
|
301 if (findResult != KErrNotFound) |
|
302 { |
|
303 // Try to remove the handle from the container |
|
304 TRAPD(err, iSvgEngines.Remove(findResult)); |
|
305 if (err != KM2GOk) |
|
306 { |
|
307 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::DeleteSvgEngineL(), cannot add handle=%d, err=%d", aEngineHandle, err); |
|
308 } |
|
309 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteSvgEngineL() - container remove result=%d", err); |
|
310 // Delete the handle |
|
311 iNative->SvgEngineDestroy(aEngineHandle); |
|
312 } |
|
313 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteSvgEngineL() - total engine count=%d - end", iSvgEngines.Count()); |
|
314 } |
|
315 |
|
316 // ----------------------------------------------------------------------------- |
|
317 // CM2GSVGProxy::DeleteSvgSurfaceL |
|
318 // ----------------------------------------------------------------------------- |
|
319 void CM2GSVGProxy::DeleteSvgSurfaceL(const TM2GBitmapHandle& /* aSurfaceHandle */) |
|
320 { |
|
321 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::DeleteSvgSurfaceL() - not supported"); |
|
322 |
|
323 User::Leave(KErrNotSupported); |
|
324 } |
|
325 |
|
326 // ----------------------------------------------------------------------------- |
|
327 // CM2GSVGProxy::DestroyPathL |
|
328 // ----------------------------------------------------------------------------- |
|
329 void CM2GSVGProxy::DestroyPathL(const TM2GSvgPathHandle& aPathHandle) |
|
330 { |
|
331 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::DestroyPathL() - begin"); |
|
332 iNative->SvgPathDestroy(aPathHandle); |
|
333 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::DestroyPathL() - end"); |
|
334 } |
|
335 |
|
336 // ----------------------------------------------------------------------------- |
|
337 // CM2GSVGProxy::DispatchMouseEventL |
|
338 // ----------------------------------------------------------------------------- |
|
339 void CM2GSVGProxy::DispatchMouseEventL( |
|
340 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
341 TInt aX, TInt aY, TM2GSvgElementHandle& aElementHandle) |
|
342 { |
|
343 M2G_DEBUG_3("M2G_DEBUG: CM2GSVGProxy::DispatchMouseEventL(): doc handle:%d, x=%d, y=%d- begin", aDocumentHandle, aX, aY); |
|
344 aElementHandle = iNative->SvgDocumentDispatchMouseEvent( |
|
345 aDocumentHandle, aX, aY); |
|
346 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DispatchMouseEventL(): element handle=%d - end", aElementHandle); |
|
347 } |
|
348 |
|
349 // ----------------------------------------------------------------------------- |
|
350 // CM2GSVGProxy::EndElementAtL |
|
351 // ----------------------------------------------------------------------------- |
|
352 void CM2GSVGProxy::EndElementAtL( |
|
353 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
354 const TM2GSvgElementHandle& aElementHandle, |
|
355 const TReal32& aOffset) |
|
356 { |
|
357 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::EndElementAtL() offset=%f - begin", aOffset); |
|
358 iNative->SvgDocumentEndElementAt( |
|
359 aDocumentHandle, aElementHandle, aOffset); |
|
360 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::EndElementAtL() - end"); |
|
361 } |
|
362 |
|
363 // ----------------------------------------------------------------------------- |
|
364 // CM2GSVGProxy::FocusOnL |
|
365 // ----------------------------------------------------------------------------- |
|
366 void CM2GSVGProxy::FocusOnL( |
|
367 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
368 const TM2GSvgElementHandle& aElementHandle) |
|
369 { |
|
370 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::FocusOnL() document=%d, element=%d - begin", aDocumentHandle, aElementHandle); |
|
371 iNative->SvgDocumentFocusOn(aDocumentHandle, aElementHandle); |
|
372 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::FocusOnL() - end"); |
|
373 } |
|
374 |
|
375 // ----------------------------------------------------------------------------- |
|
376 // CM2GSVGProxy::FocusOutL |
|
377 // ----------------------------------------------------------------------------- |
|
378 void CM2GSVGProxy::FocusOutL( |
|
379 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
380 const TM2GSvgElementHandle& aElementHandle) |
|
381 { |
|
382 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::FocusOutL() document=%d, element=%d - begin", aDocumentHandle, aElementHandle); |
|
383 iNative->SvgDocumentFocusOut(aDocumentHandle, aElementHandle); |
|
384 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::FocusOutL() - end"); |
|
385 } |
|
386 |
|
387 // ----------------------------------------------------------------------------- |
|
388 // CM2GSVGProxy::GetBBoxL |
|
389 // ----------------------------------------------------------------------------- |
|
390 void CM2GSVGProxy::GetBBoxL( |
|
391 const TM2GSvgElementHandle& aElementHandle, |
|
392 const TM2GSvgAttrType& aAttributeType, |
|
393 TM2GRectData& aRectData, TInt& aResult) |
|
394 { |
|
395 aResult = KM2GOk; |
|
396 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetBBoxL() - begin"); |
|
397 iNative->SvgElementGetBBox( |
|
398 aElementHandle, |
|
399 aAttributeType, |
|
400 &aRectData[ 0 ], // X |
|
401 &aRectData[ 1 ], // Y |
|
402 &aRectData[ 2 ], // Width |
|
403 &aRectData[ 3 ]); // Height |
|
404 M2G_DEBUG_4("M2G_DEBUG: CM2GSVGProxy::GetBBoxL(): [x=%f, y=%f, w=%f, h=%f] - end", aRectData[ 0 ], aRectData[ 1 ], aRectData[ 2 ], aRectData[ 3 ]); |
|
405 } |
|
406 |
|
407 // ----------------------------------------------------------------------------- |
|
408 // CM2GSVGProxy::GetColorTrait |
|
409 // ----------------------------------------------------------------------------- |
|
410 void CM2GSVGProxy::GetColorTraitL( |
|
411 const TM2GSvgElementHandle& aElementHandle, |
|
412 const TM2GSvgAttrType& aAttributeType, |
|
413 TM2GColorData& aColor, |
|
414 TInt& aResult) |
|
415 { |
|
416 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetColorTraitL() - begin"); |
|
417 aResult = iNative->SvgElementGetColorAttribute( |
|
418 aElementHandle, |
|
419 aAttributeType, |
|
420 &aColor[ 0 ], // Red |
|
421 &aColor[ 1 ], // Green |
|
422 &aColor[ 2 ]); // Blue |
|
423 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetColorTraitL() - end"); |
|
424 } |
|
425 |
|
426 // ----------------------------------------------------------------------------- |
|
427 // CM2GSVGProxy::GetElementByIdL |
|
428 // ----------------------------------------------------------------------------- |
|
429 void CM2GSVGProxy::GetElementByIdL( |
|
430 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
431 const TPtrC16& aId, |
|
432 TM2GSvgElementHandle& aElementHandle) |
|
433 { |
|
434 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetElementByIdL() - begin"); |
|
435 aElementHandle = iNative->SvgDocumentGetElementById( |
|
436 aDocumentHandle, |
|
437 aId); |
|
438 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetElementByIdL() - end"); |
|
439 } |
|
440 |
|
441 // ----------------------------------------------------------------------------- |
|
442 // CM2GSVGProxy::GetElementTypeIdL |
|
443 // ----------------------------------------------------------------------------- |
|
444 void CM2GSVGProxy::GetElementTypeIdL(const TM2GSvgElementHandle& aElementHandle, TInt16& aId) |
|
445 { |
|
446 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetElementTypeIdL() - begin"); |
|
447 aId = STATIC_CAST(TInt16, iNative->SvgElementGetType(aElementHandle)); |
|
448 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetElementTypeIdL() type id:%d- end", aId); |
|
449 } |
|
450 |
|
451 // ----------------------------------------------------------------------------- |
|
452 // CM2GSVGProxy::GetEnumTraitL |
|
453 // ----------------------------------------------------------------------------- |
|
454 void CM2GSVGProxy::GetEnumTraitL( |
|
455 const TM2GSvgElementHandle& aElementHandle, |
|
456 const TM2GSvgAttrType& aAttributeTypeId, |
|
457 TInt16& aEnumTrait) |
|
458 { |
|
459 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetEnumTraitIdL() - begin"); |
|
460 aEnumTrait = iNative->SvgElementGetEnumAttribute( |
|
461 aElementHandle, |
|
462 aAttributeTypeId); |
|
463 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetEnumTraitIdL() enum trait:%d - end", aEnumTrait); |
|
464 } |
|
465 |
|
466 // ----------------------------------------------------------------------------- |
|
467 // CM2GSVGProxy::GetExternalListItemL |
|
468 // ----------------------------------------------------------------------------- |
|
469 TInt CM2GSVGProxy::GetExternalListItemL( |
|
470 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
471 TInt aIndex, |
|
472 TPtrC16& aItem) |
|
473 { |
|
474 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetExternalListItemL() index=%d- begin", aIndex); |
|
475 TInt result = iNative->SvgDocumentGetExternalListItem(aDocumentHandle, aIndex, aItem); |
|
476 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::GetExternalListListItemL() result:%d, item sz:%d - end", result, aItem.Length()); |
|
477 return result; |
|
478 } |
|
479 |
|
480 // ----------------------------------------------------------------------------- |
|
481 // CM2GSVGProxy::GetExternalListSizeL |
|
482 // ----------------------------------------------------------------------------- |
|
483 void CM2GSVGProxy::GetExternalListSizeL( |
|
484 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
485 TInt& aListSz) |
|
486 { |
|
487 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetExternalListSizeL() - begin"); |
|
488 aListSz = iNative->SvgDocumentGetExternalListSize(aDocumentHandle); |
|
489 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetExternalListSizeL(): %d - end", aListSz); |
|
490 } |
|
491 |
|
492 // ----------------------------------------------------------------------------- |
|
493 // CM2GSVGProxy::GetFirstElementChildL |
|
494 // ----------------------------------------------------------------------------- |
|
495 void CM2GSVGProxy::GetFirstElementChildL( |
|
496 const TM2GSvgElementHandle& aElementHandle, |
|
497 TM2GSvgElementHandle& aChildHandle) |
|
498 { |
|
499 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetFirstElementChildL() element=%d - begin", aElementHandle); |
|
500 aChildHandle = iNative->SvgElementGetFirstElementChild(aElementHandle); |
|
501 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetFirstElementChildL() child=%d - end", aChildHandle); |
|
502 } |
|
503 |
|
504 // ----------------------------------------------------------------------------- |
|
505 // CM2GSVGProxy::GetFloatTraitL |
|
506 // ----------------------------------------------------------------------------- |
|
507 void CM2GSVGProxy::GetFloatTraitL( |
|
508 const TM2GSvgElementHandle& aElementHandle, |
|
509 const TM2GSvgAttrType& aAttributeType, |
|
510 TReal32& aFloatTrait) |
|
511 { |
|
512 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetFloatTraitL() - begin"); |
|
513 aFloatTrait = |
|
514 iNative->SvgElementGetFloatAttribute(aElementHandle, aAttributeType); |
|
515 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetFloatTraitL() - end"); |
|
516 } |
|
517 |
|
518 // ----------------------------------------------------------------------------- |
|
519 // CM2GSVGProxy::GetMatrixTraitL |
|
520 // ----------------------------------------------------------------------------- |
|
521 void CM2GSVGProxy::GetMatrixTraitL( |
|
522 const TM2GSvgElementHandle& aElementHandle, |
|
523 const TM2GSvgAttrType& aAttributeType, |
|
524 TM2GMatrixData& aMatrix, TInt& aResult) |
|
525 { |
|
526 // [ m00 m01 m02 ] |
|
527 // [ m10 m11 m12 ] |
|
528 // [ 0 0 1 ] |
|
529 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetMatrixTraitL() - begin"); |
|
530 aResult = iNative->SvgElementGetMatrixAttribute( |
|
531 aElementHandle, |
|
532 aAttributeType, |
|
533 &aMatrix[ 0 ], // m00 |
|
534 &aMatrix[ 1 ], // m10 |
|
535 &aMatrix[ 2 ], // m01 |
|
536 &aMatrix[ 3 ], // m11 |
|
537 &aMatrix[ 4 ], // m02 |
|
538 &aMatrix[ 5 ]); // m12 |
|
539 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetMatrixTraitL() - end"); |
|
540 } |
|
541 |
|
542 // ----------------------------------------------------------------------------- |
|
543 // CM2GSVGProxy::GetMediaTimeL |
|
544 // ----------------------------------------------------------------------------- |
|
545 void CM2GSVGProxy::GetMediaTimeL( |
|
546 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
547 TReal32& aSeconds) |
|
548 { |
|
549 aSeconds = iNative->SvgDocumentGetMediaTime(aDocumentHandle); |
|
550 } |
|
551 |
|
552 // ----------------------------------------------------------------------------- |
|
553 // CM2GSVGProxy::GetNextElementSiblingL |
|
554 // ----------------------------------------------------------------------------- |
|
555 void CM2GSVGProxy::GetNextElementSiblingL( |
|
556 const TM2GSvgElementHandle& aElementHandle, |
|
557 TM2GSvgElementHandle& aSiblingElementHandle) |
|
558 { |
|
559 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetNextElementSiblingL(), element=%d - begin", aElementHandle); |
|
560 aSiblingElementHandle = iNative->SvgElementGetNextElementSibling(aElementHandle); |
|
561 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetNextElementSiblingL(), sibling=%d - end", aSiblingElementHandle); |
|
562 } |
|
563 |
|
564 // ----------------------------------------------------------------------------- |
|
565 // CM2GSVGProxy::GetNumberOfSegmentsL |
|
566 // ----------------------------------------------------------------------------- |
|
567 void CM2GSVGProxy::GetNumberOfSegmentsL( |
|
568 const TM2GSvgPathHandle& aPathHandle, |
|
569 TInt& aNumberOfSegments) |
|
570 { |
|
571 aNumberOfSegments = iNative->SvgPathGetSegmentCount(aPathHandle); |
|
572 } |
|
573 |
|
574 // ----------------------------------------------------------------------------- |
|
575 // CM2GSVGProxy::GetParentL |
|
576 // ----------------------------------------------------------------------------- |
|
577 void CM2GSVGProxy::GetParentL( |
|
578 const TM2GSvgElementHandle& aElementHandle, |
|
579 TM2GSvgElementHandle& aParentElementHandle) |
|
580 { |
|
581 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetParentL() - begin"); |
|
582 aParentElementHandle = iNative->SvgElementGetParent(aElementHandle); |
|
583 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::GetParentL() element=%d, parent=%d, - end", aElementHandle, aParentElementHandle); |
|
584 } |
|
585 |
|
586 // ----------------------------------------------------------------------------- |
|
587 // CM2GSVGProxy::GetPathTraitL |
|
588 // ----------------------------------------------------------------------------- |
|
589 void CM2GSVGProxy::GetPathTraitL( |
|
590 const TM2GSvgElementHandle& aElementHandle, |
|
591 const TM2GSvgAttrType& aAttributeType, |
|
592 TInt& aPathTrait) |
|
593 { |
|
594 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetPathTraitL() - begin"); |
|
595 aPathTrait = iNative->SvgElementGetPathAttribute(aElementHandle, aAttributeType); |
|
596 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetPathTraitL() %d - end", aPathTrait); |
|
597 } |
|
598 |
|
599 // ----------------------------------------------------------------------------- |
|
600 // CM2GSVGProxy::GetRectTraitL |
|
601 // ----------------------------------------------------------------------------- |
|
602 void CM2GSVGProxy::GetRectTraitL( |
|
603 const TM2GSvgElementHandle& aElementHandle, |
|
604 const TM2GSvgAttrType& aAttributeType, |
|
605 TM2GRectData& aRectData, TInt& aResult) |
|
606 { |
|
607 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetRectTraitL() - begin"); |
|
608 aResult = iNative->SvgElementGetRectAttribute( |
|
609 aElementHandle, |
|
610 aAttributeType, |
|
611 &aRectData[ 0 ], // X |
|
612 &aRectData[ 1 ], // Y |
|
613 &aRectData[ 2 ], // Width |
|
614 &aRectData[ 3 ]); // Height |
|
615 M2G_DEBUG_5("M2G_DEBUG: CM2GSVGProxy::GetRectTraitL(): result=%d [x=%f, y=%f, w=%f, h=%f] - end", aResult, aRectData[ 0 ], aRectData[ 1 ], aRectData[ 2 ], aRectData[ 3 ]); |
|
616 } |
|
617 |
|
618 // ----------------------------------------------------------------------------- |
|
619 // CM2GSVGProxy::GetRootElementL |
|
620 // ----------------------------------------------------------------------------- |
|
621 void CM2GSVGProxy::GetRootElementL( |
|
622 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
623 TM2GSvgElementHandle& aRootElementHandle) |
|
624 { |
|
625 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetRootElementL() - begin"); |
|
626 aRootElementHandle = iNative->SvgDocumentGetRootElement(aDocumentHandle); |
|
627 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetRootElementL() handle:%d - end", aRootElementHandle); |
|
628 } |
|
629 |
|
630 // ----------------------------------------------------------------------------- |
|
631 // CM2GSVGProxy::GetScreenBBoxL |
|
632 // ----------------------------------------------------------------------------- |
|
633 void CM2GSVGProxy::GetScreenBBoxL( |
|
634 const TM2GSvgElementHandle& aElementHandle, |
|
635 TM2GScreenBBoxData& aScreenBBoxData) |
|
636 { |
|
637 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetScreenBBoxL() - begin"); |
|
638 iNative->SvgElementGetScreenBBox( |
|
639 aElementHandle, |
|
640 &aScreenBBoxData[ 0 ], // X |
|
641 &aScreenBBoxData[ 1 ], // Y |
|
642 &aScreenBBoxData[ 2 ], // Width |
|
643 &aScreenBBoxData[ 3 ]); // Height |
|
644 M2G_DEBUG_4("M2G_DEBUG: CM2GSVGProxy::GetScreenBBoxL(): [x=%f, y=%f, w=%f, h=%f] - end", aScreenBBoxData[ 0 ], aScreenBBoxData[ 1 ], aScreenBBoxData[ 2 ], aScreenBBoxData[ 3 ]); |
|
645 } |
|
646 |
|
647 // ----------------------------------------------------------------------------- |
|
648 // CM2GSVGProxy::GetSegmentParameterL |
|
649 // ----------------------------------------------------------------------------- |
|
650 void CM2GSVGProxy::GetSegmentParameterL( |
|
651 const TM2GSvgPathHandle& aPathHandle, |
|
652 TInt aSegmentIndex, TInt aParamIndex, |
|
653 TReal32& aSegmentParam) |
|
654 { |
|
655 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::SvgPathGetSegmentParameter(): index=%d, paramIndex=%d - begin", aSegmentIndex, aParamIndex); |
|
656 aSegmentParam = iNative->SvgPathGetSegmentParameter( |
|
657 aPathHandle, |
|
658 aSegmentIndex, |
|
659 aParamIndex); |
|
660 M2G_DEBUG_3("M2G_DEBUG: CM2GSVGProxy::SvgPathGetSegmentParameter(): index=%d, paramIndex=%d, param=%d - end", aSegmentIndex, aParamIndex, aSegmentParam); |
|
661 } |
|
662 |
|
663 // ----------------------------------------------------------------------------- |
|
664 // CM2GSVGProxy::GetSegmentTypeL |
|
665 // ----------------------------------------------------------------------------- |
|
666 void CM2GSVGProxy::GetSegmentTypeL( |
|
667 const TM2GSvgPathHandle& aPathHandle, |
|
668 TInt aSegmentIndex, |
|
669 TInt16& aSegmentType) |
|
670 { |
|
671 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetSegmentTypeL(): index=%d - begin", aSegmentIndex); |
|
672 aSegmentType = iNative->SvgPathGetSegmentType( |
|
673 aPathHandle, |
|
674 aSegmentIndex); |
|
675 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::GetSegmentTypeL(): index=%d, type=%d - end", aSegmentIndex, aSegmentType); |
|
676 } |
|
677 |
|
678 // ----------------------------------------------------------------------------- |
|
679 // CM2GSVGProxy::GetStringTraitL |
|
680 // ----------------------------------------------------------------------------- |
|
681 TInt CM2GSVGProxy::GetStringTraitL( |
|
682 const TM2GSvgElementHandle& aElementHandle, |
|
683 const TM2GSvgAttrType& aAttributeType, |
|
684 TPtrC16& aStr) |
|
685 { |
|
686 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::GetStringTraitL(): attribute type:%d, handle:%u - begin", aAttributeType, aElementHandle); |
|
687 |
|
688 TInt result = iNative->SvgElementGetStringAttribute(aElementHandle, aAttributeType, aStr); |
|
689 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetStringTraitL(): attribute sz:%d", aStr.Length()); |
|
690 return result; |
|
691 } |
|
692 |
|
693 // ----------------------------------------------------------------------------- |
|
694 // CM2GSVGProxy::GetSvgSurfaceHeightL |
|
695 // ----------------------------------------------------------------------------- |
|
696 TInt CM2GSVGProxy::GetSvgSurfaceHeightL(const TM2GBitmapHandle& /* aSurfaceHandle */) |
|
697 { |
|
698 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetSvgSurfaceHeightL - not supported"); |
|
699 |
|
700 User::Leave(KErrNotSupported); |
|
701 |
|
702 return 0; |
|
703 } |
|
704 |
|
705 // ----------------------------------------------------------------------------- |
|
706 // CM2GSVGProxy::GetSvgSurfaceWidthL |
|
707 // ----------------------------------------------------------------------------- |
|
708 TInt CM2GSVGProxy::GetSvgSurfaceWidthL(const TM2GBitmapHandle& /* aSurfaceHandle */) |
|
709 { |
|
710 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetSvgSurfaceWidthL - not supported"); |
|
711 |
|
712 User::Leave(KErrNotSupported); |
|
713 |
|
714 return 0; |
|
715 } |
|
716 |
|
717 // ----------------------------------------------------------------------------- |
|
718 // CM2GSVGProxy::GetUsedFromElementL |
|
719 // ----------------------------------------------------------------------------- |
|
720 void CM2GSVGProxy::GetUsedFromElementL( |
|
721 const TM2GSvgElementHandle& aElementHandle, |
|
722 TM2GSvgElementHandle& aHandle) |
|
723 { |
|
724 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetUsedFromElementL() used from element=%d - begin", aElementHandle); |
|
725 aHandle = iNative->SvgElementGetUsedFromElement(aElementHandle); |
|
726 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetUsedFromElementL() found element=%d - end", aHandle); |
|
727 } |
|
728 |
|
729 // ----------------------------------------------------------------------------- |
|
730 // CM2GSVGProxy::GetViewportHeightL |
|
731 // ----------------------------------------------------------------------------- |
|
732 void CM2GSVGProxy::GetViewportHeightL( |
|
733 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
734 TInt& aHeight) |
|
735 { |
|
736 aHeight = iNative->SvgDocumentGetViewportHeight(aDocumentHandle); |
|
737 } |
|
738 |
|
739 // ----------------------------------------------------------------------------- |
|
740 // CM2GSVGProxy::GetViewportWidthL |
|
741 // ----------------------------------------------------------------------------- |
|
742 void CM2GSVGProxy::GetViewportWidthL( |
|
743 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
744 TInt& aWidth) |
|
745 { |
|
746 aWidth = iNative->SvgDocumentGetViewportWidth(aDocumentHandle); |
|
747 } |
|
748 |
|
749 // ----------------------------------------------------------------------------- |
|
750 // CM2GSVGProxy::InitViewportL |
|
751 // ----------------------------------------------------------------------------- |
|
752 void CM2GSVGProxy::InitViewportL(const TM2GSvgDocumentHandle& aDocumentHandle) |
|
753 { |
|
754 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::InitViewportL()"); |
|
755 return iNative->SvgDocumentViewportInit(aDocumentHandle); |
|
756 } |
|
757 |
|
758 // ----------------------------------------------------------------------------- |
|
759 // CM2GSVGProxy::InsertBeforeL |
|
760 // ----------------------------------------------------------------------------- |
|
761 void CM2GSVGProxy::InsertBeforeL( |
|
762 const TM2GSvgElementHandle& aElementHandle, |
|
763 const TM2GSvgElementHandle& aNewChildElementHandle, |
|
764 const TM2GSvgElementHandle& aReferenceElementHandle) |
|
765 { |
|
766 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::InsertBeforeL() - begin"); |
|
767 iNative->SvgElementInsertBefore( |
|
768 aElementHandle, |
|
769 aNewChildElementHandle, |
|
770 aReferenceElementHandle); |
|
771 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::InsertBeforeL() - end"); |
|
772 } |
|
773 |
|
774 // ----------------------------------------------------------------------------- |
|
775 // CM2GSVGProxy::IsActiveL |
|
776 // ----------------------------------------------------------------------------- |
|
777 void CM2GSVGProxy::IsActiveL(const TM2GSvgElementHandle& aElementHandle, TInt& aActive) |
|
778 { |
|
779 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::IsActiveL() - begin"); |
|
780 aActive = iNative->SvgElementIsActive(aElementHandle); |
|
781 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::IsActiveL() active:%d - end", aActive); |
|
782 } |
|
783 |
|
784 // ----------------------------------------------------------------------------- |
|
785 // CM2GSVGProxy::IsElementInDomL |
|
786 // ----------------------------------------------------------------------------- |
|
787 void CM2GSVGProxy::IsElementInDomL( |
|
788 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
789 const TM2GSvgElementHandle& aElementHandle, |
|
790 TInt& aIsElementInDom) |
|
791 { |
|
792 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::IsElementInDomL() doc handle=%d, elem handle=%d - begin", aDocumentHandle, aElementHandle); |
|
793 aIsElementInDom = iNative->SvgElementElementInDOM( |
|
794 aDocumentHandle, aElementHandle); |
|
795 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::IsElementInDomL() result=%d - end", aIsElementInDom); |
|
796 } |
|
797 |
|
798 // ----------------------------------------------------------------------------- |
|
799 // CM2GSVGProxy::IsUsedL |
|
800 // ----------------------------------------------------------------------------- |
|
801 void CM2GSVGProxy::IsUsedL(const TM2GSvgElementHandle& aElementHandle, TInt& aResult) |
|
802 { |
|
803 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::IsUsedL() - begin"); |
|
804 aResult = iNative->SvgElementIsUsed(aElementHandle); |
|
805 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::IsUsedL(), result=%d - end", aResult); |
|
806 } |
|
807 |
|
808 // ----------------------------------------------------------------------------- |
|
809 // CM2GSVGProxy::RemoveChildL |
|
810 // ----------------------------------------------------------------------------- |
|
811 void CM2GSVGProxy::RemoveChildL( |
|
812 const TM2GSvgElementHandle& aElementHandle, |
|
813 const TM2GSvgElementHandle& aChildElementHandle, |
|
814 TM2GSvgElementHandle& aHandle) |
|
815 { |
|
816 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::RemoveChildL() parent=%d, child=%d - begin", aElementHandle, aChildElementHandle); |
|
817 aHandle = iNative->SvgElementRemoveChild(aElementHandle, aChildElementHandle); |
|
818 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::RemoveChildL() result handle=%d - end", aHandle); |
|
819 } |
|
820 |
|
821 // ----------------------------------------------------------------------------- |
|
822 // CM2GSVGProxy::RenderDocumentL |
|
823 // ----------------------------------------------------------------------------- |
|
824 void CM2GSVGProxy::RenderDocumentL( |
|
825 const TM2GSvgEngineHandle& aEngineHandle, |
|
826 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
827 const TM2GBitmapHandle& aSurfaceHandle, |
|
828 TM2GBitmapHandle aSurfaceMaskHandle, |
|
829 TReal32 aCurrentTime) |
|
830 { |
|
831 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() native:%d, time=%f - begin", iNative, aCurrentTime); |
|
832 M2G_DEBUG_3("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() engine:%d, doc:%d, surface:%d", aEngineHandle, aDocumentHandle, aSurfaceHandle); |
|
833 iNative->SvgEngineRenderDocument( |
|
834 aEngineHandle, aDocumentHandle, aSurfaceHandle, aSurfaceMaskHandle, aCurrentTime); |
|
835 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() - end"); |
|
836 } |
|
837 |
|
838 // ----------------------------------------------------------------------------- |
|
839 // CM2GSVGProxy::RenderQualityL |
|
840 // ----------------------------------------------------------------------------- |
|
841 void CM2GSVGProxy::RenderQualityL( |
|
842 const TM2GSvgDocumentHandle& aEngineHandle, |
|
843 TInt aQuality) |
|
844 { |
|
845 iNative->SvgEngineSetRenderQuality(aEngineHandle, aQuality); |
|
846 } |
|
847 |
|
848 // ----------------------------------------------------------------------------- |
|
849 // CM2GSVGProxy::RequestCompletedL |
|
850 // ----------------------------------------------------------------------------- |
|
851 void CM2GSVGProxy::RequestCompletedL( |
|
852 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
853 const TPtrC16& aURI, |
|
854 const TPtrC8& aResourceData, |
|
855 TInt& aCompleted) |
|
856 { |
|
857 M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::RequestCompleted() uri sz=%d, resource sz= %d ", aURI.Length(), aResourceData.Length()); |
|
858 aCompleted = iNative->SvgDocumentRequestCompleted( |
|
859 aDocumentHandle, |
|
860 aURI, |
|
861 aResourceData); |
|
862 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::RequestCompletedL() completed=%d - end", aCompleted); |
|
863 } |
|
864 |
|
865 // ----------------------------------------------------------------------------- |
|
866 // CM2GSVGProxy::SetColorTraitL |
|
867 // ----------------------------------------------------------------------------- |
|
868 void CM2GSVGProxy::SetColorTraitL( |
|
869 const TM2GSvgElementHandle& aElementHandle, |
|
870 const TM2GSvgAttrType& aAttributeType, |
|
871 const TM2GColorData& aColor) |
|
872 { |
|
873 iNative->SvgElementSetColorAttribute( |
|
874 aElementHandle, |
|
875 aAttributeType, |
|
876 aColor[ 0 ], // red |
|
877 aColor[ 1 ], // green |
|
878 aColor[ 2 ]); // blue |
|
879 } |
|
880 |
|
881 // ----------------------------------------------------------------------------- |
|
882 // CM2GSVGProxy::SetEnumTraitL |
|
883 // ----------------------------------------------------------------------------- |
|
884 void CM2GSVGProxy::SetEnumTraitL( |
|
885 const TM2GSvgElementHandle& aElementHandle, |
|
886 const TM2GSvgAttrType& aAttributeType, |
|
887 TInt16 aValue) |
|
888 { |
|
889 iNative->SvgElementSetEnumAttribute( |
|
890 aElementHandle, |
|
891 aAttributeType, |
|
892 aValue); |
|
893 } |
|
894 |
|
895 // ----------------------------------------------------------------------------- |
|
896 // CM2GSVGProxy::SetFloatTraitL |
|
897 // ----------------------------------------------------------------------------- |
|
898 void CM2GSVGProxy::SetFloatTraitL( |
|
899 const TM2GSvgElementHandle& aElementHandle, |
|
900 const TM2GSvgAttrType& aAttributeType, |
|
901 const TReal32& aValue) |
|
902 { |
|
903 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetFloatTraitL() - %f", aValue); |
|
904 iNative->SvgElementSetFloatAttribute( |
|
905 aElementHandle, |
|
906 aAttributeType, |
|
907 aValue); |
|
908 } |
|
909 |
|
910 // ----------------------------------------------------------------------------- |
|
911 // CM2GSVGProxy::SetMatrixTraitL |
|
912 // ----------------------------------------------------------------------------- |
|
913 void CM2GSVGProxy::SetMatrixTraitL( |
|
914 const TM2GSvgElementHandle& aElementHandle, |
|
915 const TM2GSvgAttrType& aAttributeType, |
|
916 const TM2GMatrixData& aMatrix) |
|
917 { |
|
918 // [ m00 m01 m02 ] |
|
919 // [ m10 m11 m12 ] |
|
920 // [ 0 0 1 ] |
|
921 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetMatrixTraitL() - begin"); |
|
922 iNative->SvgElementSetMatrixAttribute( |
|
923 aElementHandle, |
|
924 aAttributeType, |
|
925 aMatrix[ 0 ], // m00 - A |
|
926 aMatrix[ 1 ], // m10 - B |
|
927 aMatrix[ 2 ], // m01 - C |
|
928 aMatrix[ 3 ], // m11 - D |
|
929 aMatrix[ 4 ], // m02 - E |
|
930 aMatrix[ 5 ]); // m12 - F |
|
931 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetMatrixTraitL() - end"); |
|
932 } |
|
933 |
|
934 // ----------------------------------------------------------------------------- |
|
935 // CM2GSVGProxy::SetMediaTimeL |
|
936 // ----------------------------------------------------------------------------- |
|
937 void CM2GSVGProxy::SetMediaTimeL( |
|
938 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
939 const TReal32& aSeconds) |
|
940 { |
|
941 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetMediaTimeL() %f - begin", aSeconds); |
|
942 iNative->SvgDocumentSetMediaTime(aDocumentHandle, aSeconds); |
|
943 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetMediaTimeL() - end"); |
|
944 } |
|
945 |
|
946 // ----------------------------------------------------------------------------- |
|
947 // CM2GSVGProxy::SetPathTraitL |
|
948 // ----------------------------------------------------------------------------- |
|
949 void CM2GSVGProxy::SetPathTraitL( |
|
950 const TM2GSvgElementHandle& aElementHandle, |
|
951 const TM2GSvgAttrType& aAttributeType, |
|
952 const TM2GSvgPathHandle& aPathHandle) |
|
953 { |
|
954 iNative->SvgElementSetPathAttribute( |
|
955 aElementHandle, |
|
956 aAttributeType, |
|
957 aPathHandle); |
|
958 } |
|
959 |
|
960 // ----------------------------------------------------------------------------- |
|
961 // CM2GSVGProxy::SetRectTraitL |
|
962 // ----------------------------------------------------------------------------- |
|
963 void CM2GSVGProxy::SetRectTraitL( |
|
964 const TM2GSvgElementHandle& aElementHandle, |
|
965 const TM2GSvgAttrType& aAttributeType, |
|
966 const TM2GRectData& aRect) |
|
967 { |
|
968 iNative->SvgElementSetRectAttribute( |
|
969 aElementHandle, |
|
970 aAttributeType, |
|
971 aRect[ 0 ], // aX |
|
972 aRect[ 1 ], // aY |
|
973 aRect[ 2 ], // aWidth |
|
974 aRect[ 3 ]); // aHeight |
|
975 } |
|
976 |
|
977 // ----------------------------------------------------------------------------- |
|
978 // CM2GSVGProxy::SetRenderingQualityL |
|
979 // ----------------------------------------------------------------------------- |
|
980 void CM2GSVGProxy::SetRenderingQualityL( |
|
981 const TM2GSvgDocumentHandle& aEngineHandle, |
|
982 TInt aMode) |
|
983 { |
|
984 iNative->SvgEngineSetRenderQuality(aEngineHandle, aMode); |
|
985 } |
|
986 |
|
987 // ----------------------------------------------------------------------------- |
|
988 // CM2GSVGProxy::SetStringTraitL |
|
989 // ----------------------------------------------------------------------------- |
|
990 void CM2GSVGProxy::SetStringTraitL( |
|
991 const TM2GSvgElementHandle& aElementHandle, |
|
992 const TM2GSvgAttrType& aAttributeTypeId, |
|
993 const TPtrC16& aStr) |
|
994 { |
|
995 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetStringTraitL() - begin"); |
|
996 iNative->SvgElementSetStringAttribute( |
|
997 aElementHandle, |
|
998 aAttributeTypeId, |
|
999 aStr); |
|
1000 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetStringTraitL(): str sz:%d - end", aStr.Length()); |
|
1001 } |
|
1002 |
|
1003 // ----------------------------------------------------------------------------- |
|
1004 // CM2GSVGProxy::SetViewportWidthL |
|
1005 // ----------------------------------------------------------------------------- |
|
1006 void CM2GSVGProxy::SetViewportWidthL( |
|
1007 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
1008 TInt aWidth) |
|
1009 { |
|
1010 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetViewportWidthL(): %d - begin", aWidth); |
|
1011 iNative->SvgDocumentSetViewportWidth(aDocumentHandle, aWidth); |
|
1012 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetViewportWidthL() - end"); |
|
1013 } |
|
1014 |
|
1015 // ----------------------------------------------------------------------------- |
|
1016 // CM2GSVGProxy::SetViewportHeightL |
|
1017 // ----------------------------------------------------------------------------- |
|
1018 void CM2GSVGProxy::SetViewportHeightL( |
|
1019 const TM2GSvgDocumentHandle& aDocumentHandle, |
|
1020 TInt aHeight) |
|
1021 { |
|
1022 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetViewportHeightL(): %d - begin", aHeight); |
|
1023 iNative->SvgDocumentSetViewportHeight(aDocumentHandle, aHeight); |
|
1024 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetViewportHeightL() - end"); |
|
1025 } |
|
1026 |
|
1027 // == PROTECTED METHODS == |
|
1028 |
|
1029 // ----------------------------------------------------------------------------- |
|
1030 // CM2GSVGProxy::CloseContainers |
|
1031 // ----------------------------------------------------------------------------- |
|
1032 void CM2GSVGProxy::CloseContainers() |
|
1033 { |
|
1034 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CloseContainers() - begin"); |
|
1035 if (iNative) |
|
1036 { |
|
1037 // Clear document container |
|
1038 TInt count = iSvgDocuments.Count(); |
|
1039 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::CloseContainers() - document count=%d", count); |
|
1040 for (TInt index = 0; index < count; index++) |
|
1041 { |
|
1042 iNative->SvgDocumentDestroy(iSvgDocuments[index]); |
|
1043 } |
|
1044 iSvgDocuments.Reset(); |
|
1045 iSvgDocuments.Close(); |
|
1046 // Clear engine container |
|
1047 count = iSvgEngines.Count(); |
|
1048 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::CloseContainers() - engine count=%d", count); |
|
1049 for (TInt index = 0; index < count; index++) |
|
1050 { |
|
1051 iNative->SvgEngineDestroy(iSvgEngines[index]); |
|
1052 } |
|
1053 iSvgEngines.Reset(); |
|
1054 iSvgEngines.Close(); |
|
1055 } |
|
1056 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CloseContainers() - end"); |
|
1057 } |
|
1058 |
|
1059 // == PRIVATE METHODS == |
|
1060 |
|
1061 // ----------------------------------------------------------------------------- |
|
1062 // CM2GSVGProxy::CM2GSVGProxy |
|
1063 // ----------------------------------------------------------------------------- |
|
1064 CM2GSVGProxy::CM2GSVGProxy() |
|
1065 : CBase(), |
|
1066 iNative(NULL), |
|
1067 iSvgEngines(), |
|
1068 iSvgDocuments() |
|
1069 { |
|
1070 iSvgEngines.Compress(); |
|
1071 iSvgDocuments.Compress(); |
|
1072 } |
|
1073 |
|
1074 // ----------------------------------------------------------------------------- |
|
1075 // CM2GSVGProxy::ConstructL |
|
1076 // ----------------------------------------------------------------------------- |
|
1077 void CM2GSVGProxy::ConstructL() |
|
1078 { |
|
1079 M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::ConstructL() - begin"); |
|
1080 |
|
1081 //Get the font spec with variant default font |
|
1082 const TInt KApacFontId = EApacPlain16; |
|
1083 const TInt KLatintFontId = ELatinBold12; |
|
1084 TInt fontId = KLatintFontId; |
|
1085 |
|
1086 switch (AknLayoutUtils::Variant()) |
|
1087 { |
|
1088 case EApacVariant: |
|
1089 { |
|
1090 fontId = KApacFontId; |
|
1091 } |
|
1092 break; |
|
1093 |
|
1094 case EEuropeanVariant: |
|
1095 default: |
|
1096 break; |
|
1097 } |
|
1098 |
|
1099 const CFont* font = AknLayoutUtils::FontFromId(fontId); |
|
1100 TFontSpec spec = font->FontSpecInTwips(); |
|
1101 |
|
1102 iNative = CSvgJavaInterfaceImpl::NewL(spec); |
|
1103 M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::ConstructL() - SVGTopt created: %d", iNative); |
|
1104 } |
|
1105 |
|
1106 M2G_NS_END |