svgtopt/SVG/SVGImpl/src/SVGElementImpl.cpp
changeset 0 d46562c3d99d
child 8 baacd33d915b
equal deleted inserted replaced
-1:000000000000 0:d46562c3d99d
       
     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 source file
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #if !defined(__E32BASE_H__)
       
    20 #include <e32base.h>
       
    21 #endif
       
    22 
       
    23 #include "SVGElementImpl.h"
       
    24 #include "SVGXmlElementImpl.h"
       
    25 
       
    26 #include "GfxAffineTransform.h"
       
    27 
       
    28 #include "SVGClrCssValueImpl.h"
       
    29 #include "SVGPaintCssValueImpl.h"
       
    30 #include "SVGIntCssValueImpl.h"
       
    31 #include "SVGFloatCssValueImpl.h"
       
    32 #include "SVGStrCssValueImpl.h"
       
    33 #include "SVGVectorCssValueImpl.h"
       
    34 
       
    35 #include "SVGSchemaData.h"
       
    36 #include "SVGAnimationBase.h"
       
    37 #include "SVGLineElementImpl.h"
       
    38 #include "SVGRectElementImpl.h"
       
    39 #include "SVGCircleElementImpl.h"
       
    40 #include "SVGMpathElementImpl.h"
       
    41 
       
    42 #include "SVGFontFaceElementImpl.h"
       
    43 
       
    44 #include "SVGDocumentImpl.h"
       
    45 #include "SVGStringTokenizer.h"
       
    46 
       
    47 #include "SVGEngineImpl.h"
       
    48 #include "SVGUseElementImpl.h"
       
    49 #include "SVGAnimationElementImpl.h"
       
    50 #include "SVGTokenizer.h"
       
    51 
       
    52 // ---------------------------------------------------------------------------
       
    53 //
       
    54 // ---------------------------------------------------------------------------
       
    55 CSvgElementImpl::~CSvgElementImpl()
       
    56     {
       
    57      if ( iId )
       
    58         {
       
    59         delete iId;
       
    60         iId = NULL;
       
    61         }
       
    62 
       
    63     //need to remove from event list if it was an animation
       
    64 
       
    65     CSvgDocumentImpl* thisDocument = ( CSvgDocumentImpl* ) OwnerDocument();
       
    66 
       
    67     if (thisDocument != NULL)
       
    68     {
       
    69         thisDocument->RemoveFromEventReceiverList(this);
       
    70     }
       
    71 
       
    72     if ( iSvgTests )
       
    73     {
       
    74         delete iSvgTests;
       
    75         iSvgTests = NULL;
       
    76     }
       
    77 
       
    78     if( iSvgLangSpace )
       
    79     {
       
    80         delete iSvgLangSpace;
       
    81         iSvgLangSpace = NULL;
       
    82     }
       
    83 
       
    84     if ( iSvgTransformable )
       
    85         {
       
    86         delete iSvgTransformable;
       
    87         iSvgTransformable = NULL;
       
    88         }
       
    89     ResetReferenceAttrSet();
       
    90     }
       
    91 // ---------------------------------------------------------------------------
       
    92 //
       
    93 // ---------------------------------------------------------------------------
       
    94 // ---------------------------------------------------------------------------
       
    95 //
       
    96 // ---------------------------------------------------------------------------
       
    97 TBool CSvgElementImpl::StyleInParent(CSvgElementImpl* aElement, TInt aAttrIndex)
       
    98 		{
       
    99 			 if(aElement != NULL)
       
   100 			 {
       
   101 			   CSvgElementImpl* lParentElement = (CSvgElementImpl*)aElement->ParentNode ();
       
   102 			   while(lParentElement && (lParentElement->iSvgStyleProperties != NULL))
       
   103 			   {
       
   104 			   		if(!lParentElement)
       
   105 			   			return EFalse;
       
   106 			      if (aElement->iSvgStyleProperties->operator[](aAttrIndex) ==
       
   107 			          lParentElement->iSvgStyleProperties->operator[](aAttrIndex))
       
   108 			      {
       
   109 			      	return ETrue;
       
   110 			      }
       
   111 			      lParentElement = (CSvgElementImpl*)lParentElement->ParentNode ();
       
   112 			   }
       
   113 			 }
       
   114 		   return EFalse;
       
   115 		}
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 //
       
   119 // ---------------------------------------------------------------------------
       
   120 CSvgElementImpl::CSvgElementImpl() : iAnimateTransformMatrixIndex(-1),
       
   121 									 iSvgStyleProperties(NULL),
       
   122                                      iAnimateMotionMatrixIndex( -1 )
       
   123 
       
   124     {
       
   125     SetAllAttributesAdded( ETrue );
       
   126     }
       
   127 
       
   128 void CSvgElementImpl::InitializeL(  TUint8 aElemID)
       
   129     {
       
   130     CXmlElementImpl::InitializeL( aElemID );
       
   131     }
       
   132 
       
   133 
       
   134 // ---------------------------------------------------------------------------
       
   135 //
       
   136 // ---------------------------------------------------------------------------
       
   137 TBool CSvgElementImpl::IsDrawable()
       
   138     {
       
   139     return ETrue;
       
   140     }
       
   141 
       
   142 //*****************************************************
       
   143 //
       
   144 // ---------------------------------------------------------------------------
       
   145 //
       
   146 // ---------------------------------------------------------------------------
       
   147 void CSvgElementImpl::DrawShapeL( CGfx2dGc* aGc,
       
   148                                   MGfxShape& aShape,
       
   149                                   CSvgElementImpl* /*aElement */)
       
   150     {
       
   151     if ( !AreAllAttributesAdded() )
       
   152         {
       
   153         return;
       
   154         }
       
   155 
       
   156     // Paint is a special case.
       
   157     // Paint must be reset locally
       
   158 
       
   159     SetGCL( aGc/*, aElement */);
       
   160 
       
   161     if( iSvgTransformable )
       
   162         {
       
   163         aGc->SetTransform( GetCTM() );
       
   164         }
       
   165 
       
   166     aGc->DrawL( &aShape );
       
   167     }
       
   168 
       
   169 // ---------------------------------------------------------------------------
       
   170 //
       
   171 // ---------------------------------------------------------------------------
       
   172 void CSvgElementImpl::DrawShapeL( CGfx2dGc* aGc, CSvgElementImpl* /*aElement*/ )
       
   173     {
       
   174 
       
   175     SetGCL( aGc/*, aElement */);
       
   176 
       
   177     if(iSvgTransformable )
       
   178         {
       
   179         aGc->SetTransform( GetCTM() );
       
   180         }
       
   181     }
       
   182 
       
   183 // ---------------------------------------------------------------------------
       
   184 //
       
   185 // ---------------------------------------------------------------------------
       
   186 TBool CSvgElementImpl::DrawL( CGfx2dGc* /* aGc */,
       
   187                               CSvgElementImpl* /* aElement */ )
       
   188     {
       
   189     return ETrue;
       
   190     }
       
   191 
       
   192 // ---------------------------------------------------------------------------
       
   193 //
       
   194 // ---------------------------------------------------------------------------
       
   195 const TDesC* CSvgElementImpl::Id()
       
   196     {
       
   197         return iId;
       
   198     }
       
   199 
       
   200 // ---------------------------------------------------------------------------
       
   201 //
       
   202 // ---------------------------------------------------------------------------
       
   203 TInt CSvgElementImpl::SetIdandXmlbaseL( const TDesC& aPropertyName,
       
   204                                        const TDesC& aValue )
       
   205     {
       
   206     _LIT( KId, "id" );
       
   207     if ( aPropertyName == KId)
       
   208         {
       
   209         delete iId;
       
   210         iId = NULL;
       
   211         iId = aValue.AllocL();
       
   212         }
       
   213     else
       
   214         {
       
   215         return EFalse;
       
   216         }
       
   217     return ETrue;
       
   218     }
       
   219 
       
   220 // ---------------------------------------------------------------------------
       
   221 //
       
   222 // This method might leave with KErrNoMemory.
       
   223 // ---------------------------------------------------------------------------
       
   224 MXmlElement* CSvgElementImpl::AppendChildL( MXmlElement* aNewChild, TBool aIsJSR226Element )
       
   225     {
       
   226 
       
   227     CXmlElementImpl::AppendChildL( aNewChild );
       
   228 
       
   229     if ( aNewChild  && (((CSvgElementImpl *)aNewChild)->ElemID() != KSvgSvgElement) )
       
   230         {
       
   231         TInt err = KErrNone;
       
   232 
       
   233         if (!aIsJSR226Element)
       
   234         {
       
   235         	err = ((CSvgElementImpl *)aNewChild)->InitSvgStyleProperties();
       
   236         }
       
   237         else
       
   238         {
       
   239    				// Error return needs to be checked
       
   240         	((CSvgElementImpl*)aNewChild)->InitAllSvgStyleProperties((CSvgElementImpl*)aNewChild);
       
   241         }
       
   242         if (err != KErrNone)
       
   243             #ifdef _Debug
       
   244                 RDebug::Print(_L("CSvgElementImpl::AppendChildL[%x]: memory when append child"), this);
       
   245             #endif //_Debug
       
   246             User::Leave(err);
       
   247         }
       
   248 
       
   249 
       
   250     return aNewChild;
       
   251     }
       
   252 
       
   253 // ---------------------------------------------------------------------------
       
   254 //
       
   255 // ---------------------------------------------------------------------------
       
   256 
       
   257 TInt CSvgElementImpl::SetAttributeL( const TDesC&  aName ,
       
   258                                      const TDesC&  aValue  )
       
   259     {
       
   260 
       
   261 
       
   262     if ( SetTransform( aName, aValue ) ||
       
   263          SetIdandXmlbaseL( aName, aValue ) ||
       
   264          SetLangSpaceAttributeL( aName, aValue ) ||
       
   265          SetTestAttributeL( aName, aValue )
       
   266        )
       
   267         {
       
   268         return KErrNone;
       
   269         }
       
   270 
       
   271     return KErrNone;
       
   272     }
       
   273 
       
   274 // ---------------------------------------------------------------------------
       
   275 //
       
   276 // ---------------------------------------------------------------------------
       
   277 TInt CSvgElementImpl::RemoveAttribute( const TInt aAttrId )
       
   278     {
       
   279     if( iSvgStyleProperties && aAttrId < iSvgStyleProperties->Count() )
       
   280         {
       
   281         CCssValue *lCurrentCssPointer = iSvgStyleProperties->operator[](aAttrId);
       
   282         CCssValue *lParentCssPointer = NULL ;
       
   283 
       
   284         CSvgElementImpl* lParentElement = (CSvgElementImpl*)iParentNode;
       
   285         while(lParentElement && (lParentElement->iSvgStyleProperties == NULL))
       
   286             {
       
   287             lParentElement = (CSvgElementImpl*)lParentElement->ParentNode ();
       
   288             }
       
   289 
       
   290         if ( lParentElement )
       
   291             {
       
   292             FindProperty( (TInt8)aAttrId, lParentCssPointer, ( CSvgElementImpl * )lParentElement );
       
   293             }
       
   294 
       
   295         iSvgStyleProperties->operator[](aAttrId) = lParentCssPointer;
       
   296         PropagateToChildren( lCurrentCssPointer,lParentCssPointer, aAttrId );
       
   297         }
       
   298     return KErrNone;
       
   299 
       
   300     }
       
   301 
       
   302 // ---------------------------------------------------------------------------
       
   303 //
       
   304 // ---------------------------------------------------------------------------
       
   305 
       
   306 void CSvgElementImpl::SetPresentationAttribute( const TInt8 aPropertyId,
       
   307                                                 CCssValue*& aCssValue )
       
   308 
       
   309     {
       
   310     if( iSvgStyleProperties && aPropertyId < iSvgStyleProperties->Count() )
       
   311         {
       
   312         iSvgStyleProperties->operator[](aPropertyId) = aCssValue;
       
   313         }
       
   314 
       
   315     }
       
   316 
       
   317 // ---------------------------------------------------------------------------
       
   318 // This method sets a property value that takes a float
       
   319 // The switch statement can be expanded to add more attributes
       
   320 // ---------------------------------------------------------------------------
       
   321 TBool CSvgElementImpl::SetPropertyFloatL( const TInt& aAttrId,
       
   322                                                 TReal32 aValue)
       
   323     {
       
   324     CSvgDocumentImpl*   doc      = ( CSvgDocumentImpl* ) OwnerDocument();
       
   325 
       
   326     if (!doc)
       
   327     {
       
   328     	return EFalse;
       
   329     }
       
   330 
       
   331     TInt                position = aAttrId;
       
   332 
       
   333 
       
   334     CSvgElementImpl* lParentElement = (CSvgElementImpl*)iParentNode;
       
   335     while(lParentElement && (lParentElement->iSvgStyleProperties == NULL))
       
   336         {
       
   337         lParentElement = (CSvgElementImpl*)lParentElement->ParentNode ();
       
   338         }
       
   339 
       
   340         switch ( position )
       
   341         {
       
   342         case KCSS_ATTR_STROKE_OPACITY:
       
   343         case KCSS_ATTR_FILL_OPACITY:
       
   344         case KCSS_ATTR_GROUP_OPACITY:
       
   345             {
       
   346             TFloatFixPt KZero;
       
   347             TFloatFixPt KOne( KFloatFixOne );
       
   348             TFloatFixPt opacityValue = aValue;
       
   349             if (opacityValue < KZero)
       
   350                {
       
   351                opacityValue = KZero;
       
   352                }
       
   353             else if (opacityValue > KOne)
       
   354                {
       
   355                opacityValue = KOne;
       
   356                }
       
   357             CFloatCssValueImpl* tParentValue = NULL;
       
   358             CFloatCssValueImpl* tValue = (CFloatCssValueImpl *)(iSvgStyleProperties->operator[](position));
       
   359 
       
   360             if( this != doc->RootElement() && lParentElement )
       
   361                 {
       
   362                 tParentValue  = (CFloatCssValueImpl *)
       
   363                                     (lParentElement->iSvgStyleProperties->operator[](position));
       
   364                 }
       
   365             if (tParentValue == tValue || tValue == NULL)
       
   366                 {
       
   367                 tValue = doc->iMemoryManager->GetCssFloatObjectL( opacityValue );
       
   368 
       
   369                 iSvgStyleProperties->operator[](position) = tValue;
       
   370                 }
       
   371             else
       
   372                 {
       
   373                 tValue->SetValueL( opacityValue );
       
   374                 }
       
   375             }
       
   376         break;
       
   377         default:
       
   378         return EFalse;
       
   379 
       
   380         }
       
   381 
       
   382     return ETrue;
       
   383 
       
   384     }
       
   385 
       
   386 // ---------------------------------------------------------------------------
       
   387 //
       
   388 // ---------------------------------------------------------------------------
       
   389 
       
   390 TBool CSvgElementImpl::SetPropertyL( const TInt& aAttrId,
       
   391                                 const TDesC& aValue)
       
   392     {
       
   393     _LIT( KInherit, "inherit" );
       
   394 
       
   395     CSvgDocumentImpl*   doc                 = ( CSvgDocumentImpl* ) OwnerDocument();
       
   396 
       
   397     if (!doc)
       
   398     {
       
   399     	return EFalse;
       
   400     }
       
   401 
       
   402     CSvgSchemaData*     lSchemaData         = doc->SchemaData();
       
   403 
       
   404     TInt                position    = aAttrId;
       
   405 
       
   406 
       
   407     if( (aValue == KInherit) || (iSvgStyleProperties == NULL))
       
   408         {
       
   409         return ETrue;
       
   410         }
       
   411 
       
   412     CSvgElementImpl* lParentElement = (CSvgElementImpl*)iParentNode;
       
   413     while(lParentElement && (lParentElement->iSvgStyleProperties == NULL))
       
   414         {
       
   415         lParentElement = (CSvgElementImpl*)lParentElement->ParentNode ();
       
   416         }
       
   417 
       
   418 
       
   419     switch ( position )
       
   420         {
       
   421 
       
   422         case KCSS_ATTR_FILL:
       
   423             //fill
       
   424             {
       
   425             CPaintCssValueImpl* tParentValue = NULL;
       
   426             CPaintCssValueImpl* tValue = (CPaintCssValueImpl *)(iSvgStyleProperties->operator[](position));
       
   427             if( this != doc->RootElement() && lParentElement)
       
   428                 {
       
   429                 tParentValue  = (CPaintCssValueImpl *)
       
   430                             (lParentElement->iSvgStyleProperties->operator[](position));
       
   431                 }
       
   432             if (tParentValue == tValue || tValue == NULL)
       
   433                 {
       
   434 				tValue = doc->iMemoryManager->GetCssPaintObjectL(aValue, this);
       
   435 
       
   436 
       
   437                 if ( tValue->IsDefaultSet() )
       
   438                 	{
       
   439                 	// if default color is set, check see if parent has one
       
   440                 	if ( lParentElement )
       
   441                 		{
       
   442 		                tParentValue  = (CPaintCssValueImpl *)
       
   443 	                            (lParentElement->iSvgStyleProperties->operator[](position));
       
   444                 		}
       
   445 
       
   446                 	if ( tParentValue != NULL )
       
   447                 		{
       
   448 		                iSvgStyleProperties->operator[](position) = tParentValue;
       
   449 		                break;
       
   450                 		}
       
   451 
       
   452                 	}
       
   453                 else
       
   454                		{
       
   455 	                iSvgStyleProperties->operator[](position) = tValue;
       
   456                		}
       
   457                 }
       
   458             else
       
   459                 {
       
   460                 tValue->SetValueL( aValue );
       
   461                 }
       
   462 
       
   463             break;
       
   464 
       
   465             }
       
   466         case KCSS_ATTR_STROKE_OPACITY:
       
   467         case KCSS_ATTR_FILL_OPACITY:
       
   468         case KCSS_ATTR_GROUP_OPACITY:
       
   469             {
       
   470             TFloatFixPt KZero;
       
   471             TFloatFixPt KOne( KFloatFixOne );
       
   472             TFloatFixPt opacityValue;
       
   473             if ( TFloatFixPt::ConvertString( aValue, opacityValue ) == KErrNone )
       
   474                 {
       
   475                 if (aValue.Locate('%') != KErrNotFound)
       
   476                     {
       
   477                     //if a percentage
       
   478                     opacityValue = opacityValue / TFloatFixPt(100);
       
   479                     }
       
   480                 }
       
   481             else
       
   482                 {
       
   483                 opacityValue = KOne;
       
   484                 }
       
   485 
       
   486                 if (opacityValue < KZero)
       
   487                 opacityValue = KZero;
       
   488             else if (opacityValue > KOne)
       
   489                 opacityValue = KOne;
       
   490 
       
   491             CFloatCssValueImpl* tParentValue = NULL;
       
   492             CFloatCssValueImpl* tValue = (CFloatCssValueImpl *)(iSvgStyleProperties->operator[](position));
       
   493 
       
   494             if( this != doc->RootElement() && lParentElement )
       
   495                 {
       
   496                 tParentValue  = (CFloatCssValueImpl *)
       
   497                                     (lParentElement->iSvgStyleProperties->operator[](position));
       
   498                 }
       
   499             if (tParentValue == tValue || tValue == NULL)
       
   500                 {
       
   501                	tValue = doc->iMemoryManager->GetCssFloatObjectL(opacityValue);
       
   502 
       
   503                 iSvgStyleProperties->operator[](position) = tValue;
       
   504                 }
       
   505             else
       
   506                 {
       
   507                 tValue->SetValueL( opacityValue );
       
   508                 }
       
   509             }
       
   510         break;
       
   511 
       
   512         case KCSS_ATTR_STROKE:
       
   513         case KCSS_ATTR_COLOR:
       
   514             {
       
   515 
       
   516             CClrCssValueImpl* tParentValue = NULL;
       
   517             CClrCssValueImpl* tValue = (CClrCssValueImpl *)(iSvgStyleProperties->operator[](position));
       
   518             if( this != doc->RootElement() && lParentElement )
       
   519                 {
       
   520                 tParentValue  = (CClrCssValueImpl *)
       
   521                                     (lParentElement->iSvgStyleProperties->operator[](position));
       
   522                 }
       
   523             if (tParentValue == tValue || tValue == NULL)
       
   524                 {
       
   525                 tValue = doc->iMemoryManager->GetCssClrObjectL( aValue );
       
   526 
       
   527                 iSvgStyleProperties->operator[](position) = tValue;
       
   528                 }
       
   529             else
       
   530                 {
       
   531                 tValue->SetValueL( aValue );
       
   532                 }
       
   533 
       
   534             break;
       
   535 
       
   536             }
       
   537         case KCSS_ATTR_VISIBILITY:
       
   538         // visibility
       
   539             {
       
   540             TPtrC               lVal;
       
   541             if ( aValue == _L( "visible" ) )
       
   542                 {
       
   543                 lVal.Set( _L( "0" ) );
       
   544                 }
       
   545             else if ( aValue == _L( "hidden" ) )
       
   546                 {
       
   547                 lVal.Set( _L( "1" ) );
       
   548                 }
       
   549             else if ( aValue == _L( "collapse" ) )
       
   550                 {
       
   551                 lVal.Set( _L( "3" ) );
       
   552                 }
       
   553 
       
   554             CIntCssValueImpl* tParentValue = NULL;
       
   555             CIntCssValueImpl* tValue = (CIntCssValueImpl *)(iSvgStyleProperties->operator[](position));
       
   556             if( this != doc->RootElement() && lParentElement )
       
   557                 {
       
   558                 tParentValue  = (CIntCssValueImpl *)
       
   559                             (lParentElement->iSvgStyleProperties->operator[](position));
       
   560                 }
       
   561             if (tParentValue == tValue || tValue == NULL)
       
   562                 {
       
   563                 tValue = doc->iMemoryManager->GetCssIntObjectL( lVal );
       
   564 
       
   565                 iSvgStyleProperties->operator[](position) = tValue;
       
   566                 }
       
   567             else
       
   568                 {
       
   569                 tValue->SetValueL( lVal );
       
   570                 }
       
   571             }
       
   572         break;
       
   573 
       
   574         case KCSS_ATTR_DISPLAY:
       
   575         // display
       
   576             {
       
   577 
       
   578             TPtrC               lVal;
       
   579             if ( aValue == _L( "inline" ) )
       
   580                 {
       
   581                 lVal.Set( _L( "0" ) );
       
   582                 }
       
   583             else if ( aValue == _L( "none" ) )
       
   584                 {
       
   585                 lVal.Set( _L( "16" ) );
       
   586                 }
       
   587 
       
   588             CIntCssValueImpl* tParentValue = NULL;
       
   589             CIntCssValueImpl* tValue = (CIntCssValueImpl *)(iSvgStyleProperties->operator[](position));
       
   590             if( this != doc->RootElement() && lParentElement)
       
   591                 {
       
   592                 tParentValue  = (CIntCssValueImpl *)
       
   593                             (lParentElement->iSvgStyleProperties->operator[](position));
       
   594                 }
       
   595             if (tParentValue == tValue || tValue == NULL)
       
   596                 {
       
   597                 tValue = doc->iMemoryManager->GetCssIntObjectL( lVal );
       
   598 
       
   599                 iSvgStyleProperties->operator[](position) = tValue;
       
   600                 }
       
   601             else
       
   602                 {
       
   603                 tValue->SetValueL( lVal );
       
   604                 }
       
   605 
       
   606             break;
       
   607             }
       
   608         case KCSS_ATTR_FONTSTYLE:
       
   609         // font-style
       
   610             {
       
   611             TInt               i;
       
   612 
       
   613             i = lSchemaData->FindFontStyle(aValue);
       
   614 
       
   615             TBufC<12>   buf;
       
   616             TPtr        lVal    ( buf.Des() );
       
   617             _LIT( KFixptFormat, "%d" );
       
   618             lVal.Format( KFixptFormat, i );
       
   619 
       
   620             CIntCssValueImpl* tParentValue = NULL;
       
   621             CIntCssValueImpl* tValue = (CIntCssValueImpl *)(iSvgStyleProperties->operator[](position));
       
   622             if( this != doc->RootElement() && lParentElement )
       
   623                 {
       
   624                 tParentValue  = (CIntCssValueImpl *)
       
   625                             (lParentElement->iSvgStyleProperties->operator[](position));
       
   626                 }
       
   627             if (tParentValue == tValue || tValue == NULL)
       
   628                 {
       
   629                 tValue = doc->iMemoryManager->GetCssIntObjectL( lVal );
       
   630 
       
   631                 iSvgStyleProperties->operator[](position) = tValue;
       
   632                 }
       
   633             else
       
   634                 {
       
   635                 tValue->SetValueL( lVal );
       
   636                 }
       
   637             }
       
   638         break;
       
   639         case KCSS_ATTR_FONTWEIGHT:
       
   640         // font-weight
       
   641             {
       
   642 
       
   643             TInt               i;
       
   644             i = lSchemaData->FindFontWeightEnum(aValue);
       
   645             TBufC<12>           buf;
       
   646             TPtr        lVal    ( buf.Des() );
       
   647             _LIT( KFixptFormat, "%d" );
       
   648             lVal.Format( KFixptFormat, i );
       
   649 
       
   650             CIntCssValueImpl* tParentValue = NULL;
       
   651             CIntCssValueImpl* tValue = (CIntCssValueImpl *)(iSvgStyleProperties->operator[](position));
       
   652             if( this != doc->RootElement() && lParentElement)
       
   653                 {
       
   654                 tParentValue  = (CIntCssValueImpl *)
       
   655                                     (lParentElement->iSvgStyleProperties->operator[](position));
       
   656                 }
       
   657             if (tParentValue == tValue || tValue == NULL)
       
   658                 {
       
   659 
       
   660                 tValue = doc->iMemoryManager->GetCssIntObjectL( lVal );
       
   661 
       
   662                 iSvgStyleProperties->operator[](position) = tValue;
       
   663                 }
       
   664             else
       
   665                 {
       
   666                 tValue->SetValueL( lVal );
       
   667                 }
       
   668             }
       
   669         break;
       
   670 
       
   671         case KCSS_ATTR_FONTFAMILY:
       
   672             if( ElemID() == KSvgFontfaceElement )
       
   673                 {
       
   674                 ((CSvgFontFaceElementImpl *)this)->SetFontFamilyL(aValue);
       
   675                 }
       
   676 
       
   677         case KCSS_ATTR_STROKE_LINECAP:
       
   678         case KCSS_ATTR_STROKE_LINEJOIN:
       
   679         case KCSS_ATTR_FILLRULE:
       
   680             {
       
   681             CStrCssValueImpl* tParentValue = NULL;
       
   682             CStrCssValueImpl* tValue = (CStrCssValueImpl *)(iSvgStyleProperties->operator[](position));
       
   683             if( this != doc->RootElement() && lParentElement )
       
   684                 {
       
   685                 tParentValue  = (CStrCssValueImpl *)
       
   686                                         (lParentElement->iSvgStyleProperties->operator[](position));
       
   687                 }
       
   688             if (tParentValue == tValue || tValue == NULL)
       
   689                 {
       
   690                 tValue = doc->iMemoryManager->GetCssStrObjectL( aValue );
       
   691                 iSvgStyleProperties->operator[](position) = tValue;
       
   692                 }
       
   693             else
       
   694                 {
       
   695                 tValue->SetValueL( aValue );
       
   696                 }
       
   697             }
       
   698         break;
       
   699         case KCSS_ATTR_STROKE_DASHARRAY:
       
   700             {
       
   701 
       
   702             CVectorCssValueImpl* tParentValue = NULL;
       
   703             CVectorCssValueImpl* tValue = (CVectorCssValueImpl *)(iSvgStyleProperties->operator[](position));
       
   704             if( this != doc->RootElement() && lParentElement)
       
   705                 {
       
   706                 tParentValue  = (CVectorCssValueImpl *)
       
   707                                     (lParentElement->iSvgStyleProperties->operator[](position));
       
   708                 }
       
   709             if (tParentValue == tValue || tValue == NULL)
       
   710                 {
       
   711                 tValue = doc->iMemoryManager->GetCssVectorObjectL( aValue );
       
   712                 iSvgStyleProperties->operator[](position) = tValue;
       
   713                 }
       
   714             else
       
   715                 {
       
   716                 tValue->SetValueL( aValue );
       
   717                 }
       
   718 
       
   719             if(tValue)
       
   720 	            {
       
   721                 CArrayFix<TFloatFixPt>* lDashArray = tValue->Value();
       
   722 				TFloatFixPt lSum( 0 );
       
   723 				TUint numElem = lDashArray->Count();
       
   724 				// Iterate through the array to check whether the sum of elements
       
   725 				// of the dash array is non-zero.
       
   726 				for (TUint arrCount = 0; arrCount < numElem; arrCount++)
       
   727 					{
       
   728 					lSum = lSum + lDashArray->At(arrCount);
       
   729 					}
       
   730 				// If the sum is zero then, the behaviour should be similar to "none" i.e. no dashing applied.
       
   731 				if ( lSum == TFloatFixPt( 0 ) )
       
   732 				    {
       
   733 				    iSvgStyleProperties->operator[](position)= NULL;
       
   734 
       
   735 
       
   736 				    // Not deleting the tValue as this would be freed in the
       
   737 				    // destructor of CSvgMemoryManager
       
   738 				    }
       
   739     	        }
       
   740 
       
   741             }
       
   742         break;
       
   743         case KCSS_ATTR_STROKEWIDTH:
       
   744             {
       
   745             // stroke-width can not be negative
       
   746             TReal32 strokeWidth;
       
   747             TPtrC remainder;
       
   748             TBool validValue = TTokenizer::ParseDecimal( aValue, strokeWidth, remainder );
       
   749 
       
   750             // Check for valid number characters and no characters following
       
   751             // and must be non-negative
       
   752             if ( !validValue || strokeWidth < 0.0f )
       
   753                 {
       
   754                 strokeWidth = 1.0f;
       
   755                 }
       
   756 			/*
       
   757 			"1pt" equals "1.25px" (and therefore 1.25 user units)
       
   758 			"1pc" equals "15px" (and therefore 15 user units)
       
   759 			"1mm" would be "3.543307px" (3.543307 user units)
       
   760 			"1cm" equals "35.43307px" (and therefore 35.43307 user units)
       
   761 			"1in" equals "90px" (and therefore 90 user units)
       
   762 			*/
       
   763             else if ( remainder.Length() > 0 )
       
   764             	{
       
   765             	if ( remainder == _L("px") )
       
   766 	            	{
       
   767 	            	// do nothing
       
   768 	            	}
       
   769             	if ( remainder == _L("pt") )
       
   770 	            	{
       
   771 	            	strokeWidth *= 1.25f;
       
   772 	            	}
       
   773             	else if ( remainder == _L("pc") )
       
   774 	            	{
       
   775 	            	strokeWidth *= 15.0f;
       
   776 	            	}
       
   777             	else if ( remainder == _L("mm") )
       
   778 	            	{
       
   779 	            	strokeWidth *= 3.543307f;
       
   780 	            	}
       
   781             	else if ( remainder == _L("cm") )
       
   782 	            	{
       
   783 	            	strokeWidth *= 35.43307f;
       
   784 	            	}
       
   785             	else if ( remainder == _L("in") )
       
   786 	            	{
       
   787 	            	strokeWidth *= 90.0f;
       
   788 	            	}
       
   789             	else
       
   790 	            	{
       
   791 	                strokeWidth = 1.0f;
       
   792 	            	}
       
   793             	}
       
   794 
       
   795             CFloatCssValueImpl* tParentValue = NULL;
       
   796             CFloatCssValueImpl* tValue = (CFloatCssValueImpl *)(iSvgStyleProperties->operator[](position));
       
   797             if( this != doc->RootElement() && lParentElement)
       
   798                 {
       
   799                 tParentValue  = (CFloatCssValueImpl *)
       
   800                                 (lParentElement->iSvgStyleProperties->operator[](position));
       
   801                 }
       
   802             if (tParentValue == tValue || tValue == NULL)
       
   803                 {
       
   804                 tValue = doc->iMemoryManager->GetCssFloatObjectL( strokeWidth );
       
   805                 iSvgStyleProperties->operator[](position) = tValue;
       
   806                 }
       
   807             else
       
   808                 {
       
   809                 tValue->SetValueL( strokeWidth );
       
   810                 }
       
   811             }
       
   812         break;
       
   813 
       
   814         case KCSS_ATTR_FONTSIZE:
       
   815         case KCSS_ATTR_STROKE_DASHOFFSET:
       
   816         case KCSS_ATTR_STROKE_MITERLIMIT:
       
   817             {
       
   818             CFloatCssValueImpl* tParentValue = NULL;
       
   819             CFloatCssValueImpl* tValue = (CFloatCssValueImpl *)(iSvgStyleProperties->operator[](position));
       
   820             if( this != doc->RootElement() && lParentElement )
       
   821                 {
       
   822                 tParentValue  = (CFloatCssValueImpl *)
       
   823                                     (lParentElement->iSvgStyleProperties->operator[](position));
       
   824                 }
       
   825             if (tParentValue == tValue || tValue == NULL)
       
   826                 {
       
   827                 tValue = doc->iMemoryManager->GetCssFloatObjectL(aValue);
       
   828 
       
   829                 iSvgStyleProperties->operator[](position) = tValue;
       
   830                 }
       
   831             else
       
   832                 {
       
   833                 tValue->SetValueL( aValue );
       
   834                 }
       
   835             }
       
   836         break;
       
   837         case KCSS_ATTR_TEXTANCHOR:
       
   838         //text-anchor
       
   839             {
       
   840 
       
   841             TInt               i;
       
   842 
       
   843             i = lSchemaData->FindTextAnchorEnum(aValue);
       
   844 
       
   845             TBufC<12>   buf;
       
   846             TPtr        lVal    ( buf.Des() );
       
   847             _LIT( KFixptFormat, "%d" );
       
   848             lVal.Format( KFixptFormat, i );
       
   849 
       
   850             CIntCssValueImpl* tParentValue = NULL;
       
   851             CIntCssValueImpl* tValue = (CIntCssValueImpl *)(iSvgStyleProperties->operator[](position));
       
   852             if( this != doc->RootElement() && lParentElement )
       
   853                 {
       
   854                 tParentValue  = (CIntCssValueImpl *)
       
   855                                     (lParentElement->iSvgStyleProperties->operator[](position));
       
   856                 }
       
   857             if (tParentValue == tValue || tValue == NULL)
       
   858                 {
       
   859                 tValue = doc->iMemoryManager->GetCssIntObjectL( lVal );
       
   860 
       
   861                 iSvgStyleProperties->operator[](position) = tValue;
       
   862                 }
       
   863             else
       
   864                 {
       
   865                 tValue->SetValueL( lVal );
       
   866                 }
       
   867             }
       
   868         break;
       
   869         case KCSS_ATTR_TEXTDECORATION:
       
   870         //text-decoration
       
   871             {
       
   872 
       
   873             TInt               i;
       
   874             i = lSchemaData->FindTextDecorationEnum(aValue);
       
   875             TBufC<12>   buf;
       
   876             TPtr        lVal    ( buf.Des() );
       
   877             _LIT( KFixptFormat, "%d" );
       
   878             lVal.Format( KFixptFormat, i );
       
   879 
       
   880             CIntCssValueImpl* tParentValue = NULL;
       
   881             CIntCssValueImpl* tValue = (CIntCssValueImpl *)(iSvgStyleProperties->operator[](position));
       
   882             if( this != doc->RootElement() && lParentElement)
       
   883                 {
       
   884                 tParentValue  = (CIntCssValueImpl *)
       
   885                                     (lParentElement->iSvgStyleProperties->operator[](position));
       
   886                 }
       
   887             if (tParentValue == tValue || tValue == NULL)
       
   888                 {
       
   889                 tValue = doc->iMemoryManager->GetCssIntObjectL(lVal);
       
   890 
       
   891                 iSvgStyleProperties->operator[](position) = tValue;
       
   892                 }
       
   893             else
       
   894                 {
       
   895                 tValue->SetValueL( lVal );
       
   896                 }
       
   897             }
       
   898         break;
       
   899 
       
   900         default:
       
   901         return EFalse;
       
   902 
       
   903         }
       
   904 
       
   905     return ETrue;
       
   906 
       
   907     }
       
   908 
       
   909 
       
   910 
       
   911 // ---------------------------------------------------------------------------
       
   912 //
       
   913 // ---------------------------------------------------------------------------
       
   914 TBool CSvgElementImpl::SetTransform( const TDesC& aAttributeName,
       
   915                                      const TDesC& aValue )
       
   916     {
       
   917 
       
   918     if( iSvgTransformable == NULL )
       
   919         {
       
   920         return EFalse;
       
   921         }
       
   922 
       
   923     // If this attribute is not transform attribute, return immediately.
       
   924     _LIT( KTransform, "transform" );
       
   925     if ( aAttributeName != KTransform )
       
   926         return EFalse;
       
   927 
       
   928     TLex                input   ( aValue );
       
   929     TReal32             M00, M10, M01, M11, M02, M12;
       
   930     TGfxAffineTransform tempTransform;
       
   931     MSvgTransformList*  trList;
       
   932 
       
   933     iSvgTransformable->GetTransform( trList );
       
   934     TGfxAffineTransform originalTransform   = trList->GetItem( 0 );
       
   935 
       
   936     _LIT( KMatrixP, "matrix(" );
       
   937     _LIT( KTranslateP, "translate(" );
       
   938     _LIT( KScaleP, "scale(" );
       
   939     _LIT( KRotateP, "rotate(" );
       
   940     _LIT( KSkewxP, "skewX(" );
       
   941     _LIT( KSkewyP, "skewY(" );
       
   942 
       
   943     while ( !( input.Eos() ) )
       
   944         {
       
   945         input.Mark();
       
   946         input.SkipCharacters();
       
   947         TPtrC   token   = input.MarkedToken();    // then extract token
       
   948 
       
   949         if ( token == KMatrixP )
       
   950             {
       
   951             input.SkipSpace();  if ( input.Val( M00, '.' ) != KErrNone ) return EFalse;
       
   952             input.SkipSpace();  if ( input.Val( M10, '.' ) != KErrNone ) return EFalse;
       
   953             input.SkipSpace();  if ( input.Val( M01, '.' ) != KErrNone ) return EFalse;
       
   954             input.SkipSpace();  if ( input.Val( M11, '.' ) != KErrNone ) return EFalse;
       
   955             input.SkipSpace();  if ( input.Val( M02, '.' ) != KErrNone ) return EFalse;
       
   956             input.SkipSpace();  if ( input.Val( M12, '.' ) != KErrNone ) return EFalse;
       
   957 
       
   958             //check to make sure the user isn't setting in scale of 0 because that can never be undone
       
   959             //they probably just mean that they don't want to scale
       
   960            /* if (M00 == 0)
       
   961             {
       
   962             	M00 = 1;
       
   963             }
       
   964             if (M11 == 0)
       
   965             {
       
   966             	M11 = 1;
       
   967             }*/
       
   968 
       
   969             tempTransform.SetTransform( M00, M10, M01, M11, M02, M12 );
       
   970             originalTransform.Concatenate( tempTransform );
       
   971             trList->ReplaceItem( originalTransform, 0 );
       
   972             }
       
   973         else if ( token == KTranslateP )
       
   974             {
       
   975             // parse tx
       
   976             input.SkipSpace();
       
   977             if ( input.Val( M00, '.' ) != KErrNone ) return EFalse;
       
   978 
       
   979             // parse ty
       
   980             input.SkipSpace();
       
   981             if ( input.Val( M10, '.' ) != KErrNone ) M10 = 0.0;
       
   982 
       
   983             // set translate
       
   984             TFloatFixPt  fixM00  ( M00 );
       
   985             TFloatFixPt  fixM10  ( M10 );
       
   986             originalTransform.Translate( fixM00, fixM10 );
       
   987             trList->ReplaceItem( originalTransform, 0 );
       
   988             }
       
   989         else if ( token == KScaleP )
       
   990             {
       
   991             input.SkipSpace();
       
   992             if(input.Peek().IsDigit() || (input.Peek() == '-') || (input.Peek() == '.'))
       
   993                 {
       
   994                 if ( input.Val( M00, TChar('.') ) != KErrNone )
       
   995                     return EFalse;
       
   996                 }
       
   997             else
       
   998                 {
       
   999                 M00 = 1.0;
       
  1000                 }
       
  1001             input.SkipSpace();
       
  1002             // If only one value is given then both scale values are set to that value
       
  1003             if ( input.Eos() || input.Peek() == ')' )
       
  1004                 {
       
  1005                 M11 = M00;
       
  1006                 }
       
  1007             else
       
  1008                 {
       
  1009                 if(input.Peek().IsDigit() || (input.Peek() == '-') || (input.Peek() == '.'))
       
  1010                     {
       
  1011                     if ( input.Val( M11, TChar('.')) != KErrNone )
       
  1012                         return EFalse;
       
  1013                     }
       
  1014                 else
       
  1015                     {
       
  1016                     M11 = 1.0;
       
  1017                     }
       
  1018                 }
       
  1019             originalTransform.Scale( M00, M11 );
       
  1020             trList->ReplaceItem( originalTransform, 0 );
       
  1021             }
       
  1022         else if ( token == KRotateP )
       
  1023             {
       
  1024             // parse r
       
  1025             input.SkipSpace();
       
  1026             if ( input.Val( M00, '.' ) != KErrNone ) return EFalse;
       
  1027             // parse cx
       
  1028             input.SkipSpace();
       
  1029             if ( input.Val( M01, '.' ) == KErrNone )
       
  1030                 {
       
  1031                 // parse cy
       
  1032                 input.SkipSpace();
       
  1033                 if ( input.Val( M10, '.' ) != KErrNone ) return EFalse;
       
  1034                 M00 = M00 * KGradiansPerDegree; // Convert to Radians
       
  1035                 originalTransform.Rotate( M00, TFloatFixPt(M01), TFloatFixPt(M10) );
       
  1036                 trList->ReplaceItem( originalTransform, 0 );
       
  1037                 }
       
  1038             else
       
  1039                 {
       
  1040                 M00 = M00 * KGradiansPerDegree; // Convert to Radians
       
  1041                 originalTransform.Rotate( M00 );
       
  1042                 trList->ReplaceItem( originalTransform, 0 );
       
  1043                 }
       
  1044             }
       
  1045         else if ( token == KSkewxP )
       
  1046             {
       
  1047             input.SkipSpace();  if ( input.Val( M00, '.' ) != KErrNone ) return EFalse;
       
  1048             M00 = M00 * KGradiansPerDegree; // Convert to Radians
       
  1049             originalTransform.Shear( M00, 0.0f  );
       
  1050             trList->ReplaceItem( originalTransform, 0 );
       
  1051             }
       
  1052         else if ( token == KSkewyP )
       
  1053             {
       
  1054             input.SkipSpace();  if ( input.Val( M00, '.' ) != KErrNone ) return EFalse;
       
  1055             M00 = M00 * KGradiansPerDegree; // Convert to Radians
       
  1056             originalTransform.Shear(  0.0f, M00 );
       
  1057             trList->ReplaceItem( originalTransform, 0 );
       
  1058             }
       
  1059 
       
  1060         // Skip close paranthesis
       
  1061         input.SkipSpace();
       
  1062         input.Mark();
       
  1063         input.MarkedToken();    // then extract token
       
  1064         }
       
  1065     return ETrue;
       
  1066     }
       
  1067 
       
  1068 
       
  1069 // ---------------------------------------------------------------------------
       
  1070 //
       
  1071 // ---------------------------------------------------------------------------
       
  1072 TSvgColor* CSvgElementImpl::CurrentColor()
       
  1073     {
       
  1074 
       
  1075 
       
  1076     if( iSvgStyleProperties )
       
  1077         {
       
  1078         CCssValue*  lColorValue = NULL;
       
  1079         lColorValue = iSvgStyleProperties->operator[](KCSS_ATTR_COLOR);
       
  1080 
       
  1081         if (    lColorValue  &&
       
  1082                 ( ( CClrCssValueImpl * ) lColorValue )->Value() &&
       
  1083                 ( ( TSvgColor*)(( CClrCssValueImpl * ) lColorValue )->Value())->GetColor() != KSvgCurrentColor
       
  1084             )
       
  1085             {
       
  1086             // current color found and useful, return it
       
  1087             return ( TSvgColor*)(( CClrCssValueImpl * ) lColorValue )->Value();
       
  1088             }
       
  1089         else
       
  1090             {
       
  1091             // current color found, but it is "currentColor"
       
  1092             // find the real color from searching parents
       
  1093 
       
  1094             if ( iParentNode )
       
  1095                 {
       
  1096                 return ( ( CSvgElementImpl * ) iParentNode )->CurrentColor();
       
  1097                 }
       
  1098             }
       
  1099         }
       
  1100     else
       
  1101         {
       
  1102         if ( iParentNode )
       
  1103             {
       
  1104             return ( ( CSvgElementImpl * ) iParentNode )->CurrentColor();
       
  1105             }
       
  1106         }
       
  1107     return NULL;
       
  1108     }
       
  1109 
       
  1110 void CSvgElementImpl::InitAllSvgStyleProperties(CSvgElementImpl* aElement)
       
  1111 {
       
  1112 	if (aElement && aElement->ParentNode())
       
  1113 	{
       
  1114 		aElement->InitSvgJSRStyleProperties((CSvgElementImpl*)aElement->ParentNode());
       
  1115 	}
       
  1116 
       
  1117 	if (aElement && aElement->iSvgStyleProperties && aElement->iSvgStyleProperties->Count() == KCSS_MAX_ATTR)
       
  1118 	{
       
  1119 		CSvgElementImpl* lChildElement = (CSvgElementImpl*)aElement->FirstChild();
       
  1120 
       
  1121 		if ( lChildElement )
       
  1122 		{
       
  1123 			InitAllSvgStyleProperties( lChildElement );
       
  1124 		}
       
  1125 
       
  1126 		CSvgElementImpl* lSiblingElement = (CSvgElementImpl*)aElement->NextSibling();
       
  1127 
       
  1128 		if ( lSiblingElement )
       
  1129 		{
       
  1130 			InitAllSvgStyleProperties( lSiblingElement );
       
  1131 		}
       
  1132 	}
       
  1133 }
       
  1134 
       
  1135 void CSvgElementImpl::InitSvgJSRStyleProperties(CSvgElementImpl* aParentElement)
       
  1136 {
       
  1137 	if ( iSvgStyleProperties && iSvgStyleProperties->Count() == KCSS_MAX_ATTR )
       
  1138     {
       
  1139     	//JSR226 ELEMENT CREATION WILL COME TO THIS
       
  1140         // any non NULL values in the iSvgStyleProperties array should be kept and
       
  1141         // the NULL ones should be replaced by the parent values
       
  1142 
       
  1143         if( aParentElement && aParentElement->iSvgStyleProperties)
       
  1144             {
       
  1145                 TInt  count = aParentElement->iSvgStyleProperties->Count();
       
  1146                 for ( TInt i = 0; i < count; i++ )
       
  1147                 {
       
  1148                     CCssValue*   lCssValue   = aParentElement->iSvgStyleProperties->operator[]( i );
       
  1149                     CCssValue*   thisCssValue = this->iSvgStyleProperties->operator[]( i );
       
  1150 
       
  1151                     if( lCssValue && !thisCssValue )
       
  1152                     {
       
  1153                         // the parent had a property but we just had NULL, so lets inherit the parent property
       
  1154                         (*iSvgStyleProperties)[i] = lCssValue;
       
  1155                     }
       
  1156                     else
       
  1157                     {
       
  1158                         //this element must have a new value of its own in it so leave it alone
       
  1159                     }
       
  1160                 }
       
  1161             }
       
  1162     }
       
  1163 }
       
  1164 
       
  1165 TInt CSvgElementImpl::InitSvgStyleProperties( )
       
  1166     {
       
  1167     // all styles from all elements for the normal engine
       
  1168     // flow will be setup in this function
       
  1169 
       
  1170     TInt err(KErrNone);
       
  1171 
       
  1172     if( iSvgStyleProperties && iSvgStyleProperties->Count() == 0 )
       
  1173         {
       
  1174         //NORMAL ENGINE ELEMENT CREATION...
       
  1175         CSvgElementImpl* lParentElement = (CSvgElementImpl*)iParentNode;
       
  1176         while(lParentElement && ((lParentElement->iSvgStyleProperties == NULL) || (lParentElement->iSvgStyleProperties->Count() == 0)) )
       
  1177             {
       
  1178             lParentElement = (CSvgElementImpl*)lParentElement->ParentNode ();
       
  1179             }
       
  1180 
       
  1181         if( lParentElement )
       
  1182             {
       
  1183             TInt  count       = lParentElement->iSvgStyleProperties->Count();
       
  1184             for ( TInt i = 0; i < count; i++ )
       
  1185                 {
       
  1186                 CCssValue*   lCssValue   = lParentElement->iSvgStyleProperties->operator[]( i );
       
  1187                 err = iSvgStyleProperties->Insert(lCssValue,i);
       
  1188                 if (err)
       
  1189                     return err;
       
  1190                 }
       
  1191             }
       
  1192         }
       
  1193 
       
  1194     return err;
       
  1195 }
       
  1196 
       
  1197 // ---------------------------------------------------------------------------
       
  1198 //
       
  1199 // ---------------------------------------------------------------------------
       
  1200 
       
  1201 void CSvgElementImpl::FindProperty( const TInt8 aPropertyId,
       
  1202                                     CCssValue*& aCssValue,
       
  1203                                     CSvgElementImpl* aElement )
       
  1204 
       
  1205     {
       
  1206         if (aElement != NULL)
       
  1207             aElement->FindProperty(aPropertyId, aCssValue);
       
  1208         else
       
  1209             FindProperty(aPropertyId, aCssValue);
       
  1210     }
       
  1211 
       
  1212 void CSvgElementImpl::FindProperty( const TInt8 aPropertyId,
       
  1213                                     CCssValue*& aCssValue)
       
  1214 
       
  1215     {
       
  1216         if( iSvgStyleProperties && iSvgStyleProperties->Count() > aPropertyId)
       
  1217         {
       
  1218         aCssValue = iSvgStyleProperties->operator[](aPropertyId);
       
  1219         }
       
  1220     }
       
  1221 
       
  1222 
       
  1223 // ---------------------------------------------------------------------------
       
  1224 //
       
  1225 // ---------------------------------------------------------------------------
       
  1226 void CSvgElementImpl::SetTransform( MSvgTransformList*& aTransformList )
       
  1227     {
       
  1228     if( !iSvgTransformable )
       
  1229     {
       
  1230         // iSvgTransformable should not be NULL (created by subclass)
       
  1231         TRAP_IGNORE( iSvgTransformable = CSvgTransformableImpl::NewL() );
       
  1232     }
       
  1233 
       
  1234     if( iSvgTransformable )
       
  1235         {
       
  1236         iSvgTransformable->SetTransform( aTransformList );
       
  1237         }
       
  1238     }
       
  1239 
       
  1240 
       
  1241 // ---------------------------------------------------------------------------
       
  1242 //
       
  1243 // ---------------------------------------------------------------------------
       
  1244 void CSvgElementImpl::GetTransform( MSvgTransformList*& aTransformList )
       
  1245     {
       
  1246     if( !iSvgTransformable )
       
  1247     {
       
  1248         // iSvgTransformable should not be NULL (created by subclass)
       
  1249         TRAP_IGNORE( iSvgTransformable = CSvgTransformableImpl::NewL() );
       
  1250     }
       
  1251 
       
  1252      if( iSvgTransformable )
       
  1253         {
       
  1254         iSvgTransformable->GetTransform( aTransformList );
       
  1255         }
       
  1256     }
       
  1257 
       
  1258 // ---------------------------------------------------------------------------
       
  1259 //
       
  1260 // ---------------------------------------------------------------------------
       
  1261 const TGfxAffineTransform& CSvgElementImpl::GetCTM()
       
  1262     {
       
  1263     if( !iSvgTransformable )
       
  1264     {
       
  1265     	// iSvgTransformable should not be NULL (created by subclass)
       
  1266     	TRAP_IGNORE( iSvgTransformable = CSvgTransformableImpl::NewL() );
       
  1267     }
       
  1268     return( iSvgTransformable->GetCTM() );
       
  1269     }
       
  1270 
       
  1271 // ---------------------------------------------------------------------------
       
  1272 //
       
  1273 // ---------------------------------------------------------------------------
       
  1274 void CSvgElementImpl::SetCTM( TGfxAffineTransform& aTr )
       
  1275     {
       
  1276     if( !iSvgTransformable )
       
  1277     {
       
  1278         // iSvgTransformable should not be NULL (created by subclass)
       
  1279         TRAP_IGNORE( iSvgTransformable = CSvgTransformableImpl::NewL() );
       
  1280     }
       
  1281 
       
  1282     if( iSvgTransformable )
       
  1283         {
       
  1284         iSvgTransformable->SetCTM( aTr );
       
  1285         }
       
  1286     else
       
  1287     	{
       
  1288 			#ifdef _DEBUG
       
  1289     		RDebug::Printf("CSvgElementImpl::SetCTM element %d wasnt transformable CTM not set", this->ElemID());
       
  1290 			#endif
       
  1291     	}
       
  1292     }
       
  1293 
       
  1294 // ---------------------------------------------------------------------------
       
  1295 //
       
  1296 // ---------------------------------------------------------------------------
       
  1297 void CSvgElementImpl::SetGCL( CGfx2dGc* aGc)
       
  1298     {
       
  1299 
       
  1300 
       
  1301     TSvgColor*          lStroke         = NULL;
       
  1302     MGfxPaint*          lFill           = NULL;
       
  1303     TGfxStroke          lStrokeC;
       
  1304     TFloatFixPt              lStrokeWidth    = 1;
       
  1305     TPtrC               lFillRule; // Should be a defined constant for nonzero
       
  1306     TPtrC               lSLinecap; // Should be a defined constant for linecap
       
  1307     TPtrC               lSLinejoin; // Should be a defined constant for linejoin
       
  1308     TInt                lFontStyle      = -1; // Should be a defined constant for fontstyle
       
  1309     TFloatFixPt              lFontSize       = 10; // Should be a defined constant for fontstyle
       
  1310     TInt                lFontWeight     = -1; // Should be a defined constant for fontweight
       
  1311     TInt                lTextanchor     = -1;
       
  1312     TInt                lTextDecoration = -1;
       
  1313     TFloatFixPt              lDashOffset     = 0;
       
  1314     TFloatFixPt              lSMiterlimit; // Should be a defined constant for strokemiterlimit
       
  1315     CArrayFix<TFloatFixPt>*  lDasharray      = NULL;
       
  1316 
       
  1317     CCssValue*          lCssValue       = NULL;
       
  1318 
       
  1319     // Get fill color
       
  1320 
       
  1321     FindProperty( KCSS_ATTR_FILL, lCssValue);
       
  1322     if ( lCssValue )
       
  1323         {
       
  1324         // Currently only TSvgColor is represented by PaintCssValue
       
  1325         // It will be extended to handle CGfxTexturePaint and CGfxGradientPaint
       
  1326         lFill = ( ( CPaintCssValueImpl * ) lCssValue )->Value();
       
  1327         // Set fill color
       
  1328         if(lFill)
       
  1329             {
       
  1330             if (lFill->GetColor() == KSvgCurrentColor )
       
  1331                 {
       
  1332 
       
  1333                 lFill = CurrentColor();
       
  1334                 if (lFill && lFill->GetColor() != KGfxColorNull )
       
  1335                     {
       
  1336                     aGc->SetPaint( lFill );
       
  1337 
       
  1338                     }
       
  1339                 else
       
  1340                     {
       
  1341                     aGc->SetPaint( NULL );
       
  1342                     }
       
  1343                 }
       
  1344             else if (lFill->GetColor() != KGfxColorNull )
       
  1345                 {
       
  1346                  aGc->SetPaint( lFill );
       
  1347                 }
       
  1348             else
       
  1349                 {
       
  1350                 aGc->SetPaint( NULL );
       
  1351                 }
       
  1352             }
       
  1353         else
       
  1354             {
       
  1355             aGc->SetPaint( NULL );
       
  1356             }
       
  1357         }
       
  1358     else
       
  1359         {
       
  1360         TSvgColor   black   ( 0 );
       
  1361         aGc->SetPaint( &black );
       
  1362         }
       
  1363 
       
  1364     // this is just regular opacity which needs to be an entire elements opacity
       
  1365     // Opacity set using stroke and fill opacity
       
  1366     CCssValue* lOpacityCssValue = NULL;
       
  1367     FindProperty( KCSS_ATTR_GROUP_OPACITY, lOpacityCssValue);
       
  1368     if ( lOpacityCssValue && ( ((CFloatCssValueImpl*)lOpacityCssValue)->Value() < TFloatFixPt(1) ) )
       
  1369         {
       
  1370         aGc->SetStrokeOpacity( ( ( CFloatCssValueImpl * ) lOpacityCssValue )->Value() );
       
  1371         aGc->SetFillOpacity( ( ( CFloatCssValueImpl * ) lOpacityCssValue )->Value() );
       
  1372         }
       
  1373 
       
  1374     lCssValue       = NULL;
       
  1375     FindProperty( KCSS_ATTR_STROKE_OPACITY, lCssValue);
       
  1376     if ( lCssValue )
       
  1377     {
       
  1378     	TFloatFixPt lValue = ( ( CFloatCssValueImpl * ) lCssValue )->Value();
       
  1379         aGc->SetStrokeOpacity( lValue );
       
  1380     }
       
  1381     else
       
  1382     {
       
  1383         aGc->SetStrokeOpacity(1);
       
  1384     }
       
  1385 
       
  1386     lCssValue       = NULL;
       
  1387     FindProperty( KCSS_ATTR_FILL_OPACITY, lCssValue);
       
  1388     if ( lCssValue )
       
  1389     {
       
  1390     	TFloatFixPt lValue = ( ( CFloatCssValueImpl * ) lCssValue )->Value();
       
  1391         aGc->SetFillOpacity( lValue );
       
  1392     }
       
  1393     else
       
  1394     {
       
  1395         aGc->SetFillOpacity(1);
       
  1396     }
       
  1397 
       
  1398     // Get stroke color
       
  1399     lCssValue       = NULL;
       
  1400     FindProperty( KCSS_ATTR_STROKE, lCssValue);
       
  1401 
       
  1402     if ( lCssValue )
       
  1403         {
       
  1404         lStroke = ( ( CClrCssValueImpl * ) lCssValue )->Value();
       
  1405         // Set stroke color
       
  1406         if ( lStroke && lStroke->GetColor () == KSvgCurrentColor )
       
  1407             {
       
  1408             lStroke = CurrentColor();
       
  1409             if(lStroke)
       
  1410                 {
       
  1411                 aGc->SetForegroundColor( *lStroke );
       
  1412                 }
       
  1413             }
       
  1414         else if ( lStroke )
       
  1415             {
       
  1416             aGc->SetForegroundColor( *lStroke );
       
  1417             }
       
  1418         }
       
  1419 
       
  1420     // Get stroke-width
       
  1421     lCssValue       = NULL;
       
  1422     FindProperty( KCSS_ATTR_STROKEWIDTH, lCssValue);
       
  1423 
       
  1424     if ( lCssValue )
       
  1425         {
       
  1426         lStrokeWidth = ( ( CFloatCssValueImpl * ) lCssValue )->Value();
       
  1427         if (lStrokeWidth <= TFloatFixPt(0))
       
  1428             {
       
  1429             lStrokeC.SetStrokeWidth( TFloatFixPt(0) );
       
  1430             }
       
  1431         else
       
  1432             {
       
  1433             // Set stroke-width
       
  1434             lStrokeC.SetStrokeWidth( lStrokeWidth );
       
  1435             }
       
  1436          }
       
  1437 
       
  1438     // Get and set fill-rule
       
  1439     lCssValue       = NULL;
       
  1440     FindProperty( KCSS_ATTR_FILLRULE, lCssValue);
       
  1441 
       
  1442     if ( lCssValue )
       
  1443         {
       
  1444         lFillRule.Set( ( ( CStrCssValueImpl * ) lCssValue )->Value() );
       
  1445             if ( lFillRule == _L("evenodd" ) )// evenodd
       
  1446             {
       
  1447             aGc->SetWindingRule( EGfxWindEvenOdd );
       
  1448             }
       
  1449             else if ( lFillRule == _L("nonzero") )
       
  1450             {
       
  1451             	aGc->SetWindingRule( EGfxWindNonZero );
       
  1452             }
       
  1453         }
       
  1454 
       
  1455     // Get and set stroke-linecap
       
  1456     lCssValue       = NULL;
       
  1457     FindProperty( KCSS_ATTR_STROKE_LINECAP, lCssValue);
       
  1458 
       
  1459     if ( lCssValue )
       
  1460         {
       
  1461         lSLinecap.Set( ( ( CStrCssValueImpl * ) lCssValue )->Value() );
       
  1462 
       
  1463         if (lSLinecap == _L("butt"))
       
  1464         {
       
  1465             lStrokeC.SetCapType( EGfxCapButt );
       
  1466         }
       
  1467         else if (lSLinecap == _L("round"))
       
  1468         {
       
  1469             lStrokeC.SetCapType( EGfxCapRound );
       
  1470         }
       
  1471         else if (lSLinecap == _L("square"))
       
  1472         {
       
  1473             lStrokeC.SetCapType( EGfxCapSquare );
       
  1474         }
       
  1475         }
       
  1476 
       
  1477     lCssValue = NULL;
       
  1478     FindProperty( KCSS_ATTR_STROKE_LINEJOIN, lCssValue);
       
  1479 
       
  1480     if ( lCssValue )
       
  1481         {
       
  1482         lSLinejoin.Set( ( ( CStrCssValueImpl * ) lCssValue )->Value() );
       
  1483 
       
  1484         if (lSLinejoin == _L("miter"))
       
  1485         {
       
  1486             lStrokeC.SetJoinType( EGfxJoinMiter );
       
  1487         }
       
  1488         else if (lSLinejoin == _L("round"))
       
  1489         {
       
  1490             lStrokeC.SetJoinType( EGfxJoinRound );
       
  1491         }
       
  1492         else if (lSLinejoin == _L("bevel"))
       
  1493         {
       
  1494             lStrokeC.SetJoinType( EGfxJoinBevel );
       
  1495         }
       
  1496         }
       
  1497 
       
  1498    
       
  1499     lCssValue = NULL;
       
  1500 
       
  1501     FindProperty( KCSS_ATTR_STROKE_DASHOFFSET, lCssValue);
       
  1502       if ( lCssValue )
       
  1503         {
       
  1504         lDashOffset = ( ( CFloatCssValueImpl * ) lCssValue )->Value();
       
  1505         // Set dashoffset into GC
       
  1506         aGc->SetDashOffset( lDashOffset );
       
  1507         }
       
  1508 
       
  1509     // Get and set stroke-dasharray
       
  1510     lCssValue       = NULL;
       
  1511     FindProperty( KCSS_ATTR_STROKE_DASHARRAY, lCssValue);
       
  1512       if ( lCssValue )
       
  1513         {
       
  1514         ( ( CVectorCssValueImpl * ) lCssValue )->Value( lDasharray );
       
  1515         // Set stroke-dasharray into GC
       
  1516         aGc->SetDashArrayL( lDasharray );
       
  1517         }
       
  1518 
       
  1519     // get and set stroke-miterlimit
       
  1520     lCssValue       = NULL;
       
  1521     FindProperty( KCSS_ATTR_STROKE_MITERLIMIT, lCssValue);
       
  1522 
       
  1523     if ( lCssValue )
       
  1524         {
       
  1525         lSMiterlimit = ( ( CFloatCssValueImpl * ) lCssValue )->Value();
       
  1526 
       
  1527         lStrokeC.SetMiterLimit(lSMiterlimit);
       
  1528         }
       
  1529 
       
  1530     if( iElemID == KSvgTextAreaElement || iElemID == KSvgTextElement)
       
  1531     {
       
  1532         lCssValue       = NULL;
       
  1533         FindProperty( KCSS_ATTR_FONTSIZE, lCssValue);
       
  1534 
       
  1535 	    if ( lCssValue )
       
  1536 	        {
       
  1537 	        lFontSize = ( ( CFloatCssValueImpl * ) lCssValue )->Value();
       
  1538 
       
  1539 		#ifdef SVG_FLOAT_BUILD
       
  1540 	        if(lFontSize <= TFloatFixPt ( 0 ) )
       
  1541 	        {
       
  1542 	            lFontSize = TFloatFixPt ( 10 );
       
  1543 	        }
       
  1544 		#else
       
  1545 	        if(lFontSize <= TFloatFixPt ( 0,ETrue ) )
       
  1546 	            lFontSize = TFloatFixPt ( 10 );
       
  1547 		#endif
       
  1548 	        aGc->SetFontSize( lFontSize );
       
  1549 	        }
       
  1550 
       
  1551 	    lCssValue       = NULL;
       
  1552 	    FindProperty( KCSS_ATTR_FONTSTYLE, lCssValue);
       
  1553 
       
  1554 	    if ( lCssValue )
       
  1555 	        {
       
  1556 	        lFontStyle = ( ( CIntCssValueImpl * ) lCssValue )->Value();
       
  1557 	        aGc->SetFontStyle( lFontStyle );
       
  1558 	        }
       
  1559 
       
  1560 	    // Get and set font-weight
       
  1561 	    lCssValue       = NULL;
       
  1562 	    FindProperty( KCSS_ATTR_FONTWEIGHT, lCssValue);
       
  1563 
       
  1564 	    if ( lCssValue )
       
  1565 	        {
       
  1566 	        lFontWeight = ( ( CIntCssValueImpl * ) lCssValue )->Value();
       
  1567 	        aGc->SetFontWeight( lFontWeight );
       
  1568 	        }
       
  1569 
       
  1570 	    // Get and set text-anchor
       
  1571 	    lCssValue       = NULL;
       
  1572 	    FindProperty( KCSS_ATTR_TEXTANCHOR, lCssValue);
       
  1573 
       
  1574 	    if ( lCssValue )
       
  1575 	        {
       
  1576 	        lTextanchor = ( ( CIntCssValueImpl * ) lCssValue )->Value();
       
  1577 	        aGc->SetTextanchor( lTextanchor );
       
  1578 	        }
       
  1579 
       
  1580 	    // Get and set text-decoration
       
  1581 	    lCssValue       = NULL;
       
  1582 	    FindProperty( KCSS_ATTR_TEXTDECORATION, lCssValue);
       
  1583 
       
  1584 	    if ( lCssValue )
       
  1585 	        {
       
  1586 	        lTextDecoration = ( ( CIntCssValueImpl * ) lCssValue )->Value();
       
  1587 	        aGc->SetTextDecoration( lTextDecoration );
       
  1588 	        }
       
  1589 	    }
       
  1590 		// Sset the stroke into the graphics library now that we are done
       
  1591 		aGc->SetStroke( lStrokeC );
       
  1592 
       
  1593     }
       
  1594 
       
  1595 // ---------------------------------------------------------------------------
       
  1596 //
       
  1597 // ---------------------------------------------------------------------------
       
  1598 void CSvgElementImpl::UpdateCTM( )
       
  1599 {
       
  1600     CSvgDocumentImpl* lDocument = (CSvgDocumentImpl*)(this->OwnerDocument());
       
  1601 
       
  1602 	if ( !lDocument )
       
  1603 	{
       
  1604 		return;
       
  1605 	}
       
  1606 
       
  1607     TInt lElementId = this->ElemID();
       
  1608     if( this->IsTransformable() )
       
  1609         {
       
  1610         MSvgTransformList*  trList;
       
  1611 
       
  1612         // Current delta transformation due to animation, etc.
       
  1613         TGfxAffineTransform localUserSpace;
       
  1614         // Element's CTM
       
  1615         TGfxAffineTransform lCurrentTM;
       
  1616 
       
  1617 
       
  1618         // we do not need this for the radial and linear Gradient Element.
       
  1619         //
       
  1620         if ( this != lDocument->RootElement()
       
  1621                 && !(lElementId == KSvgLinearGradientElement
       
  1622                 || lElementId == KSvgRadialGradientElement ))
       
  1623 
       
  1624             {
       
  1625             CSvgElementImpl* lParentEl   = ( CSvgElementImpl* )this->ParentNode();
       
  1626             while (lParentEl && !(lParentEl->IsTransformable()) )
       
  1627                 {
       
  1628                 lParentEl   = ( CSvgElementImpl* )lParentEl->ParentNode();
       
  1629                 }
       
  1630             if( lParentEl )
       
  1631                 {
       
  1632                 lCurrentTM = lParentEl->GetCTM();
       
  1633                 }
       
  1634             }
       
  1635 
       
  1636         this->GetTransform( trList );
       
  1637         localUserSpace = trList->Consolidate( IsOverwriteTransforms() );
       
  1638         lCurrentTM.Concatenate( localUserSpace );
       
  1639 
       
  1640         if(lElementId == KSvgUseElement)
       
  1641             {
       
  1642             lCurrentTM.Translate(((CSvgUseElementImpl *)this)->X(),((CSvgUseElementImpl *)this)->Y() );
       
  1643             }
       
  1644        /* else if(lElementId == KSvgAnimationElement)
       
  1645             {
       
  1646             lCurrentTM.Translate(((CSvgAnimationElementImpl *)this)->X(),((CSvgAnimationElementImpl *)this)->Y() );
       
  1647             }*/
       
  1648         else if ( lElementId == KSvgSvgElement )
       
  1649             {
       
  1650             // Viewbox
       
  1651             CSvgSvgElementImpl* tmpSvgEl    = ( CSvgSvgElementImpl* )
       
  1652                                               this;
       
  1653             TGfxRectangle2D     tmpRect     ( tmpSvgEl->X(),
       
  1654                                               tmpSvgEl->Y(),
       
  1655                                               tmpSvgEl->Width(),
       
  1656                                               tmpSvgEl->Height() );
       
  1657 
       
  1658             // Add stop for bogus viewports being set if the SVG element hasn't been set
       
  1659             // from the Java side.
       
  1660                   if (tmpRect.iWidth >= TFloatFixPt(0) && tmpRect.iHeight >= TFloatFixPt(0))
       
  1661                   {
       
  1662                     tmpSvgEl->SetWindowViewportTrans( tmpRect, lCurrentTM );
       
  1663                   }
       
  1664 
       
  1665             }
       
  1666 
       
  1667         this->SetCTM( lCurrentTM );
       
  1668         }
       
  1669 
       
  1670     CSvgElementImpl*lNewElement = ( CSvgElementImpl* )
       
  1671                                   this->FirstChild();
       
  1672     while ( lNewElement != NULL )
       
  1673         {
       
  1674         lNewElement->UpdateCTM();
       
  1675         lNewElement = ( CSvgElementImpl * ) lNewElement->NextSibling();
       
  1676         }
       
  1677 }
       
  1678 
       
  1679 
       
  1680 
       
  1681 
       
  1682 
       
  1683 // *******************************************************
       
  1684 
       
  1685 // ---------------------------------------------------------------------------
       
  1686 // From MSvgTests
       
  1687 // ---------------------------------------------------------------------------
       
  1688 void CSvgElementImpl::GetRequiredFeatures( const CDesCArrayFlat*& aRequiredFeatures )
       
  1689     {
       
  1690     if( iSvgTests )
       
  1691         {
       
  1692         iSvgTests->GetRequiredFeatures( aRequiredFeatures );
       
  1693         }
       
  1694     }
       
  1695 
       
  1696 // ---------------------------------------------------------------------------
       
  1697 //
       
  1698 // ---------------------------------------------------------------------------
       
  1699 void CSvgElementImpl::GetRequiredExtensions( const CDesCArrayFlat*& aRequiredExtensions )
       
  1700     {
       
  1701     if( iSvgTests )
       
  1702         {
       
  1703         iSvgTests->GetRequiredExtensions( aRequiredExtensions );
       
  1704         }
       
  1705     }
       
  1706 
       
  1707 // ---------------------------------------------------------------------------
       
  1708 // returns false if system language was empty string
       
  1709 // ---------------------------------------------------------------------------
       
  1710 TBool CSvgElementImpl::GetSystemLanguage( const CDesCArrayFlat*& aSystemLanguage )
       
  1711     {
       
  1712     if( iSvgTests )
       
  1713         {
       
  1714         return (iSvgTests->GetSystemLanguage( aSystemLanguage ));
       
  1715         }
       
  1716 
       
  1717         return ETrue;
       
  1718     }
       
  1719 
       
  1720 // ---------------------------------------------------------------------------
       
  1721 //
       
  1722 // ---------------------------------------------------------------------------
       
  1723 TBool CSvgElementImpl::HasExtension( const TDesC& aExtension )
       
  1724     {
       
  1725     if( iSvgTests )
       
  1726         {
       
  1727         return iSvgTests->HasExtension( aExtension );
       
  1728         }
       
  1729     return EFalse;
       
  1730     }
       
  1731 
       
  1732 // ---------------------------------------------------------------------------
       
  1733 //
       
  1734 // ---------------------------------------------------------------------------
       
  1735 TBool CSvgElementImpl::HasAnyTests( )
       
  1736     {
       
  1737     if( iSvgTests )
       
  1738         {
       
  1739         return iSvgTests->HasAnyTests( );
       
  1740         }
       
  1741     return EFalse;
       
  1742     }
       
  1743 
       
  1744 // ---------------------------------------------------------------------------
       
  1745 //
       
  1746 // ---------------------------------------------------------------------------
       
  1747 TBool CSvgElementImpl::HasFeature( const TDesC& aFeature )
       
  1748     {
       
  1749     if( iSvgTests )
       
  1750         {
       
  1751         return iSvgTests->HasFeature( aFeature );
       
  1752         }
       
  1753     return EFalse;
       
  1754     }
       
  1755 
       
  1756 // ---------------------------------------------------------------------------
       
  1757 //
       
  1758 // ---------------------------------------------------------------------------
       
  1759 TBool CSvgElementImpl::SetTestAttributeL( const TDesC& aPropertyName,
       
  1760                                           const TDesC& aValue )
       
  1761     {
       
  1762 
       
  1763     _LIT( KRequiredFeatures, "requiredFeatures" );
       
  1764     _LIT( KRequiredExtensions, "requiredExtensions" );
       
  1765     _LIT( KSystemLanguage, "systemLanguage" );
       
  1766 
       
  1767     if (aPropertyName == KRequiredFeatures || aPropertyName == KRequiredExtensions || aPropertyName == KSystemLanguage)
       
  1768     {
       
  1769         if (!iSvgTests)
       
  1770         {
       
  1771             iSvgTests = CSvgTestsImpl::NewL();
       
  1772         }
       
  1773 
       
  1774         return iSvgTests->SetTestAttributeL( aPropertyName, aValue );
       
  1775     }
       
  1776 
       
  1777     return EFalse;
       
  1778     }
       
  1779 
       
  1780 // ---------------------------------------------------------------------------
       
  1781 //
       
  1782 // ---------------------------------------------------------------------------
       
  1783 void CSvgElementImpl::CreateSvgTestL(const TUint16 aAttrName)
       
  1784 {
       
  1785 	if (aAttrName == KAtrRequiredFeatures || aAttrName == KAtrRequiredExtensions || aAttrName == KAtrSystemLanguage)
       
  1786 	{
       
  1787 		if (!iSvgTests)
       
  1788         {
       
  1789             iSvgTests = CSvgTestsImpl::NewL();
       
  1790         }
       
  1791 	}
       
  1792 }
       
  1793 // *******************************************************
       
  1794 // ---------------------------------------------------------------------------
       
  1795 // From MSvgLangSpace.h
       
  1796 // ---------------------------------------------------------------------------
       
  1797 const TDesC& CSvgElementImpl::XMLLang()
       
  1798     {
       
  1799     if( iSvgLangSpace )
       
  1800         {
       
  1801         return iSvgLangSpace->XMLLang();
       
  1802         }
       
  1803     else
       
  1804         {
       
  1805         return KNullDesC;
       
  1806         }
       
  1807     }
       
  1808 
       
  1809 // ---------------------------------------------------------------------------
       
  1810 //
       
  1811 // ---------------------------------------------------------------------------
       
  1812 TInt CSvgElementImpl::SetXMLLangL( const TDesC& aXMLLang )
       
  1813     {
       
  1814     if( iSvgLangSpace )
       
  1815         {
       
  1816         iSvgLangSpace->SetXMLLangL( aXMLLang );
       
  1817         }
       
  1818     return KErrNone;
       
  1819     }
       
  1820 
       
  1821 // ---------------------------------------------------------------------------
       
  1822 //
       
  1823 // ---------------------------------------------------------------------------
       
  1824 const TDesC& CSvgElementImpl::XMLSpace()
       
  1825     {
       
  1826     if( iSvgLangSpace )
       
  1827         {
       
  1828         return iSvgLangSpace->XMLSpace();
       
  1829         }
       
  1830     else
       
  1831         {
       
  1832         return KNullDesC;
       
  1833         }
       
  1834 
       
  1835     }
       
  1836 
       
  1837 // ---------------------------------------------------------------------------
       
  1838 //
       
  1839 // ---------------------------------------------------------------------------
       
  1840 TInt CSvgElementImpl::SetXMLSpaceL( const TDesC& aXMLSpace )
       
  1841     {
       
  1842     if(  iSvgLangSpace )
       
  1843         {
       
  1844         iSvgLangSpace->SetXMLSpaceL( aXMLSpace );
       
  1845         }
       
  1846     return KErrNone;
       
  1847     }
       
  1848 
       
  1849 // ---------------------------------------------------------------------------
       
  1850 //
       
  1851 // ---------------------------------------------------------------------------
       
  1852 TBool CSvgElementImpl::SetLangSpaceAttributeL( const TDesC& aPropertyName,
       
  1853                                                const TDesC& aValue )
       
  1854 {
       
  1855         _LIT( KXMLLang, "xml:lang" );
       
  1856         _LIT( KXMLSpace, "xml:space" );
       
  1857 
       
  1858     if (aPropertyName == KXMLLang || aPropertyName == KXMLSpace)
       
  1859     {
       
  1860         if (!iSvgLangSpace)
       
  1861         {
       
  1862             iSvgLangSpace = CSvgLangSpaceImpl::NewL();
       
  1863         }
       
  1864 
       
  1865         return iSvgLangSpace->SetLangSpaceAttributeL( aPropertyName, aValue );
       
  1866     }
       
  1867     else
       
  1868     {
       
  1869         return EFalse;
       
  1870     }
       
  1871 }
       
  1872 
       
  1873 // ---------------------------------------------------------------------------
       
  1874 //
       
  1875 // ---------------------------------------------------------------------------
       
  1876 TBool CSvgElementImpl::SetXlinkAttributeL( const TDesC& aPropertyName,
       
  1877                                            const TDesC& aValue )
       
  1878     {
       
  1879     if( iSvgUriReferenceImpl )
       
  1880         {
       
  1881         return iSvgUriReferenceImpl->SetXlinkAttributeL( aPropertyName, aValue );
       
  1882         }
       
  1883     else
       
  1884         {
       
  1885         return EFalse;
       
  1886         }
       
  1887     }
       
  1888 
       
  1889 // ---------------------------------------------------------------------------
       
  1890 //
       
  1891 // ---------------------------------------------------------------------------
       
  1892 const TDesC& CSvgElementImpl::Href()
       
  1893     {
       
  1894     if( iSvgUriReferenceImpl )
       
  1895         {
       
  1896         return iSvgUriReferenceImpl->Href();
       
  1897         }
       
  1898     return KNullDesC;
       
  1899 
       
  1900     }
       
  1901 
       
  1902 // ---------------------------------------------------------------------------
       
  1903 //
       
  1904 // ---------------------------------------------------------------------------
       
  1905 TDesC* CSvgElementImpl::HrefPointer()
       
  1906     {
       
  1907     if( iSvgUriReferenceImpl )
       
  1908         {
       
  1909         return iSvgUriReferenceImpl->HrefPointer();
       
  1910         }
       
  1911     return NULL;
       
  1912     }
       
  1913 
       
  1914 // ---------------------------------------------------------------------------
       
  1915 //
       
  1916 // ---------------------------------------------------------------------------
       
  1917 
       
  1918 const TDesC& CSvgElementImpl::XlinkShow()
       
  1919     {
       
  1920     if(iSvgUriReferenceImpl )
       
  1921         {
       
  1922         return iSvgUriReferenceImpl->XlinkShow();
       
  1923         }
       
  1924     return KNullDesC;
       
  1925     }
       
  1926 
       
  1927 
       
  1928 // *******************************************************
       
  1929 // From MSvgEventReceiver
       
  1930 // ---------------------------------------------------------------------------
       
  1931 //
       
  1932 // ---------------------------------------------------------------------------
       
  1933 TBool CSvgElementImpl::ReceiveEventL( MSvgEvent* aEvent, const TUint16 aSubEventMask )
       
  1934     {
       
  1935     CSvgEngineImpl* engine  = ( ( CSvgDocumentImpl* ) OwnerDocument() )->Engine();
       
  1936 
       
  1937     // Accepts Internal event and mouse events
       
  1938     switch ( aEvent->EventType() )
       
  1939         {
       
  1940         case ESvgEngineInternalEvent:
       
  1941         break;
       
  1942         case ESvgEngineEventMouseDown:
       
  1943         case ESvgEngineEventMouseUp:
       
  1944         case ESvgEngineEventMouseMove:
       
  1945             {
       
  1946             // Check if pointer is inside of the element
       
  1947             MSvgUiMouseEvent*   mevent  = ( MSvgUiMouseEvent* ) aEvent;
       
  1948             //TGfxRectangle2D p(mevent->X(), mevent->Y(), 0,0);
       
  1949             TGfxPoint2D         p       ( mevent->X(), mevent->Y() );
       
  1950             TGfxRectangle2D     bbox;
       
  1951             TInt32 lVisible;
       
  1952             TInt32 lDisplay;
       
  1953             this->GetAttributeIntL(KCSS_ATTR_VISIBILITY,lVisible);
       
  1954             this->GetAttributeIntL(KCSS_ATTR_DISPLAY,lDisplay);
       
  1955             GetBBox( bbox );
       
  1956             if ( bbox.Contains( p ) && lDisplay != 16 && lVisible == 0 )
       
  1957                 {
       
  1958                 // Invoke internal event
       
  1959                 switch ( aEvent->EventType() )
       
  1960                     {
       
  1961                     case ESvgEngineEventMouseDown:
       
  1962                         {
       
  1963                         TSvgInternalEvent   evt ( ESvgEventMousedown,
       
  1964                                                   ( CSvgElementImpl* )
       
  1965                                                        this );
       
  1966                         engine->ProcessEventL( 
       
  1967                             ( CSvgDocumentImpl* )OwnerDocument(), &evt );
       
  1968                         SetMouseDown( ETrue );
       
  1969                         }
       
  1970                     break;
       
  1971                     case ESvgEngineEventMouseUp:
       
  1972                         {
       
  1973                         TSvgInternalEvent   evt ( ESvgEventMouseup,
       
  1974                                                   ( CSvgElementImpl* )
       
  1975                                                        this );
       
  1976                         engine->ProcessEventL( 
       
  1977                             ( CSvgDocumentImpl* )OwnerDocument(), &evt );
       
  1978                         
       
  1979                         if ( IsMouseDown() )
       
  1980                             {
       
  1981                             // Check the aSubEventMask to know which event 
       
  1982                             // has occured                                                   
       
  1983                             if(CanGenerateInternalEvent(aSubEventMask,ESvgEventActivate))
       
  1984                                {
       
  1985                                 
       
  1986                                TSvgInternalEvent   evt1 (
       
  1987                                                     ESvgEventActivate,
       
  1988                                                     ( CSvgElementImpl* )this );
       
  1989                             
       
  1990                                engine->ProcessEventL(
       
  1991                                         ( CSvgDocumentImpl* ) OwnerDocument(),
       
  1992                                          &evt1 );
       
  1993                                }
       
  1994                             if ( CanGenerateInternalEvent(aSubEventMask,ESvgEventClick))
       
  1995                                 {
       
  1996                                
       
  1997                                TSvgInternalEvent   evt ( 
       
  1998                                                     ESvgEventClick,
       
  1999                                                     ( CSvgElementImpl* )this );
       
  2000                             
       
  2001                                engine->ProcessEventL( 
       
  2002                                         ( CSvgDocumentImpl* ) OwnerDocument(),
       
  2003                                          &evt );
       
  2004                                   
       
  2005                                 }                                
       
  2006                             }
       
  2007                         SetMouseDown( EFalse );
       
  2008                         }
       
  2009                     break;
       
  2010                     case ESvgEngineEventMouseMove:
       
  2011                         {
       
  2012                         
       
  2013                         engine->NotifyElementActivatedLinkEntered(this);
       
  2014                         
       
  2015                         if ( CanGenerateInternalEvent(aSubEventMask,ESvgEventMousemove) )
       
  2016                         	{
       
  2017                          
       
  2018                             TSvgInternalEvent evt1( 
       
  2019                                                   ESvgEventMousemove,
       
  2020                                                   ( CSvgElementImpl* )this );
       
  2021                             engine->ProcessEventL( 
       
  2022                                         ( CSvgDocumentImpl* ) OwnerDocument(),
       
  2023                                          &evt1 );
       
  2024                             }
       
  2025                         
       
  2026                         if ( !IsMouseIn() )
       
  2027                             {
       
  2028                             
       
  2029                             engine->NotifyInteractiveElementEntered(this);                       
       
  2030                             
       
  2031                             // Check the aSubEventMask to know which event 
       
  2032                             // has occured
       
  2033                             if ( CanGenerateInternalEvent(aSubEventMask,ESvgEventMouseover) )
       
  2034                                 {
       
  2035                          
       
  2036                                 TSvgInternalEvent   evt ( 
       
  2037                                                     ESvgEventMouseover,
       
  2038                                                     ( CSvgElementImpl* )this );
       
  2039                                 engine->ProcessEventL( 
       
  2040                                         ( CSvgDocumentImpl* ) OwnerDocument(),
       
  2041                                          &evt );
       
  2042                                 }
       
  2043                         
       
  2044                             if ( CanGenerateInternalEvent(aSubEventMask,ESvgEventFocusin) )
       
  2045                                 {
       
  2046                         
       
  2047                                 TSvgInternalEvent   evt2 ( 
       
  2048                                                     ESvgEventFocusin,
       
  2049                                                     ( CSvgElementImpl* )this );
       
  2050                                     
       
  2051                                 engine->ProcessEventL( 
       
  2052                                         ( CSvgDocumentImpl* ) OwnerDocument(),
       
  2053                                          &evt2 );
       
  2054                                     
       
  2055                                  }
       
  2056                             }
       
  2057                         SetMouseIn( ETrue );
       
  2058                         }
       
  2059                     break;
       
  2060                     default:
       
  2061                         break;
       
  2062                     }
       
  2063                 }
       
  2064             else
       
  2065                 {
       
  2066                 engine->NotifyElementActivatedLinkExited(this);
       
  2067                     
       
  2068                                 
       
  2069                 // if state was 'mouse down'then reset the state
       
  2070                 SetMouseDown( EFalse );
       
  2071 
       
  2072                 // if state was 'mouse in' and event is ESvgEngineEventMouseMove,
       
  2073                 // invoke mouseout event
       
  2074                 
       
  2075                 //MouseMove: in case of scrolling over a element focusOut events must
       
  2076                 //           be generated
       
  2077                 
       
  2078                 //MouseDown: In touch cases, if you tap on a element and then tap outside
       
  2079                 //          then a focusout event must be generated
       
  2080                 if ( IsMouseIn() &&
       
  2081                      (aEvent->EventType() == ESvgEngineEventMouseMove || aEvent->EventType() == ESvgEngineEventMouseDown )
       
  2082                      )
       
  2083                     {
       
  2084                     
       
  2085                     // Check the aSubEventMask to know whether any valid bit  
       
  2086                     // is set
       
  2087                     if(engine->Document()->IsValidSubEventMask(aSubEventMask))
       
  2088                         {
       
  2089                         engine->NotifyInteractiveElementExited(this);    
       
  2090                         }               
       
  2091                     if ( CanGenerateInternalEvent(
       
  2092                                     aSubEventMask,ESvgEventMouseout ) )
       
  2093                         {
       
  2094                         TSvgInternalEvent   mouseOutEvent ( 
       
  2095                                                     ESvgEventMouseout, this );
       
  2096                         engine->ProcessEventL( 
       
  2097                                     ( CSvgDocumentImpl* ) OwnerDocument(),
       
  2098                                      &mouseOutEvent );                                    
       
  2099                         }
       
  2100                     if ( CanGenerateInternalEvent(
       
  2101                                     aSubEventMask,ESvgEventFocusout))
       
  2102                         {
       
  2103                         TSvgInternalEvent   focusOutEvent ( 
       
  2104                                                     ESvgEventFocusout, this );
       
  2105                         engine->ProcessEventL( 
       
  2106                                     ( CSvgDocumentImpl* ) OwnerDocument(),
       
  2107                                      &focusOutEvent ); 
       
  2108                         }
       
  2109                     }                
       
  2110                     SetMouseIn( EFalse );
       
  2111                 }
       
  2112             }
       
  2113         break;
       
  2114         default:
       
  2115         break;
       
  2116         }
       
  2117 
       
  2118     return EFalse;
       
  2119     }
       
  2120     
       
  2121     // *******************************************************
       
  2122 // From MSvgEventReceiver
       
  2123 // ---------------------------------------------------------------------------
       
  2124 //
       
  2125 // ---------------------------------------------------------------------------
       
  2126 TBool CSvgElementImpl::ReceiveEventL( MSvgEvent* /*aEvent*/ )
       
  2127     {
       
  2128     // Dummy implementation
       
  2129     return EFalse;
       
  2130     }
       
  2131 
       
  2132 
       
  2133 
       
  2134 
       
  2135 // *******************************************************
       
  2136 // From MXmlElementOpt
       
  2137 // ---------------------------------------------------------------------------
       
  2138 //
       
  2139 // ---------------------------------------------------------------------------
       
  2140 TInt CSvgElementImpl::GetAttributeIntL( const TInt aNameId, TInt32& aValue )
       
  2141     {
       
  2142 
       
  2143 
       
  2144     CCssValue*          lCssValue           = NULL;
       
  2145 
       
  2146 
       
  2147     if( aNameId == KAtrAnimMotionMatrixIndex )
       
  2148         {
       
  2149         aValue = AnimateMotionMatrixIndexL();
       
  2150         }
       
  2151     else if(aNameId== KAtrAnimTransformMatrixIndex)
       
  2152         {
       
  2153         aValue = AnimateTransformMatrixIndexL();
       
  2154         }
       
  2155     else
       
  2156         {
       
  2157         if( (aNameId >= KCSS_MAX_ATTR || aNameId < 0))
       
  2158             {
       
  2159             return KErrInvalidAttribute;
       
  2160             }
       
  2161 
       
  2162 				if (iSvgStyleProperties == NULL )
       
  2163 				{
       
  2164 					//if the style properties havent been set then just get a default one to be safe
       
  2165 					GetDefaultAttributeL(aNameId, lCssValue);
       
  2166 				}
       
  2167 				else
       
  2168 				{
       
  2169         			lCssValue = iSvgStyleProperties->operator[](aNameId);
       
  2170     			}
       
  2171 
       
  2172         if( lCssValue )
       
  2173             {
       
  2174           	aValue = (( CIntCssValueImpl* )lCssValue)->Value();
       
  2175 
       
  2176             if( aNameId == KCSS_ATTR_FILL )
       
  2177                 {
       
  2178 
       
  2179                 MGfxPaint* lPaintValue = (MGfxPaint *)((( CPaintCssValueImpl* )lCssValue)->Value());
       
  2180                 if(lPaintValue && lPaintValue->GetColor()== KSvgCurrentColor)
       
  2181                     {
       
  2182                     lPaintValue = CurrentColor();
       
  2183                     aValue = lPaintValue->GetColor();                     
       
  2184                     }
       
  2185                 else if(lPaintValue)
       
  2186                 	{
       
  2187                 	aValue = lPaintValue->GetColor();
       
  2188                 	}
       
  2189                 else
       
  2190                 	{
       
  2191                     return KErrNoAttribute;
       
  2192                 	}
       
  2193                 }
       
  2194             else if(aNameId == KCSS_ATTR_STROKE || aNameId == KCSS_ATTR_COLOR)
       
  2195                 {
       
  2196                 TSvgColor *lColorValue  = (( CClrCssValueImpl* )lCssValue)->Value();
       
  2197                 if(lColorValue)
       
  2198                 	{
       
  2199                 	aValue = lColorValue->GetColor();
       
  2200                 	}
       
  2201                 else
       
  2202                 	{
       
  2203                     return KErrNoAttribute;
       
  2204                 	}
       
  2205                 }
       
  2206             return KErrNone;
       
  2207             }
       
  2208         else
       
  2209             {
       
  2210             return KErrNoAttribute;
       
  2211             }
       
  2212         }
       
  2213     return KErrNone;
       
  2214 
       
  2215     }
       
  2216 
       
  2217 // ---------------------------------------------------------------------------
       
  2218 //
       
  2219 // ---------------------------------------------------------------------------
       
  2220 TInt CSvgElementImpl::SetAttributeIntL( const TInt aNameId,
       
  2221                                         const TInt32 aValue )
       
  2222     {
       
  2223 
       
  2224 
       
  2225     CSvgDocumentImpl*   doc                 = ( CSvgDocumentImpl* ) OwnerDocument();
       
  2226 
       
  2227     if (!doc)
       
  2228     {
       
  2229     	return KErrNoAttribute;
       
  2230     }
       
  2231 
       
  2232     if( aNameId >= KCSS_MAX_ATTR  || (iSvgStyleProperties == NULL))
       
  2233         {
       
  2234         return KErrNoAttribute;
       
  2235         }
       
  2236 
       
  2237     CSvgElementImpl* lParentElement = (CSvgElementImpl*)ParentNode ();
       
  2238     while(lParentElement && (lParentElement->iSvgStyleProperties == NULL))
       
  2239         {
       
  2240         lParentElement = (CSvgElementImpl*)lParentElement->ParentNode ();
       
  2241         }
       
  2242     switch(aNameId)
       
  2243         {
       
  2244         case KCSS_ATTR_FILL:
       
  2245             {
       
  2246             CPaintCssValueImpl* tValue = (CPaintCssValueImpl *)(iSvgStyleProperties->operator[](aNameId));
       
  2247             CPaintCssValueImpl* tParentValue = NULL ;
       
  2248             if( this != doc->RootElement() && lParentElement )
       
  2249                 {
       
  2250                 tParentValue  = (CPaintCssValueImpl *)(lParentElement->iSvgStyleProperties->operator[](aNameId));
       
  2251                 }
       
  2252 
       
  2253             if( tParentValue == tValue || tValue == NULL) //Not Yet set
       
  2254                 {
       
  2255                 tValue = doc->iMemoryManager->GetCssPaintObjectL();
       
  2256 
       
  2257                 CCssValue*  oldValue = iSvgStyleProperties->operator[](aNameId);
       
  2258                 PropagateToChildren( oldValue, tValue, aNameId );
       
  2259                 iSvgStyleProperties->operator[](aNameId) = tValue;
       
  2260                 }
       
  2261             tValue->SetValueL( aValue );
       
  2262 
       
  2263             break;
       
  2264             }
       
  2265         case KCSS_ATTR_STROKE:
       
  2266         case KCSS_ATTR_COLOR:
       
  2267             {
       
  2268 
       
  2269             CClrCssValueImpl* tValue = (CClrCssValueImpl *)(iSvgStyleProperties->operator[](aNameId));
       
  2270             CClrCssValueImpl* tParentValue = NULL ;
       
  2271             if( this != doc->RootElement() && lParentElement)
       
  2272                 {
       
  2273                 tParentValue  = (CClrCssValueImpl *)(lParentElement->iSvgStyleProperties->operator[](aNameId));
       
  2274                 }
       
  2275 
       
  2276             if( tParentValue == tValue || tValue == NULL) //Not Yet set
       
  2277                 {
       
  2278                 tValue = doc->iMemoryManager->GetCssClrObjectL();
       
  2279 
       
  2280                 CCssValue*  oldValue = iSvgStyleProperties->operator[](aNameId);
       
  2281                 PropagateToChildren( oldValue, tValue, aNameId );
       
  2282                 iSvgStyleProperties->operator[](aNameId) = tValue;
       
  2283                 }
       
  2284             tValue->SetValueL( aValue );
       
  2285 
       
  2286             break;
       
  2287             }
       
  2288         default:
       
  2289             {
       
  2290             CIntCssValueImpl* tValue = (CIntCssValueImpl *)(iSvgStyleProperties->operator[](aNameId));
       
  2291             if( tValue != NULL && tValue->Value() == aValue )
       
  2292             {
       
  2293                 return KErrNone;
       
  2294             }
       
  2295             CIntCssValueImpl* tParentValue = NULL ;
       
  2296             if( this != doc->RootElement() && lParentElement )
       
  2297                 {
       
  2298                 tParentValue  = (CIntCssValueImpl *)(lParentElement->iSvgStyleProperties->operator[](aNameId));
       
  2299                 }
       
  2300 
       
  2301             if( tParentValue == tValue || tValue == NULL) //Not Yet set
       
  2302                 {
       
  2303                 tValue = doc->iMemoryManager->GetCssIntObjectL();
       
  2304 
       
  2305                 CCssValue*  oldValue = iSvgStyleProperties->operator[](aNameId);
       
  2306                 PropagateToChildren( oldValue, tValue, aNameId );
       
  2307                 iSvgStyleProperties->operator[](aNameId) = tValue;
       
  2308 
       
  2309                 }
       
  2310             if( lParentElement && aValue == KInherit )    
       
  2311             {
       
  2312             tParentValue  = (CIntCssValueImpl *)(lParentElement->iSvgStyleProperties->operator[](aNameId));
       
  2313             (*iSvgStyleProperties)[aNameId]= tParentValue;
       
  2314             }
       
  2315             else
       
  2316             {
       
  2317             tValue->SetValueL( aValue );	
       
  2318             }
       
  2319 
       
  2320             break;
       
  2321 
       
  2322             }
       
  2323         }
       
  2324     return KErrNoAttribute;
       
  2325 
       
  2326 
       
  2327     }
       
  2328 
       
  2329 // ---------------------------------------------------------------------------
       
  2330 //
       
  2331 // ---------------------------------------------------------------------------
       
  2332 TInt CSvgElementImpl::GetAttributeFloat( const TInt aNameId, TFloatFixPt& aValue )
       
  2333     {
       
  2334 
       
  2335     CCssValue*          lCssValue           = NULL;
       
  2336     if((aNameId < KCSS_MAX_ATTR) && iSvgStyleProperties )
       
  2337         {
       
  2338         lCssValue = iSvgStyleProperties->operator[](aNameId);
       
  2339         if( lCssValue )
       
  2340             {
       
  2341             aValue = (( CFloatCssValueImpl * )lCssValue)->Value();
       
  2342             return KErrNone;
       
  2343             }
       
  2344         else
       
  2345             {
       
  2346             TRAPD(err, GetDefaultAttributeL(aNameId, lCssValue));
       
  2347             if (err)
       
  2348                 {
       
  2349                 #ifdef _DEBUG
       
  2350                 RDebug::Printf("CSvgElementImpl::GetAttributeFloat: Error trapped=%d", err);
       
  2351                 #endif
       
  2352                 return KErrNoAttribute;
       
  2353                 }
       
  2354             aValue = (( CFloatCssValueImpl * )lCssValue)->Value();
       
  2355             return KErrNone;
       
  2356             }
       
  2357         }
       
  2358     return KErrNoAttribute;
       
  2359 
       
  2360     }
       
  2361 
       
  2362 // ---------------------------------------------------------------------------
       
  2363 //
       
  2364 // ---------------------------------------------------------------------------
       
  2365 TInt CSvgElementImpl::SetAttributeFloatL( const TInt aNameId,
       
  2366                                           const TFloatFixPt aValue )
       
  2367     {
       
  2368     CSvgDocumentImpl*   doc                 = ( CSvgDocumentImpl* ) OwnerDocument();
       
  2369 
       
  2370     if (!doc)
       
  2371     {
       
  2372     	return KErrNoAttribute;
       
  2373     }
       
  2374 
       
  2375     if(aNameId < KCSS_MAX_ATTR  && iSvgStyleProperties)
       
  2376         {
       
  2377         CSvgElementImpl* lParentElement = (CSvgElementImpl*)ParentNode ();
       
  2378         while(lParentElement && (lParentElement->iSvgStyleProperties == NULL))
       
  2379             {
       
  2380             lParentElement = (CSvgElementImpl*)lParentElement->ParentNode ();
       
  2381             }
       
  2382 
       
  2383 
       
  2384         CFloatCssValueImpl* tValue = (CFloatCssValueImpl *)(iSvgStyleProperties->operator[](aNameId));
       
  2385         CFloatCssValueImpl* tParentValue = NULL ;
       
  2386         if( this != doc->RootElement() && lParentElement)
       
  2387             {
       
  2388             tParentValue  = (CFloatCssValueImpl *)(lParentElement->iSvgStyleProperties->operator[](aNameId));
       
  2389 
       
  2390             }
       
  2391 
       
  2392         if( tParentValue == tValue || tValue == NULL) //Not Yet set
       
  2393             {
       
  2394            	tValue = doc->iMemoryManager->GetCssFloatObjectL();
       
  2395 
       
  2396 
       
  2397             CCssValue*  oldValue = iSvgStyleProperties->operator[](aNameId);
       
  2398             PropagateToChildren( oldValue, tValue, aNameId );
       
  2399 
       
  2400             iSvgStyleProperties->operator[](aNameId) = tValue;
       
  2401             }
       
  2402         return tValue->SetValueL( aValue );
       
  2403 
       
  2404         }
       
  2405     return KErrNoAttribute;
       
  2406 
       
  2407     }
       
  2408 
       
  2409 
       
  2410 void CSvgElementImpl::GetSvgStylePropertiesArray( RPointerArray<CCssValue>*& aSvgStyleProperties)
       
  2411     {
       
  2412     aSvgStyleProperties = iSvgStyleProperties;
       
  2413     }
       
  2414 
       
  2415 
       
  2416 // ---------------------------------------------------------------------------
       
  2417 //
       
  2418 // ---------------------------------------------------------------------------
       
  2419 TInt CSvgElementImpl::GetAttributePath( const TInt /* aNameId */,
       
  2420                                         CGfxGeneralPath*& /* aValue */ )
       
  2421     {
       
  2422     return KErrNoAttribute;
       
  2423     }
       
  2424 
       
  2425 // ---------------------------------------------------------------------------
       
  2426 //
       
  2427 // ---------------------------------------------------------------------------
       
  2428 TInt CSvgElementImpl::SetAttributePathL( const TInt /*aNameId */,
       
  2429                                          CGfxGeneralPath* /* aValue */ )
       
  2430     {
       
  2431     return KErrNoAttribute;
       
  2432     }
       
  2433 
       
  2434 // ---------------------------------------------------------------------------
       
  2435 //
       
  2436 // ---------------------------------------------------------------------------
       
  2437 TInt CSvgElementImpl::SetAttributePathRef( const TInt /*aNameId */,
       
  2438                                          CGfxGeneralPath*& /* aValue */ )
       
  2439     {
       
  2440     return KErrNoAttribute;
       
  2441     }
       
  2442 
       
  2443 // ---------------------------------------------------------------------------
       
  2444 //
       
  2445 // ---------------------------------------------------------------------------
       
  2446 TInt CSvgElementImpl::GetAttributeDes( const TInt aNameId, TPtrC16& aValue )
       
  2447     {
       
  2448     CCssValue*          lCssValue           = NULL;
       
  2449 
       
  2450     if(aNameId < KCSS_MAX_ATTR && iSvgStyleProperties)
       
  2451         {
       
  2452         lCssValue = iSvgStyleProperties->operator[](aNameId);
       
  2453         if( lCssValue )
       
  2454             {
       
  2455             aValue.Set( (( CStrCssValueImpl * )lCssValue)->Value() );
       
  2456             return KErrNone;
       
  2457 
       
  2458             }
       
  2459         else
       
  2460             {
       
  2461                 TBool defaultAttr = EFalse;
       
  2462                 TRAPD(err, defaultAttr = GetDefaultAttributeL(aNameId, lCssValue));
       
  2463                 if (err)
       
  2464                     {
       
  2465                     #ifdef _DEBUG
       
  2466                     RDebug::Printf("CSvgElementImpl::GetAttributeDes: Error trapped=%d", err);
       
  2467                     #endif
       
  2468                     return KErrNoAttribute;
       
  2469                     }
       
  2470 
       
  2471             	if (defaultAttr && lCssValue)
       
  2472             	{
       
  2473             		aValue.Set( (( CStrCssValueImpl * )lCssValue)->Value() );
       
  2474             		return KErrNone;
       
  2475            	 	}
       
  2476             return KErrNoAttribute;
       
  2477             }
       
  2478         }
       
  2479     // This is added for JSR API's and this is helpful for testing of the JSR API's
       
  2480     if(aNameId == KAtrId)
       
  2481        {
       
  2482         if( Id() )
       
  2483             {
       
  2484         aValue.Set( *Id() );
       
  2485         return KErrNone;
       
  2486             }
       
  2487        }
       
  2488     return KErrNoAttribute;
       
  2489 
       
  2490     }
       
  2491 
       
  2492 // ---------------------------------------------------------------------------
       
  2493 //
       
  2494 // ---------------------------------------------------------------------------
       
  2495 TInt CSvgElementImpl::SetAttributeDesL( const TInt aNameId,
       
  2496                                         const TDesC& aValue )
       
  2497     {
       
  2498     CSvgDocumentImpl*   doc                 = ( CSvgDocumentImpl* ) OwnerDocument();
       
  2499 
       
  2500 	if (!doc)
       
  2501 	{
       
  2502 		return KErrNoAttribute;
       
  2503 	}
       
  2504 
       
  2505     if(aNameId < KCSS_MAX_ATTR && iSvgStyleProperties)
       
  2506         {
       
  2507 
       
  2508         CSvgElementImpl* lParentElement = (CSvgElementImpl*)ParentNode ();
       
  2509         while(lParentElement && (lParentElement->iSvgStyleProperties == NULL))
       
  2510             {
       
  2511             lParentElement = (CSvgElementImpl*)lParentElement->ParentNode ();
       
  2512             }
       
  2513 
       
  2514         CStrCssValueImpl* tValue = (CStrCssValueImpl *)(iSvgStyleProperties->operator[](aNameId));
       
  2515         CStrCssValueImpl* tParentValue = NULL ;
       
  2516         if( this != doc->RootElement() && lParentElement)
       
  2517             {
       
  2518             tParentValue  = (CStrCssValueImpl *)(lParentElement->iSvgStyleProperties->operator[](aNameId));
       
  2519             }
       
  2520 
       
  2521         if( tParentValue == tValue || tValue == NULL) //Not Yet set
       
  2522             {
       
  2523             tValue = doc->iMemoryManager->GetCssStrObjectL(KNullDesC);
       
  2524 
       
  2525 
       
  2526             CCssValue*  oldValue = iSvgStyleProperties->operator[](aNameId);
       
  2527             PropagateToChildren( oldValue, tValue, aNameId );
       
  2528 
       
  2529             iSvgStyleProperties->operator[](aNameId) = tValue;
       
  2530 
       
  2531             }
       
  2532         return tValue->SetValueL( aValue );
       
  2533 
       
  2534         }
       
  2535     // the following code is added to modify the Id. This might be needed for the JSR API's
       
  2536     if(aNameId == KAtrId)
       
  2537        {
       
  2538         delete iId;
       
  2539         iId = NULL;
       
  2540         iId = aValue.AllocL();
       
  2541         return KErrNone;
       
  2542        }
       
  2543     return KErrNoAttribute;
       
  2544 
       
  2545 
       
  2546     }
       
  2547 
       
  2548 // ---------------------------------------------------------------------------
       
  2549 // Internal public method (public but not exported)
       
  2550 // ---------------------------------------------------------------------------
       
  2551 TInt32 CSvgElementImpl::AnimateMotionMatrixIndexL()
       
  2552     {
       
  2553     if ( iAnimateMotionMatrixIndex < 0 && iSvgTransformable )
       
  2554         {
       
  2555         TGfxAffineTransform ident;
       
  2556         MSvgTransformList*  trList;
       
  2557         this->GetTransform( trList );
       
  2558         trList->AppendItemL( ident, ETrue, ETrue ); // Set identity transform
       
  2559         iAnimateMotionMatrixIndex = ( TInt16 ) ( trList->NumberOfItems() - 1 );// Keep index in list for this anim element
       
  2560         }
       
  2561 
       
  2562     return iAnimateMotionMatrixIndex;
       
  2563     }
       
  2564 TInt32 CSvgElementImpl::AnimateTransformMatrixIndexL()
       
  2565     {
       
  2566     if ( iAnimateTransformMatrixIndex < 0 && iSvgTransformable )
       
  2567         {
       
  2568         TGfxAffineTransform ident;
       
  2569         MSvgTransformList*  trList;
       
  2570         this->GetTransform( trList );
       
  2571         trList->AppendItemL( ident, ETrue, 2); // Set identity transform
       
  2572         iAnimateTransformMatrixIndex = trList->NumberOfItems() - 1;// Keep index in list for this anim element */
       
  2573         }
       
  2574 
       
  2575     return iAnimateTransformMatrixIndex;
       
  2576     }
       
  2577 // ---------------------------------------------------------------------------
       
  2578 //
       
  2579 // ---------------------------------------------------------------------------
       
  2580 void CSvgElementImpl::GetBBox( TGfxRectangle2D& /*aBbox*/ )
       
  2581     {
       
  2582     }
       
  2583 
       
  2584 // ---------------------------------------------------------------------------
       
  2585 //
       
  2586 // ---------------------------------------------------------------------------
       
  2587 void CSvgElementImpl::GetUnscaledBBox( TGfxRectangle2D& /*aBbox*/ )
       
  2588     {
       
  2589     }
       
  2590 
       
  2591 // ---------------------------------------------------------------------------
       
  2592 //
       
  2593 // ---------------------------------------------------------------------------
       
  2594 void CSvgElementImpl::ResetReferenceElementL()
       
  2595     {
       
  2596     }
       
  2597 
       
  2598 // ---------------------------------------------------------------------------
       
  2599 // perform a deep clone of this object
       
  2600 // ---------------------------------------------------------------------------
       
  2601 MXmlElement* CSvgElementImpl::CloneL(MXmlElement*)
       
  2602     {
       
  2603     return NULL;
       
  2604     }
       
  2605 
       
  2606 // ---------------------------------------------------------------------------
       
  2607 // copy the contents of this object to the passed object
       
  2608 // this method assumes that the passed object has already been
       
  2609 // created using the proper NewL method.
       
  2610 // ---------------------------------------------------------------------------
       
  2611 void CSvgElementImpl::CopyL( CSvgElementImpl* aDestElement )
       
  2612     {
       
  2613 
       
  2614     if(aDestElement)
       
  2615     {
       
  2616 
       
  2617     if( iSvgStyleProperties )
       
  2618         {
       
  2619         aDestElement->iSvgStyleProperties->Reset();
       
  2620 
       
  2621         CloneSvgStylePropertiesL(aDestElement,(CSvgElementImpl *)(aDestElement->ParentNode()));
       
  2622         }
       
  2623 
       
  2624 
       
  2625     // copy iSvgTransformable (CSvgTransformableImpl)
       
  2626     if( iSvgTransformable )
       
  2627         {
       
  2628         if ( aDestElement->iSvgTransformable != NULL )
       
  2629             {
       
  2630             delete aDestElement->iSvgTransformable;
       
  2631             aDestElement->iSvgTransformable = NULL;
       
  2632             }
       
  2633         aDestElement->iSvgTransformable = this->iSvgTransformable->CloneL();
       
  2634         }
       
  2635 
       
  2636     // copy iSvgTests (CSvgTestImpl)
       
  2637     if( iSvgTests )
       
  2638         {
       
  2639         if ( aDestElement->iSvgTests != NULL )
       
  2640             {
       
  2641             delete aDestElement->iSvgTests;
       
  2642             aDestElement->iSvgTests = NULL;
       
  2643             }
       
  2644         aDestElement->iSvgTests = this->iSvgTests->CloneL();
       
  2645         }
       
  2646 
       
  2647     // copy iSvgUriReferenceImpl (CSvgUriReferenceImpl)
       
  2648     if( iSvgUriReferenceImpl )
       
  2649         {
       
  2650         if ( aDestElement->iSvgUriReferenceImpl != NULL )
       
  2651             {
       
  2652             delete aDestElement->iSvgUriReferenceImpl;
       
  2653             aDestElement->iSvgUriReferenceImpl = NULL;
       
  2654             }
       
  2655         aDestElement->iSvgUriReferenceImpl = this->iSvgUriReferenceImpl->CloneL();
       
  2656         }
       
  2657 
       
  2658     // copy iSvgLangSpace (CSvgLangSpaceImpl)
       
  2659     if( iSvgLangSpace )
       
  2660         {
       
  2661         if ( aDestElement->iSvgLangSpace != NULL )
       
  2662             {
       
  2663             delete aDestElement->iSvgLangSpace;
       
  2664             aDestElement->iSvgLangSpace = NULL;
       
  2665             }
       
  2666         aDestElement->iSvgLangSpace = this->iSvgLangSpace->CloneL();
       
  2667         }
       
  2668 	
       
  2669 	// copy Id (iId)
       
  2670 	if( iId )
       
  2671 	{
       
  2672 		aDestElement->SetAttributeDesL(	KAtrId, *iId );
       
  2673 	}
       
  2674 	
       
  2675 	// copy stuff from superclass
       
  2676     this->CXmlElementImpl::CopyL(aDestElement);
       
  2677     }
       
  2678 
       
  2679     }
       
  2680 
       
  2681 void CSvgElementImpl::PropagateToChildren( CCssValue *oldValue, CCssValue *newValue, const TInt aNameId )
       
  2682     {
       
  2683     CSvgElementImpl *lChild = (CSvgElementImpl *)FirstChild();
       
  2684 
       
  2685     while(lChild)
       
  2686         {
       
  2687         if( lChild->iSvgStyleProperties )
       
  2688             {
       
  2689             if( lChild->iSvgStyleProperties->operator[](aNameId) == oldValue)
       
  2690                 {
       
  2691                 lChild->iSvgStyleProperties->operator[](aNameId) = newValue;
       
  2692                 if( lChild->FirstChild() )
       
  2693                     {
       
  2694                     lChild = (CSvgElementImpl *)lChild->FirstChild();
       
  2695                     continue;
       
  2696                     }
       
  2697 
       
  2698                 }
       
  2699             }
       
  2700         else
       
  2701             {
       
  2702             if( lChild->FirstChild() )
       
  2703                 {
       
  2704                 lChild = (CSvgElementImpl *)lChild->FirstChild();
       
  2705                 continue;
       
  2706                 }
       
  2707             }
       
  2708 
       
  2709 
       
  2710         if( lChild->NextSibling() )
       
  2711             {
       
  2712             lChild = (CSvgElementImpl *)lChild->NextSibling();
       
  2713             }
       
  2714         else
       
  2715             {
       
  2716             lChild = (CSvgElementImpl *)lChild->ParentNode();
       
  2717             while( lChild != this && lChild->NextSibling() == NULL )
       
  2718                 {
       
  2719                 lChild = (CSvgElementImpl *)lChild->ParentNode();
       
  2720                 }
       
  2721             if( lChild == this )
       
  2722                 {
       
  2723                 lChild = NULL ;
       
  2724                 }
       
  2725             else
       
  2726                 {
       
  2727                 lChild = (CSvgElementImpl *)(lChild->NextSibling());
       
  2728                 }
       
  2729             }
       
  2730         }
       
  2731     }
       
  2732 
       
  2733 void CSvgElementImpl::CloneSvgStylePropertiesL( CSvgElementImpl* aNewChild, CSvgElementImpl* aParentElement)
       
  2734     {
       
  2735 
       
  2736 	CSvgDocumentImpl* doc = (CSvgDocumentImpl*)OwnerDocument();
       
  2737 
       
  2738 	if (!doc)
       
  2739 	{
       
  2740 		return;
       
  2741 	}
       
  2742 
       
  2743     if( iSvgStyleProperties )
       
  2744         {
       
  2745         TInt                        count       = iSvgStyleProperties->Count();
       
  2746         CSvgElementImpl* lTmpParent = (CSvgElementImpl*)ParentNode ();
       
  2747         while(lTmpParent && (lTmpParent->iSvgStyleProperties == NULL))
       
  2748         {
       
  2749         lTmpParent = (CSvgElementImpl*)lTmpParent->ParentNode ();
       
  2750         }
       
  2751 
       
  2752         RPointerArray<CCssValue>*lSvgStyleProperties = NULL;
       
  2753 
       
  2754         (  ( CSvgElementImpl * ) aNewChild  )->GetSvgStylePropertiesArray( lSvgStyleProperties );
       
  2755 
       
  2756         CSvgElementImpl* lTmpCloneParent = aParentElement;
       
  2757         while(lTmpCloneParent && (lTmpCloneParent->iSvgStyleProperties == NULL))
       
  2758             {
       
  2759             lTmpCloneParent = (CSvgElementImpl*)lTmpCloneParent->ParentNode ();
       
  2760             }
       
  2761 
       
  2762         for ( TInt i = 0; i < count; i++ )
       
  2763             {
       
  2764             if( lTmpParent && (lTmpParent->iSvgStyleProperties->operator[]( i ) == iSvgStyleProperties->operator[]( i )) )
       
  2765                 {
       
  2766                 CCssValue*   lCssValue = NULL;
       
  2767                 if( lTmpCloneParent )
       
  2768                     {
       
  2769                     lCssValue   = lTmpCloneParent->iSvgStyleProperties->operator[]( i );
       
  2770                     }
       
  2771                 lSvgStyleProperties->InsertL(lCssValue,i);
       
  2772                 }
       
  2773             else
       
  2774                 {
       
  2775 
       
  2776                 CCssValue*   lCssValue = (iSvgStyleProperties->operator[]( i ));
       
  2777 
       
  2778                 //CLONING VALUES THROUGH MEMORY MANAGER
       
  2779 
       
  2780                 CCssValue* lCssValueCloned = doc->iMemoryManager->CloneCssValueL(lCssValue);
       
  2781 
       
  2782                 lSvgStyleProperties->InsertL(lCssValueCloned,i);
       
  2783                 }
       
  2784             }
       
  2785             }
       
  2786     }
       
  2787 
       
  2788 void CSvgElementImpl::ResetReferenceAttrSet()
       
  2789     {
       
  2790       if( iAnimateAttrSet )
       
  2791         {
       
  2792         iAnimateAttrSet->Close();
       
  2793         delete iAnimateAttrSet;
       
  2794         iAnimateAttrSet = NULL ;
       
  2795         }
       
  2796     }
       
  2797 
       
  2798 
       
  2799 // functions for encoding
       
  2800 
       
  2801 void  CSvgElementImpl::SetTransformList(TGfxAffineTransform& aTr)
       
  2802     {
       
  2803     if( iSvgTransformable )
       
  2804         {
       
  2805         iSvgTransformable->SetTransformList(aTr);
       
  2806         }
       
  2807     }
       
  2808 
       
  2809 
       
  2810 void  CSvgElementImpl::SetRequiredFeatures(  CDesCArrayFlat*& aRequiredFeatures )
       
  2811     {
       
  2812     if( iSvgTests )
       
  2813         {
       
  2814         iSvgTests->SetRequiredFeatures (aRequiredFeatures);
       
  2815         }
       
  2816     }
       
  2817 
       
  2818 void  CSvgElementImpl::SetRequiredExtensions(  CDesCArrayFlat*& aRequiredExtensions )
       
  2819     {
       
  2820     if( iSvgTests )
       
  2821         {
       
  2822         iSvgTests->SetRequiredExtensions (aRequiredExtensions);
       
  2823         }
       
  2824     }
       
  2825 
       
  2826 void  CSvgElementImpl::SetSystemLanguage(  CDesCArrayFlat*& aSystemLanguage )
       
  2827     {
       
  2828     if( iSvgTests )
       
  2829         {
       
  2830         iSvgTests->SetSystemLanguage (aSystemLanguage);
       
  2831         }
       
  2832     }
       
  2833 
       
  2834 TBool CSvgElementImpl::IsTransformable()
       
  2835     {
       
  2836     if( iSvgTransformable )
       
  2837         return ETrue;
       
  2838     else
       
  2839         return EFalse;
       
  2840     }
       
  2841 TInt  CSvgElementImpl::SetUriRefDesL( const TUint16 aNameId,
       
  2842                                         const TDesC& aValue )
       
  2843     {
       
  2844     if( iSvgUriReferenceImpl )
       
  2845         {
       
  2846         return iSvgUriReferenceImpl->SetUriRefDesL(aNameId, aValue);
       
  2847         }
       
  2848     return (TInt) EFalse;
       
  2849     }
       
  2850 void CSvgElementImpl::Reset(MSvgEvent* /*aEvent*/)
       
  2851     {
       
  2852 
       
  2853     }
       
  2854 
       
  2855 void CSvgElementImpl::ReInitializeAnimation()
       
  2856 {
       
  2857 
       
  2858 }
       
  2859 
       
  2860 CGfxGeneralPath*  CSvgElementImpl::GetPathAttribute(TInt /*aAttributeId*/)
       
  2861 {
       
  2862     return NULL;
       
  2863 }
       
  2864 void CSvgElementImpl::SetPathAttribute(TInt /*aSvgAttrId*/, CGfxGeneralPath* /*aPathHandle*/)
       
  2865 {
       
  2866 
       
  2867 }
       
  2868 
       
  2869 //this element has an animation associated with it
       
  2870 TBool CSvgElementImpl::HasAnimation()
       
  2871 {
       
  2872 	if (iHasAnimationBase)
       
  2873 	{
       
  2874 		return ETrue;
       
  2875 	}
       
  2876 
       
  2877 	return EFalse;
       
  2878 }
       
  2879 
       
  2880 void CSvgElementImpl::SetIsAnimating( TBool aBool )
       
  2881 {
       
  2882     if ( aBool )
       
  2883     {
       
  2884         iBooleanFlags = iBooleanFlags | KAnimatingBit;
       
  2885     }
       
  2886     else
       
  2887     {
       
  2888         iBooleanFlags = iBooleanFlags & ~KAnimatingBit;
       
  2889     }
       
  2890 }
       
  2891 
       
  2892 TBool CSvgElementImpl::IsAnimating()
       
  2893 {
       
  2894     return iBooleanFlags & KAnimatingBit;
       
  2895 }
       
  2896 
       
  2897 void CSvgElementImpl::SetTurnOff( TBool aBool )
       
  2898 {
       
  2899     if ( aBool )
       
  2900     {
       
  2901         iBooleanFlags = iBooleanFlags | KWasTurnedOffBit;
       
  2902     }
       
  2903     else
       
  2904     {
       
  2905         iBooleanFlags = iBooleanFlags & ~KWasTurnedOffBit;
       
  2906     }
       
  2907 }
       
  2908 
       
  2909 TBool CSvgElementImpl::WasTurnedOff()
       
  2910 {
       
  2911     return iBooleanFlags & KWasTurnedOffBit;
       
  2912 }
       
  2913 
       
  2914 void CSvgElementImpl::SetOverwriteTransforms( TBool aBool )
       
  2915 {
       
  2916     if ( aBool )
       
  2917     {
       
  2918         iBooleanFlags = iBooleanFlags | KOverwriteTransformsBit;
       
  2919     }
       
  2920     else
       
  2921     {
       
  2922         iBooleanFlags = iBooleanFlags & ~KOverwriteTransformsBit;
       
  2923     }
       
  2924 }
       
  2925 
       
  2926 TBool CSvgElementImpl::IsOverwriteTransforms()
       
  2927 {
       
  2928     return iBooleanFlags & KOverwriteTransformsBit;
       
  2929 }
       
  2930 
       
  2931 void CSvgElementImpl::SetAllAttributesAdded( TBool aBool )
       
  2932 {
       
  2933     if ( aBool )
       
  2934     {
       
  2935         iBooleanFlags = iBooleanFlags | KAllAttributesAddedBit;
       
  2936     }
       
  2937     else
       
  2938     {
       
  2939         iBooleanFlags = iBooleanFlags & ~KAllAttributesAddedBit;
       
  2940     }
       
  2941 }
       
  2942 
       
  2943 TBool CSvgElementImpl::AreAllAttributesAdded()
       
  2944 {
       
  2945     return iBooleanFlags & KAllAttributesAddedBit;
       
  2946 }
       
  2947 
       
  2948 void CSvgElementImpl::SetMouseDown( TBool aBool )
       
  2949 {
       
  2950     if ( aBool )
       
  2951     {
       
  2952         iBooleanFlags = iBooleanFlags | KMouseDownBit;
       
  2953     }
       
  2954     else
       
  2955     {
       
  2956         iBooleanFlags = iBooleanFlags & ~KMouseDownBit;
       
  2957     }
       
  2958 }
       
  2959 
       
  2960 TBool CSvgElementImpl::IsMouseDown()
       
  2961 {
       
  2962     return iBooleanFlags & KMouseDownBit;
       
  2963 }
       
  2964 
       
  2965 void CSvgElementImpl::SetMouseIn( TBool aBool )
       
  2966 {
       
  2967     if ( aBool )
       
  2968     {
       
  2969         iBooleanFlags = iBooleanFlags | KMouseInBit;
       
  2970     }
       
  2971     else
       
  2972     {
       
  2973         iBooleanFlags = iBooleanFlags & ~KMouseInBit;
       
  2974     }
       
  2975 }
       
  2976 
       
  2977 TBool CSvgElementImpl::IsMouseIn()
       
  2978 {
       
  2979     return iBooleanFlags & KMouseInBit;
       
  2980 }
       
  2981 
       
  2982 void CSvgElementImpl::DeactivateAnimation()
       
  2983 {
       
  2984 }
       
  2985 
       
  2986 TBool  CSvgElementImpl::DoAnimProcL(MSvgEvent* /*aEvent*/)
       
  2987 {
       
  2988 return ETrue;
       
  2989 }
       
  2990 void CSvgElementImpl ::PointToParent(const TInt aAttrId)
       
  2991 {
       
  2992 	//this method doesnt look too good to me.
       
  2993 	//especially since the OldPointer that is getting passed
       
  2994 	//to PropagateToChildren is NULL
       
  2995 
       
  2996     if(aAttrId < KCSS_MAX_ATTR && iSvgStyleProperties)
       
  2997         {
       
  2998         CSvgElementImpl* lTmpParent = (CSvgElementImpl*)ParentNode ();
       
  2999         if(lTmpParent)
       
  3000             {
       
  3001             if(iSvgStyleProperties->operator[]( aAttrId ) != lTmpParent->iSvgStyleProperties->operator[](aAttrId ))
       
  3002                 {
       
  3003 
       
  3004                 //store the old value.
       
  3005                 CCssValue *OldPointer = iSvgStyleProperties->operator[]( aAttrId );
       
  3006 
       
  3007                 //this deletion is no longer needed as the memory manager is in charge of this now
       
  3008 
       
  3009                 // set the pointer
       
  3010                 iSvgStyleProperties->operator[]( aAttrId ) = lTmpParent->iSvgStyleProperties->operator[](aAttrId );
       
  3011 
       
  3012                 // update the child pointers to the previous values.
       
  3013                 PropagateToChildren(OldPointer, lTmpParent->iSvgStyleProperties->operator[](aAttrId ), aAttrId );
       
  3014                 }
       
  3015             }
       
  3016         }
       
  3017 }
       
  3018 TBool CSvgElementImpl::IsInherited(const TInt aAttrId)
       
  3019 {
       
  3020 if(aAttrId < KCSS_MAX_ATTR && iSvgStyleProperties)
       
  3021     {
       
  3022     CSvgElementImpl* lTmpParent = (CSvgElementImpl*)ParentNode ();
       
  3023     if(lTmpParent && lTmpParent->iSvgStyleProperties)
       
  3024         {
       
  3025         return (iSvgStyleProperties->operator[]( aAttrId ) == lTmpParent->iSvgStyleProperties->operator[](aAttrId ));
       
  3026         }
       
  3027     }
       
  3028 return EFalse;
       
  3029 }
       
  3030 
       
  3031 //probably dont need this anymore
       
  3032 void CSvgElementImpl::InitSvgStylePropertiesWithNullL()
       
  3033 {
       
  3034     for( int i=0; i < KCSS_MAX_ATTR; i++ )
       
  3035     {
       
  3036         User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
       
  3037     }
       
  3038 }
       
  3039 
       
  3040 TBool CSvgElementImpl::IsVisible()
       
  3041 {
       
  3042     if ( !AreAllAttributesAdded() )
       
  3043         {
       
  3044         return EFalse;
       
  3045         }
       
  3046 
       
  3047     TInt32 visbilityValue = -1;
       
  3048     TInt lReturnValue = KErrGeneral;
       
  3049     TRAPD(err, lReturnValue = this->GetAttributeIntL( KCSS_ATTR_VISIBILITY, visbilityValue ));
       
  3050     if (err)
       
  3051         {
       
  3052         #ifdef _DEBUG
       
  3053         RDebug::Printf("CSvgElementImpl::IsVisible() GetAttributeIntL error");
       
  3054         #endif
       
  3055         }
       
  3056 
       
  3057     return ( ( lReturnValue == KErrNone) && (visbilityValue == 0) );
       
  3058 }
       
  3059 
       
  3060 void CSvgElementImpl::PrintStyleProperties( )
       
  3061 {
       
  3062 	//prints all of the style properties out that this element has ahold of
       
  3063 
       
  3064 	#ifdef _DEBUG
       
  3065 	if (!iSvgStyleProperties)
       
  3066 	{
       
  3067 		RDebug::Printf("CSvgElementImpl::PrintStyleProperties[%x]: NO STYLES FOUND", this);
       
  3068 		return;
       
  3069 	}
       
  3070 
       
  3071 	RDebug::Printf("----STYLES---");
       
  3072 	for (TInt i=0; i<iSvgStyleProperties->Count(); i++)
       
  3073 	{
       
  3074 		switch (i)
       
  3075 		{
       
  3076 			case 0:
       
  3077 				RDebug::Printf("fill=\"");
       
  3078 			break;
       
  3079 			case 22:
       
  3080 				RDebug::Printf("fill-opacity=\"");
       
  3081 			break;
       
  3082 			case 23:
       
  3083 				RDebug::Printf("stroke-opacity=\"");
       
  3084 			break;
       
  3085 			case 1:
       
  3086 				RDebug::Printf("stroke=\"");
       
  3087 			break;
       
  3088 			case 2:
       
  3089 				RDebug::Printf("stroke-width=\"");
       
  3090 			break;
       
  3091 			case 3:
       
  3092 				RDebug::Printf("visibility=\"");
       
  3093 			break;
       
  3094 			case 4:
       
  3095 				RDebug::Printf("font-family=\"");
       
  3096 			break;
       
  3097 			case 5:
       
  3098 				RDebug::Printf("font-size=\"");
       
  3099 			break;
       
  3100 			case 6:
       
  3101 				RDebug::Printf("font-style=\"");
       
  3102 			break;
       
  3103 			case 7:
       
  3104 				RDebug::Printf("font-weight=\"");
       
  3105 			break;
       
  3106 			case 8:
       
  3107 				RDebug::Printf("stroke-dasharray=\"");
       
  3108 			break;
       
  3109 			case 9:
       
  3110 				RDebug::Printf("display=\"");
       
  3111 			break;
       
  3112 			case 10:
       
  3113 				RDebug::Printf("fill-rule=\"");
       
  3114 			break;
       
  3115 			case 11:
       
  3116 				RDebug::Printf("stroke-linecap=\"");
       
  3117 			break;
       
  3118 			case 12:
       
  3119 				RDebug::Printf("stroke-linejoin=\"");
       
  3120 			break;
       
  3121 			case 13:
       
  3122 				RDebug::Printf("stroke-dashoffset=\"");
       
  3123 			break;
       
  3124 			case 14:
       
  3125 				RDebug::Printf("stroke-miterlimit=\"");
       
  3126 			break;
       
  3127 			case 15:
       
  3128 				RDebug::Printf("color=\"");
       
  3129 			break;
       
  3130 			case 16:
       
  3131 				RDebug::Printf("text-anchor=\"");
       
  3132 			break;
       
  3133 			case 17:
       
  3134 				RDebug::Printf("text-decoration=\"");
       
  3135 			break;
       
  3136 			case 18:
       
  3137 				RDebug::Printf("color-interpolation=\"");
       
  3138 			break;
       
  3139 			case 19:
       
  3140 				RDebug::Printf("color-rendering=\"");
       
  3141 			break;
       
  3142 			case 20:
       
  3143 				RDebug::Printf("letter-spacing=\"");
       
  3144 			break;
       
  3145 			case 21:
       
  3146 				RDebug::Printf("word-spacing=\"");
       
  3147 			break;
       
  3148 			case 24: //THIS SHOULD BE = KSS_MAX_ATTR
       
  3149 				RDebug::Printf("group-opacity=\"");
       
  3150 			break;
       
  3151 		default:
       
  3152 			RDebug::Printf("UNKNOWN STYLE FOUND!!");
       
  3153 		break;
       
  3154 		}
       
  3155 
       
  3156 		if ( iSvgStyleProperties->operator[]( i ) )
       
  3157 		{
       
  3158 			iSvgStyleProperties->operator[]( i )->Print();
       
  3159 			RDebug::Printf("\"");
       
  3160 		}
       
  3161 		else
       
  3162 		{
       
  3163 			//that style was empty
       
  3164 			RDebug::Printf("EMPTY!!\"", i);
       
  3165 		}
       
  3166 	}
       
  3167 	RDebug::Printf("---END OF STYLES---");
       
  3168 
       
  3169 	#endif
       
  3170 
       
  3171 }
       
  3172 
       
  3173 TBool CSvgElementImpl::GetDefaultAttributeL( const TInt aNameId, CCssValue*& aValue )
       
  3174 {
       
  3175 	CSvgDocumentImpl* lDocument = (CSvgDocumentImpl*)OwnerDocument();
       
  3176 
       
  3177 	if (!lDocument)
       
  3178 	{
       
  3179 		return EFalse;
       
  3180 	}
       
  3181 
       
  3182 	CSvgElementImpl* lRootElement = (CSvgElementImpl*)(lDocument->RootElement());
       
  3183 
       
  3184 	if (lRootElement)
       
  3185 	{
       
  3186 		RPointerArray<CCssValue>*lSvgStyleProperties = NULL;
       
  3187 
       
  3188 		lRootElement->GetSvgStylePropertiesArray(lSvgStyleProperties);
       
  3189 
       
  3190 		if (lSvgStyleProperties && lSvgStyleProperties->operator[](aNameId) != NULL )
       
  3191 		{
       
  3192 			aValue = (CCssValue*)lSvgStyleProperties->operator[](aNameId);
       
  3193 			return ETrue;
       
  3194 		}
       
  3195 	}
       
  3196 
       
  3197 	switch( aNameId )
       
  3198 	{
       
  3199 		// Initilaise Svg Element with default values
       
  3200 		case KCSS_ATTR_FILL:
       
  3201 		{
       
  3202 			CPaintCssValueImpl* lPaintObject = lDocument->iMemoryManager->GetCssPaintObjectL(_L("black"),(CSvgElementImpl *)this);
       
  3203 
       
  3204 			iSvgStyleProperties->InsertL(lPaintObject, KCSS_ATTR_FILL );
       
  3205 		}
       
  3206 		case KCSS_ATTR_FILL_OPACITY:
       
  3207 		{
       
  3208 			CFloatCssValueImpl* lFloatObject5 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("1"));
       
  3209 
       
  3210 			iSvgStyleProperties->InsertL(lFloatObject5,KCSS_ATTR_FILL_OPACITY);
       
  3211 		}
       
  3212 		break;
       
  3213 
       
  3214 		case KCSS_ATTR_STROKE_OPACITY:
       
  3215 		{
       
  3216 			CFloatCssValueImpl* lFloatObject6 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("1"));
       
  3217 
       
  3218 			iSvgStyleProperties->InsertL(lFloatObject6,KCSS_ATTR_STROKE_OPACITY);
       
  3219 		}
       
  3220 		break;
       
  3221 
       
  3222 		case KCSS_ATTR_STROKE:
       
  3223 		{
       
  3224 			CClrCssValueImpl* lClrObject = lDocument->iMemoryManager->GetCssClrObjectL(_L("none"));
       
  3225 
       
  3226 			iSvgStyleProperties->InsertL(lClrObject, KCSS_ATTR_STROKE);
       
  3227 		}
       
  3228 		break;
       
  3229 
       
  3230 		case KCSS_ATTR_STROKEWIDTH:
       
  3231 		{
       
  3232 			CFloatCssValueImpl* lFloatObject = lDocument->iMemoryManager->GetCssFloatObjectL(_L("1"));
       
  3233 
       
  3234 			iSvgStyleProperties->InsertL(lFloatObject, KCSS_ATTR_STROKEWIDTH);
       
  3235 		}
       
  3236 		break;
       
  3237 
       
  3238 		case KCSS_ATTR_VISIBILITY:
       
  3239 		{
       
  3240 			CIntCssValueImpl* lIntObject = lDocument->iMemoryManager->GetCssIntObjectL(_L("0"));
       
  3241 
       
  3242 			iSvgStyleProperties->InsertL(lIntObject,KCSS_ATTR_VISIBILITY);
       
  3243 		}
       
  3244 		break;
       
  3245 
       
  3246 		case KCSS_ATTR_FONTFAMILY:
       
  3247 		{
       
  3248 			iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_FONTFAMILY);
       
  3249 		}
       
  3250 		break;
       
  3251 
       
  3252 		case KCSS_ATTR_FONTSIZE:
       
  3253 		{
       
  3254 			CFloatCssValueImpl* lFloatObject2 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("10"));
       
  3255 
       
  3256 			iSvgStyleProperties->InsertL(lFloatObject2 ,KCSS_ATTR_FONTSIZE);
       
  3257 		}
       
  3258 		break;
       
  3259 
       
  3260 		case KCSS_ATTR_FONTSTYLE:
       
  3261 		{
       
  3262 			CIntCssValueImpl* lIntObject2 = lDocument->iMemoryManager->GetCssIntObjectL(_L("0"));
       
  3263 
       
  3264 			iSvgStyleProperties->InsertL(lIntObject2,KCSS_ATTR_FONTSTYLE);
       
  3265 		}
       
  3266 		break;
       
  3267 
       
  3268 		case KCSS_ATTR_FONTWEIGHT:
       
  3269 		{
       
  3270 			CIntCssValueImpl* lIntObject3 = lDocument->iMemoryManager->GetCssIntObjectL(_L("0"));
       
  3271 
       
  3272             iSvgStyleProperties->InsertL(lIntObject3,KCSS_ATTR_FONTWEIGHT);
       
  3273 		}
       
  3274 		break;
       
  3275 
       
  3276 		case KCSS_ATTR_STROKE_DASHARRAY:
       
  3277 		{
       
  3278 			iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_STROKE_DASHARRAY);
       
  3279 		}
       
  3280 		break;
       
  3281 
       
  3282 		case KCSS_ATTR_DISPLAY:
       
  3283     {
       
  3284     	//set default to inline
       
  3285     	CIntCssValueImpl* lIntObject4 = lDocument->iMemoryManager->GetCssIntObjectL(_L("0"));
       
  3286 
       
  3287     	iSvgStyleProperties->InsertL(lIntObject4,KCSS_ATTR_DISPLAY);
       
  3288 		}
       
  3289     break;
       
  3290 
       
  3291 		case KCSS_ATTR_FILLRULE:
       
  3292 		{
       
  3293 			CStrCssValueImpl* lStrObject1 = lDocument->iMemoryManager->GetCssStrObjectL(_L("nonzero"));
       
  3294 
       
  3295 			iSvgStyleProperties->InsertL(lStrObject1,KCSS_ATTR_FILLRULE);
       
  3296 		}
       
  3297 		break;
       
  3298 
       
  3299 		case KCSS_ATTR_STROKE_LINECAP:
       
  3300 		{
       
  3301 			CStrCssValueImpl* lStrObject2 = lDocument->iMemoryManager->GetCssStrObjectL(_L("butt"));
       
  3302 
       
  3303 			iSvgStyleProperties->InsertL(lStrObject2,KCSS_ATTR_STROKE_LINECAP);
       
  3304 		}
       
  3305 		break;
       
  3306 
       
  3307 		case KCSS_ATTR_STROKE_LINEJOIN:
       
  3308 		{
       
  3309 			CStrCssValueImpl* lStrObject3 = lDocument->iMemoryManager->GetCssStrObjectL(_L("miter"));
       
  3310 
       
  3311 			iSvgStyleProperties->InsertL(lStrObject3,KCSS_ATTR_STROKE_LINEJOIN);
       
  3312 		}
       
  3313 		break;
       
  3314 
       
  3315 		case KCSS_ATTR_STROKE_DASHOFFSET:
       
  3316 		{
       
  3317 			CFloatCssValueImpl* lFloatObject3 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("0"));
       
  3318 
       
  3319 			iSvgStyleProperties->InsertL(lFloatObject3,KCSS_ATTR_STROKE_DASHOFFSET);
       
  3320 		}
       
  3321 		break;
       
  3322 
       
  3323 		case KCSS_ATTR_STROKE_MITERLIMIT:
       
  3324 		{
       
  3325 			CFloatCssValueImpl* lFloatObject4 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("4"));
       
  3326 
       
  3327     	iSvgStyleProperties->InsertL(lFloatObject4,KCSS_ATTR_STROKE_MITERLIMIT);
       
  3328 		}
       
  3329 		break;
       
  3330 
       
  3331 		case KCSS_ATTR_COLOR:
       
  3332 		{
       
  3333 			CClrCssValueImpl* lClrObject4 = lDocument->iMemoryManager->GetCssClrObjectL(_L("black"));
       
  3334 
       
  3335     	iSvgStyleProperties->InsertL(lClrObject4,KCSS_ATTR_COLOR);
       
  3336 		}
       
  3337 		break;
       
  3338 
       
  3339 		case KCSS_ATTR_TEXTANCHOR:
       
  3340 		{
       
  3341 			CIntCssValueImpl* lIntObject5 = lDocument->iMemoryManager->GetCssIntObjectL(_L("0"));
       
  3342 
       
  3343 			iSvgStyleProperties->InsertL(lIntObject5,KCSS_ATTR_TEXTANCHOR);
       
  3344 		}
       
  3345 		break;
       
  3346 
       
  3347 		case KCSS_ATTR_TEXTDECORATION:
       
  3348 		{
       
  3349 			CIntCssValueImpl* lIntObject6 = lDocument->iMemoryManager->GetCssIntObjectL(_L("-1"));
       
  3350 
       
  3351     	iSvgStyleProperties->InsertL(lIntObject6,KCSS_ATTR_TEXTDECORATION);
       
  3352 		}
       
  3353 		break;
       
  3354 
       
  3355 		case KCSS_ATTR_COLORINTERPOLATION:
       
  3356 		{
       
  3357 			iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_COLORINTERPOLATION);
       
  3358 		}
       
  3359 		break;
       
  3360 
       
  3361 		case KCSS_ATTR_COLORRENDERING:
       
  3362 		{
       
  3363 			iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_COLORRENDERING);
       
  3364 		}
       
  3365 		break;
       
  3366 
       
  3367 		case KCSS_ATTR_LETTERSPACING:
       
  3368 		{
       
  3369 			iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_LETTERSPACING);
       
  3370 		}
       
  3371 		break;
       
  3372 
       
  3373 		case KCSS_ATTR_WORDSPACING:
       
  3374 		{
       
  3375 			iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_WORDSPACING);
       
  3376 		}
       
  3377 		break;
       
  3378 
       
  3379 		case KCSS_ATTR_GROUP_OPACITY:
       
  3380 		{
       
  3381 			CFloatCssValueImpl* lFloatObject7 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("1"));
       
  3382 
       
  3383 			iSvgStyleProperties->InsertL(lFloatObject7,KCSS_ATTR_GROUP_OPACITY);
       
  3384 		}
       
  3385 		break;
       
  3386 
       
  3387 		default:
       
  3388 			{
       
  3389 			//don't know the element
       
  3390 			return EFalse;
       
  3391 			}
       
  3392 		}
       
  3393 
       
  3394     aValue = (CCssValue*)iSvgStyleProperties->operator[](aNameId);
       
  3395     return ETrue;
       
  3396 }
       
  3397 
       
  3398 TFloatFixPt CSvgElementImpl::GetCurrentScale( )
       
  3399 {
       
  3400     const TGfxAffineTransform& ctm = GetCTM();
       
  3401 	//GET THE SCALE FACTOR FROM THE CURRENT ELEMENT
       
  3402 	TGfxPoint2D ep( 1, 0 ), org( 2, 0 );
       
  3403     ctm.Transform( &ep, & ep, 1 );
       
  3404     ctm.Transform( &org, & org, 1 );
       
  3405     ep.iX -= org.iX;
       
  3406     ep.iY -= org.iY;
       
  3407 
       
  3408     TFloatFixPt scale = TFloatFixPt::Sqrt( ep.iX * ep.iX + ep.iY * ep.iY );
       
  3409     // adjust for rounding error when rotated (and not scaled)
       
  3410     if ( scale < TFloatFixPt(1.0f) && scale > TFloatFixPt(0.998f) )
       
  3411         {
       
  3412         scale = TFloatFixPt(1.0f);
       
  3413         }
       
  3414 
       
  3415     return scale;
       
  3416 }
       
  3417 
       
  3418 
       
  3419 //ALL animated element types must be listed here
       
  3420 TBool CSvgElementImpl::IsAnimatedElement(  )
       
  3421 {
       
  3422 	return ( iElemID == KSvgAnimateElement ||
       
  3423 			iElemID == KSvgAnimateColorElement ||
       
  3424 			iElemID == KSvgAnimateMotionElement ||
       
  3425 			iElemID == KSvgAnimateTransformElement ||
       
  3426 			iElemID == KSvgSetElement ||
       
  3427 			//iElemID == KSvgDiscardElement ||	//discard has a begin but doesn't inherit from animationbase?
       
  3428 			iElemID == KSvgAudioElement ||
       
  3429             iElemID == KSvgMediaAnimationElement );	 
       
  3430 }
       
  3431 
       
  3432 TBool CSvgElementImpl::CanGenerateInternalEvent(TUint16 aSubEventmask, TSvgEvent aEvent)
       
  3433     {
       
  3434     TUint16 tmp=aSubEventmask;
       
  3435     switch(aEvent)
       
  3436         {
       
  3437         case ESvgEventActivate:
       
  3438         tmp= tmp & ESvgInteractiveEventActivate;
       
  3439         break;
       
  3440         case ESvgEventClick:
       
  3441         tmp = tmp & ESvgInteractiveEventClick;
       
  3442         break;
       
  3443         case ESvgEventMouseover:
       
  3444         tmp = tmp & ESvgInteractiveEventMouseover;
       
  3445         break;
       
  3446         case ESvgEventMousemove:
       
  3447         tmp = tmp & ESvgInteractiveEventMousemove;
       
  3448         break;
       
  3449         case ESvgEventFocusin:
       
  3450         tmp = tmp & ESvgInteractiveEventFocusin;
       
  3451         break;
       
  3452         case ESvgEventMouseout:
       
  3453         tmp = tmp & ESvgInteractiveEventMouseout;
       
  3454         break;
       
  3455         case ESvgEventFocusout:
       
  3456         tmp = tmp & ESvgInteractiveEventFocusout;
       
  3457         break;
       
  3458         default:
       
  3459         tmp=0;
       
  3460         }
       
  3461     if(tmp)
       
  3462         {
       
  3463         return ETrue;
       
  3464         }
       
  3465     else
       
  3466         {
       
  3467         return EFalse;
       
  3468         }
       
  3469     }
       
  3470 TBool CSvgElementImpl::IsSVGEnginePaused()
       
  3471 {
       
  3472 	CSvgEngineImpl* lEngine  = ( ( CSvgDocumentImpl* ) OwnerDocument() )->Engine();
       
  3473     return ( lEngine->IsSVGEnginePaused() );
       
  3474 
       
  3475 }