svgtopt/SVG/SVGImpl/src/SVGTransformableImpl.cpp
changeset 46 88edb906c587
equal deleted inserted replaced
-1:000000000000 46:88edb906c587
       
     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 "SVGTransformableImpl.h"
       
    24 
       
    25 
       
    26 // ==========================================================================
       
    27 // Need method description
       
    28 // ==========================================================================
       
    29 CSvgTransformableImpl* CSvgTransformableImpl::NewL()
       
    30     {
       
    31     CSvgTransformableImpl* self = new ( ELeave ) CSvgTransformableImpl();
       
    32     CleanupStack::PushL( self );
       
    33     self->ConstructL();
       
    34     CleanupStack::Pop();
       
    35 
       
    36     return self;
       
    37     }
       
    38 
       
    39 // ==========================================================================
       
    40 // Need method description
       
    41 // ==========================================================================
       
    42 CSvgTransformableImpl* CSvgTransformableImpl::NewLC()
       
    43     {
       
    44     CSvgTransformableImpl* self = new ( ELeave ) CSvgTransformableImpl();
       
    45     CleanupStack::PushL( self );
       
    46     self->ConstructL();
       
    47 
       
    48     return self;
       
    49     }
       
    50 
       
    51 // ==========================================================================
       
    52 // Need method description
       
    53 // ==========================================================================
       
    54 CSvgTransformableImpl::~CSvgTransformableImpl()
       
    55     {
       
    56 	if ( iTransform )
       
    57 		{
       
    58 		delete iTransform;
       
    59 		iTransform = NULL;
       
    60 		}
       
    61     }
       
    62 
       
    63 // From MSvgTransformable
       
    64 
       
    65 // ==========================================================================
       
    66 // Need method description
       
    67 // ==========================================================================
       
    68 void CSvgTransformableImpl::GetTransform( MSvgTransformList*& aTransformList )
       
    69     {
       
    70     aTransformList = ( MSvgTransformList * ) iTransform;
       
    71     }
       
    72 
       
    73 // ==========================================================================
       
    74 // Need method description
       
    75 // ==========================================================================
       
    76 void CSvgTransformableImpl::SetTransform( MSvgTransformList*& aTransformList )
       
    77     {
       
    78     iTransform = ( CSvgTransformListImpl * ) aTransformList;
       
    79 	iTransform->SetAvoidConsolidation(EFalse);
       
    80     }
       
    81 
       
    82 // From MSvgLocatable
       
    83 
       
    84 // ==========================================================================
       
    85 // Need method description
       
    86 // ==========================================================================
       
    87 const TGfxAffineTransform& CSvgTransformableImpl::GetCTM()
       
    88     {
       
    89     return iCTM;
       
    90     }
       
    91 
       
    92 // ==========================================================================
       
    93 // Need method description
       
    94 // ==========================================================================
       
    95 void CSvgTransformableImpl::SetCTM( TGfxAffineTransform& aTr )
       
    96     {
       
    97     iCTM = aTr;
       
    98     }
       
    99 
       
   100 // Private
       
   101 
       
   102 // ==========================================================================
       
   103 // Need method description
       
   104 // ==========================================================================
       
   105 void CSvgTransformableImpl::ConstructL()
       
   106     {
       
   107     iTransform = CSvgTransformListImpl::NewL();
       
   108     }
       
   109 
       
   110 // ==========================================================================
       
   111 // Need method description
       
   112 // ==========================================================================
       
   113 CSvgTransformableImpl::CSvgTransformableImpl()
       
   114     {
       
   115     }
       
   116 
       
   117 // ==========================================================================
       
   118 // perform a deep clone of this object
       
   119 // ==========================================================================
       
   120 CSvgTransformableImpl* CSvgTransformableImpl::CloneL()
       
   121     {
       
   122     CSvgTransformableImpl* newObject = CSvgTransformableImpl::NewL();
       
   123     CleanupStack::PushL(newObject);
       
   124 
       
   125     // copy iTransform
       
   126     if (newObject->iTransform != NULL)
       
   127         {
       
   128         delete newObject->iTransform;
       
   129         newObject->iTransform= NULL;
       
   130         }
       
   131     newObject->iTransform = this->iTransform->CloneL();
       
   132 
       
   133     // copy iCTM
       
   134     newObject->iCTM = this->iCTM;
       
   135     CleanupStack::Pop();
       
   136 
       
   137     return newObject;
       
   138     }
       
   139 
       
   140 
       
   141 void  CSvgTransformableImpl::SetTransformList(TGfxAffineTransform& aTr)
       
   142 	{
       
   143 	iTransform->ReplaceItem(aTr, 0);
       
   144 	iTransform->SetAvoidConsolidation(EFalse);
       
   145 	}
       
   146