|
1 /* |
|
2 * Copyright (c) 2003 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: SVG Engine header file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef SVGENGINEINTERFACEIMPL_H |
|
20 #define SVGENGINEINTERFACEIMPL_H |
|
21 |
|
22 #if !defined(__E32BASE_H__) |
|
23 #include <e32base.h> |
|
24 #endif |
|
25 |
|
26 //does this need to be in a #define |
|
27 #include <e32cons.h> |
|
28 #include <w32std.h> |
|
29 #include <badesca.h> |
|
30 #include "SVGRendererId.h" |
|
31 #include "SVGListener.h" |
|
32 |
|
33 const TInt KSvgEngineUidValue=0x040039CE; |
|
34 const TUid KSvgEngineUid={KSvgEngineUidValue}; |
|
35 |
|
36 typedef TUint TRenderingQuality; |
|
37 const TRenderingQuality KLowNoAA = 0; |
|
38 const TRenderingQuality KHighNoAA = 1; |
|
39 const TRenderingQuality KLowAA = 2; |
|
40 const TRenderingQuality KHighAA = 3; |
|
41 |
|
42 const TInt KInvalidEnumAttribute = -10000; |
|
43 const TReal32 KInvalidFloatAttribute = -10000; |
|
44 #define KSVGColorNone 2 |
|
45 #define KSVGCurrentColor 3 |
|
46 #define KSVGColorInherit 4 |
|
47 #define KSVGAttributeInherit 5 |
|
48 #define __TLV_ // Needed by orbit. |
|
49 |
|
50 enum TSvgErrorCode |
|
51 { |
|
52 ESvgNoError = 0, |
|
53 ESvgFileNotFound, |
|
54 ESvgDocumentNotValid, |
|
55 ESvgDocumentNotAvailable, |
|
56 ESvgNoMemory, |
|
57 ESvgDiskFull, |
|
58 ESvgUnknown, |
|
59 ESvgMissingRequiredAttribute, |
|
60 ESvgInvalidAttributeValue, |
|
61 ESvgbFileNotValid, |
|
62 ESvgDRMFailure, |
|
63 ESvgThumbNailRestriction |
|
64 }; |
|
65 |
|
66 enum TSvgPreserveAspectAlignType |
|
67 { |
|
68 ESvgPreserveAspectRatio_None, |
|
69 ESvgPreserveAspectRatio_Unknown, |
|
70 ESvgPreserveAspectRatio_XmaxYmax, |
|
71 ESvgPreserveAspectRatio_XmaxYmid, |
|
72 ESvgPreserveAspectRatio_XmaxYmin, |
|
73 ESvgPreserveAspectRatio_XmidYmax, |
|
74 ESvgPreserveAspectRatio_XmidYmid, //default |
|
75 ESvgPreserveAspectRatio_XmidYmin, |
|
76 ESvgPreserveAspectRatio_XminYmax, |
|
77 ESvgPreserveAspectRatio_XminYmid, |
|
78 ESvgPreserveAspectRatio_XminYmin |
|
79 }; |
|
80 |
|
81 enum TSvgMeetOrSliceType |
|
82 { |
|
83 ESvgMeetOrSlice_Meet, |
|
84 ESvgMeetOrSlice_Slice, |
|
85 ESvgMeetOrSlice_Unknown |
|
86 }; |
|
87 |
|
88 class MSvgHyperlinkListener; |
|
89 class MSvgTextAreaListener; |
|
90 class MSvgTextListener; |
|
91 class MSvgAnimationListener; |
|
92 class MSvgListener; |
|
93 class CGfxGeneralPath; |
|
94 class CFbsBitmap; |
|
95 class CSvgEngineImpl; |
|
96 //class CSvgGcStack; |
|
97 class CSvgElementImpl; |
|
98 class MSvgEventReceiver; |
|
99 class MSvgRequestObserver; |
|
100 class CSvgTimer; |
|
101 class MXmlElement; |
|
102 class CSvgDocumentImpl; |
|
103 class CXmlElementImpl; |
|
104 class CSvgErrorImpl; |
|
105 class CSvgTextElementImpl; |
|
106 |
|
107 class CSvgBitmapFontProvider; |
|
108 class MRect |
|
109 { |
|
110 public: |
|
111 |
|
112 /** |
|
113 * Get the four points for a rectangle |
|
114 * |
|
115 * @since 1.0 |
|
116 * @return : void |
|
117 */ |
|
118 virtual void GetPoints(TPoint& aPoint1, TPoint& aPoint2, TPoint& aPoint3, TPoint& aPoint4) const = 0; |
|
119 |
|
120 virtual TBool Intersects( const MRect& aRect ) = 0; |
|
121 |
|
122 virtual void Center( TPoint& aCenter ) = 0; |
|
123 |
|
124 }; |
|
125 |
|
126 |
|
127 class MSvgError |
|
128 { |
|
129 public: |
|
130 |
|
131 /** |
|
132 * Determine wether an error is indicated by this object. |
|
133 * |
|
134 * @since 1.0 |
|
135 * @return : ETrue, if ErrorCode() != ESvgNoError |
|
136 */ |
|
137 virtual TBool HasError() = 0; |
|
138 |
|
139 /** |
|
140 * Determine wether an error is only a warning. |
|
141 * This should be a state when the svg may be display, despite |
|
142 * a conflict. |
|
143 * |
|
144 * @since 1.0 |
|
145 * @return ETrue if HasError() is only a warning. |
|
146 */ |
|
147 virtual TBool IsWarning() = 0; |
|
148 |
|
149 /** |
|
150 * Get the error code contained by this object. |
|
151 * |
|
152 * @since 1.0 |
|
153 * @return : the TSvgErrorCode value |
|
154 */ |
|
155 virtual TSvgErrorCode ErrorCode() = 0; |
|
156 |
|
157 /** |
|
158 * Get the error description string for this object. |
|
159 * |
|
160 * @since 1.0 |
|
161 * @return : error description string. |
|
162 */ |
|
163 virtual TDesC& Description() = 0; |
|
164 |
|
165 /** |
|
166 * Get the system error code contained by this object. For example, |
|
167 * If ErrorCode() is ESvgDRMFailure, SystemErrorCode() will contain |
|
168 * the error-code returned by the system for a drm-failure. |
|
169 * |
|
170 * @since 1.0 |
|
171 * @return : the TSvgErrorCode value |
|
172 */ |
|
173 virtual TInt SystemErrorCode() = 0; |
|
174 }; |
|
175 |
|
176 /** |
|
177 * This class implements the interface for a SVGT Engine, providing methods |
|
178 * to load svg contents and manipulate the output, such as zooming, panning |
|
179 * and rotating the display. |
|
180 */ |
|
181 class CSvgEngineInterfaceImpl : public CBase |
|
182 { |
|
183 public: |
|
184 |
|
185 IMPORT_C MSvgError* CSvgEngineInterfaceImpl::SaveSvgDom(TInt aHandle, const TDesC& aFileName, TInt aEngine = NULL); |
|
186 |
|
187 /** |
|
188 * Two phase construction |
|
189 */ |
|
190 // April 27th : Add thrid new parameter for specifying the Text height |
|
191 IMPORT_C static CSvgEngineInterfaceImpl* NewL( CFbsBitmap* aFrameBuffer, |
|
192 MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec ); |
|
193 IMPORT_C static CSvgEngineInterfaceImpl* NewL( CFbsBitmap* aFrameBuffer, |
|
194 MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec ,SVGRendererId aRendererType ); |
|
195 |
|
196 /** |
|
197 * Create a new Svg Engine interface. |
|
198 * |
|
199 * @since 1.0 |
|
200 * @param : aFrameBuffer -- bitmap to draw resulting svg image. |
|
201 * @param : aReqObserver -- interface for callbacks to retrieve info |
|
202 * only client can provide, such as opening files. |
|
203 * @param : aFontSpec -- Font spec to use for text drawing. |
|
204 * @return : none |
|
205 */ |
|
206 IMPORT_C static CSvgEngineInterfaceImpl* NewLC( CFbsBitmap* aFrameBuffer, |
|
207 MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec ); |
|
208 // NGA:: overloading NewLC to include a renderer selector parameter |
|
209 IMPORT_C static CSvgEngineInterfaceImpl* NewLC( CFbsBitmap* aFrameBuffer, |
|
210 MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec ,SVGRendererId aRendererType ); |
|
211 |
|
212 /** |
|
213 * Added for getting the NVG-TLV from S60SVGTEngine in QT S60 baseport. |
|
214 * @since 1.0 |
|
215 * @return : Pointer to the tlv data |
|
216 */ |
|
217 |
|
218 IMPORT_C const TPtrC8 TLVEncodedData() const; |
|
219 |
|
220 /** |
|
221 * Svg Engine interface Destructor. |
|
222 * |
|
223 * @since 1.0 |
|
224 * @param : None |
|
225 * @return : none |
|
226 */ |
|
227 IMPORT_C ~CSvgEngineInterfaceImpl(); |
|
228 |
|
229 /** |
|
230 * Load a svg document from a file. An error is return if one is encountered. |
|
231 * Some errors may be more like warnings, which may allow the svg content |
|
232 * to display nevertheless. |
|
233 * |
|
234 * @since 1.0 |
|
235 * @param aFileName -- Name of svg file |
|
236 * @return : Error code if any |
|
237 */ |
|
238 IMPORT_C MSvgError* Load( const TDesC& aFileName ); |
|
239 |
|
240 /** |
|
241 * Load a svg document from a byte array. An error is return if one is encountered. |
|
242 * Some errors may be more like warnings, which may allow the svg content |
|
243 * to display nevertheless. |
|
244 * |
|
245 * @since 1.0 |
|
246 * @param aByteData -- Byte array of svg document. |
|
247 * @return : Error code if any |
|
248 */ |
|
249 IMPORT_C MSvgError* Load( const TDesC8& aByteData ); |
|
250 |
|
251 /** |
|
252 * Load a svg document from from the RFile Handle passed. An error is return if one is encountered. |
|
253 * Some errors may be more like warnings, which may allow the svg content |
|
254 * to display nevertheless. |
|
255 * |
|
256 * @since 1.0 |
|
257 * @param aFileHandle -- RFile handle of svg document. |
|
258 * @return : Error code if any |
|
259 **/ |
|
260 IMPORT_C MSvgError* Load( RFile& aFileHandle ); |
|
261 |
|
262 /** |
|
263 * Destroy the currently "loaded" svg document. Prepared documents, |
|
264 * must be destroy through DeleteDom, or the engine will destroy them |
|
265 * in its destructor function. |
|
266 * |
|
267 * @since 1.0 |
|
268 * @param : none |
|
269 * @return : none |
|
270 */ |
|
271 IMPORT_C void Destroy(); |
|
272 |
|
273 |
|
274 /** |
|
275 * Request the SVG Engine to begin an animation. |
|
276 * |
|
277 * @since 1.0 |
|
278 * @param : aEngine -- NULL to start internal svg-engine |
|
279 * @param : aIsMainThread -- EFalse to start engine asynchronously, |
|
280 * defaulted to EFalse. |
|
281 * @return : none |
|
282 */ |
|
283 IMPORT_C void Start( CSvgEngineImpl* aEngine = NULL, |
|
284 TBool aIsMainThread = ETrue ); |
|
285 |
|
286 /** |
|
287 * Request the SVG Engine to begin an animation. |
|
288 * This method returns an error code. |
|
289 * @since 1.0 |
|
290 * @param : MSvgError*& -- Pointer to Error object , |
|
291 * @param : aEngine -- NULL to start internal svg-engine, |
|
292 * @return : none |
|
293 */ |
|
294 |
|
295 IMPORT_C void Start( MSvgError*& aError, |
|
296 CSvgEngineImpl* aEngine = NULL |
|
297 ); |
|
298 /** |
|
299 * Request the SVG Engine to stop an animation. |
|
300 * |
|
301 * @since 1.0 |
|
302 * @param : none |
|
303 * @return : none |
|
304 */ |
|
305 IMPORT_C void Stop( CSvgEngineImpl* aEngine = NULL ); |
|
306 |
|
307 /** |
|
308 * Request the SVG Engine to pause an animation. |
|
309 * |
|
310 * @since Series 60 3.0 |
|
311 * @param : none |
|
312 * @return : none |
|
313 */ |
|
314 IMPORT_C void Pause( CSvgEngineImpl* aEngine = NULL ); |
|
315 |
|
316 /** |
|
317 * Request the SVG Engine to resume an animation. |
|
318 * |
|
319 * @since 1.0 |
|
320 * @param : none |
|
321 * @return : none |
|
322 */ |
|
323 IMPORT_C void Resume( CSvgEngineImpl* aEngine = NULL ); |
|
324 |
|
325 /** |
|
326 * Get the animation duration of a svg content, in milliseconds, |
|
327 * for non-indefinite animations. |
|
328 * |
|
329 * @since 1.0 |
|
330 * @param |
|
331 * @return the animation duration. |
|
332 */ |
|
333 IMPORT_C TUint32 Duration( TInt aEngine = NULL ); |
|
334 |
|
335 /** |
|
336 * Reset the view to the default values. Redraw() must be called to |
|
337 * update the output image. |
|
338 * |
|
339 * @since 1.0 |
|
340 * @param |
|
341 * @return the animation duration. |
|
342 */ |
|
343 IMPORT_C void OriginalView( TInt aEngine = NULL ); |
|
344 |
|
345 |
|
346 /** |
|
347 * Request the SVG Engine to zoom-in on the content given the zoom factor. |
|
348 * The value range is greater than zero. The current zoom factor is |
|
349 * multiplied with the given value to yield the final result. Redraw() |
|
350 * must be called to update the output image. |
|
351 * |
|
352 * @since 1.0 |
|
353 * @param : aScaleFactor -- A value greater than zero. |
|
354 * @return |
|
355 */ |
|
356 IMPORT_C void Zoom( TReal32 aScaleFactor, TInt aEngine = NULL ) __SOFTFP; |
|
357 |
|
358 /** |
|
359 * Shift the center of the content in both x and y coordinates. The |
|
360 * values are in user-coordinate values and may be negative. Redraw() |
|
361 * must be called to update the output image. |
|
362 * |
|
363 * @since 1.0 |
|
364 * @param : aX -- Number of pixels to pan left (negative) or right. |
|
365 * @param : aY -- Number of pixels to pan up (negative) or down. |
|
366 * @return |
|
367 */ |
|
368 IMPORT_C void Pan( TInt aX, TInt aY, TInt aEngine = NULL ); |
|
369 |
|
370 /** |
|
371 * Shift the center of the content in both x and y coordinates. The |
|
372 * values are in user-coordinate values and may be negative. |
|
373 * |
|
374 * @since 1.0 |
|
375 * @param : aX -- Number of pixels to pan left (negative) or right. |
|
376 * @param : aY -- Number of pixels to pan up (negative) or down. |
|
377 * @return TBool |
|
378 */ |
|
379 IMPORT_C TBool IsPanPossible( TInt aX, TInt aY, TInt aEngine = NULL ); |
|
380 |
|
381 /** |
|
382 * Checks the panning possibility in four directions. A efficient |
|
383 * API for clients which want to show 4 way panning indicators. |
|
384 * It is efficient for these clients to get the all four direction |
|
385 * information at one go. Saves rendering time significantly per |
|
386 * frame. |
|
387 * |
|
388 * @since 1.0 |
|
389 * @param : left: would contain result of whether panning of one pixel |
|
390 * possible to left. |
|
391 * @param : right: would contain result of whether panning of one pixel |
|
392 * possible to right. |
|
393 * @param : up: would contain result of whether panning of one pixel |
|
394 * possible to up. |
|
395 * @param : down: would contain result of whether panning of one pixel |
|
396 * possible to down. |
|
397 * @param : |
|
398 * @return |
|
399 */ |
|
400 IMPORT_C void IsPanPossibleFourWay |
|
401 ( TBool& left, TBool& right, TBool& up, TBool& down, TInt aEngine = NULL); |
|
402 |
|
403 /** |
|
404 * Rotate the content about the given point by the given angle. |
|
405 * The point is in user-coordinates. Redraw() must be called to |
|
406 * update the output image. |
|
407 * |
|
408 * @since 1.0 |
|
409 * @param : aAngle -- Number of gradients to rotate. |
|
410 * @param : aX -- X center of rotation |
|
411 * @param : aY -- Y center of rotation. |
|
412 * @return |
|
413 */ |
|
414 IMPORT_C void Rotate( TReal32 aAngle, |
|
415 TInt aX, |
|
416 TInt aY, |
|
417 TInt aEngine = NULL ) __SOFTFP; |
|
418 |
|
419 /** |
|
420 * Notify the SVG Engine that a "mouse down" event. The engine will |
|
421 * initiate mouse-related events, such as links, if appropriate. |
|
422 * |
|
423 * @since 1.0 |
|
424 * @param : aX -- x coordinate of mouse event. |
|
425 * @param : aY -- y coordinate of mouse event. |
|
426 * @return |
|
427 */ |
|
428 IMPORT_C TInt MouseDown( TInt aX, TInt aY, TInt aEngine = NULL ); |
|
429 |
|
430 /** |
|
431 * Notify the SVG Engine that a "mouse up" event. The engine will |
|
432 * initiate mouse-related events, such as links, if appropriate. |
|
433 * |
|
434 * @since 1.0 |
|
435 * @param : aX -- x coordinate of mouse event. |
|
436 * @param : aY -- y coordinate of mouse event. |
|
437 * @return |
|
438 */ |
|
439 IMPORT_C void MouseUp( TInt aX, TInt aY, TInt aEngine = NULL ); |
|
440 |
|
441 /** |
|
442 * Notify the SVG Engine that a "mouse move" event. The engine will |
|
443 * initiate mouse-related events, such as links, if appropriate. |
|
444 * |
|
445 * @since 1.0 |
|
446 * @param : aX -- x coordinate of mouse event. |
|
447 * @param : aY -- y coordinate of mouse event. |
|
448 * @return |
|
449 */ |
|
450 IMPORT_C void MouseMove( TInt aX, TInt aY, TInt aEngine = NULL ); |
|
451 |
|
452 /** |
|
453 * Notify the SVG Engine that a "key press" event. The engine will |
|
454 * initiate key-related events if appropriate. |
|
455 * @since 1.0 |
|
456 * @param : aKeyCode -- key code of key event. |
|
457 * @return |
|
458 */ |
|
459 |
|
460 IMPORT_C void KeyPress( const TKeyEvent& aKeyEvent, TInt aEngine = NULL ); |
|
461 |
|
462 /** |
|
463 * Retrieve the rendering quality setting. See TRenderingQuality |
|
464 * for possible values. |
|
465 * |
|
466 * @since 1.0 |
|
467 * @param |
|
468 * @return |
|
469 */ |
|
470 IMPORT_C TRenderingQuality GetRenderQuality( ); |
|
471 |
|
472 /** |
|
473 * Set the rendering quality. Low-level graphics is always set |
|
474 * to high -- no effect from this call. Redraw() must be called to |
|
475 * update the output image. |
|
476 * |
|
477 * @since 1.0 |
|
478 * @param : aQualityLevel -- rendering quality |
|
479 * @return |
|
480 */ |
|
481 IMPORT_C void SetRenderQuality( TRenderingQuality aQualityLevel, TInt aEngine = NULL ); |
|
482 |
|
483 /** |
|
484 * Retrieve the reference to the svg document object. |
|
485 * |
|
486 * @since 1.0 |
|
487 * @param none |
|
488 * @return current document that was Loaded or Prepare/UseDom. |
|
489 */ |
|
490 |
|
491 //DEPRECATED API... |
|
492 IMPORT_C CSvgDocumentImpl* SvgDocument(); |
|
493 |
|
494 /** |
|
495 * Set the minimum delay between each frame, in milliseconds. |
|
496 * Frames per Second = 1000 / aFrameDelay |
|
497 * |
|
498 * The default/minimum value is 67 milliseconds (15 fps). |
|
499 * |
|
500 * @since 1.0 |
|
501 * @param : aFrameDelay -- animation frame duration. |
|
502 * @return none |
|
503 */ |
|
504 IMPORT_C void SetAnimFrameDuration( TUint aAFDur, TInt aEngine = NULL ); |
|
505 |
|
506 /** |
|
507 * Request for updating the off-screen image buffer with the |
|
508 * svg content. |
|
509 * |
|
510 * @since 1.0 |
|
511 * @param aIsMainThread -- indicate whether this redraw request |
|
512 * is called in the main thread (executed immediately). |
|
513 * Otherwise, this request is to be executed asynchronously. |
|
514 * 'Main thread' used here means the thread which instantiated |
|
515 * this CSvgEngineInterfaceImpl object. |
|
516 * @return none |
|
517 */ |
|
518 IMPORT_C void Redraw( TBool aIsMainThread = ETrue, TInt aEngine = NULL ); |
|
519 |
|
520 /** |
|
521 * Switch the debugging mode on/off. |
|
522 * |
|
523 * @since 1.0 |
|
524 * @param none |
|
525 * @return none |
|
526 */ |
|
527 IMPORT_C void SwitchDebugInfo( TInt aEngine = NULL ); |
|
528 |
|
529 /** |
|
530 * This is the integer version of ContentDimensions. |
|
531 * 1) Return the size of the <svg> width/height if given in non-percentage. |
|
532 * |
|
533 * 2) If <svg> width/height are given as percentages: |
|
534 * A) If viewbox attribute is specified, return the viewbox width/height times the <svg> width/height percentages. |
|
535 * B) Else return the content bounding-box size times times the <svg> width/height percentages. |
|
536 * |
|
537 * @since 1.0 |
|
538 * @param none |
|
539 * @return TSize |
|
540 */ |
|
541 IMPORT_C TSize ContentDimensions( TInt aEngine = NULL ); |
|
542 |
|
543 /** |
|
544 * This is the floating-point version of ContentDimensions. |
|
545 * 1) Return the size of the <svg> width/height if given in non-percentage. |
|
546 * |
|
547 * 2) If <svg> width/height are given as percentages: |
|
548 * A) If viewbox attribute is specified, return the viewbox width/height times the <svg> width/height percentages. |
|
549 * B) Else return the content bounding-box size times times the <svg> width/height percentages. |
|
550 * |
|
551 * @since 1.0 |
|
552 * @param none |
|
553 * @return |
|
554 */ |
|
555 IMPORT_C void ContentDimensions( TReal32& aWidth, TReal32& aHeight, TInt aEngine = NULL ) __SOFTFP; |
|
556 |
|
557 /** |
|
558 * Retrieve the content size in user-coordinates if specified as |
|
559 * percentage. |
|
560 * |
|
561 * @since 3.1 |
|
562 * @param none |
|
563 * @return TSize |
|
564 */ |
|
565 IMPORT_C TSize ContentDimensionsInPercentage( TInt aEngine = NULL ); |
|
566 |
|
567 |
|
568 /** |
|
569 * Set focus coordinates to the next focusable object. |
|
570 * |
|
571 * @since 1.0 |
|
572 * @param none |
|
573 * @return rectangle area having the focus on an object. |
|
574 */ |
|
575 IMPORT_C TRect FocusNext(); |
|
576 |
|
577 /** |
|
578 * Set focus coordinates to the previous focusable object. |
|
579 * |
|
580 * @since 1.0 |
|
581 * @param none |
|
582 * @return rectangle area having the focus on the previous object. |
|
583 */ |
|
584 IMPORT_C TRect FocusPrevious(); |
|
585 |
|
586 /** |
|
587 * Activate currently focussed object. |
|
588 * |
|
589 * @since 1.0 |
|
590 * @param none |
|
591 * @return none |
|
592 */ |
|
593 IMPORT_C void ActivateObjectInFocus(); |
|
594 |
|
595 /** |
|
596 * Get the current animation frame time, in milliseconds. |
|
597 * |
|
598 * @since 1.0 |
|
599 * @param none |
|
600 * @return current frame time. |
|
601 */ |
|
602 IMPORT_C TInt32 MediaTime( TInt aEngine = NULL ); |
|
603 |
|
604 /** |
|
605 * Set the current animation frame time, in millseconds. |
|
606 * |
|
607 * @since 1.0 |
|
608 * @param aTime -- time to forward/rewind to. |
|
609 * @return none |
|
610 */ |
|
611 IMPORT_C void SetMediaTime( TInt32 aTime, TInt aEngine = NULL ); |
|
612 /** |
|
613 * Returns the Size of Viewport |
|
614 * |
|
615 * @since 1.0 |
|
616 * @param none |
|
617 * @return viewport size |
|
618 */ |
|
619 IMPORT_C TSize Size( TInt aEngine = NULL ); |
|
620 |
|
621 /** |
|
622 * Returns the Position of Viewport |
|
623 * |
|
624 * @since 1.0 |
|
625 * @param none |
|
626 * @return |
|
627 */ |
|
628 IMPORT_C TPoint Position( TInt aEngine = NULL ) ; |
|
629 |
|
630 /** |
|
631 * Reset the focus list |
|
632 * This happens in the event of new additions to EventReceiver list and/or |
|
633 * sorting of this list |
|
634 * |
|
635 * @since 1.0 |
|
636 * @param aIndex - index of object to reset focus. |
|
637 * @return |
|
638 */ |
|
639 void ResetFocusIndex(TInt32 aIndex); |
|
640 |
|
641 /** |
|
642 * Generate mask bitmap from the current frame |
|
643 * |
|
644 * @since 1.0 |
|
645 * @param aMask - bitmap to hold masking info. |
|
646 * @return none |
|
647 */ |
|
648 IMPORT_C void GenerateMask( CFbsBitmap* aMask, TInt aEngine = NULL ); |
|
649 |
|
650 /** |
|
651 * Set the color for clearing background. |
|
652 * |
|
653 * @since 1.0 |
|
654 * @param aRGBA8888Color - 32-bit color value |
|
655 * @return none |
|
656 */ |
|
657 IMPORT_C void SetBackgroundColor( TUint32 aRGBA8888Color, CSvgEngineImpl* aEngine = NULL ); |
|
658 |
|
659 /** |
|
660 * Returns SVG Engine State |
|
661 * |
|
662 * @since 1.0 |
|
663 * @param none |
|
664 * @return 0 == SVG Running and 1 == SVG Paused |
|
665 */ |
|
666 |
|
667 IMPORT_C TInt CurrentState( TInt aEngine = NULL ); |
|
668 |
|
669 /** |
|
670 * Returns SVG Engine Pan Position |
|
671 * |
|
672 * @since 1.0 |
|
673 * @param |
|
674 * @return TPoint |
|
675 */ |
|
676 IMPORT_C TPoint PanPosition( TInt aEngine = NULL ); |
|
677 |
|
678 /** |
|
679 * This method is a special case Constructor method used for polymorphic |
|
680 * DLL loading, which enforces this method to be public. |
|
681 * |
|
682 * @since 1.0 |
|
683 * @return |
|
684 */ |
|
685 IMPORT_C CSvgEngineInterfaceImpl(); |
|
686 |
|
687 /** |
|
688 * Replay the Current Animation. |
|
689 * |
|
690 * @since 1.0 |
|
691 * @param : |
|
692 * @return : MSvgError* Error object specifying the error occured during operation |
|
693 */ |
|
694 IMPORT_C MSvgError* Replay( TInt aEngine = NULL ); |
|
695 |
|
696 /**Added for DOM Caching API changes*/ |
|
697 |
|
698 /** |
|
699 * Parses and Prepares DOM for given SVG or SVGB file. |
|
700 * Provides a Handle to the created DOM. A prepared DOM may be |
|
701 * delete with DeleteDom or when the engine is deleted. |
|
702 * |
|
703 * @param aFileName: the name of the file to be parsed |
|
704 * @param aHandle: Handle to the created DOM. |
|
705 * @return: MSvgError* Error object specifying the error occured during operation |
|
706 */ |
|
707 IMPORT_C MSvgError* PrepareDom(const TDesC& aFileName, TInt& aHandle, TInt aEngine = NULL); |
|
708 |
|
709 /** |
|
710 * Parses and Prepares DOM for both svg and svg binary data. |
|
711 * Provides a Handle to the created DOM. A prepared DOM may be |
|
712 * delete with DeleteDom or when the engine is deleted. |
|
713 * |
|
714 * @param aByteData: Svg/SvgBinary data. |
|
715 * @param aHandle: Handle to the created DOM. |
|
716 * @return: MSvgError* Error object specifying the error occured during operation |
|
717 */ |
|
718 IMPORT_C MSvgError* PrepareDom(const TDesC8& aByteData, TInt& aHandle, TInt aEngine = NULL); |
|
719 |
|
720 /** |
|
721 * Parses and Prepares DOM for given SVG or SVGB file. |
|
722 * Provides a Handle to the created DOM. A prepared DOM may be |
|
723 * delete with DeleteDom or when the engine is deleted. |
|
724 * |
|
725 * @param : aFileHandle -- File handle |
|
726 * @param : aHandle -- Handle to a DOM. |
|
727 * @return: MSvgError* Error object specifying the error occured during operation |
|
728 */ |
|
729 IMPORT_C MSvgError* PrepareDom( RFile& aFileHandle, TInt& aHandle, TInt aEngine = NULL ); |
|
730 |
|
731 /** |
|
732 * Defines view box for SVG content associated with |
|
733 * handle if not set. |
|
734 */ |
|
735 |
|
736 |
|
737 IMPORT_C void ChooseViewBoxIfNotSet(TInt aDomHandle); |
|
738 /** |
|
739 * Renders the DOM tree associated with the Handle (UseDom). |
|
740 * |
|
741 * @param : aHandle -- Handle to a DOM. |
|
742 * @param : aBitmap -- Bitmap to draw DOM content. |
|
743 *@param : aMaskBuffer - Buffer for mask (alpha values) of framebuffer result (optional). |
|
744 * @return: MSvgError* Error object specifying the error occured during operation |
|
745 */ |
|
746 IMPORT_C MSvgError* RenderDom(TInt aHandle, CFbsBitmap* aBitmap, CFbsBitmap* aMaskBuffer = NULL); |
|
747 |
|
748 /** |
|
749 * Deletes the DOM tree associated with the Handle. |
|
750 * |
|
751 * @param : aHandle -- Handle to a DOM. |
|
752 * @return: MSvgError* Error object specifying the error occured during operation |
|
753 */ |
|
754 IMPORT_C MSvgError* DeleteDom( TInt aHandle ); |
|
755 |
|
756 /** |
|
757 * Enable/Disable DRM. |
|
758 * |
|
759 * @param : aEnable -- Flag to enable/distable DRM. |
|
760 * @return: none |
|
761 */ |
|
762 IMPORT_C void SetDRMMode(TBool aEnable, TInt aEngine = NULL); |
|
763 |
|
764 /** |
|
765 * initialization of the engine according to a particular cached DOM tree. |
|
766 * |
|
767 * |
|
768 *@param : aHandle -- Handle to DOM Tree. |
|
769 *@param : aRenderBuffer - Buffer for drawing the DOM Tree. |
|
770 *@param : aMaskBuffer - Buffer for mask (alpha values) of framebuffer result (optional). |
|
771 *@param : aEngine - SvgEngine handle to manager DOM (optional). |
|
772 *@return MSvgError* Error object specifying the error occured. |
|
773 */ |
|
774 IMPORT_C MSvgError* UseDom(TInt aHandle, CFbsBitmap* aRenderBuffer, CFbsBitmap* aMaskBuffer = NULL, TInt aEngine = NULL); |
|
775 |
|
776 IMPORT_C MSvgError* UseDom(TInt aHandle,CFbsBitmap* aRenderBuffer, CFbsBitmap* aMaskBuffer,TSize aRenderBufferSize,TDisplayMode aRenderDisplayMode,TDisplayMode aMaskDisplayMode,TInt aEngine = NULL); |
|
777 /** |
|
778 * Set the SVG dimensions to the root buffer size. |
|
779 * |
|
780 *@param aWidth - width to set root size. |
|
781 *@param aHeight - height to set root size. |
|
782 *@return none |
|
783 */ |
|
784 IMPORT_C void SetSvgDimensionToFrameBuffer(TUint aWidth, TUint aHeight, TInt aEngine = NULL); |
|
785 |
|
786 /** |
|
787 * Return the scaled bounding box for the whole svg document. |
|
788 * |
|
789 *@param none |
|
790 *@return the scaled bounding box info. |
|
791 */ |
|
792 IMPORT_C TRect GetSvgBoundingBox( TInt aEngine = NULL ); |
|
793 |
|
794 /** |
|
795 * Check for interactive/non-interactive content. |
|
796 * |
|
797 *@param aDocument - Document Pointer |
|
798 *@return wether document has interactive elements. |
|
799 */ |
|
800 IMPORT_C TBool IsContentInteractive( CSvgDocumentImpl* aDocument, TInt aEngine = NULL ); |
|
801 |
|
802 /** |
|
803 * Update the path information with the given element |
|
804 * |
|
805 *@param hPath - path handle |
|
806 *@param hElement - element handle |
|
807 *@return none |
|
808 */ |
|
809 IMPORT_C void UpdatePath(TInt hPath, CSvgElementImpl* hElement); |
|
810 |
|
811 /** |
|
812 * Returns the size (number of external elements) in the given document |
|
813 * |
|
814 *@param aDocument - Document Pointer |
|
815 *@return number of external elements |
|
816 */ |
|
817 IMPORT_C TInt GetExternalListSize(CSvgDocumentImpl* aDocument); |
|
818 |
|
819 /** |
|
820 * Given an index number and a document handle returns an external resource uri associated |
|
821 * with an element |
|
822 *@param aDocument - Document Pointer index - index in external list |
|
823 *@return URI |
|
824 */ |
|
825 IMPORT_C void GetExternalListItemL( |
|
826 CSvgDocumentImpl* aDocument, TInt aIndex, TPtrC16& aUri); |
|
827 |
|
828 /** |
|
829 * Given a document handle and a url this call attaches |
|
830 * the given data (ldata) to every element that references that url |
|
831 * |
|
832 *@param aDocument - Document Pointer |
|
833 *@param lUrl- uri string that is an external resource to be retrieved |
|
834 *@param ldata - byte array containing the data that that external resource recieved |
|
835 *@return none |
|
836 * NULL if image-decoding is not initiated. |
|
837 */ |
|
838 IMPORT_C CSvgElementImpl* AddExternalData( CSvgDocumentImpl* aDocument, |
|
839 const TDesC& aUri, |
|
840 const TDesC8& aData, |
|
841 TBool aMakeCopy = EFalse, |
|
842 TInt aSize = 0, |
|
843 TInt aEngine = NULL ); |
|
844 |
|
845 /** |
|
846 * Create an instance of a CSvgEngineImpl. |
|
847 * |
|
848 *@param : None |
|
849 *@return Pointer to CSvgEngineImpl object if creation is succesful, otherwise |
|
850 * the function leaves. |
|
851 */ |
|
852 IMPORT_C CSvgEngineImpl* SvgEngineNewL(); |
|
853 |
|
854 /** |
|
855 * Intialize the given SVG Engine. |
|
856 * |
|
857 *@param : aEngine -- SVG Engine. |
|
858 *@return None |
|
859 */ |
|
860 IMPORT_C void StartEngine( CSvgEngineImpl* aEngine ); |
|
861 IMPORT_C void RenderFrame( CSvgEngineImpl* aEngine, TUint aCurrentTime ); |
|
862 |
|
863 IMPORT_C void ViewportInit( CSvgDocumentImpl* aDocumentHandle ); |
|
864 |
|
865 /** |
|
866 * Set the GDI context for the given SVG Engine. |
|
867 * |
|
868 *@param : aEngine -- SVG Engine. |
|
869 *@param : aFrameBuffer -- Bitmap to become gdi context. |
|
870 *@return None |
|
871 */ |
|
872 IMPORT_C void SetGdiContextL( CSvgEngineImpl* aEngine, CFbsBitmap* aFrameBuffer ); |
|
873 |
|
874 /** |
|
875 * Associate the given document with the given engine. |
|
876 * |
|
877 *@param : aEngine -- SVG Engine. |
|
878 *@param : aDocument -- SVG Document |
|
879 *@return None |
|
880 */ |
|
881 IMPORT_C void SetDocument( CSvgEngineImpl* aEngine, CSvgDocumentImpl* aDocument ); |
|
882 void SvgElementAssignDocument( CSvgElementImpl* aElement, CSvgDocumentImpl* aDoc ); |
|
883 |
|
884 /** |
|
885 * Create an empty instance of a SVG document. |
|
886 * |
|
887 *@param : aEngine -- SVG Engine. |
|
888 *@param : aDocument -- SVG Document |
|
889 *@return Svg Document if successful, otherwise the function leaves. |
|
890 */ |
|
891 IMPORT_C CSvgDocumentImpl* SvgDocumentNewL(); |
|
892 |
|
893 /** |
|
894 * Fill a SVG document by parsing the given byte array. |
|
895 * |
|
896 *@param : aEngine -- SVG Engine. |
|
897 *@param : aDocument -- SVG Document |
|
898 *@return None if successful, otherwise the function leaves. |
|
899 */ |
|
900 IMPORT_C void FillDocumentL( CSvgDocumentImpl* aDocument, const TDesC16& aByteData ); |
|
901 |
|
902 /** |
|
903 * Destroy the given SVG document |
|
904 * |
|
905 *@param : aDocument -- SVG document. |
|
906 *@return None . |
|
907 */ |
|
908 IMPORT_C void DestroyDocument( CSvgDocumentImpl* aDocument ); |
|
909 |
|
910 /** |
|
911 * Destroy the given SVG engine |
|
912 * |
|
913 *@param : aEngine -- SVG Engine. |
|
914 *@return None . |
|
915 */ |
|
916 IMPORT_C void DestroyEngine( CSvgEngineImpl* aEngine ); |
|
917 |
|
918 /** |
|
919 * Return the root element of the given document. |
|
920 * |
|
921 *@param : aDocument -- SVG document. |
|
922 *@return root element . |
|
923 */ |
|
924 IMPORT_C CXmlElementImpl* GetRootElement( CSvgDocumentImpl* aDocument ); |
|
925 |
|
926 /** |
|
927 * Set a default SvgSvg root element of the given document. |
|
928 * |
|
929 *@param : aDocument -- SVG document. |
|
930 *@return void. |
|
931 */ |
|
932 IMPORT_C void InitRootElement( CSvgDocumentImpl* aDocument ); |
|
933 |
|
934 /** |
|
935 * Return the root element of the given document. |
|
936 * |
|
937 *@param : aDocument -- SVG document. |
|
938 *@param : aId -- id string to search for element. |
|
939 *@return element with given id . |
|
940 */ |
|
941 IMPORT_C CXmlElementImpl* GetElementById( CSvgDocumentImpl* aDocument, const TDesC& aId ); |
|
942 |
|
943 /** |
|
944 * Return the number of ids in a given document |
|
945 * |
|
946 *@param : aDocument -- SVG document. |
|
947 *@return number of ids found. |
|
948 */ |
|
949 IMPORT_C TInt GetNumberOfIds( CSvgDocumentImpl* aDocument ); |
|
950 |
|
951 /** |
|
952 * Return the id at from the document at index |
|
953 * |
|
954 *@param : aDocument -- SVG document. |
|
955 *@param : index -- which id to return |
|
956 *@param : myId -- id string to return by reference. |
|
957 *@return none |
|
958 */ |
|
959 IMPORT_C TDesC* GetId( CSvgDocumentImpl* aDocument, TInt index ); |
|
960 |
|
961 /** |
|
962 * Return parent element of the given element. |
|
963 * |
|
964 *@param : aElement -- SVG element. |
|
965 *@return element with given child. |
|
966 */ |
|
967 IMPORT_C CXmlElementImpl* GetParentElement( CXmlElementImpl* aElement ); |
|
968 |
|
969 /** |
|
970 * Set parent element for the given element. |
|
971 * |
|
972 *@param : aElement -- SVG element. |
|
973 *@param : aParentElement -- SVG parent element. |
|
974 *@return void |
|
975 */ |
|
976 IMPORT_C void SetParentElement( CXmlElementImpl* aElement, CXmlElementImpl* aParentElement ); |
|
977 |
|
978 /** |
|
979 * Set the first child for the given element. |
|
980 * |
|
981 *@param : aFirstChildElement -- SVG element. |
|
982 *@param : aParentElement -- SVG parent element. |
|
983 *@return void |
|
984 */ |
|
985 IMPORT_C void SetFirstChildElement( CXmlElementImpl* aFirstChildElement, CXmlElementImpl* aParentElement ); |
|
986 |
|
987 |
|
988 /** |
|
989 * Create an element of the given type. |
|
990 * |
|
991 *@param : aDocument -- SVG element document. |
|
992 *@param : aElementType -- SVG element type. |
|
993 *@return element. |
|
994 */ |
|
995 IMPORT_C CXmlElementImpl* CreateElementL( CSvgDocumentImpl* aDocument, TInt aElementType ); |
|
996 |
|
997 /** |
|
998 * Create an element of the given type. |
|
999 * |
|
1000 *@param : aDocument -- SVG element document. |
|
1001 *@param : aElementType -- SVG element type. |
|
1002 *@return element. |
|
1003 */ |
|
1004 IMPORT_C void DestroyElement( CXmlElementImpl* aElement ); |
|
1005 |
|
1006 /** |
|
1007 * Append the given child element to the given parent element. |
|
1008 * |
|
1009 *@param : aParentElement -- SVG parent element. |
|
1010 *@param : aChildElement -- SVG child element. |
|
1011 *@return None. |
|
1012 */ |
|
1013 IMPORT_C void AppendChild( CXmlElementImpl* aParentElement, CXmlElementImpl* aChildElement, TBool aIsJSR226Element = EFalse); |
|
1014 |
|
1015 /** |
|
1016 * Remove the given child element from the given parent element. |
|
1017 * |
|
1018 *@param : aParentElement -- SVG parent element. |
|
1019 *@param : aChildElement -- SVG child element. |
|
1020 *@return None. |
|
1021 */ |
|
1022 IMPORT_C void RemoveChild( CXmlElementImpl* aParentElement, CXmlElementImpl* aChildElement); |
|
1023 |
|
1024 /** |
|
1025 * Get the first child element in the given parent. |
|
1026 * |
|
1027 *@param : aParentElement -- SVG parent element. |
|
1028 *@return The first child element. |
|
1029 */ |
|
1030 IMPORT_C CXmlElementImpl* GetFirstChild( CXmlElementImpl* aParentElement ); |
|
1031 |
|
1032 /** |
|
1033 * Get the next sibling element of the given element. |
|
1034 * |
|
1035 *@param : aElement -- SVG element. |
|
1036 *@return The next sibling element. |
|
1037 */ |
|
1038 IMPORT_C CXmlElementImpl* GetNextSibling( CXmlElementImpl* aElement ); |
|
1039 |
|
1040 /** |
|
1041 * Set the next sibling element for the given element. |
|
1042 * |
|
1043 *@param : aElement -- SVG element. |
|
1044 *@param : aSibling -- SVG sibling element. |
|
1045 *@return None |
|
1046 */ |
|
1047 IMPORT_C void SetNextSibling( CXmlElementImpl* aElement, CXmlElementImpl* aSibling ); |
|
1048 |
|
1049 /** |
|
1050 * Get the document that is associated with the given element. |
|
1051 * |
|
1052 *@param : aElement -- SVG element. |
|
1053 *@return svg document. |
|
1054 */ |
|
1055 IMPORT_C CSvgDocumentImpl* GetOwnerDocument( CXmlElementImpl* aElement ); |
|
1056 |
|
1057 /** |
|
1058 * Get the element type, such as rect, circle, etc. for the given element. |
|
1059 * |
|
1060 *@param : aElement -- SVG element. |
|
1061 *@return element type |
|
1062 */ |
|
1063 IMPORT_C TInt GetElementType( CXmlElementImpl* aElement ); |
|
1064 |
|
1065 /** |
|
1066 * Set the given request-observer for the given svg engine. |
|
1067 * |
|
1068 *@param : aElement -- SVG element. |
|
1069 *@return element type |
|
1070 */ |
|
1071 IMPORT_C void SetRequestObserver( CSvgEngineImpl* aEngine, MSvgRequestObserver* aObserver ); |
|
1072 |
|
1073 /** |
|
1074 * Get the Bounding Box for an element. |
|
1075 * |
|
1076 *@param : aElementHandle -- SVG element. |
|
1077 *@param : aX -- X coordinate for the top left. |
|
1078 *@param : aY -- Y coordinate for the top left. |
|
1079 *@param : aWidth -- Width of the bounding rectangle. |
|
1080 *@param : aHeight -- Height for the bounding rectangle. |
|
1081 *@return None. |
|
1082 */ |
|
1083 IMPORT_C void GetElementBoundingbox(CSvgElementImpl* aElementHandle,TReal32& aX ,TReal32& aY,TReal32& aWidth,TReal32& aHeight) __SOFTFP; |
|
1084 |
|
1085 /** |
|
1086 * Get the unscaled Bounding Box for an element. |
|
1087 * |
|
1088 *@param : aElementHandle -- SVG element. |
|
1089 *@param : aX -- X coordinate for the top left. |
|
1090 *@param : aY -- Y coordinate for the top left. |
|
1091 *@param : aWidth -- Width of the bounding rectangle. |
|
1092 *@param : aHeight -- Height for the bounding rectangle. |
|
1093 *@return None. |
|
1094 */ |
|
1095 |
|
1096 IMPORT_C void GetElementUnScaledBoundingBox( CSvgElementImpl* aElementHandle,TReal32& aX ,TReal32& aY,TReal32& aWidth,TReal32& aHeight) __SOFTFP; |
|
1097 |
|
1098 /** |
|
1099 * Get the Bounding Box for an element. |
|
1100 * |
|
1101 *@param : aElementHandle -- SVG element. |
|
1102 *@param : aPoint1 -- coordinate for the top left. |
|
1103 *@param : aPoint2 -- coordinate for the top right. |
|
1104 *@param : aPoint3 -- coordinate for the bottom left. |
|
1105 *@param : aPoint4 -- coordinate for the bottom right. |
|
1106 *@return None. |
|
1107 */ |
|
1108 IMPORT_C void GetFourPointElementBoundingBox(CSvgTextElementImpl* aElementHandle,TPoint& aPoint1 ,TPoint& aPoint2,TPoint& aPoint3,TPoint& aPoint4); |
|
1109 |
|
1110 /** |
|
1111 * Get the Float attribute for the element. |
|
1112 * |
|
1113 *@param : aElementHandle -- SVG element. |
|
1114 *@param : aAttribute Id the attribute Id corresponding to the attribute. |
|
1115 *@return The float attribute value. |
|
1116 */ |
|
1117 IMPORT_C TReal32 GetElementFloatAttribute( CSvgElementImpl* aElementHandle, const TInt aAttributeId) __SOFTFP; |
|
1118 |
|
1119 /** |
|
1120 * Set the Float attribute for the element. |
|
1121 * |
|
1122 *@param : aElementHandle -- SVG element. |
|
1123 *@param : aAttribute Id the attribute Id corresponding to the attribute. |
|
1124 *@param : aValue the value to for the float attribute to be set. |
|
1125 *@return None. |
|
1126 */ |
|
1127 IMPORT_C void SetElementFloatAttribute( CSvgElementImpl* aElementHandle, const TInt aAttributeId, TReal32 aValue) __SOFTFP; |
|
1128 |
|
1129 /** |
|
1130 * Set the Descriptor attribute for the element. |
|
1131 * |
|
1132 *@param : aElementHandle -- SVG element. |
|
1133 *@param : aAttribute Id the attribute Id corresponding to the attribute. |
|
1134 *@param : aAttributeValue the value to for the Desc attribute to be set. |
|
1135 *@return None. |
|
1136 */ |
|
1137 IMPORT_C void SetElementDesAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId, const TDesC& aAttributeValue); |
|
1138 |
|
1139 /** |
|
1140 * Get the Desc attribute for the element. |
|
1141 * |
|
1142 *@param : aElementHandle -- SVG element. |
|
1143 *@param : aAttribute Id the attribute Id corresponding to the attribute. |
|
1144 *@param : aValue . reference to the attribute value. |
|
1145 *@return : None. |
|
1146 */ |
|
1147 IMPORT_C TInt GetElementDesAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId,TPtrC16& aValue); |
|
1148 |
|
1149 /** |
|
1150 * Set the Color attribute for the element. |
|
1151 * |
|
1152 *@param : aElementHandle -- SVG element. |
|
1153 *@param : aAttribute Id the attribute Id corresponding to the attribute. |
|
1154 *@param : aColorValue The Integer value corresponding to the color. |
|
1155 *@return None. |
|
1156 */ |
|
1157 IMPORT_C void SetElementColorAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId,TInt32 aColorValue); |
|
1158 |
|
1159 /** |
|
1160 * Get the CoLor attribute for the element. // this basically means the fill and stroke. |
|
1161 * |
|
1162 *@param : aElementHandle -- SVG element. |
|
1163 *@param : aAttribute Id the attribute Id corresponding to the attribute. |
|
1164 *@return : Integer containing the RGB value for the color. |
|
1165 */ |
|
1166 IMPORT_C TInt32 GetElementColorAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId); |
|
1167 |
|
1168 /** |
|
1169 * Get the Enum attribute for the element. // this basically means the fill and stroke. |
|
1170 * |
|
1171 *@param : aElementHandle -- SVG element. |
|
1172 *@param : aAttribute Id the attribute Id corresponding to the attribute. |
|
1173 *@param : Integer containing the enum value for the attribute. |
|
1174 */ |
|
1175 IMPORT_C void SetEnumAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId,TInt32 lValue); |
|
1176 |
|
1177 /** |
|
1178 * Set the preserve aspect ratio setting for the current document |
|
1179 * |
|
1180 *@param : aDocumentHandle |
|
1181 *@param : TPreserveAspectRatio a preserve aspect ratio setting |
|
1182 */ |
|
1183 IMPORT_C void SetPreserveAspectRatio( CSvgDocumentImpl* aDocument, TSvgPreserveAspectAlignType aPreserveAspectSetting, TSvgMeetOrSliceType aSmilFitSetting, TBool aFrameBufferOverridesViewport = EFalse ); |
|
1184 |
|
1185 /** |
|
1186 * Set the Enum attribute for the element. // this basically means the fill and stroke. |
|
1187 * |
|
1188 *@param : aElementHandle -- SVG element. |
|
1189 *@param : aAttribute Id the attribute Id corresponding to the attribute. |
|
1190 *@return : Integer containing the enum value for the attribute. |
|
1191 */ |
|
1192 IMPORT_C TInt GetEnumAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId,TInt32& lValue); |
|
1193 /** |
|
1194 * Get the rect values. |
|
1195 * |
|
1196 *@param : aElementHandle, aX, aY, aWidth, aHeight |
|
1197 *@return TBool a viewbox existed |
|
1198 */ |
|
1199 IMPORT_C TBool GetRectAttribute( CXmlElementImpl* aElementHandle, |
|
1200 float* aX, float* aY, float* aWidth, float* aHeight ); |
|
1201 |
|
1202 /** |
|
1203 * Set the rect values. |
|
1204 * |
|
1205 *@param : aElementHandle, aX, aY, aWidth, aHeight |
|
1206 *@return none |
|
1207 */ |
|
1208 IMPORT_C void SetRectAttribute( CXmlElementImpl* aElementHandle, |
|
1209 float aX, float aY, float aWidth, float aHeight ); |
|
1210 |
|
1211 /** |
|
1212 * Get the matrix values. |
|
1213 * |
|
1214 *@param : aElementHandle, aAVal, aBVal, aCVal, aDVal, aEVal, aFVal |
|
1215 *@return none |
|
1216 */ |
|
1217 IMPORT_C void GetMatrixAttribute( CXmlElementImpl* aElementHandle, float* aAVal, |
|
1218 float* aBVal, float* aCVal, float* aDVal, |
|
1219 float* aEVal, float* aFVal ); |
|
1220 |
|
1221 /** |
|
1222 * Get the matrix values for a given matrix type. |
|
1223 * |
|
1224 *@param : aElementHandle, aAVal, aBVal, aCVal, aDVal, aEVal, aFVal |
|
1225 *@return none |
|
1226 */ |
|
1227 IMPORT_C void GetMatrixAttribute( CXmlElementImpl* aElementHandle, TInt aAttributeType, |
|
1228 float* aAVal, float* aBVal, |
|
1229 float* aCVal, float* aDVal, |
|
1230 float* aEVal, float* aFVal ); |
|
1231 |
|
1232 /** |
|
1233 * Set the matrix values. |
|
1234 * |
|
1235 *@param : aElementHandle, aAVal, aBVal, aCVal, aDVal, aEVal, aFVal |
|
1236 *@return none |
|
1237 */ |
|
1238 IMPORT_C void SetMatrixAttribute( CXmlElementImpl* aElementHandle, float aAVal, |
|
1239 float aBVal, float aCVal, float aDVal, |
|
1240 float aEVal, float aFVal ); |
|
1241 |
|
1242 /** |
|
1243 * Get the Viewport Width . |
|
1244 * |
|
1245 *@param : aDocumentHandle |
|
1246 *@return TInt integer containing the width of the viewport. viewport means |
|
1247 * svg element. |
|
1248 */ |
|
1249 IMPORT_C TInt GetViewportWidth( CSvgDocumentImpl* aDocumentHandle ); |
|
1250 |
|
1251 /** |
|
1252 * Get the Viewport Height. |
|
1253 * |
|
1254 *@param : aDocumentHandle |
|
1255 *@return TInt integer containing the Height of the viewport. Viewport means |
|
1256 * svg Element. |
|
1257 */ |
|
1258 IMPORT_C TInt GetViewportHeight( CSvgDocumentImpl* aDocumentHandle ); |
|
1259 |
|
1260 /** |
|
1261 * Set the Viewport Width. |
|
1262 * |
|
1263 *@param : aDocumentHandle |
|
1264 *@param TInt integer containing the Width of the viewport. Viewport means |
|
1265 * svg Element. |
|
1266 *@return none |
|
1267 */ |
|
1268 IMPORT_C void SetViewportWidth( CSvgDocumentImpl* aDocumentHandle, TInt aWidth ); |
|
1269 |
|
1270 /** |
|
1271 * Set the Viewport Height. |
|
1272 * |
|
1273 *@param : aDocumentHandle |
|
1274 *@param TInt integer containing the Height of the viewport. Viewport means |
|
1275 * svg Element. |
|
1276 *@return none |
|
1277 */ |
|
1278 IMPORT_C void SetViewportHeight( CSvgDocumentImpl* aDocumentHandle, TInt aHeight ); |
|
1279 |
|
1280 /** |
|
1281 * Get the Viewport Units. This means the units in which the width and height of |
|
1282 * <svg> element are specified. |
|
1283 * |
|
1284 *@param : aDocumentHandle |
|
1285 *@return TInt integer containing the units. |
|
1286 */ |
|
1287 IMPORT_C TInt GetViewportUnits( CSvgDocumentImpl* aDocumentHandle ); |
|
1288 |
|
1289 /** |
|
1290 * Set the end time for an animation element. |
|
1291 * |
|
1292 *@param : aElementHandle |
|
1293 *@param : aOffsetTime |
|
1294 *@return none. |
|
1295 */ |
|
1296 IMPORT_C void SvgEndElementAt(CXmlElementImpl* aElementHandle , TUint32 aOffsetTime, CSvgDocumentImpl* aDocumentHandle = NULL); |
|
1297 |
|
1298 /** |
|
1299 * Set the Begin time for an animation element. |
|
1300 * |
|
1301 *@param : aElementHandle |
|
1302 *@param : aOffsetTime |
|
1303 *@return none. |
|
1304 */ |
|
1305 IMPORT_C void SvgBeginElementAt(CXmlElementImpl* aElementHandle , TUint32 aOffsetTime, CSvgDocumentImpl* aDocumentHandle = NULL); |
|
1306 /** |
|
1307 * Sets the Media time for a Document. |
|
1308 * |
|
1309 *@param : aDocumentHandle |
|
1310 *@param : aTimeInMilliSeconds. This represents the time in milliseconds. |
|
1311 *@return none. |
|
1312 */ |
|
1313 IMPORT_C void SvgSetMediaTime(CSvgDocumentImpl* aDocumentHandle ,TUint32 aTimeInMilliSeconds); |
|
1314 |
|
1315 /** |
|
1316 * Gets the Media time for a Document. |
|
1317 * |
|
1318 *@param : aDocumentHandle |
|
1319 *@return TReal32 . Media time in seconds. |
|
1320 */ |
|
1321 IMPORT_C TReal32 SvgGetMediaTime(CSvgDocumentImpl* aDocumentHandle ) __SOFTFP; |
|
1322 |
|
1323 /** |
|
1324 * checks whether the document has any animation elements present. |
|
1325 * |
|
1326 *@param : aDocumentHandle |
|
1327 *@return TBool . ETrue if animation present otherwise EFalse. |
|
1328 */ |
|
1329 IMPORT_C TBool SvgHasAnimation(CSvgDocumentImpl* aDocumentHandle ); |
|
1330 |
|
1331 |
|
1332 /** |
|
1333 * Return true if element is removeable (no id or children with ids) |
|
1334 * |
|
1335 *@param : aElement -- SVG element. |
|
1336 *@return true if removeable false if not removeable |
|
1337 */ |
|
1338 IMPORT_C TBool IsRemoveable( CSvgElementImpl* hElement, TBool aCheckSibling = EFalse ); |
|
1339 |
|
1340 /** |
|
1341 * Return true if element is removeable (no id or children with ids) |
|
1342 * |
|
1343 *@param : aElement -- SVG element. |
|
1344 *@return true if removeable false if not removeable |
|
1345 */ |
|
1346 IMPORT_C TBool IsElementActive( CSvgElementImpl* hElement ); |
|
1347 |
|
1348 /** |
|
1349 * returns the pointer to the focussed element. |
|
1350 * |
|
1351 *@param : None. |
|
1352 *@return : CXmlElementImpl* pointer to the focussed element at present. |
|
1353 */ |
|
1354 IMPORT_C CXmlElementImpl* GetFocusedElement(CSvgDocumentImpl* aDocument); |
|
1355 |
|
1356 /** |
|
1357 * Sets the focus on a specific element. |
|
1358 * |
|
1359 *@param : aElement. |
|
1360 *@return : None. |
|
1361 */ |
|
1362 IMPORT_C void SetFocusElement(CXmlElementImpl* aElement, CSvgDocumentImpl* aDocument); |
|
1363 |
|
1364 /** |
|
1365 * checks whether a given element is present in DOM. |
|
1366 * |
|
1367 *@param : aDocument. this is pointer to the document which is to be searched for the presence |
|
1368 * of the element. |
|
1369 *@param : aElement. This represents the pointer to the element. |
|
1370 *@return : TBool. True if element is present otherwise false. |
|
1371 */ |
|
1372 IMPORT_C TBool SVGElementInDom(CSvgDocumentImpl* aDocument, CXmlElementImpl* aElement); |
|
1373 |
|
1374 /** |
|
1375 * This API will start the animation if the focussed object is an animation element. |
|
1376 * |
|
1377 *@param : aDocument. This is a pointer to the document. ?? this may not be needed. |
|
1378 *@return : None. |
|
1379 */ |
|
1380 IMPORT_C void SvgActivateAnimation(CSvgDocumentImpl* aDocument); |
|
1381 |
|
1382 /** |
|
1383 * SVGElement_GetUsedElement :- This API will return a pointer to the original |
|
1384 * element which was cloned to use it. i.e.the cloned element is made a chld of the <use> |
|
1385 * element. |
|
1386 * @param : aElement :- this is handle to the cloned element. this is child of the |
|
1387 * : <use> element. |
|
1388 * @return : CXmlElementImpl* this is the pointer to the actual element, which is |
|
1389 * cloned. |
|
1390 */ |
|
1391 IMPORT_C CXmlElementImpl* SVGElementGetUsedElement(CXmlElementImpl* aElement); |
|
1392 |
|
1393 /** |
|
1394 * This API will add the given element to the event receiver list. |
|
1395 * |
|
1396 *@param : aElement. This is pointer to the element which is to be added. |
|
1397 *@param : aEventMask. This is the event mask. |
|
1398 *@return : None. |
|
1399 */ |
|
1400 IMPORT_C void AddToEventReceiverList(CXmlElementImpl* aElement, const TUint8 aEventMask); |
|
1401 |
|
1402 /** |
|
1403 * This API will remove the given element to the event receiver list. |
|
1404 * |
|
1405 *@param : aElement. This is pointer to the element which is to be removed. |
|
1406 *@param : aEventMask. This is the event mask. |
|
1407 *@return : None. |
|
1408 */ |
|
1409 IMPORT_C void RemoveFromEventReceiverList(CXmlElementImpl* aElement); |
|
1410 |
|
1411 /** |
|
1412 * DispatchMouseEventsAt This will send mouse events to the Engine at this points. |
|
1413 * |
|
1414 *@param : aDocumentHandle. which document should get the engine. |
|
1415 *@param : aMouseX. X coordinate for the mouseEvents |
|
1416 *@param : aMouseY. Y coordinate for the mouseEvents |
|
1417 *@return : int. |
|
1418 */ |
|
1419 IMPORT_C TInt DispatchMouseEventsAt(CSvgDocumentImpl* aDocumentHandle, TInt aMouseX, TInt aMouseY, MSvgMouseListener* aListener); |
|
1420 |
|
1421 /** |
|
1422 * SvgCreatePath his will create a new empty path. |
|
1423 * |
|
1424 *@param : None. |
|
1425 *@return : None. |
|
1426 */ |
|
1427 IMPORT_C CGfxGeneralPath* SvgCreatePath(); |
|
1428 |
|
1429 /** |
|
1430 * SvgDestroyPath this will delete a path given a pointer to it. |
|
1431 * |
|
1432 *@param : aPathHandle. Path element pointer. |
|
1433 *@return : None. |
|
1434 */ |
|
1435 IMPORT_C void SvgDestroyPath(CGfxGeneralPath* aPathHandle); |
|
1436 |
|
1437 /** |
|
1438 * GetSegmentCount Returns the number of segments in a PATH. |
|
1439 * |
|
1440 *@param : aPathHandle. Path element pointer. |
|
1441 *@return : integer representing the number of segments. |
|
1442 */ |
|
1443 IMPORT_C TInt GetSegmentCount(CGfxGeneralPath* aPathHandle); |
|
1444 |
|
1445 /** |
|
1446 * GetSegmentType Returns the segment type for a specific segment in a path element. |
|
1447 * |
|
1448 *@param : aPathHandle. Path element pointer. |
|
1449 *@param : aSegmentIndex , Segment index for the specific segments. |
|
1450 *@return : integer representing the type of segments. |
|
1451 */ |
|
1452 IMPORT_C TInt GetSegmentType(CGfxGeneralPath* aPathHandle, TInt aSegmentIndex); |
|
1453 |
|
1454 /** |
|
1455 * GetSegmentParameter Returns the segment parameter for a specific segment in a path element. |
|
1456 * |
|
1457 *@param : aPathHandle. Path element pointer. |
|
1458 *@param : aSegmentIndex , Segment index for the specific segments. |
|
1459 *@param : aSegmentParameterIndex. This gives the segment parameter index. |
|
1460 *@return : TReal32 representing the segment parameter. |
|
1461 */ |
|
1462 IMPORT_C TReal32 GetSegmentParameter(CGfxGeneralPath* aPathHandle,TInt aSegmentIndex,TInt aSegmentParameterIndex) __SOFTFP; |
|
1463 |
|
1464 /** |
|
1465 * ADDMoveTo Adds a moveTo segment to a path element. |
|
1466 * |
|
1467 *@param : aPathHandle. Path element pointer. |
|
1468 *@param : aX , x coordinate for the MoveTo command. |
|
1469 *@param : aY. Y coordinate for the MoveTo command. |
|
1470 *@return : None. |
|
1471 */ |
|
1472 IMPORT_C void ADDMoveTo(CGfxGeneralPath* aPathHandle, TReal32 aX,TReal32 aY) __SOFTFP; |
|
1473 |
|
1474 /** |
|
1475 * ADDLineTo Adds a LineTo segment to a path element. |
|
1476 * |
|
1477 *@param : aPathHandle. Path element pointer. |
|
1478 *@param : aX , x coordinate for the LineTo command. |
|
1479 *@param : aY. Y coordinate for the LineTo command. |
|
1480 *@return : None. |
|
1481 */ |
|
1482 IMPORT_C void ADDLineTo(CGfxGeneralPath* aPathHandle,TReal32 aX,TReal32 aY) __SOFTFP; |
|
1483 |
|
1484 /** |
|
1485 * ADDQuadTo Adds a QuadTo segment to a path element. |
|
1486 * |
|
1487 *@param : aPathHandle. Path element pointer. |
|
1488 *@param : aX1 , X coordinate for the first control point. |
|
1489 *@param : aY1 , Y coordinate for the first control point. |
|
1490 *@param : aX2 , X coordinate for the end point. |
|
1491 *@param : aY2 , Y coordinate for the end point. |
|
1492 *@return : None. |
|
1493 */ |
|
1494 IMPORT_C void ADDQuadTo(CGfxGeneralPath* aPathHandle,TReal32 aX1,TReal32 aY1,TReal32 aX2,TReal32 aY2) __SOFTFP; |
|
1495 |
|
1496 /** |
|
1497 * ADDCurveTo Adds a curveTo segment to a path element. |
|
1498 * |
|
1499 *@param : aPathHandle. Path element pointer. |
|
1500 *@param : aX1 , X coordinate for the first control point. |
|
1501 *@param : aY1 , Y coordinate for the first control point. |
|
1502 *@param : aX2 , X coordinate for the second control point. |
|
1503 *@param : aY2 , Y coordinate for the second control point. |
|
1504 *@param : aX3 , X coordinate for the end point. |
|
1505 *@param : aY3 , Y coordinate for the end point. |
|
1506 *@return : None. |
|
1507 */ |
|
1508 IMPORT_C void ADDCurveTo(CGfxGeneralPath* aPathHandle,TReal32 aX1,TReal32 aY1,TReal32 aX2,TReal32 aY2, TReal32 aX3, TReal32 aY3) __SOFTFP; |
|
1509 |
|
1510 /** |
|
1511 * ADDCloseTo Closes a given path element. |
|
1512 * |
|
1513 *@param : aPathHandle. Path element pointer. |
|
1514 *@return : None. |
|
1515 */ |
|
1516 |
|
1517 IMPORT_C void ADDCloseTo(CGfxGeneralPath* aPathHandle); |
|
1518 |
|
1519 /** |
|
1520 * GetPathAttribute gets a pointer to the path attribuite for a given element. |
|
1521 * |
|
1522 *@param : aElementHandle. Svg element pointer. |
|
1523 *@param : aAttributeId. This gives you the attributeId for the element to get. |
|
1524 *@return : CGfxGeneralPath* this gives you the path attribute pointer fetched. |
|
1525 */ |
|
1526 IMPORT_C CGfxGeneralPath* GetPathAttribute(CXmlElementImpl* aElementHandle, TInt aAttributeId); |
|
1527 |
|
1528 /** |
|
1529 * SetPathAttribute sets the path attribute for a given element. |
|
1530 * |
|
1531 *@param : aElementHandle. Svg element pointer. |
|
1532 *@param : aAttributeId. This gives you the attributeId for the element to get. |
|
1533 *@param : PathHandle this gives you the path attribute pointer fetched. |
|
1534 *@return : NONE. |
|
1535 */ |
|
1536 IMPORT_C void SetPathAttribute(CSvgElementImpl* aElementHandle, TInt lSvgAttrId, CGfxGeneralPath* aPathHandle); |
|
1537 |
|
1538 /** |
|
1539 * Change the frame Buffer dynamically |
|
1540 * |
|
1541 * |
|
1542 * |
|
1543 *@aRenderBuffer :- Buffer for drawing the DOM Tree. |
|
1544 */ |
|
1545 IMPORT_C void SetFrameBuffer(CFbsBitmap* aRenderBuffer, TInt aEngine = NULL); |
|
1546 |
|
1547 IMPORT_C void ClearFrameBuffer(CFbsBitmap* aFrameBuffer, TUint32 aClearingColor, TInt aEngine = NULL); |
|
1548 |
|
1549 /** |
|
1550 * Search for all occurrences of a string in the current svg document, |
|
1551 * in the cdata of the <text> elements. The bounding-boxes are transformed, |
|
1552 * accounted for zooming/panning. |
|
1553 * |
|
1554 * |
|
1555 *@param : aSearchString -- String to search |
|
1556 *@param : aBoundingBoxes -- Array to contain the bounding boxes of texts found. |
|
1557 * The bounding boxes are already transformed so that they're related |
|
1558 * to the frame buffer origin. |
|
1559 *@param : aTexts -- Array to contain cdata of the <text> elements containing |
|
1560 * the search-string. |
|
1561 *@param : aCaseSensitive -- Flag to indicate whether to search with case-sensitivity |
|
1562 * or not, defaults to ETrue. |
|
1563 *@return ETrue if at least one occurrence is found, EFalse otherwise. |
|
1564 */ |
|
1565 IMPORT_C TBool SearchForText( const TDesC& aSearchString, |
|
1566 RPointerArray<MRect>& aBoundingBoxes, |
|
1567 RArray<TPtrC>& aTexts, |
|
1568 RArray<TInt>& aElementIds, |
|
1569 TBool aCaseSensitive = ETrue, |
|
1570 TInt aEngine = NULL ); |
|
1571 |
|
1572 /** |
|
1573 * Add a HyperlinkListener to the SVG Engine.. |
|
1574 * |
|
1575 *@param : aListener -- HyperlinkListener to receive callbacks. |
|
1576 *@return None |
|
1577 */ |
|
1578 IMPORT_C void AddHyperlinkListener( MSvgHyperlinkListener* aListener, TInt aEngine = NULL ); |
|
1579 |
|
1580 /** |
|
1581 * Add a TextAreaListener to the SVG Engine.. |
|
1582 * |
|
1583 *@param : aListener -- TextAreaListener to receive callbacks. |
|
1584 *@return None |
|
1585 */ |
|
1586 IMPORT_C TBool AddTextAreaListener( MSvgTextAreaListener* aListener, TInt aEngine = NULL ); |
|
1587 |
|
1588 /** |
|
1589 * Remove a TextAreaListener from the SVG Engine.. |
|
1590 * |
|
1591 *@param : aListener -- TextAreaListener to receive callbacks. |
|
1592 *@return None |
|
1593 */ |
|
1594 IMPORT_C TBool RemoveTextAreaListener( MSvgTextAreaListener* aListener, TInt aEngine = NULL ); |
|
1595 |
|
1596 /** |
|
1597 * Add a TextListener to the SVG Engine.. |
|
1598 * |
|
1599 *@param : aListener -- TextListener to receive callbacks. |
|
1600 *@return None |
|
1601 */ |
|
1602 IMPORT_C TBool AddTextListener( MSvgTextListener* aListener, TInt aEngine = NULL ); |
|
1603 |
|
1604 /** |
|
1605 * Remove a TextListener from the SVG Engine.. |
|
1606 * |
|
1607 *@param : aListener -- TextListener to receive callbacks. |
|
1608 *@return None |
|
1609 */ |
|
1610 IMPORT_C TBool RemoveTextListener( MSvgTextListener* aListener, TInt aEngine = NULL ); |
|
1611 |
|
1612 |
|
1613 /** |
|
1614 * Add a text string to a text area |
|
1615 * |
|
1616 *@param : aTextAreaElementId, aString |
|
1617 *@return ETrue EFalse |
|
1618 */ |
|
1619 IMPORT_C TBool SetTextForTextAreaElement( TInt aTextAreaElementId, TDesC& aXmlString ); |
|
1620 |
|
1621 /** |
|
1622 * Get the entire text string from the specified text area |
|
1623 * |
|
1624 *@param : aTextAreaElementId, is text area editable, aString |
|
1625 *@return is text area editable |
|
1626 */ |
|
1627 IMPORT_C TBool GetTextForTextAreaElement( TInt aTextAreaElementId, TBool& editable, TDes& aXmlString ); |
|
1628 |
|
1629 /** |
|
1630 * Add a text string to a text element |
|
1631 * |
|
1632 *@param : aTextElementId, aString |
|
1633 *@return ETrue EFalse |
|
1634 */ |
|
1635 IMPORT_C TBool SetTextForTextElement( TInt aTextElementId, TDesC& aXmlString ); |
|
1636 |
|
1637 /** |
|
1638 * Get the entire text string from the specified text element |
|
1639 * |
|
1640 *@param : aTextElementId, is text editable, aString |
|
1641 *@return is text editable |
|
1642 */ |
|
1643 IMPORT_C TBool GetTextForTextElement( TInt aTextElementId, TBool& editable, TDes& aXmlString ); |
|
1644 |
|
1645 /** |
|
1646 * Remove a HyperlinkListener from the SVG Engine.. |
|
1647 * |
|
1648 *@param : aListener -- HyperlinkListener to receive callbacks. |
|
1649 *@return None |
|
1650 */ |
|
1651 IMPORT_C void RemoveHyperlinkListener( MSvgHyperlinkListener* aListener, TInt aEngine = NULL ); |
|
1652 |
|
1653 /** |
|
1654 * Add a HyperlinkListener to the SVG Engine.. |
|
1655 * |
|
1656 *@param : aListener -- HyperlinkListener to receive callbacks. |
|
1657 *@return None |
|
1658 */ |
|
1659 IMPORT_C void AddAnimationListener( MSvgAnimationListener* aListener, TInt aEngine = NULL ); |
|
1660 |
|
1661 /** |
|
1662 * Remove a HyperlinkListener from the SVG Engine.. |
|
1663 * |
|
1664 *@param : aListener -- HyperlinkListener to receive callbacks. |
|
1665 *@return None |
|
1666 */ |
|
1667 IMPORT_C void RemoveAnimationListener( MSvgAnimationListener* aListener, TInt aEngine = NULL ); |
|
1668 |
|
1669 /** |
|
1670 * Return whether an element is visible on the frame buffer. |
|
1671 * |
|
1672 *@param : aElementHandle -- an SVG element identifier. |
|
1673 *@return ETrue if element is visible, EFalse otherwise. |
|
1674 */ |
|
1675 IMPORT_C TBool IsElementVisible( TInt aElementHandle, TInt aEngine = NULL ); |
|
1676 |
|
1677 /** |
|
1678 * Set the engine to load SVG contents as thumbnails: |
|
1679 * a) Only DRM protected contents are affected by this API. |
|
1680 * b) In thumbnail mode, DRM rights in not consumed. |
|
1681 * c) In thumbnail mode, the svg contents are drawn only |
|
1682 * to frame-buffers of 64x64 or smaller. |
|
1683 * |
|
1684 *@param : aThumbNailMode -- Flag to turn on/off thumbnial mode. |
|
1685 *@return : none |
|
1686 */ |
|
1687 IMPORT_C void SetThumbNailMode( TBool aThumbNailMode, TInt aEngine = NULL ); |
|
1688 |
|
1689 /** |
|
1690 * Set the engine to enable/disable consuming DRM rights |
|
1691 * |
|
1692 *@param : aEnable -- Flag to turn off/on consuming rights |
|
1693 *@return: none |
|
1694 */ |
|
1695 IMPORT_C void SetDRMRights(TBool aEnable); |
|
1696 |
|
1697 /** |
|
1698 * Adds a text element to display the frames per second if isShowOn = true |
|
1699 * |
|
1700 *@param : isShowOn specified whether or not to display fps |
|
1701 *@return : frames per second in the engine |
|
1702 */ |
|
1703 IMPORT_C TReal FramesPerSecond(TBool isShowOn = EFalse, TInt aEngine = NULL) __SOFTFP; |
|
1704 |
|
1705 /** |
|
1706 * Used for testing purpose. |
|
1707 * |
|
1708 *@param : aCustomOption specified whether or not to use OpenVG implementation |
|
1709 *@return : none |
|
1710 */ |
|
1711 EXPORT_C void CustomOption(TBool aCustomOption = EFalse, TInt aEngine = NULL); |
|
1712 |
|
1713 // return an array with all of the elements of a certain type |
|
1714 // passing in a -1 for element id will return all elements |
|
1715 IMPORT_C void FindAllElements( CSvgElementImpl* aStartElement, TInt aElementId, |
|
1716 RPointerArray<CSvgElementImpl>& aList, TInt aEngine = NULL ); |
|
1717 |
|
1718 |
|
1719 /** |
|
1720 * Create an svg element that can be added to the a document |
|
1721 * to draw the given rectangle. |
|
1722 * |
|
1723 *@param : aRect - rectangle to request element. |
|
1724 *@return : element represent rectangle. |
|
1725 */ |
|
1726 IMPORT_C CSvgElementImpl* DrawBox(TRect aRect, TInt aEngine = NULL); |
|
1727 |
|
1728 /** |
|
1729 * Return the default size of the given document handle, defined |
|
1730 * by the union of the bounding boxes of the elements. This function |
|
1731 * is independent of frame-buffer or any other document. |
|
1732 * |
|
1733 * @since 1.0 |
|
1734 * @param aDomHandle - Handle to svg document (thru PrepareDom) |
|
1735 * @return Size of svg content |
|
1736 */ |
|
1737 IMPORT_C TSize GetUnscaledContentSize( TInt aDomHandle ); |
|
1738 |
|
1739 /** |
|
1740 * Generate frames, defined by the given |
|
1741 * duration, delay per seconds, etc. The calling client will be |
|
1742 * responsible for managing the bitmaps created by this method that |
|
1743 * are appended to the given bitmap arrays. The starting frame can |
|
1744 * be specified with the starting time parameter. |
|
1745 * |
|
1746 * Note: Embedded images/svg files will not be rendered, due |
|
1747 * to asynchronous image decoder. |
|
1748 * |
|
1749 * Redundant frames removal is implemented, defaulted to EFalse. |
|
1750 * |
|
1751 * aDomHandle -- Handle to the svg dom. |
|
1752 * aDimensionOfBitmaps -- Size of bitmaps to generate (same for mask) |
|
1753 * aStartTime -- Start time of first frame (in milliseconds) |
|
1754 * aDuration -- Total time of animation (in milliseconds) |
|
1755 * aMillisecondsPerFrame -- Request delay time between each frame. |
|
1756 * aColorDepth -- Color display mode for main bitmaps |
|
1757 * aMaskType -- Color display mode for mask bitmaps |
|
1758 * aBitmapFrames -- Array to hold animation bitmaps |
|
1759 * aMaskFrames -- Array to hold mask bitmaps |
|
1760 * aDelayIntervals -- Delay interval between each frame (in milliseconds) |
|
1761 * aRemoveRedundantFrames -- If ETrue, remove consecutive frames that are the same |
|
1762 * and set the correct delay. |
|
1763 * Return Non-NULL Pointer to a svg error (MSvgError*) |
|
1764 */ |
|
1765 IMPORT_C MSvgError* RenderFrames( TInt aDomHandle, |
|
1766 const TSize& aDimensionOfBitmaps, |
|
1767 TUint aStartTime, |
|
1768 TUint aDuration, |
|
1769 TUint aMillisecondsPerFrame, |
|
1770 TDisplayMode aColorDepth, |
|
1771 TDisplayMode aMaskType, |
|
1772 RPointerArray<CFbsBitmap>& aBitmapFrames, |
|
1773 RPointerArray<CFbsBitmap>& aMaskFrames, |
|
1774 RArray<TUint>& aDelayIntervals, |
|
1775 TBool aRemoveRedundantFrames = EFalse ); |
|
1776 |
|
1777 /** |
|
1778 * Used when creating an element from the java interface |
|
1779 * initializes all of the style properties attribute array to |
|
1780 * null for a newly created element so that attributes can be added |
|
1781 * to that element |
|
1782 * |
|
1783 *@param : aElementHandle -- an SVG element identifier. |
|
1784 *@return |
|
1785 */ |
|
1786 IMPORT_C void InitSvgStylePropertiesWithNullL( CSvgElementImpl* aElement ); |
|
1787 |
|
1788 /** |
|
1789 * Add a specific event listener to the engine |
|
1790 * |
|
1791 *@param : aListener, a listener type |
|
1792 *@return : none |
|
1793 */ |
|
1794 IMPORT_C void AddListener( const MSvgListener* aListener, TSvgListenerType aType, TInt aEngine = NULL ); |
|
1795 |
|
1796 /** |
|
1797 * Remove a specific event listener from the engine |
|
1798 * |
|
1799 *@param : aListener, a listener type |
|
1800 *@return : none |
|
1801 */ |
|
1802 IMPORT_C void RemoveListener( const MSvgListener* aListener, TSvgListenerType aType, TInt aEngine = NULL ); |
|
1803 |
|
1804 /** |
|
1805 * Request the given engine (or internal engine) to |
|
1806 * initialize from information in the svg-document attached |
|
1807 * to it (if any). This is used to setup the display information |
|
1808 * from the <svg> tag. Usually called from MSvgLoadingListener |
|
1809 * method when <svg> reached. If aEngine is NULL, then |
|
1810 * the internal engine is used. |
|
1811 * |
|
1812 * @since 1.0 |
|
1813 * @param : aEngine -- svg engine to request initialization. |
|
1814 * A NULL value, by default, indicates to use the internal |
|
1815 * engine for initialization. |
|
1816 * @param : aIsMainThread -- indicates whether this call is |
|
1817 * made in the "main thread" or not, default to ETrue. |
|
1818 * @return : none |
|
1819 */ |
|
1820 IMPORT_C void InitializeEngine( CSvgEngineImpl* aEngine = NULL, |
|
1821 TBool aIsMainThread = ETrue ); |
|
1822 |
|
1823 /** |
|
1824 * Set the timeout duration for fetching external data |
|
1825 * (Fetchimage calls). A value of zero, |
|
1826 * indicates no timeout (by default). This is designed mainly |
|
1827 * for SVGT Plugin. |
|
1828 * @param : aTimeoutSeconds -- |
|
1829 */ |
|
1830 IMPORT_C void SetDataRetrievalTimeOut( TUint aTimeoutSeconds, TInt aEngine = NULL ); |
|
1831 |
|
1832 /** |
|
1833 * Request canceling of parsing of the current document being |
|
1834 * parsed (through Load API). This API allows a different thread |
|
1835 * other than the loading thread to cancel a Load call. |
|
1836 * @since 1.0 |
|
1837 */ |
|
1838 IMPORT_C void CancelLoad( TInt aEngine = NULL ); |
|
1839 |
|
1840 /** |
|
1841 * Query wether a document is currently bieng parsed through |
|
1842 * the Load API. EFalse is returned when a document has completed |
|
1843 * parsing or CancelLoad has completed successfully. |
|
1844 * @since 1.0 |
|
1845 */ |
|
1846 IMPORT_C TBool IsLoading( TInt aEngine = NULL ); |
|
1847 |
|
1848 /** |
|
1849 * In _DEBUG mode all elements in the documents DOM will be printed out |
|
1850 * this method may be used in the future to regenerate the DOM tree |
|
1851 * could also be used as an encoder |
|
1852 * |
|
1853 *@param : aDocument |
|
1854 *@return : none |
|
1855 */ |
|
1856 IMPORT_C void PrintAllElements( CSvgDocumentImpl* aDocument ); |
|
1857 |
|
1858 /** |
|
1859 * In _DEBUG mode print all of the values that are in the styles |
|
1860 * for the element |
|
1861 * |
|
1862 *@param : aElement |
|
1863 *@return : none |
|
1864 */ |
|
1865 IMPORT_C void PrintElementsStyles( CSvgElementImpl* aElement ); |
|
1866 |
|
1867 /** |
|
1868 * Set to indicate whether the contents should be rendered |
|
1869 * or wait for all images in a content to be decoded, defaults |
|
1870 * to waiting for all images. |
|
1871 * |
|
1872 *@param : aBool -- indicates waiting for all images to finish |
|
1873 * decoding before drawing any content. |
|
1874 *@return : none |
|
1875 */ |
|
1876 IMPORT_C void WaitForImages( TBool aBool = ETrue, TInt aEngine = NULL ); |
|
1877 |
|
1878 /** |
|
1879 * This API provides a delayed (asynchronous) assignment of image |
|
1880 * data to <image> elements. This is used when the clients |
|
1881 * returns a non-KErrNone value for FetchImage callback, so that |
|
1882 * FetchImage does not block the parsing thread. |
|
1883 * |
|
1884 *@param aUri- uri string that is passed by FetchImage, |
|
1885 * the URI of the image files. |
|
1886 *@param aData - byte array containing the image data to |
|
1887 * be decoded. This object will be managed (deleted) |
|
1888 * by svg-engine. |
|
1889 *@return none |
|
1890 */ |
|
1891 IMPORT_C void AssignImageData( const TDesC& aUri, HBufC8* aData ); |
|
1892 |
|
1893 /** |
|
1894 * This API provides API for client to set RWindow so that svgengine |
|
1895 * is aware of the window that client is using. This will benefit |
|
1896 * video rendering. |
|
1897 * |
|
1898 *@param aWindow- RWindowBase that retrieve from CCoeControl to derived |
|
1899 * classes. |
|
1900 *@return none |
|
1901 */ |
|
1902 IMPORT_C void SetClientWindow( RWindow* aWindow ); |
|
1903 |
|
1904 /** |
|
1905 * Method to output the currently loaded SVG content in standard SVG XML form |
|
1906 * or output a binary encoded version to a file |
|
1907 *@param aIsEncodeOn tell whether or not to output binary or standard SVG file. |
|
1908 *@return none |
|
1909 */ |
|
1910 IMPORT_C void SaveSvg( TBool aIsEncodeOn, const TDesC& aFileName, TInt aEngine ); |
|
1911 |
|
1912 /** |
|
1913 * This method sets the volume with user input as a percentage |
|
1914 * value (unsigned between 0 and 100 ) |
|
1915 * |
|
1916 * @since S60 3.1 |
|
1917 * @param aPercentage percentage value of volume |
|
1918 * @return none |
|
1919 */ |
|
1920 IMPORT_C void SetAudioVolume( TInt aPercentage , TInt aEngine = NULL); |
|
1921 |
|
1922 /** |
|
1923 * This method mutes the volume of the SVG content |
|
1924 * |
|
1925 * @since S60 3.1 |
|
1926 * @return none |
|
1927 */ |
|
1928 IMPORT_C void MuteAudioVolume( TInt aEngine = NULL ); |
|
1929 |
|
1930 /** |
|
1931 * This API provides client the functionality to trigger focus-in |
|
1932 * event for a particular element |
|
1933 * |
|
1934 * |
|
1935 *@param aDocumentHandle- Pointer to the document of type SvgDocumentImpl |
|
1936 * aElement- Pointer to the element for which focus needs to be set |
|
1937 * |
|
1938 *@return none |
|
1939 */ |
|
1940 IMPORT_C void DispatchFocusInEvent(CSvgDocumentImpl* aDocumentHandle,CSvgElementImpl *aElement); |
|
1941 |
|
1942 /** |
|
1943 * This API provides client the functionality to trigger focus-in |
|
1944 * event for a particular element |
|
1945 * |
|
1946 * |
|
1947 *@param aDocumentHandle- Pointer to the document of type SvgDocumentImpl |
|
1948 * aElement- Pointer to the element for which focus needs to be set |
|
1949 * |
|
1950 *@return none |
|
1951 */ |
|
1952 IMPORT_C void DispatchFocusOutEvent(CSvgDocumentImpl* aDocumentHandle,CSvgElementImpl *aElement); |
|
1953 IMPORT_C void ResetContext(TInt aEngine = NULL ); |
|
1954 |
|
1955 |
|
1956 protected: |
|
1957 /** |
|
1958 * This method is a special case "ConstructL" method used for polymorphic |
|
1959 * DLL loading, which enforces this method to be public. |
|
1960 * |
|
1961 * @since 1.0 |
|
1962 * @param : aFrameBuffer -- Bitmap to draw svg content. |
|
1963 * @param : aReqObserver -- Request observer called by svg engine. |
|
1964 * @return |
|
1965 */ |
|
1966 IMPORT_C void ConstructL( CFbsBitmap* aFrameBuffer, |
|
1967 MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec ); |
|
1968 //NGA :: ConstructL overload is added to include renderertype selector |
|
1969 IMPORT_C void ConstructL( CFbsBitmap* aFrameBuffer, |
|
1970 MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec ,SVGRendererId aRendererType ); |
|
1971 /** |
|
1972 * This method is a special case "ConstructL" method used for polymorphic |
|
1973 * DLL loading, which enforces this method to be public. |
|
1974 * |
|
1975 * @since 1.0 |
|
1976 * |
|
1977 * @return |
|
1978 */ |
|
1979 IMPORT_C void ConstructL(); |
|
1980 IMPORT_C void ConstructL(TFontSpec& aFontSpec); |
|
1981 |
|
1982 private: |
|
1983 |
|
1984 /** |
|
1985 * Adds a text element to display the frames per second if isShowOn = true |
|
1986 * |
|
1987 *@param : isShowOn specified whether or not to display fps |
|
1988 *@return : frames per second in the engine |
|
1989 */ |
|
1990 TReal FramesPerSecondL( TInt aEngine = NULL ); |
|
1991 |
|
1992 |
|
1993 /** |
|
1994 * Get the current focus object's bounding box. |
|
1995 * |
|
1996 * @since 1.0 |
|
1997 * @param ETrue - Get the next object |
|
1998 * @param EFalse - Get the previous object |
|
1999 * @return |
|
2000 */ |
|
2001 TRect GetFocusBbox(TBool aNextObject, TInt aEngine = NULL ); |
|
2002 |
|
2003 /** |
|
2004 * Checks whether the Handle is associated with a DOM |
|
2005 * |
|
2006 * @param : aHandle -- Handle to a DOM. |
|
2007 * @return: TBool boolean |
|
2008 */ |
|
2009 TBool IsDomCached(TInt aHandle); |
|
2010 |
|
2011 /** |
|
2012 * Request the SVG Engine to resume an animation after certain amount of time |
|
2013 * |
|
2014 * @since 1.0 |
|
2015 * @param : none |
|
2016 * @return : none |
|
2017 */ |
|
2018 void Resume(TInt32 aTime, TInt aEngine = NULL); |
|
2019 |
|
2020 /** |
|
2021 * Utility function to clean-up after loading a file -- mainly, |
|
2022 * removing the prepared dom from Dom-list, since it's loaded and |
|
2023 * more prepared. |
|
2024 * |
|
2025 * @since 1.0 |
|
2026 * @param : aDocumentHandle -- document info to handle clean up |
|
2027 * @return : none |
|
2028 */ |
|
2029 void PostLoadProcessing( TInt aDocumentHandle ); |
|
2030 |
|
2031 // |
|
2032 /** |
|
2033 * ImageLoadingObserver interface method. |
|
2034 * Called from Image loading class to notify image loading |
|
2035 * completion. |
|
2036 * |
|
2037 * @since 1.0 |
|
2038 * @param : aErrorStatus -- error status, if any |
|
2039 * @return : none |
|
2040 */ |
|
2041 void ImageLoadingCompleted( TInt aErrorStatus ); |
|
2042 |
|
2043 /******* DOM FUNCTIONALITY / ELEMENT TRAVERSAL INTERFACE *****/ |
|
2044 /** |
|
2045 * Returns the first child element node of this element. null if this element has no child elements |
|
2046 * |
|
2047 * @since 1.2 |
|
2048 * @param aParentElement - a handle to a parent element |
|
2049 * @return a handle to the first child of the parent element |
|
2050 */ |
|
2051 CSvgElementImpl* FirstElementChild(CSvgElementImpl* aParentElement); |
|
2052 |
|
2053 /** |
|
2054 * last child element node of this element. null if this element has no child elements |
|
2055 * |
|
2056 * @since 1.2 |
|
2057 * @param aParentElement - a handle to a parent element |
|
2058 * @return a handle to the first child of the parent element |
|
2059 */ |
|
2060 // |
|
2061 CSvgElementImpl* LastElementChild(CSvgElementImpl* aParentElement); |
|
2062 |
|
2063 /** |
|
2064 * Returns the next sibling element node of this element. null if this element has no element sibling nodes that come after this one in the document tree |
|
2065 * |
|
2066 * @since 1.2 |
|
2067 * @param aSiblingElement - a handle to a sibling element |
|
2068 * @return a handle to the sibling before the sibling passed in |
|
2069 */ |
|
2070 CSvgElementImpl* PreviousElementSibling(CSvgElementImpl* aSiblingElement); |
|
2071 |
|
2072 /** |
|
2073 * previous sibling element node of this element. null if this element has no element sibling nodes that come before this one in the document tree. |
|
2074 * |
|
2075 * @since 1.2 |
|
2076 * @param aParentElement - a handle to a sibling element |
|
2077 * @return a handle to the next sibling of the parameter element |
|
2078 */ |
|
2079 CSvgElementImpl* NextElementSibling(CSvgElementImpl* aSiblingElement); |
|
2080 |
|
2081 /** |
|
2082 * Return whether the two given bitmaps are the same. |
|
2083 * |
|
2084 * @since 1.0 |
|
2085 * @param : aBitmapA -- Bitmap A |
|
2086 * @param : aBitmapB -- Bitmap B |
|
2087 * @return : ETrue both bitmaps are the same. |
|
2088 */ |
|
2089 TBool AreBitmapsTheSame( CFbsBitmap& aBitmapA, CFbsBitmap& aBitmapB ); |
|
2090 |
|
2091 /** |
|
2092 * Create a new CFbsBitmap object with the specific size and color mode. |
|
2093 * |
|
2094 * @since 1.0 |
|
2095 * @param : aSize -- size of bitmap to create |
|
2096 * @param : aColorMode : Color mode to create bitmap |
|
2097 * @param : aError : Error object to hold error info, if an error occurs |
|
2098 * @return : Non-Null CFbsBitmap object if no error was encounter |
|
2099 */ |
|
2100 CFbsBitmap* CreateBitmapL( TSize aSize, TDisplayMode aColorMode, |
|
2101 CSvgErrorImpl& aError ); |
|
2102 |
|
2103 |
|
2104 /** |
|
2105 * This mathod restores some style properties back to the |
|
2106 * original value of the animatied elements' iSvgStyleProperties. |
|
2107 * |
|
2108 * @since S60 3.0 |
|
2109 * @return none |
|
2110 */ |
|
2111 void RestoreAnimStyleProperties( TInt aEngine = NULL ); |
|
2112 |
|
2113 CSvgEngineImpl* ChooseEngine( TInt aEngine ); |
|
2114 |
|
2115 //Utility method to write out the current SVG engine framebuffer to a file |
|
2116 void ConvertBitmapToFileL(CFbsBitmap* aBitmap, const TDesC& aText); |
|
2117 |
|
2118 protected: |
|
2119 // Current SvgEngine instance |
|
2120 CSvgEngineImpl* iSvgEngine; |
|
2121 // Current iSvgDocument through Load( ) method |
|
2122 CSvgDocumentImpl* iSvgLoadedDocument; |
|
2123 |
|
2124 // Flag to indicate if a content is present, to perform or |
|
2125 // ignore operations. |
|
2126 TBool iFileIsLoaded; |
|
2127 |
|
2128 |
|
2129 // Error object to pass back to clients, maintained by this object. |
|
2130 CSvgErrorImpl* iSvgError; |
|
2131 |
|
2132 // List of prepared DOMs (created by PrepareDom). |
|
2133 // Deleted by destructor or calling DeleteDom. |
|
2134 RPointerArray<CSvgDocumentImpl> iSvgDocumentPointers; |
|
2135 RPointerArray<CSvgEngineImpl> iSvgEnginePointers; |
|
2136 |
|
2137 // Keeping track of rotation applied. |
|
2138 TReal32 iTotalRotation; |
|
2139 |
|
2140 public: |
|
2141 |
|
2142 IMPORT_C void Start(MSvgError*& aError, const TDesC8* aHeaderData , |
|
2143 CSvgEngineImpl* aEngine = NULL ); |
|
2144 |
|
2145 IMPORT_C void Start( const TDesC8* aHeaderData, CSvgEngineImpl* aEngine = NULL, |
|
2146 TBool aIsMainThread = ETrue); |
|
2147 private: |
|
2148 // DRM related |
|
2149 TBool iDrmEnabled; |
|
2150 |
|
2151 // Thumbnail mode |
|
2152 TBool iIsThumbNailMode; |
|
2153 |
|
2154 // DRM Rights consumption |
|
2155 TBool iDrmRightsConsumptionEnabled; |
|
2156 |
|
2157 // MSvgLoadingListener list |
|
2158 RPointerArray<MSvgLoadingListener> iSvgLoadingListeners; |
|
2159 |
|
2160 // Keep track of elements currently having mouse pointer inside |
|
2161 // to report mouse-exit when it is moved. |
|
2162 RPointerArray<CSvgElementImpl> iSvgMouseEnteredElements; |
|
2163 |
|
2164 // Flag to indicate Load or PrepareDom call. |
|
2165 TBool iIsLoadingRequest; |
|
2166 |
|
2167 TBool iMouseDownFlag; |
|
2168 |
|
2169 //Stores Font Type information |
|
2170 CSvgBitmapFontProvider *iSvgBitmapFontProvider; |
|
2171 }; |
|
2172 |
|
2173 #endif // SVGENGINEINTERFACEIMPL_H |