|
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 Implementation header file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef SVGDOCUMENTIMPL_H |
|
20 #define SVGDOCUMENTIMPL_H |
|
21 |
|
22 |
|
23 #if !defined(__E32BASE_H__) |
|
24 #include <e32base.h> |
|
25 #endif |
|
26 |
|
27 #include <gdi.h> |
|
28 class CSvgEngineImpl; |
|
29 class CSvgEventHandler; |
|
30 class CSvgErrorImpl; |
|
31 class CSvgElementImpl; |
|
32 class MSvgEventReceiver; |
|
33 #include "SVGXmlDocument.h" |
|
34 #include "SVGEvent.h" |
|
35 |
|
36 #include "SVGEngineInterfaceImpl.h" |
|
37 #include "SVGImageLoadingObserver.h" // MSVGImageLoadingObserver |
|
38 #include "SVGErrorImpl.h" |
|
39 #include "Gfx2dGcOpenVG.h" |
|
40 |
|
41 //#include "SVGImageHashMap.h" |
|
42 #include "SVGFontHashMap.h" |
|
43 #include "SVGMemoryManager.h" |
|
44 #include "SVGTimedEntityInterface.h" |
|
45 |
|
46 #include "SvgBitmapFontProvider.h" |
|
47 class MXmlElement; |
|
48 class CSvgSchemaData; |
|
49 class CSvgContentHandler; |
|
50 |
|
51 class CSvgAnimationBase; |
|
52 class CSvgTimeContainer; |
|
53 |
|
54 /** |
|
55 * Enumeration to define search query constraints for FindAllElements |
|
56 */ |
|
57 enum TSvgSearchFlags |
|
58 { |
|
59 ESvgSearchAllElements = 0, |
|
60 ESvgSearchExcludeUseSubtree = 0x2, |
|
61 }; |
|
62 /** |
|
63 * An SVG document that represents a SVG element tree.. |
|
64 */ |
|
65 class CSvgDocumentImpl : public CBase, |
|
66 public MXmlDocument, |
|
67 public MSVGImageLoadingObserver, |
|
68 public MSvgTimedEntityInterface |
|
69 { |
|
70 public: |
|
71 /** |
|
72 * Two Phase constructor for SVG document |
|
73 * @since 1.0 |
|
74 * @param aHasParent - Indicates whether document has a |
|
75 * parent document or not |
|
76 * aSyncBehavDefault - Indicates default synchronised behaviour |
|
77 * for runtime synchronisation. |
|
78 * aSyncTolDefault - Indicates the synchronised tolerance in |
|
79 * msecs for runtime synchronisation. |
|
80 * @return CSvgDocumentImpl* |
|
81 */ |
|
82 void Reset(MSvgEvent* aEvent); |
|
83 |
|
84 static CSvgDocumentImpl* NewL(CSvgBitmapFontProvider* aSvgBitmapFontProvider, |
|
85 const TBool aHasParent = EFalse, |
|
86 const TSvgSyncBehaviour aSyncBehavDefault = KSvgDefaultSyncBehaviour, |
|
87 const TInt32 aSyncTolDefault = KSvgDefaultSyncTolerance ); |
|
88 |
|
89 /** |
|
90 * Need method description |
|
91 * |
|
92 * @since 1.0 |
|
93 * @param aHasParent - Indicates whether document has a |
|
94 * parent document or not |
|
95 * aSyncBehavDefault - Indicates default synchronised behaviour |
|
96 * for runtime synchronisation. |
|
97 * aSyncTolDefault - Indicates the synchronised tolerance in |
|
98 * msecs for runtime synchronisation. |
|
99 * @return |
|
100 */ |
|
101 static CSvgDocumentImpl* NewLC(CSvgBitmapFontProvider* aSvgBitmapFontProvider, |
|
102 const TBool aHasParent = EFalse, |
|
103 const TSvgSyncBehaviour aSyncBehavDefault = KSvgDefaultSyncBehaviour, |
|
104 const TInt32 aSyncTolDefault = KSvgDefaultSyncTolerance ); |
|
105 |
|
106 /** |
|
107 * Need method description |
|
108 * |
|
109 * @since 1.0 |
|
110 * @param |
|
111 * @return |
|
112 */ |
|
113 virtual ~CSvgDocumentImpl(); |
|
114 |
|
115 public: |
|
116 /** |
|
117 * ImageLoadingObserver interface method. |
|
118 * Called from Image loading class to notify image loading |
|
119 * completion. |
|
120 * |
|
121 * @since 1.0 |
|
122 * @param : aErrorStatus -- error status, if any |
|
123 * @return : none |
|
124 */ |
|
125 virtual void ImageLoadingCompleted( TInt aErrorStatus ); |
|
126 |
|
127 // Pointer/Hyperlink related |
|
128 void FindAllElements( CSvgElementImpl* aStartElement, TInt aElementId, |
|
129 RPointerArray<CSvgElementImpl>& aList, |
|
130 TSvgSearchFlags aFlags = ESvgSearchAllElements ); |
|
131 |
|
132 TBool SvgElementPresent(CSvgElementImpl* aElement); |
|
133 TBool SearchByPointer(CSvgElementImpl* aParent, CSvgElementImpl* aElement); |
|
134 CXmlElementImpl* GetFocusElement(); |
|
135 void SetFocusElement(CXmlElementImpl* aElement ); |
|
136 // From MXmlDocument |
|
137 /** |
|
138 * Need method description |
|
139 * |
|
140 * @since 1.0 |
|
141 * @param |
|
142 * @return |
|
143 */ |
|
144 MXmlElement* CreateElementL( const TDesC& aTagName ); |
|
145 |
|
146 MXmlElement* CreateElementL( const TUint8 aTagName ); |
|
147 |
|
148 /** |
|
149 * Need method description |
|
150 * |
|
151 * @since 1.0 |
|
152 * @param |
|
153 * @return |
|
154 */ |
|
155 TInt CreateAttribute( const TDesC& aName ); |
|
156 |
|
157 /** |
|
158 * Need method description |
|
159 * |
|
160 * @since 1.0 |
|
161 * @param |
|
162 * @return |
|
163 */ |
|
164 MXmlElement* GetElementById( const TDesC& aElementId ); |
|
165 |
|
166 /** |
|
167 * Need method description |
|
168 * |
|
169 * @since 1.0 |
|
170 * @param |
|
171 * @return |
|
172 */ |
|
173 TInt GetNumberOfIds(MXmlElement* aElement); |
|
174 |
|
175 /** |
|
176 * Need method description |
|
177 * |
|
178 * @since 1.0 |
|
179 * @param |
|
180 * @return |
|
181 */ |
|
182 TDesC* GetId( TInt index ); |
|
183 |
|
184 /** |
|
185 * Need method description |
|
186 * |
|
187 * @since 1.0 |
|
188 * @param |
|
189 * @return |
|
190 */ |
|
191 void FindAllIds( CSvgElementImpl* aStartElement, RPointerArray<TDesC>& aList ); |
|
192 |
|
193 /** |
|
194 * Need method description |
|
195 * |
|
196 * @since 1.0 |
|
197 * @param |
|
198 * @return |
|
199 */ |
|
200 MXmlElement* AppendChildL( MXmlElement* aAppendChild ); |
|
201 |
|
202 // From MSvgDocument |
|
203 |
|
204 /** |
|
205 * Need method description |
|
206 * |
|
207 * @since 1.0 |
|
208 * @param |
|
209 * @return |
|
210 */ |
|
211 |
|
212 /** |
|
213 * Get URL |
|
214 */ |
|
215 TDesC& GetUrl(); // method of CSvgDocumentImpl |
|
216 |
|
217 /** |
|
218 * get root element |
|
219 */ |
|
220 IMPORT_C MXmlElement* RootElement(); // method of CSvgDocumentImpl |
|
221 |
|
222 // Class functions |
|
223 |
|
224 /** |
|
225 * Need method description |
|
226 * |
|
227 * @since 1.0 |
|
228 * @param |
|
229 * @return |
|
230 */ |
|
231 CSvgSchemaData* SchemaData(); |
|
232 |
|
233 |
|
234 /** |
|
235 * Need method description |
|
236 * |
|
237 * @since 1.0 |
|
238 * @param |
|
239 * @return |
|
240 */ |
|
241 void SetUri( const TDesC& aUri ); |
|
242 |
|
243 |
|
244 /** |
|
245 * Need method description |
|
246 * |
|
247 * @since 1.0 |
|
248 * @param |
|
249 * @return |
|
250 */ |
|
251 void GetUri( TDes& aUri ); |
|
252 |
|
253 |
|
254 /** |
|
255 * Need method description |
|
256 * |
|
257 * @since 1.0 |
|
258 * @param |
|
259 * @return |
|
260 */ |
|
261 void SetEngine( CSvgEngineImpl* aEngine ); |
|
262 |
|
263 /** |
|
264 * Need method description |
|
265 * |
|
266 * @since 1.0 |
|
267 * @param |
|
268 * @return |
|
269 */ |
|
270 CSvgEngineImpl* Engine(); |
|
271 |
|
272 /** |
|
273 * Add an object to the list of objects that are notified of an event |
|
274 * |
|
275 * @since 1.0 |
|
276 * @param aElement - An SVG element that wants to be registered for an event (implements MSvgEventReceiver interface) |
|
277 * @param aEventMask - A bit mask that indicates the types of events an object listens for |
|
278 * @return None |
|
279 */ |
|
280 void AddToEventReceiverListL( MSvgEventReceiver* aElement, |
|
281 TUint8 aEventMask ); |
|
282 |
|
283 /** |
|
284 * Add an object to the list of objects that are notified of an event |
|
285 * Has an additional parameter aEvent which is used to check for interactive events |
|
286 * |
|
287 * @since v3.2 |
|
288 * @param aElement - An SVG element that wants to be registered for an event (implements MSvgEventReceiver interface) |
|
289 * @param aEvent - An SVG Event that the target element needs to generate |
|
290 * @param aEventMask - A bit mask that indicates the types of events an object listens for |
|
291 * @return None |
|
292 */ |
|
293 void AddToEventReceiverListL( MSvgEventReceiver* aElement, |
|
294 TSvgEvent aEvent, |
|
295 TUint8 aEventMask ); |
|
296 |
|
297 /** |
|
298 * Removed an object to the list of objects that are notified of an event |
|
299 * |
|
300 * @since 1.0 |
|
301 * @param aElement - An SVG element that wants to be registered for an event (implements MSvgEventReceiver interface) |
|
302 * @return None |
|
303 */ |
|
304 void RemoveFromEventReceiverList( MSvgEventReceiver* aElement ); |
|
305 |
|
306 /** |
|
307 * Provide the event end time information to the Event Handler |
|
308 * |
|
309 * @since 1.0 |
|
310 * @param aElement - An element that, ultimately, processes the event (eg. an animation element) |
|
311 * @param aTime - The end time for an event on the target element |
|
312 * @param aTargetElement - The element for which the event is processed |
|
313 * @return |
|
314 */ |
|
315 void AddEventBeginTime(MSvgEventReceiver* aElement, TUint32 aTime, MSvgEventReceiver* aTargetElement ); |
|
316 |
|
317 |
|
318 |
|
319 /** |
|
320 * An internal method that sorts the events in a time scale |
|
321 * |
|
322 * @since 1.0 |
|
323 * @param None |
|
324 * @return None |
|
325 */ |
|
326 void SortEventList(); |
|
327 |
|
328 /** |
|
329 * returns the next (or prev) focussable object starting with a given index |
|
330 * |
|
331 * @since 1.0 |
|
332 * @param aIndex - search for a focussable object with this index |
|
333 * @param aNext - Etrue (next) EFalse (prev) (go forward or backward for search) |
|
334 * @param aEventMask - Event mask for event types the client is interested in |
|
335 * @param aNewIndex - Return the actual index where the object was found |
|
336 * @return The focussable object or NULL if not found |
|
337 */ |
|
338 CSvgElementImpl* GetEventReceiverElement(TInt32 aIndex, TBool aNext, TUint8 aEventMask, TInt32& aNewIndex); |
|
339 |
|
340 /** |
|
341 * Checks whether the current loaded file is animatable or static |
|
342 * |
|
343 * |
|
344 * |
|
345 * @param : None |
|
346 * @return: TBool boolean |
|
347 */ |
|
348 |
|
349 TBool IsAnimationFile(); |
|
350 |
|
351 /** |
|
352 * Checks whether the aSubEventMask is has a valid value set |
|
353 * @since v3.2 |
|
354 * @param : aSubEventMask - The bitmap mask which contains the list |
|
355 * of interactive events if any with the element. |
|
356 * @return: Etrue - if aSubEventMask has some valid bits set else EFalsee |
|
357 */ |
|
358 TBool IsValidSubEventMask(TUint16 aSubEventMask); |
|
359 |
|
360 /** |
|
361 * Sets DRM Check Enable/Disable |
|
362 * |
|
363 * |
|
364 * @param : TBool : aEnable Boolean |
|
365 * @return: None |
|
366 */ |
|
367 void SetDRMMode(TBool aEnable); |
|
368 |
|
369 void ReInitialize(); |
|
370 |
|
371 /** |
|
372 * Load a svg content from the given filename |
|
373 * |
|
374 * @param : aFileName : filename of content (binary or text content) |
|
375 * @param : aError : error object to store error-info |
|
376 * @return: None |
|
377 */ |
|
378 void Load( const TDesC& aFileName, CSvgErrorImpl& aError ); |
|
379 |
|
380 /** |
|
381 * Load a svg content from the given byte-array |
|
382 * |
|
383 * @param : aByteData : byte-array content (binary or text content) |
|
384 * @param : aError : error object to store error-info |
|
385 * @return: None |
|
386 */ |
|
387 void Load( const TDesC8& aByteData, CSvgErrorImpl& aError, TBool aRemoveFalseSwitchElements = ETrue ); |
|
388 |
|
389 /** |
|
390 * Load a svg content from JSR226 that is already TDesc16 |
|
391 * |
|
392 * @param : aSvgString |
|
393 * @param : aError : error object to store error-info |
|
394 * @return: None |
|
395 */ |
|
396 void Load16BitString( const TDesC16& aSvgString, CSvgErrorImpl& aError, TBool aRemoveFalseSwitchElements = ETrue ); |
|
397 |
|
398 /** |
|
399 * Load a svg content from the given file-handle |
|
400 * |
|
401 * @param : aFileHandle : file-handle content (binary or text content) |
|
402 * @param : aError : error object to store error-info |
|
403 * @return: None |
|
404 */ |
|
405 void Load( RFile& aFileHandle, CSvgErrorImpl& aError ); |
|
406 |
|
407 /** |
|
408 * Set the document to be in thumbnailmode, which will not consume the DRM right |
|
409 * if the Svg content is DRM encrypted. |
|
410 * |
|
411 * @param : aThumbNailMode : thumbnail mode flag. |
|
412 * @return: |
|
413 */ |
|
414 void SetThumbNailMode( TBool aThumbNailMode ); |
|
415 |
|
416 |
|
417 /** |
|
418 * Set the document to disable/enable consuming drm rights |
|
419 * @param aEnable: ETrue for disabling consumption of drm rights |
|
420 * @return : none |
|
421 */ |
|
422 void SetDRMRights(TBool aEnable); |
|
423 /** |
|
424 * Return whether the loaded document is a thumbnail only. ETrue is returned only |
|
425 * when the loaded content is DRM protected AND SetThumbNailMode is called with ETrue. |
|
426 * |
|
427 * @return: |
|
428 */ |
|
429 TBool IsThumbNailOnly(); |
|
430 |
|
431 /** |
|
432 * Set the flag to indicate this document was prepared (PrepareDom) or loaded (Load). |
|
433 * |
|
434 * @return: None |
|
435 */ |
|
436 void SetWasPrepared( TBool aBool ); |
|
437 |
|
438 /** |
|
439 * Return whether this document was prepared (PrepareDom) or loaded (Load). |
|
440 * |
|
441 * @return: Prepared or Loaded. |
|
442 */ |
|
443 TBool WasPrepared(); |
|
444 |
|
445 /** |
|
446 * Set the list of MSvgLoadingListener for this document to send |
|
447 * back notification of parsing progress. NULL is also valid. |
|
448 * @param : aList : Pointer to list |
|
449 * @return : none |
|
450 */ |
|
451 void SetLoadingListeners( const RPointerArray<MSvgLoadingListener>* aList ); |
|
452 |
|
453 /** |
|
454 * Set the list of MSvgLoadingListener for this document to send |
|
455 * back notification of parsing progress. NULL is also valid. |
|
456 * @param : aList : Pointer to list |
|
457 * @return : none |
|
458 */ |
|
459 const RPointerArray<MSvgLoadingListener>* GetLoadingListeners(); |
|
460 |
|
461 /** |
|
462 * Add a MSvgMouseListener to this SvgEngine |
|
463 * |
|
464 * @param : aListener -- listener to add to listener list |
|
465 * @return: None |
|
466 */ |
|
467 void AddInternalMouseListener( const MSvgMouseListener* aListener ); |
|
468 |
|
469 /** |
|
470 * Remove a MSvgMouseListener to this SvgEngine |
|
471 * |
|
472 * @param : aListener -- listener to remove from listener list |
|
473 * @return: None |
|
474 */ |
|
475 void RemoveInternalMouseListener( const MSvgMouseListener* aListener ); |
|
476 |
|
477 /** |
|
478 * Return number of mouselisteners. |
|
479 * |
|
480 * @return: mouse-listener count |
|
481 */ |
|
482 TInt MouseInternalListenerCount(); |
|
483 |
|
484 /** |
|
485 * Send to mouse listeners of a mouse-pressed event. |
|
486 * |
|
487 * @param : aElements -- elements affected by mouse-event. |
|
488 * @param : aX -- X-cooordinate of mouse-event. |
|
489 * @param : aY -- X-cooordinate of mouse-event. |
|
490 * @return: None |
|
491 */ |
|
492 void NotifyInternalMousePressed( RPointerArray<CSvgElementImpl>& aElements, |
|
493 TInt aX, TInt aY ); |
|
494 |
|
495 /** |
|
496 * Send to mouse listeners of a mouse-released event. |
|
497 * |
|
498 * @param : aElements -- elements affected by mouse-event. |
|
499 * @param : aX -- X-cooordinate of mouse-event. |
|
500 * @param : aY -- X-cooordinate of mouse-event. |
|
501 * @return: None |
|
502 */ |
|
503 void NotifyInternalMouseReleased( RPointerArray<CSvgElementImpl>& aElements, |
|
504 TInt aX, TInt aY ); |
|
505 |
|
506 /** |
|
507 * Send to mouse listeners of a mouse-entered event. |
|
508 * |
|
509 * @param : aElements -- elements affected by mouse-event. |
|
510 * @param : aX -- X-cooordinate of mouse-event. |
|
511 * @param : aY -- X-cooordinate of mouse-event. |
|
512 * @return: None |
|
513 */ |
|
514 void NotifyInternalMouseEntered( RPointerArray<CSvgElementImpl>& aElements, |
|
515 TInt aX, TInt aY ); |
|
516 /** |
|
517 * Send to mouse listeners of a mouse-exited event. |
|
518 * |
|
519 * @param : aElements -- elements affected by mouse-event. |
|
520 * @param : aX -- X-cooordinate of mouse-event. |
|
521 * @param : aY -- X-cooordinate of mouse-event. |
|
522 * @return: None |
|
523 */ |
|
524 void NotifyInternalMouseExited( RPointerArray<CSvgElementImpl>& aElements, |
|
525 TInt aX, TInt aY ); |
|
526 |
|
527 |
|
528 /** |
|
529 * Send to mouse listeners of a mouse-moved event. |
|
530 * |
|
531 * @param : aElements -- elements affected by mouse-event. |
|
532 * @param : aX -- X-cooordinate of mouse-event. |
|
533 * @param : aY -- X-cooordinate of mouse-event. |
|
534 * @return: None |
|
535 */ |
|
536 void NotifyInternalMouseMoved( RPointerArray<CSvgElementImpl>& aElements, |
|
537 TInt aX, TInt aY ); |
|
538 |
|
539 // LoadingListeners notification |
|
540 /** |
|
541 * Send to loading listeners of a document start event. |
|
542 * |
|
543 * @return: None |
|
544 */ |
|
545 void NotifyDocumentStart(); |
|
546 |
|
547 /** |
|
548 * Send to loading listeners of a document end event. |
|
549 * |
|
550 * @return: None |
|
551 */ |
|
552 void NotifyDocumentEnd(); |
|
553 |
|
554 /** |
|
555 * Send to loading listeners of an element start event. |
|
556 * |
|
557 * @param : aTagName -- name of element tag. |
|
558 * @param : aIsSvgChild -- flag to indicate element is <svg> or child |
|
559 * of <svg> tag. |
|
560 * @return: None |
|
561 */ |
|
562 void NotifyElementStart( const TDesC& aTagName, |
|
563 MSvgAttributeList& aAttributeList, |
|
564 TBool aIsSvgChild ); |
|
565 |
|
566 /** |
|
567 * Send to loading listeners of an element end event. |
|
568 * |
|
569 * @param : aTagName -- name of element tag. |
|
570 * @param : aIsSvgChild -- flag to indicate element is <svg> or child |
|
571 * of <svg> tag. |
|
572 * @return: None |
|
573 */ |
|
574 void NotifyElementEnd( const TDesC& aTagName, TBool aIsSvgChild ); |
|
575 |
|
576 /** |
|
577 * Send to loading listeners of an unsupported element event. |
|
578 * |
|
579 * @param : aTagName -- name of element tag. |
|
580 * @return: None |
|
581 */ |
|
582 void NotifyUnsupportedElement( const TDesC& aTagName, |
|
583 MSvgAttributeList& aAttributeList ); |
|
584 |
|
585 /** |
|
586 * Send to loading listeners of an external data request. |
|
587 * |
|
588 * @param : aUri -- URI of data request. |
|
589 * @return: None |
|
590 */ |
|
591 void NotifyExternalDataRequested( const TDesC& aUri ); |
|
592 |
|
593 /** |
|
594 * Send to loading listeners of a succesfful external data reception. |
|
595 * |
|
596 * @param : aUri -- URI of data request. |
|
597 * @return: None |
|
598 */ |
|
599 void NotifyExternalDataReceived( const TDesC& aUri ); |
|
600 |
|
601 /** |
|
602 * Send to loading listeners of a failed external data request. |
|
603 * |
|
604 * @param : aUri -- URI of data request. |
|
605 * @return: None |
|
606 */ |
|
607 void NotifyExternalDataRequestFailed( const TDesC& aUri ); |
|
608 |
|
609 |
|
610 /** |
|
611 * return the animation duration in milliseconds. |
|
612 * @return : duration of animation |
|
613 */ |
|
614 TUint32 AnimationDuration(); |
|
615 |
|
616 /** |
|
617 * return wether animation is indefinite. |
|
618 */ |
|
619 TUint32 IsIndefiniteAnimation(); |
|
620 |
|
621 /** |
|
622 * Called by AppendChild/RemoveChild to notify owner document |
|
623 * of changes. |
|
624 */ |
|
625 void ElementAppendedOrRemoved(); |
|
626 |
|
627 /** |
|
628 * Cancel loading of document if it is currently parsing. |
|
629 */ |
|
630 void CancelParsing(); |
|
631 |
|
632 /** |
|
633 * Return whether document is currently parsing. |
|
634 */ |
|
635 TBool IsParsing(); |
|
636 |
|
637 /** |
|
638 * return whether this document has an error set. |
|
639 */ |
|
640 TBool HasError(); |
|
641 |
|
642 /** |
|
643 * return the error reference. May be NULL. Call HasError first. |
|
644 */ |
|
645 MSvgError* GetError(); |
|
646 |
|
647 /** |
|
648 * Set the error type and error message for this document. |
|
649 * Will note override existing error. |
|
650 */ |
|
651 void SetError( TInt aErrorType, const TDesC& aMsg1, const TDesC& aMsg2 ); |
|
652 |
|
653 void SetIsWarning( TBool aIsWarning = ETrue ); |
|
654 //------------------------------------------------------------------- |
|
655 // Utility Functions |
|
656 //------------------------------------------------------------------- |
|
657 /** |
|
658 * Fill the given error object with the appropriate error codes, messages. |
|
659 * |
|
660 * @param : aError : Error object to fill code/message. |
|
661 * @param : aSvgErrorCode : Svg related error code. |
|
662 * @param : aSystemError : Symbian error code. |
|
663 * @param : aMsg1 : Message string |
|
664 * @param : aMsg2 : Second message string, if needed, appended to first string. |
|
665 * @return: None |
|
666 */ |
|
667 static void PrepareError( CSvgErrorImpl& aError, |
|
668 TSvgErrorCode aSvgErrorCode, TInt aSystemError, |
|
669 const TDesC& aMsg1, const TDesC& aMsg2 ); |
|
670 |
|
671 static void OpenSession( RFs& aSession, CSvgErrorImpl& aError ); |
|
672 |
|
673 // ------------------------------------------------------------------ |
|
674 // Opacity |
|
675 // ------------------------------------------------------------------ |
|
676 TBool isGroupOpacity( CSvgElementImpl* aElement ); |
|
677 |
|
678 void PrintAllElements( CSvgElementImpl* aStartElement); |
|
679 |
|
680 void QueueFontReleaseReq(CFont* aFont); |
|
681 |
|
682 |
|
683 /** |
|
684 * Accessor funciton for SyncBehaviorDefault value |
|
685 * @since S60 3.2 |
|
686 * @param none |
|
687 * @return TSvgSyncBehavior indicating default value. |
|
688 */ |
|
689 TSvgSyncBehaviour SyncBehaviorDefault(); |
|
690 |
|
691 /** |
|
692 * Accessor funciton for SyncToleranceDefault value |
|
693 * @since S60 3.2 |
|
694 * @param none |
|
695 * @return TUint32 indicating default value in msecs. |
|
696 */ |
|
697 TUint32 SyncToleranceDefault(); |
|
698 |
|
699 /** |
|
700 * Set Function for the document's current time |
|
701 * @since S60 3.2 |
|
702 * @param aCurTime Current Time to be set in msecs |
|
703 * @return none. |
|
704 */ |
|
705 void SetCurrentTime( const TInt32 aCurTime ); |
|
706 |
|
707 /** |
|
708 * Accessor Function for the document's current time |
|
709 * @since S60 3.2 |
|
710 * @param none. |
|
711 * @return TInt32 Current Time to be set in msecs. |
|
712 */ |
|
713 TInt32 CurrentTime(); |
|
714 |
|
715 void DocumentTransform(TGfxAffineTransform& aTr); |
|
716 TGfxAffineTransform GetDocumentTransform(); |
|
717 |
|
718 /** |
|
719 * Set the Synchronised behaviour for the time container |
|
720 * @since S60 3.2 |
|
721 * @param aValue canSlip | locked | independent |
|
722 * @return none. |
|
723 */ |
|
724 void SetTCSyncBehavior( const TSvgSyncBehaviour aValue ); |
|
725 |
|
726 /** |
|
727 * Set the Synchronised Tolerance for the time container |
|
728 * @since S60 3.2 |
|
729 * @param aValue Clock-value |
|
730 * @return none. |
|
731 */ |
|
732 void SetTCSyncTolerance( const TUint32 aValue ); |
|
733 |
|
734 /** |
|
735 * Set the time container as Synchronised Master |
|
736 * @since S60 3.2 |
|
737 * @param aValue true | false |
|
738 * @return none. |
|
739 */ |
|
740 void SetTCSyncMaster( const TBool aValue ); |
|
741 |
|
742 /** |
|
743 * Accessor for the time container. |
|
744 * @since Series 3.2 |
|
745 * @param none. |
|
746 * @return CSvgTimeContainer* |
|
747 */ |
|
748 CSvgTimeContainer* TimeContainer(); |
|
749 |
|
750 |
|
751 //Get function(s) |
|
752 CSvgBitmapFontProvider* GetBitmapFontProvider() ; |
|
753 |
|
754 void SetImageElementsCount(TInt aCnt); |
|
755 |
|
756 TInt GetImageElementsCount(); |
|
757 |
|
758 /* Return the value of the current focus index. |
|
759 @return: current focus index |
|
760 */ |
|
761 TInt32 GetCurFocusIndex(); |
|
762 |
|
763 /* Set the value fo the current focus index |
|
764 @param: aVal : Value that has to be set as the focus index. |
|
765 @return: none. |
|
766 */ |
|
767 void SetCurFocusIndex(TInt32 aVal); |
|
768 |
|
769 /* Decrement the value of the current focus index |
|
770 @return: decremented focus index value. |
|
771 */ |
|
772 TInt32 DecCurFocusIndex(); |
|
773 |
|
774 /* Increment the value of the current focus index |
|
775 @return: Incremented focus index value. |
|
776 */ |
|
777 TInt32 IncCurFocusIndex(); |
|
778 |
|
779 /* Return the pointer to the current focus element |
|
780 @return: current focus element |
|
781 */ |
|
782 CSvgElementImpl* GetCurFocusObject(); |
|
783 |
|
784 /* Set the value of the current focus element to aElement. |
|
785 @param: aElement : Element that has to be set as the focus element |
|
786 @return: none. |
|
787 */ |
|
788 void SetCurFocusObject(CSvgElementImpl* aElement); |
|
789 |
|
790 /* |
|
791 From MSvgTimedEntityInterface |
|
792 Would return the type of object |
|
793 @param none |
|
794 @return type of object |
|
795 */ |
|
796 TSvgObjectType ObjectType(); |
|
797 |
|
798 |
|
799 |
|
800 /** |
|
801 * Prepare a list of media elements in DOM tree in |
|
802 * postorder |
|
803 * @since Series 3.2 |
|
804 * @param aRoot Root Node of tree |
|
805 * @param aPostOrderList List of nodes which |
|
806 * will contain the elements. |
|
807 * @return None. |
|
808 */ |
|
809 void ParsePostOrderMediaElements( CSvgElementImpl* aRoot, |
|
810 RPointerArray<CSvgElementImpl>& aPostOrderList); |
|
811 |
|
812 /** |
|
813 * Finds if Animation element is there. |
|
814 * |
|
815 * @since Series 3.2 |
|
816 * @param none |
|
817 * @return True if animation element is present. |
|
818 */ |
|
819 TBool SvgHasAnimationElement(); |
|
820 |
|
821 /** |
|
822 * Finds if Document content is Interactive |
|
823 * |
|
824 * @since Series 3.2 |
|
825 * @param none |
|
826 * @return True if Document content is Interactive |
|
827 */ |
|
828 TBool IsDocumentContentInteractive(); |
|
829 |
|
830 private: |
|
831 /** |
|
832 * Constructor |
|
833 * @param aHasParent - Indicates whether document has a parent or not |
|
834 * aSyncBehavDefault - Indicates default synchronised behaviour |
|
835 * for runtime synchronisation. |
|
836 * aSyncTolDefault - Indicates the synchronised tolerance in |
|
837 * msecs for runtime synchronisation. |
|
838 */ |
|
839 CSvgDocumentImpl( CSvgBitmapFontProvider* aSvgBitmapFontProvider, const TBool aHasParent, |
|
840 const TSvgSyncBehaviour aSyncBehavDefault, |
|
841 const TInt32 aSyncTolDefault ); |
|
842 |
|
843 /** |
|
844 * 2-phase construction |
|
845 */ |
|
846 void ConstructL(); |
|
847 |
|
848 /** |
|
849 * search element by ID |
|
850 */ |
|
851 MXmlElement* SearchElementById( MXmlElement* aElement, |
|
852 const TDesC& aId ); |
|
853 |
|
854 public: |
|
855 TBool iInitSortList; |
|
856 TBool iReqExReqFtrSysLTested; |
|
857 TBool iInitialDrawFlag; |
|
858 CSvgEventHandler *iEventHandler; |
|
859 TBool iIsInteractive; |
|
860 TBool iFinishedParsing; |
|
861 TBool iHasGroupOpacity; |
|
862 //for debugging and performance checking |
|
863 CSvgElementImpl* iPerfText; |
|
864 |
|
865 TUint32 iTimeForJSR226; |
|
866 |
|
867 // CSvgImageHashMap* iImageHashMap; |
|
868 CSvgFontHashMap* iFontHashMap; |
|
869 CSvgMemoryManager* iMemoryManager; |
|
870 |
|
871 RPointerArray<CSvgAnimationBase> iSvgAnimations; |
|
872 |
|
873 TInt iImageElementCnt; |
|
874 |
|
875 private: // From MSvgTimedEntityInterface |
|
876 /** |
|
877 * From MSvgTimedEntityInterface |
|
878 * The parent time container provides the timing clock to |
|
879 * the timed entity (audio, video, animation, document) |
|
880 * using this routine. |
|
881 * @since Series 3.2 |
|
882 * @param aTick Current tick information |
|
883 * @return none. |
|
884 */ |
|
885 void ParentTimeContainerTick( TSvgTick aTick ); |
|
886 |
|
887 /** |
|
888 * From MSvgTimedEntityInterface |
|
889 * Returns the sync behavior of the entity. |
|
890 * @since Series 3.2 |
|
891 * @param none. |
|
892 * @return TSvgSyncBehaviour Element's Sync Behaviour. |
|
893 */ |
|
894 TSvgSyncBehaviour GetEntitySyncBehavior(); |
|
895 |
|
896 /** |
|
897 * From MSvgTimedEntityInterface |
|
898 * When the timed entity acts as timing master in the time container, |
|
899 * the time container gets the timed entity clock using this method |
|
900 * and feeds to rest of timed entities. |
|
901 * @since Series 3.2 |
|
902 * @param aEntityCurTime Current Entity Time in msecs. |
|
903 * @return none. |
|
904 */ |
|
905 void GetEntityCurrentTime( TUint32& aEntityCurTime ); |
|
906 |
|
907 /** |
|
908 * From MSvgTimedEntityInterface |
|
909 * Returns the configured sync master value(as per DOM tree) as specified |
|
910 * in the SVG content. |
|
911 * @since Series 3.2 |
|
912 * @param aIsSyncMaster Indicates whether the element is configured as |
|
913 * Sync Master. |
|
914 * @return none. |
|
915 */ |
|
916 void GetCnfSyncMasterStatus( TBool& aIsSyncMaster ); |
|
917 |
|
918 /** |
|
919 * From MSvgTimedEntityInterface |
|
920 * Check if timed entity is going to act as timing master in the |
|
921 * time container. This behavior could change dynamically. |
|
922 * @since Series 3.2 |
|
923 * @param aIsSyncMaster Indicates whether the element is currrently Sync Master. |
|
924 * @return none. |
|
925 */ |
|
926 void GetCurSyncMasterStatus( TBool& isSyncMaster ); |
|
927 |
|
928 /** |
|
929 * From MSvgTimedEntityInterface |
|
930 * If some other element is resolved as syncMaster in the time container group, |
|
931 * this element can not act as sync master. |
|
932 * @since Series 3.2 |
|
933 * @param aSyncMasterStatus Indicates whether the element is currrently |
|
934 * Sync Master. |
|
935 * @return none. |
|
936 */ |
|
937 void SetCurSyncMasterStatus( TBool aSyncMasterStatus ); |
|
938 |
|
939 /** |
|
940 * From MSvgTimedEntityInterface |
|
941 * Check if timed entity can provide timing ticks to rest of time |
|
942 * container elements. This behavior could change dynamically. |
|
943 * For example, if audio clip is over, the audio element can't generate |
|
944 * ticks for others. |
|
945 * @since Series 3.2 |
|
946 * @param none. |
|
947 * @return TBool True if can generate timing tick. |
|
948 */ |
|
949 TBool CanGenerateTick(); |
|
950 |
|
951 /** |
|
952 * Check if timed entity can use its parent's tick. Usually only the |
|
953 * parent document should return true for this function. |
|
954 * All other elements return false |
|
955 * @since Series 3.2 |
|
956 * @param none. |
|
957 * @return TBool True if can use parent's timing tick. |
|
958 */ |
|
959 TBool CanUseParentTick(); |
|
960 |
|
961 /** |
|
962 * From MSvgTimedEntityInterface |
|
963 * If the timed entity needs to be in sync with the time container and |
|
964 * it has slipped beyond the sync tolerance limit, the method is called to |
|
965 * bring the element in sync with the time container. |
|
966 * @since Series 3.2 |
|
967 * @param aSynctime Time for resync in msecs. |
|
968 * @return none. |
|
969 */ |
|
970 void ResyncTimedEntity( TUint32 aSynctime ); |
|
971 |
|
972 /** |
|
973 * From MSvgTimedEntityInterface |
|
974 * This would be used for pausing the timed entity while other locked |
|
975 * timed entities get loaded. |
|
976 * @since S60 3.2 |
|
977 * @param none. |
|
978 * @return none. |
|
979 */ |
|
980 void PauseTimedEntity(); |
|
981 |
|
982 /** |
|
983 * From MSvgTimedEntityInterface |
|
984 * This would be used for resuming the timed entity once all locked |
|
985 * timed entities get loaded. |
|
986 * @since S60 3.2 |
|
987 * @param none. |
|
988 * @return none. |
|
989 */ |
|
990 void ResumeTimedEntity(); |
|
991 |
|
992 /** |
|
993 * From MSvgTimedEntityInterface |
|
994 * This would be used for stopping the timed entity. |
|
995 * @since S60 3.2 |
|
996 * @param none. |
|
997 * @return none. |
|
998 */ |
|
999 void StopTimedEntity(); |
|
1000 |
|
1001 |
|
1002 CSvgTimeContainer* GetChildTimeContainer(); |
|
1003 |
|
1004 |
|
1005 private: |
|
1006 void Load( RFs& aSession, RFile& aFileHandle, CSvgErrorImpl& aError ); |
|
1007 |
|
1008 void ProcessDRMError( TInt errorCode, CSvgErrorImpl& aError ); |
|
1009 |
|
1010 TBool IsGzipContent( RFile& aFile ); |
|
1011 TBool IsGzipContent( const TDesC8& aByteArray ); |
|
1012 |
|
1013 TBool IsDRMContent( RFile& aFileHandle ); |
|
1014 TBool IsDRMContent( const TDesC8& aByteData ); |
|
1015 |
|
1016 TBool IsBinarySvg( const TDesC8& aByteArray ); |
|
1017 |
|
1018 TBool ProcessGZipContent( RFs& aSession, |
|
1019 RFile& aFileHandle, |
|
1020 TFileName& aFileName, |
|
1021 CSvgErrorImpl& aError ); |
|
1022 |
|
1023 TBool ProcessGZipContent( RFs& aSession, |
|
1024 TFileName& aZippedFileName, |
|
1025 TFileName& aUnzippedFileName , |
|
1026 CSvgErrorImpl& aError ); |
|
1027 |
|
1028 HBufC8* ProcessDRMContentL( RFile& aFileHandle, CSvgErrorImpl& aError ); |
|
1029 |
|
1030 void ProcessSvgContentL( const TDesC8& aByteArray, CSvgErrorImpl& aError, TBool aRemoveFalseSwitchElements = ETrue ); |
|
1031 |
|
1032 void Process16BitSvgContentL( const TDesC16& aByteArray, CSvgErrorImpl& aError, TBool aRemoveFalseSwitchElements = ETrue ); |
|
1033 |
|
1034 TInt GetProcessPrivatePath( RFs& aSession, TFileName& aPath ); |
|
1035 |
|
1036 TInt CreateProcessPrivateDirectory( RFs& aSession, TFileName& aPath ); |
|
1037 |
|
1038 TInt WriteToTempFile( RFs& aSession, const TDesC8& aByteArray, |
|
1039 TFileName& aFilename, CSvgErrorImpl& aError ); |
|
1040 |
|
1041 TInt WriteToTempFile( RFs& aSession, RFile& aFileHandle, |
|
1042 TFileName& aFilename, CSvgErrorImpl& aError ); |
|
1043 |
|
1044 void LoadingCompleted(); |
|
1045 |
|
1046 TUint32 SubtreeDuration( CSvgElementImpl* aRootElement ); |
|
1047 |
|
1048 public: |
|
1049 TBool iAnimationResetNeeded; |
|
1050 |
|
1051 // Flag set to ETrue when content-handler is removing false switch statements |
|
1052 TBool iIsPruningTree; |
|
1053 TBool iIsRendering; |
|
1054 |
|
1055 private: |
|
1056 CSvgEngineImpl* iEngine; |
|
1057 |
|
1058 TBuf<256> iUri; |
|
1059 CSvgElementImpl* iRootElement; |
|
1060 |
|
1061 CSvgSchemaData* iSchemaData; |
|
1062 |
|
1063 TBool iDrmEnable; |
|
1064 |
|
1065 //flag used for DOM_Reuse |
|
1066 TBool iMultipleRendering; |
|
1067 |
|
1068 TBool iHasGradientElement; |
|
1069 |
|
1070 TBool iIsThumbNailMode; |
|
1071 TBool iIsDRMProtected; |
|
1072 //The value that holds the index of the current focus element. |
|
1073 TInt32 iCurObjIdx; |
|
1074 // pointer to the current focus element object. |
|
1075 CSvgElementImpl* iCurrentFocusObject; |
|
1076 // DRM Rights consumption |
|
1077 TBool iDrmRightsConsumptionEnabled; |
|
1078 |
|
1079 // Flag to indicate this dom was Loaded or Prepared. |
|
1080 TBool iWasPrepared; |
|
1081 |
|
1082 const RPointerArray<MSvgLoadingListener>* iLoadingListeners; |
|
1083 |
|
1084 // MSvgMouseListener list |
|
1085 RPointerArray<MSvgMouseListener> iSvgMouseListeners; |
|
1086 |
|
1087 TBool iCheckedAnimationDuration; |
|
1088 TUint iAnimationDuration; |
|
1089 |
|
1090 CSvgContentHandler* iXmlHandler; |
|
1091 |
|
1092 CSvgErrorImpl* iError; |
|
1093 |
|
1094 // Time container for document for run time sync |
|
1095 CSvgTimeContainer* iTimeContainer; |
|
1096 // Indicates if this document a top-level document |
|
1097 TBool iHasParent; |
|
1098 |
|
1099 // Default run time sync behaviour |
|
1100 TSvgSyncBehaviour iSyncBehaviorDefault; |
|
1101 |
|
1102 // Default synchronised tolerance value in msecs |
|
1103 TUint32 iSyncToleranceDefault; |
|
1104 |
|
1105 |
|
1106 static const TInt KIndefiniteAnimationDuration = 2147483647; |
|
1107 TGfxAffineTransform iTransformMatrix; |
|
1108 |
|
1109 //Stores Font Type information as passed by CSvgEngineInterfaceImpl |
|
1110 CSvgBitmapFontProvider *iSvgBitmapFontProvider; |
|
1111 }; |
|
1112 |
|
1113 #endif // SVGDOCUMENTIMPL_H |