svgtopt/SVG/SVGImpl/inc/SVGAnimationElementImpl.h
changeset 46 88edb906c587
equal deleted inserted replaced
-1:000000000000 46:88edb906c587
       
     1 /*
       
     2 * Copyright (c) 2005 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 __INC_CSVGANIMATIONELEMENTIMPL__
       
    20 #define __INC_CSVGANIMATIONELEMENTIMPL__
       
    21 
       
    22 //  INCLUDES
       
    23 #include "SVGAnimationBase.h"
       
    24 #include "SVGElementImpl.h"
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CSvgDocumentImpl;
       
    28 
       
    29 
       
    30 /**
       
    31  * The animation elements specifies an SVG document or an SVG document fragment
       
    32  * providing synchronized animated vector graphics.
       
    33  *
       
    34  * This element also supports all Run-time synchronization attributes and SVG
       
    35  * Timing attributes.
       
    36  *
       
    37  * @lib SVGEngine.lib
       
    38  * @since Series 60 3.1
       
    39  */
       
    40 class CSvgAnimationElementImpl : public CSvgAnimationBase
       
    41     {
       
    42     public:   // Constructor/deconstructor
       
    43 
       
    44         /**
       
    45         * Two-phased constructor.
       
    46         */
       
    47         static CSvgAnimationElementImpl*NewL(  const TUint8 aElemID,
       
    48                                       CSvgDocumentImpl* aDoc );
       
    49 
       
    50         /**
       
    51         * Two-phased constructor.
       
    52         */
       
    53         static CSvgAnimationElementImpl*NewLC(  const TUint8 aElemID,
       
    54                                        CSvgDocumentImpl* aDoc );
       
    55 
       
    56         /**
       
    57         * Destructor.
       
    58         */
       
    59         virtual ~CSvgAnimationElementImpl();
       
    60 
       
    61     public: // From CSvgAnimationBase
       
    62 
       
    63         /**
       
    64          * Execute animation of its children when instructed.
       
    65          *
       
    66          * @since Series 60 3.1
       
    67          * @param MSvgTimerEvent* aEvent
       
    68          * @return TBool
       
    69          */
       
    70 
       
    71         virtual TBool AnimProcL( MSvgTimerEvent* aEvent );
       
    72 
       
    73         /**
       
    74          * Cleanup animation work to its children
       
    75          *
       
    76          * @since Series 60 3.1
       
    77          * @param none
       
    78          * @return none
       
    79          */
       
    80         void ResetAnimationL();
       
    81 
       
    82 
       
    83     public:  // From MXmlElement API
       
    84 
       
    85 		/**
       
    86          * SetAttributeL: Called by Contenthandler or decoder to set attributes that
       
    87          * are floating type.
       
    88          *
       
    89          * @since Series 60 3.1
       
    90          * @param TDesC& id of the attribute
       
    91          * @param TDesC& aValue value of the attribute
       
    92          * @return TInt error code
       
    93          */
       
    94 
       
    95 		TInt SetAttributeFloatL( const TInt aNameId, const TFloatFixPt aValue );
       
    96 
       
    97 
       
    98         /**
       
    99          * SetAttributeFloatL: Called by Contenthandler or decoder to set attributes
       
   100          * that are string type.
       
   101          *
       
   102          * @since Series 60 3.1
       
   103          * @param TDesC& id of the attribute
       
   104          * @param TDesC& aValue value of the attribute
       
   105          * @return TInt error code
       
   106          */
       
   107         TInt SetAttributeL( const TDesC& aName, const TDesC& aValue );
       
   108 
       
   109 
       
   110         /**
       
   111          * GetAttributeFloat: returns value of the floating attribute
       
   112          * that are string type.
       
   113          *
       
   114          * @since Series 60 3.1
       
   115          * @param TDesC& id of the attribute
       
   116          * @param TDesC& aValue value of the attribute
       
   117          * @return TInt error code
       
   118          */
       
   119 		TInt GetAttributeFloat( const TInt aNameId, TFloatFixPt& aValue );
       
   120 
       
   121     public:  // From MEventReceiver
       
   122 
       
   123         /**
       
   124          * ReceiveEventL: This function will be called whenever the registered
       
   125 		 * event was happened.
       
   126          *
       
   127          * @since Series 60 3.1
       
   128          * @param MSvgEvent* aEvent
       
   129          * @return TBool ETrue if redraw is needed
       
   130          */
       
   131         TBool ReceiveEventL( MSvgEvent* aEvent );
       
   132 
       
   133 
       
   134 		/**
       
   135          * CloneL: Clone the animation element
       
   136          *
       
   137          * @since Series 60 3.1
       
   138          * @param MXmlElement* new parent element
       
   139          * @return MXmlElement*
       
   140          */
       
   141 		MXmlElement* CloneL(MXmlElement* aParentElement);
       
   142 
       
   143     public: // New functions
       
   144 
       
   145         /**
       
   146          * Getter function for iPreservRatio
       
   147 		 *
       
   148 		 *
       
   149          *
       
   150          * @since Series 60 3.1 SVGTiny 1.2
       
   151          * @param none
       
   152          * @return TDesC& TargetId the target element's id
       
   153          */
       
   154         const TDesC& PreservRatio();
       
   155 
       
   156 
       
   157         /**
       
   158          * X: Returns the x coordinate of the defined region
       
   159          *
       
   160          * @since Series 60 3.1
       
   161          * @param none
       
   162          * @return TFixPt
       
   163          */
       
   164         TFloatFixPt                      X();
       
   165 
       
   166 
       
   167         /**
       
   168          * Y: Returns the y coordinate of the defined region
       
   169          *
       
   170          * @since Series 60 3.1
       
   171          * @param none
       
   172          * @return TFixPt
       
   173          */
       
   174         TFloatFixPt                      Y();
       
   175 
       
   176 
       
   177         /**
       
   178          * Width: Returns the width of the defined region
       
   179          *
       
   180          * @since Series 60 3.1
       
   181          * @param none
       
   182          * @return TFixPt
       
   183          */
       
   184         TFloatFixPt                      Width();
       
   185 
       
   186 
       
   187         /**
       
   188          * Height: Returns the height of the defined region
       
   189          *
       
   190          * @since Series 60 3.1
       
   191          * @param none
       
   192          * @return TFixPt
       
   193          */
       
   194         TFloatFixPt                      Height();
       
   195 
       
   196 
       
   197 		/**
       
   198          * SetReferenceElementL: Clone the referenced element.
       
   199          *
       
   200          * @since Series 60 3.1
       
   201          * @param none
       
   202          * @return none
       
   203          */
       
   204         void SetReferenceElementL();
       
   205 
       
   206 		/**
       
   207          * SetRefElemById: Sets the referenced id.
       
   208          *
       
   209          * @since Series 60 3.1
       
   210          * @param TDesC& the referenced id
       
   211          * @return TInt error code
       
   212          */
       
   213 		TInt SetRefElemById(const TDesC& aName);
       
   214 
       
   215 		/**
       
   216          * SetRecursionVariable: Set the flag to indicate if the element
       
   217          * has been cloned or not.
       
   218          *
       
   219          * @since Series 60 3.1
       
   220          * @param TBool flag ETrue if the element has been cloned
       
   221          * @return none
       
   222          */
       
   223 		void SetRecursionVariable(TBool aIsRecursion);
       
   224 
       
   225 		/**
       
   226          * RecursionVariable: Returns the flag indicates that if the element
       
   227          * has been cloned.
       
   228          *
       
   229          * @since Series 60 3.1
       
   230          * @param none
       
   231          * @return TBool
       
   232          */
       
   233 		TBool RecursionVariable();
       
   234 
       
   235 
       
   236 		/**
       
   237          * ResetEventListener: Reset all event listener for it's children
       
   238          * and add to it's own event handler
       
   239          *
       
   240          * @since Series 60 3.1
       
   241          * @param none
       
   242          * @return void
       
   243          */
       
   244 		void ResetEventListener();
       
   245 
       
   246 
       
   247 		/**
       
   248          * RemoveEventListener: Remove all event listener for it's children.
       
   249          *
       
   250          * @since Series 60 3.1
       
   251          * @param none
       
   252          * @return void
       
   253          */
       
   254 		void RemoveEventListener();
       
   255 
       
   256 
       
   257 
       
   258 		/**
       
   259          * FindAllAnimationElements: Find and store all animation elements
       
   260          * under the element.
       
   261          *
       
   262          * @since Series 60 3.1
       
   263          * @param none
       
   264          * @return void
       
   265          */
       
   266         void FindAllAnimationElements( CSvgElementImpl* aElement,
       
   267                                RPointerArray<CSvgElementImpl>* aList );
       
   268 
       
   269 
       
   270         /**
       
   271          * Check to see if the target element is animation element
       
   272          *
       
   273          * @since Series 60 3.1 SVGTiny 1.2
       
   274          * @param CSvgElementImpl* Target element
       
   275          * @return ETrue if the target element is animation element.
       
   276          */
       
   277 		TBool IsAnimationElement(CSvgElementImpl* aElement);
       
   278 
       
   279 
       
   280         /**
       
   281          * Return the id of referenced target
       
   282          *
       
   283          * @since Series 60 3.1 SVGTiny 1.2
       
   284          * @param none
       
   285          * @return TDesC& id
       
   286          */
       
   287 		//const TDesC&                 GetUriRefId();
       
   288 
       
   289         /**
       
   290          * Return the flag if the URI of the reference id is set
       
   291          *
       
   292          * @since Series 60 3.1 SVGTiny 1.2
       
   293          * @param none
       
   294          * @return ETrue if the id of the target element is been set.
       
   295          */
       
   296 		TBool                        IsUriRefSet();
       
   297 
       
   298 		void						 Print( TBool aIsEncodeOn );
       
   299 		
       
   300     protected:
       
   301 
       
   302         /**
       
   303          * Copy content to an element
       
   304          *
       
   305          * @since Series 60 3.1
       
   306          * @param CSvgAnimationElementImpl new element
       
   307          * @return none
       
   308          */
       
   309         void CopyL( CSvgAnimationElementImpl* aDestElement );
       
   310 
       
   311 	private:
       
   312 
       
   313         /**
       
   314         * C++ default constructor.
       
   315         */
       
   316         CSvgAnimationElementImpl( CSvgDocumentImpl* aDoc );
       
   317 
       
   318 		/**
       
   319          * Symbian 2nd phase constructor
       
   320          *
       
   321          * Mainly initialize the element and subscribe events to be listen.
       
   322          *
       
   323          * @since Series 60 3.1 SVGTiny 1.2
       
   324          * @param
       
   325          * @return
       
   326          */
       
   327         void ConstructL(  const TUint8 aElemID  );
       
   328 
       
   329 
       
   330     private: //New Functions
       
   331 
       
   332 
       
   333     private:
       
   334 
       
   335         // The x-axis coordinate of one corner of the rectangular region into
       
   336         // which the animation is placed.
       
   337         TFloatFixPt iX;
       
   338 
       
   339         // The y-axis coordinate of one corner of the rectangular region into
       
   340         // which the animation is placed.
       
   341         TFloatFixPt iY;
       
   342 
       
   343         // The width of the rectangular region into which the animation is placed.
       
   344         TFloatFixPt iWidth;
       
   345 
       
   346         // The height of the rectangular region into which the animation is placed.
       
   347         TFloatFixPt iHeight;
       
   348 
       
   349         // Referenced (target) element
       
   350         CSvgElementImpl* iReferencedElement;
       
   351 
       
   352         // Flag if recursion is set
       
   353 		TBool iUseInRecursion;
       
   354 
       
   355         // A container that holds animation elements' reference of its children
       
   356         RPointerArray<CSvgElementImpl>* iMyAnimationElementList;
       
   357 
       
   358         // a separated Event Handler from DocumentImpl
       
   359         CSvgEventHandler *iAnimationEventHandler;
       
   360 
       
   361         // flag indicates if the event list's sorting has initial state or not.
       
   362         TBool iInitSortList;
       
   363 
       
   364         // flag indicates if engine has started or not.
       
   365         TBool iEngineStart;
       
   366 
       
   367         // value of PreserveAspectRatio
       
   368         HBufC* iPreservRatio;
       
   369 
       
   370     };
       
   371 
       
   372 #endif // __INC_CSVGANIMATIONELEMENTIMPL__