javauis/m2g_qt/src/CM2GSVGProxy.cpp
changeset 56 abc41079b313
equal deleted inserted replaced
50:023eef975703 56:abc41079b313
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  SVGTopt proxy implementation
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <AknUtils.h>  // Files add recently
       
    20 #include <avkon.hrh>   // Files add recently
       
    21 #include <SvgJavaInterfaceImpl.h>
       
    22 #include <utf.h> // Character conversion API
       
    23 #include <featmgr.h>
       
    24 #include "CM2GSVGProxy.h"
       
    25 
       
    26 M2G_NS_START
       
    27 
       
    28 // EXTERNAL DATA STRUCTURES
       
    29 
       
    30 // EXTERNAL FUNCTION PROTOTYPES
       
    31 
       
    32 // CONSTANTS
       
    33 
       
    34 // MACROS
       
    35 
       
    36 // LOCAL CONSTANTS AND MACROS
       
    37 
       
    38 // MODULE DATA STRUCTURES
       
    39 
       
    40 // LOCAL FUNCTION PROTOTYPES
       
    41 
       
    42 // FORWARD DECLARATIONS
       
    43 
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // CM2GSVGProxy::NewL
       
    47 // -----------------------------------------------------------------------------
       
    48 CM2GSVGProxy* CM2GSVGProxy::NewL()
       
    49 {
       
    50     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::NewL()");
       
    51     CM2GSVGProxy* self = new(ELeave) CM2GSVGProxy;
       
    52     CleanupStack::PushL(self);
       
    53     self->ConstructL();
       
    54     CleanupStack::Pop();
       
    55     return self;
       
    56 }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CM2GSVGProxy::~CM2GSVGProxy
       
    60 // -----------------------------------------------------------------------------
       
    61 CM2GSVGProxy::~CM2GSVGProxy()
       
    62 {
       
    63     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::~CM2GSVGProxy() - native SVGTopt: %d", iNative);
       
    64     if (iNative)
       
    65     {
       
    66         CloseContainers();
       
    67         delete iNative;
       
    68         M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::~CM2GSVGProxy() - native deleted");
       
    69         iNative = NULL;
       
    70     }
       
    71 }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CM2GSVGProxy::AddCloseL
       
    75 // -----------------------------------------------------------------------------
       
    76 void CM2GSVGProxy::AddCloseL(const TM2GSvgPathHandle& aPathHandle)
       
    77 {
       
    78     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddCloseL() - begin");
       
    79     iNative->SvgPathAddClose(aPathHandle);
       
    80     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddCloseL() - end");
       
    81 }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CM2GSVGProxy::AddCurveToL
       
    85 // -----------------------------------------------------------------------------
       
    86 void CM2GSVGProxy::AddCurveToL(
       
    87     const TM2GSvgPathHandle& aPathHandle,
       
    88     const TM2GPathCurveData& aPathCurveData)
       
    89 {
       
    90     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddCurveToL() - begin");
       
    91     iNative->SvgPathAddCurveTo(
       
    92         aPathHandle,
       
    93         aPathCurveData[ 0 ], aPathCurveData[ 1 ],  // X1, Y1
       
    94         aPathCurveData[ 2 ], aPathCurveData[ 3 ],  // X2, Y2
       
    95         aPathCurveData[ 4 ], aPathCurveData[ 5 ]);  // X3, Y3
       
    96     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddCurveToL() - end");
       
    97 }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // CM2GSVGProxy::AddLineToL
       
   101 // -----------------------------------------------------------------------------
       
   102 void CM2GSVGProxy::AddLineToL(
       
   103     const TM2GSvgPathHandle& aPathHandle,
       
   104     const TReal32& aX, const TReal32& aY)
       
   105 {
       
   106     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddLineToL() - begin");
       
   107     iNative->SvgPathAddLineTo(aPathHandle, aX, aY);
       
   108     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddLineToL() - end");
       
   109 }
       
   110 
       
   111 // -----------------------------------------------------------------------------
       
   112 // CM2GSVGProxy::AddMoveToL
       
   113 // -----------------------------------------------------------------------------
       
   114 void CM2GSVGProxy::AddMoveToL(
       
   115     const TM2GSvgPathHandle& aPathHandle,
       
   116     const TReal32& aX, const TReal32& aY)
       
   117 {
       
   118     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddMoveToL() - begin");
       
   119     iNative->SvgPathAddMoveTo(aPathHandle, aX, aY);
       
   120     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddMoveToL() - end");
       
   121 }
       
   122 
       
   123 // -----------------------------------------------------------------------------
       
   124 // CM2GSVGProxy::AddQuadToL
       
   125 // -----------------------------------------------------------------------------
       
   126 void CM2GSVGProxy::AddQuadToL(
       
   127     const TM2GSvgPathHandle& aPathHandle,
       
   128     const TReal32& aX1, const TReal32& aY1,
       
   129     const TReal32& aX2, const TReal32& aY2)
       
   130 {
       
   131     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddQuadToL() - begin");
       
   132     iNative->SvgPathAddQuadTo(aPathHandle, aX1, aY1, aX2, aY2);
       
   133     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddQuadToL() - end");
       
   134 }
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 // CM2GSVGProxy::AppendChildL
       
   138 // -----------------------------------------------------------------------------
       
   139 void CM2GSVGProxy::AppendChildL(
       
   140     const TM2GSvgElementHandle& aElementHandle,
       
   141     const TM2GSvgElementHandle& aChildElementHandle)
       
   142 {
       
   143     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AppendChildL() - begin");
       
   144     iNative->SvgElementAppendChild(aElementHandle, aChildElementHandle);
       
   145     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AppendChildL() - end");
       
   146 }
       
   147 
       
   148 // -----------------------------------------------------------------------------
       
   149 // CM2GSVGProxy::BeginElementAtL
       
   150 // -----------------------------------------------------------------------------
       
   151 void CM2GSVGProxy::BeginElementAtL(
       
   152     const TM2GSvgDocumentHandle& aDocumentHandle,
       
   153     const TM2GSvgElementHandle& aElementHandle,
       
   154     const TReal32& aOffset)
       
   155 {
       
   156     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::BeginElementAtL() offset:%f - begin", aOffset);
       
   157     iNative->SvgDocumentBeginElementAt(
       
   158         aDocumentHandle, aElementHandle, aOffset);
       
   159     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::BeginElementAtL() - end");
       
   160 }
       
   161 
       
   162 // -----------------------------------------------------------------------------
       
   163 // CM2GSVGProxy::CheckRemoveableL
       
   164 // -----------------------------------------------------------------------------
       
   165 void CM2GSVGProxy::CheckRemoveableL(
       
   166     const TM2GSvgElementHandle& aElementHandle,
       
   167     TInt& aRemoveable)
       
   168 
       
   169 {
       
   170     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CheckRemoveableL() - begin");
       
   171     aRemoveable = iNative->SvgElementCheckRemoveable(aElementHandle);
       
   172     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CheckRemoveableL() - end");
       
   173 }
       
   174 
       
   175 // -----------------------------------------------------------------------------
       
   176 // CM2GSVGProxy::ClearSvgSurfaceL
       
   177 // -----------------------------------------------------------------------------
       
   178 void CM2GSVGProxy::ClearSvgSurfaceL(const TM2GBitmapHandle& /* aSurfaceHandle */)
       
   179 {
       
   180     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::ClearSvgSurfaceL() - not supported");
       
   181     User::Leave(KErrNotSupported);
       
   182 }
       
   183 
       
   184 // -----------------------------------------------------------------------------
       
   185 // CM2GSVGProxy::CreateDocumentL
       
   186 // -----------------------------------------------------------------------------
       
   187 void CM2GSVGProxy::CreateDocumentL(const TPtrC16& aData, TM2GSvgDocumentHandle& aDocumentHandle)
       
   188 {
       
   189     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreateDocumentL() - begin");
       
   190     aDocumentHandle = M2G_INVALID_HANDLE;
       
   191 
       
   192     M2G_DEBUG_1("M2G_DEBUG: M2G_DEBUG: CM2GSVGProxy::CreateDocumentL(): content length=%d - call engine", aData.Length());
       
   193 
       
   194     // Create document handle. Note: validity check is done in java side
       
   195     aDocumentHandle = iNative->SvgDocumentCreateL(aData);
       
   196     // Append document handle to the container
       
   197     if (iSvgDocuments.Find(aDocumentHandle) == KErrNotFound)
       
   198     {
       
   199         TRAPD(err, iSvgDocuments.Append(aDocumentHandle));
       
   200         if (err != KM2GOk)
       
   201         {
       
   202             M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::CreateDocumentL(), cannot add handle=%d, err=%d", aDocumentHandle, err);
       
   203         }
       
   204     }
       
   205     M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::CreateDocumentL(), handle=%d, total document count=%d - end", aDocumentHandle, iSvgDocuments.Count());
       
   206 }
       
   207 
       
   208 // -----------------------------------------------------------------------------
       
   209 // CM2GSVGProxy::CreateElementNsL
       
   210 // -----------------------------------------------------------------------------
       
   211 void CM2GSVGProxy::CreateElementNsL(
       
   212     const TM2GSvgAttrType& aType,
       
   213     const TM2GSvgDocumentHandle& /* aDocumentHandle */,
       
   214     TM2GSvgElementHandle& aElementHandle)
       
   215 {
       
   216     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreateElementNsL() - begin");
       
   217     // Note: validity check is done in java side
       
   218     aElementHandle = iNative->SvgElementCreate(aType);
       
   219     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::CreateElementNsL() handle=%d - end", aElementHandle);
       
   220 }
       
   221 
       
   222 // -----------------------------------------------------------------------------
       
   223 // CM2GSVGProxy::CreatePathL
       
   224 // -----------------------------------------------------------------------------
       
   225 void CM2GSVGProxy::CreatePathL(TM2GSvgPathHandle& aPathHandle)
       
   226 {
       
   227     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreatePathL() - begin");
       
   228     aPathHandle = iNative->SvgPathCreate();
       
   229     if (aPathHandle == M2G_INVALID_HANDLE)
       
   230     {
       
   231         User::Leave(KM2GMemoryNotOk);
       
   232     }
       
   233     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreatePathL() - end");
       
   234 }
       
   235 
       
   236 // -----------------------------------------------------------------------------
       
   237 // CM2GSVGProxy::CreateSvgEngineL
       
   238 // -----------------------------------------------------------------------------
       
   239 void CM2GSVGProxy::CreateSvgEngineL(TM2GSvgEngineHandle& aEngineHandle)
       
   240 {
       
   241     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreateSvgEngineL() - begin");
       
   242     // Create engine handle
       
   243     aEngineHandle = iNative->SvgEngineCreate();
       
   244     if (aEngineHandle == M2G_INVALID_HANDLE)
       
   245     {
       
   246         User::Leave(KM2GMemoryNotOk);
       
   247     }
       
   248     // Append engine handle  to the container
       
   249     if (iSvgEngines.Find(aEngineHandle) == KErrNotFound)
       
   250     {
       
   251         TRAPD(err, iSvgEngines.Append(aEngineHandle));
       
   252         if (err != KM2GOk)
       
   253         {
       
   254             M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::CreateSvgEngineL(), cannot add handle=%d, err=%d", aEngineHandle, err);
       
   255         }
       
   256     }
       
   257     M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::CreateSvgEngineL(), handle=%d, total engine count=%d - end", aEngineHandle, iSvgEngines.Count());
       
   258 }
       
   259 
       
   260 // -----------------------------------------------------------------------------
       
   261 // CM2GSVGProxy::CreateSvgSurfaceL
       
   262 // -----------------------------------------------------------------------------
       
   263 TM2GBitmapHandle CM2GSVGProxy::CreateSvgSurfaceL(TInt /* aWidth */, TInt /* aHeight */)
       
   264 {
       
   265     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreateSvgSurfaceL() - not supported");
       
   266 
       
   267     User::Leave(KErrNotSupported);
       
   268 
       
   269     return M2G_INVALID_HANDLE;
       
   270 }
       
   271 
       
   272 // -----------------------------------------------------------------------------
       
   273 // CM2GSVGProxy::DeleteDocumentL
       
   274 // -----------------------------------------------------------------------------
       
   275 void CM2GSVGProxy::DeleteDocumentL(const TM2GSvgDocumentHandle& aDocumentHandle)
       
   276 {
       
   277     M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::DeleteDocumentL() native:%d, document:%d - begin", iNative, aDocumentHandle);
       
   278     TInt findResult = iSvgDocuments.Find(aDocumentHandle);
       
   279     if (findResult != KErrNotFound)
       
   280     {
       
   281         // Try to remove the handle from the container
       
   282         TRAPD(err, iSvgDocuments.Remove(findResult));
       
   283         if (err != KM2GOk)
       
   284         {
       
   285             M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::DeleteDocumentL(), cannot add handle=%d, err=%d", aDocumentHandle, err);
       
   286         }
       
   287         M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteDocumentL()  - container remove result=%d", err);
       
   288         // Delete the handle
       
   289         iNative->SvgDocumentDestroy(aDocumentHandle);
       
   290     }
       
   291     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteDocumentL() - total document count=%d - end", iSvgDocuments.Count());
       
   292 }
       
   293 
       
   294 // -----------------------------------------------------------------------------
       
   295 // CM2GSVGProxy::DeleteSvgEngineL
       
   296 // -----------------------------------------------------------------------------
       
   297 void CM2GSVGProxy::DeleteSvgEngineL(const TM2GSvgEngineHandle& aEngineHandle)
       
   298 {
       
   299     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteSvgEngineL() engine:%d - begin", aEngineHandle);
       
   300     TInt findResult = iSvgEngines.Find(aEngineHandle);
       
   301     if (findResult != KErrNotFound)
       
   302     {
       
   303         // Try to remove the handle from the container
       
   304         TRAPD(err, iSvgEngines.Remove(findResult));
       
   305         if (err != KM2GOk)
       
   306         {
       
   307             M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::DeleteSvgEngineL(), cannot add handle=%d, err=%d", aEngineHandle, err);
       
   308         }
       
   309         M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteSvgEngineL()  - container remove result=%d", err);
       
   310         // Delete the handle
       
   311         iNative->SvgEngineDestroy(aEngineHandle);
       
   312     }
       
   313     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteSvgEngineL() - total engine count=%d - end", iSvgEngines.Count());
       
   314 }
       
   315 
       
   316 // -----------------------------------------------------------------------------
       
   317 // CM2GSVGProxy::DeleteSvgSurfaceL
       
   318 // -----------------------------------------------------------------------------
       
   319 void CM2GSVGProxy::DeleteSvgSurfaceL(const TM2GBitmapHandle& /* aSurfaceHandle */)
       
   320 {
       
   321     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::DeleteSvgSurfaceL() - not supported");
       
   322 
       
   323     User::Leave(KErrNotSupported);
       
   324 }
       
   325 
       
   326 // -----------------------------------------------------------------------------
       
   327 // CM2GSVGProxy::DestroyPathL
       
   328 // -----------------------------------------------------------------------------
       
   329 void CM2GSVGProxy::DestroyPathL(const TM2GSvgPathHandle& aPathHandle)
       
   330 {
       
   331     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::DestroyPathL() - begin");
       
   332     iNative->SvgPathDestroy(aPathHandle);
       
   333     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::DestroyPathL() - end");
       
   334 }
       
   335 
       
   336 // -----------------------------------------------------------------------------
       
   337 // CM2GSVGProxy::DispatchMouseEventL
       
   338 // -----------------------------------------------------------------------------
       
   339 void CM2GSVGProxy::DispatchMouseEventL(
       
   340     const TM2GSvgDocumentHandle& aDocumentHandle,
       
   341     TInt aX, TInt aY, TM2GSvgElementHandle& aElementHandle)
       
   342 {
       
   343     M2G_DEBUG_3("M2G_DEBUG: CM2GSVGProxy::DispatchMouseEventL(): doc handle:%d, x=%d, y=%d- begin", aDocumentHandle, aX, aY);
       
   344     aElementHandle = iNative->SvgDocumentDispatchMouseEvent(
       
   345                          aDocumentHandle, aX, aY);
       
   346     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DispatchMouseEventL(): element handle=%d - end", aElementHandle);
       
   347 }
       
   348 
       
   349 // -----------------------------------------------------------------------------
       
   350 // CM2GSVGProxy::EndElementAtL
       
   351 // -----------------------------------------------------------------------------
       
   352 void CM2GSVGProxy::EndElementAtL(
       
   353     const TM2GSvgDocumentHandle& aDocumentHandle,
       
   354     const TM2GSvgElementHandle& aElementHandle,
       
   355     const TReal32& aOffset)
       
   356 {
       
   357     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::EndElementAtL() offset=%f - begin", aOffset);
       
   358     iNative->SvgDocumentEndElementAt(
       
   359         aDocumentHandle, aElementHandle, aOffset);
       
   360     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::EndElementAtL() - end");
       
   361 }
       
   362 
       
   363 // -----------------------------------------------------------------------------
       
   364 // CM2GSVGProxy::FocusOnL
       
   365 // -----------------------------------------------------------------------------
       
   366 void CM2GSVGProxy::FocusOnL(
       
   367     const TM2GSvgDocumentHandle& aDocumentHandle,
       
   368     const TM2GSvgElementHandle& aElementHandle)
       
   369 {
       
   370     M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::FocusOnL() document=%d, element=%d - begin", aDocumentHandle, aElementHandle);
       
   371     iNative->SvgDocumentFocusOn(aDocumentHandle, aElementHandle);
       
   372     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::FocusOnL() - end");
       
   373 }
       
   374 
       
   375 // -----------------------------------------------------------------------------
       
   376 // CM2GSVGProxy::FocusOutL
       
   377 // -----------------------------------------------------------------------------
       
   378 void CM2GSVGProxy::FocusOutL(
       
   379     const TM2GSvgDocumentHandle& aDocumentHandle,
       
   380     const TM2GSvgElementHandle& aElementHandle)
       
   381 {
       
   382     M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::FocusOutL() document=%d, element=%d - begin", aDocumentHandle, aElementHandle);
       
   383     iNative->SvgDocumentFocusOut(aDocumentHandle, aElementHandle);
       
   384     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::FocusOutL() - end");
       
   385 }
       
   386 
       
   387 // -----------------------------------------------------------------------------
       
   388 // CM2GSVGProxy::GetBBoxL
       
   389 // -----------------------------------------------------------------------------
       
   390 void CM2GSVGProxy::GetBBoxL(
       
   391     const TM2GSvgElementHandle& aElementHandle,
       
   392     const TM2GSvgAttrType& aAttributeType,
       
   393     TM2GRectData& aRectData, TInt& aResult)
       
   394 {
       
   395     aResult = KM2GOk;
       
   396     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetBBoxL() - begin");
       
   397     iNative->SvgElementGetBBox(
       
   398         aElementHandle,
       
   399         aAttributeType,
       
   400         &aRectData[ 0 ],  // X
       
   401         &aRectData[ 1 ],  // Y
       
   402         &aRectData[ 2 ],  // Width
       
   403         &aRectData[ 3 ]);  // Height
       
   404     M2G_DEBUG_4("M2G_DEBUG: CM2GSVGProxy::GetBBoxL(): [x=%f, y=%f, w=%f, h=%f] - end", aRectData[ 0 ], aRectData[ 1 ], aRectData[ 2 ], aRectData[ 3 ]);
       
   405 }
       
   406 
       
   407 // -----------------------------------------------------------------------------
       
   408 // CM2GSVGProxy::GetColorTrait
       
   409 // -----------------------------------------------------------------------------
       
   410 void CM2GSVGProxy::GetColorTraitL(
       
   411     const TM2GSvgElementHandle& aElementHandle,
       
   412     const TM2GSvgAttrType& aAttributeType,
       
   413     TM2GColorData& aColor,
       
   414     TInt& aResult)
       
   415 {
       
   416     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetColorTraitL() - begin");
       
   417     aResult = iNative->SvgElementGetColorAttribute(
       
   418                   aElementHandle,
       
   419                   aAttributeType,
       
   420                   &aColor[ 0 ],  // Red
       
   421                   &aColor[ 1 ],  // Green
       
   422                   &aColor[ 2 ]);  // Blue
       
   423     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetColorTraitL() - end");
       
   424 }
       
   425 
       
   426 // -----------------------------------------------------------------------------
       
   427 // CM2GSVGProxy::GetElementByIdL
       
   428 // -----------------------------------------------------------------------------
       
   429 void CM2GSVGProxy::GetElementByIdL(
       
   430     const TM2GSvgDocumentHandle& aDocumentHandle,
       
   431     const TPtrC16& aId,
       
   432     TM2GSvgElementHandle& aElementHandle)
       
   433 {
       
   434     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetElementByIdL() - begin");
       
   435     aElementHandle = iNative->SvgDocumentGetElementById(
       
   436                          aDocumentHandle,
       
   437                          aId);
       
   438     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetElementByIdL() - end");
       
   439 }
       
   440 
       
   441 // -----------------------------------------------------------------------------
       
   442 // CM2GSVGProxy::GetElementTypeIdL
       
   443 // -----------------------------------------------------------------------------
       
   444 void CM2GSVGProxy::GetElementTypeIdL(const TM2GSvgElementHandle& aElementHandle, TInt16& aId)
       
   445 {
       
   446     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetElementTypeIdL() - begin");
       
   447     aId = STATIC_CAST(TInt16, iNative->SvgElementGetType(aElementHandle));
       
   448     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetElementTypeIdL() type id:%d- end", aId);
       
   449 }
       
   450 
       
   451 // -----------------------------------------------------------------------------
       
   452 // CM2GSVGProxy::GetEnumTraitL
       
   453 // -----------------------------------------------------------------------------
       
   454 void CM2GSVGProxy::GetEnumTraitL(
       
   455     const TM2GSvgElementHandle& aElementHandle,
       
   456     const TM2GSvgAttrType& aAttributeTypeId,
       
   457     TInt16& aEnumTrait)
       
   458 {
       
   459     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetEnumTraitIdL() - begin");
       
   460     aEnumTrait = iNative->SvgElementGetEnumAttribute(
       
   461                      aElementHandle,
       
   462                      aAttributeTypeId);
       
   463     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetEnumTraitIdL() enum trait:%d - end", aEnumTrait);
       
   464 }
       
   465 
       
   466 // -----------------------------------------------------------------------------
       
   467 // CM2GSVGProxy::GetExternalListItemL
       
   468 // -----------------------------------------------------------------------------
       
   469 TInt CM2GSVGProxy::GetExternalListItemL(
       
   470     const TM2GSvgDocumentHandle& aDocumentHandle,
       
   471     TInt aIndex,
       
   472     TPtrC16& aItem)
       
   473 {
       
   474     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetExternalListItemL() index=%d- begin", aIndex);
       
   475     TInt result = iNative->SvgDocumentGetExternalListItem(aDocumentHandle, aIndex, aItem);
       
   476     M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::GetExternalListListItemL() result:%d, item sz:%d - end", result, aItem.Length());
       
   477     return result;
       
   478 }
       
   479 
       
   480 // -----------------------------------------------------------------------------
       
   481 // CM2GSVGProxy::GetExternalListSizeL
       
   482 // -----------------------------------------------------------------------------
       
   483 void CM2GSVGProxy::GetExternalListSizeL(
       
   484     const TM2GSvgDocumentHandle& aDocumentHandle,
       
   485     TInt& aListSz)
       
   486 {
       
   487     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetExternalListSizeL() - begin");
       
   488     aListSz = iNative->SvgDocumentGetExternalListSize(aDocumentHandle);
       
   489     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetExternalListSizeL(): %d - end", aListSz);
       
   490 }
       
   491 
       
   492 // -----------------------------------------------------------------------------
       
   493 // CM2GSVGProxy::GetFirstElementChildL
       
   494 // -----------------------------------------------------------------------------
       
   495 void CM2GSVGProxy::GetFirstElementChildL(
       
   496     const TM2GSvgElementHandle& aElementHandle,
       
   497     TM2GSvgElementHandle& aChildHandle)
       
   498 {
       
   499     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetFirstElementChildL() element=%d - begin", aElementHandle);
       
   500     aChildHandle = iNative->SvgElementGetFirstElementChild(aElementHandle);
       
   501     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetFirstElementChildL() child=%d - end", aChildHandle);
       
   502 }
       
   503 
       
   504 // -----------------------------------------------------------------------------
       
   505 // CM2GSVGProxy::GetFloatTraitL
       
   506 // -----------------------------------------------------------------------------
       
   507 void CM2GSVGProxy::GetFloatTraitL(
       
   508     const TM2GSvgElementHandle& aElementHandle,
       
   509     const TM2GSvgAttrType& aAttributeType,
       
   510     TReal32& aFloatTrait)
       
   511 {
       
   512     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetFloatTraitL() - begin");
       
   513     aFloatTrait =
       
   514         iNative->SvgElementGetFloatAttribute(aElementHandle, aAttributeType);
       
   515     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetFloatTraitL() - end");
       
   516 }
       
   517 
       
   518 // -----------------------------------------------------------------------------
       
   519 // CM2GSVGProxy::GetMatrixTraitL
       
   520 // -----------------------------------------------------------------------------
       
   521 void CM2GSVGProxy::GetMatrixTraitL(
       
   522     const TM2GSvgElementHandle& aElementHandle,
       
   523     const TM2GSvgAttrType& aAttributeType,
       
   524     TM2GMatrixData& aMatrix, TInt& aResult)
       
   525 {
       
   526     // [ m00 m01 m02 ]
       
   527     // [ m10 m11 m12 ]
       
   528     // [  0   0   1  ]
       
   529     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetMatrixTraitL() - begin");
       
   530     aResult = iNative->SvgElementGetMatrixAttribute(
       
   531                   aElementHandle,
       
   532                   aAttributeType,
       
   533                   &aMatrix[ 0 ], // m00
       
   534                   &aMatrix[ 1 ], // m10
       
   535                   &aMatrix[ 2 ], // m01
       
   536                   &aMatrix[ 3 ], // m11
       
   537                   &aMatrix[ 4 ], // m02
       
   538                   &aMatrix[ 5 ]);  // m12
       
   539     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetMatrixTraitL() - end");
       
   540 }
       
   541 
       
   542 // -----------------------------------------------------------------------------
       
   543 // CM2GSVGProxy::GetMediaTimeL
       
   544 // -----------------------------------------------------------------------------
       
   545 void CM2GSVGProxy::GetMediaTimeL(
       
   546     const TM2GSvgDocumentHandle& aDocumentHandle,
       
   547     TReal32& aSeconds)
       
   548 {
       
   549     aSeconds = iNative->SvgDocumentGetMediaTime(aDocumentHandle);
       
   550 }
       
   551 
       
   552 // -----------------------------------------------------------------------------
       
   553 // CM2GSVGProxy::GetNextElementSiblingL
       
   554 // -----------------------------------------------------------------------------
       
   555 void CM2GSVGProxy::GetNextElementSiblingL(
       
   556     const TM2GSvgElementHandle& aElementHandle,
       
   557     TM2GSvgElementHandle& aSiblingElementHandle)
       
   558 {
       
   559     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetNextElementSiblingL(), element=%d - begin", aElementHandle);
       
   560     aSiblingElementHandle = iNative->SvgElementGetNextElementSibling(aElementHandle);
       
   561     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetNextElementSiblingL(), sibling=%d - end", aSiblingElementHandle);
       
   562 }
       
   563 
       
   564 // -----------------------------------------------------------------------------
       
   565 // CM2GSVGProxy::GetNumberOfSegmentsL
       
   566 // -----------------------------------------------------------------------------
       
   567 void CM2GSVGProxy::GetNumberOfSegmentsL(
       
   568     const TM2GSvgPathHandle& aPathHandle,
       
   569     TInt& aNumberOfSegments)
       
   570 {
       
   571     aNumberOfSegments = iNative->SvgPathGetSegmentCount(aPathHandle);
       
   572 }
       
   573 
       
   574 // -----------------------------------------------------------------------------
       
   575 // CM2GSVGProxy::GetParentL
       
   576 // -----------------------------------------------------------------------------
       
   577 void CM2GSVGProxy::GetParentL(
       
   578     const TM2GSvgElementHandle& aElementHandle,
       
   579     TM2GSvgElementHandle& aParentElementHandle)
       
   580 {
       
   581     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetParentL() - begin");
       
   582     aParentElementHandle = iNative->SvgElementGetParent(aElementHandle);
       
   583     M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::GetParentL() element=%d, parent=%d, - end", aElementHandle, aParentElementHandle);
       
   584 }
       
   585 
       
   586 // -----------------------------------------------------------------------------
       
   587 // CM2GSVGProxy::GetPathTraitL
       
   588 // -----------------------------------------------------------------------------
       
   589 void CM2GSVGProxy::GetPathTraitL(
       
   590     const TM2GSvgElementHandle& aElementHandle,
       
   591     const TM2GSvgAttrType& aAttributeType,
       
   592     TInt& aPathTrait)
       
   593 {
       
   594     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetPathTraitL() - begin");
       
   595     aPathTrait = iNative->SvgElementGetPathAttribute(aElementHandle, aAttributeType);
       
   596     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetPathTraitL() %d - end", aPathTrait);
       
   597 }
       
   598 
       
   599 // -----------------------------------------------------------------------------
       
   600 // CM2GSVGProxy::GetRectTraitL
       
   601 // -----------------------------------------------------------------------------
       
   602 void CM2GSVGProxy::GetRectTraitL(
       
   603     const TM2GSvgElementHandle& aElementHandle,
       
   604     const TM2GSvgAttrType& aAttributeType,
       
   605     TM2GRectData& aRectData, TInt& aResult)
       
   606 {
       
   607     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetRectTraitL() - begin");
       
   608     aResult = iNative->SvgElementGetRectAttribute(
       
   609                   aElementHandle,
       
   610                   aAttributeType,
       
   611                   &aRectData[ 0 ], // X
       
   612                   &aRectData[ 1 ], // Y
       
   613                   &aRectData[ 2 ], // Width
       
   614                   &aRectData[ 3 ]);  // Height
       
   615     M2G_DEBUG_5("M2G_DEBUG: CM2GSVGProxy::GetRectTraitL(): result=%d [x=%f, y=%f, w=%f, h=%f] - end", aResult, aRectData[ 0 ], aRectData[ 1 ], aRectData[ 2 ], aRectData[ 3 ]);
       
   616 }
       
   617 
       
   618 // -----------------------------------------------------------------------------
       
   619 // CM2GSVGProxy::GetRootElementL
       
   620 // -----------------------------------------------------------------------------
       
   621 void CM2GSVGProxy::GetRootElementL(
       
   622     const TM2GSvgDocumentHandle& aDocumentHandle,
       
   623     TM2GSvgElementHandle& aRootElementHandle)
       
   624 {
       
   625     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetRootElementL() - begin");
       
   626     aRootElementHandle = iNative->SvgDocumentGetRootElement(aDocumentHandle);
       
   627     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetRootElementL() handle:%d - end", aRootElementHandle);
       
   628 }
       
   629 
       
   630 // -----------------------------------------------------------------------------
       
   631 // CM2GSVGProxy::GetScreenBBoxL
       
   632 // -----------------------------------------------------------------------------
       
   633 void CM2GSVGProxy::GetScreenBBoxL(
       
   634     const TM2GSvgElementHandle& aElementHandle,
       
   635     TM2GScreenBBoxData& aScreenBBoxData)
       
   636 {
       
   637     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetScreenBBoxL() - begin");
       
   638     iNative->SvgElementGetScreenBBox(
       
   639         aElementHandle,
       
   640         &aScreenBBoxData[ 0 ], // X
       
   641         &aScreenBBoxData[ 1 ], // Y
       
   642         &aScreenBBoxData[ 2 ], // Width
       
   643         &aScreenBBoxData[ 3 ]);  // Height
       
   644     M2G_DEBUG_4("M2G_DEBUG: CM2GSVGProxy::GetScreenBBoxL(): [x=%f, y=%f, w=%f, h=%f] - end", aScreenBBoxData[ 0 ], aScreenBBoxData[ 1 ], aScreenBBoxData[ 2 ], aScreenBBoxData[ 3 ]);
       
   645 }
       
   646 
       
   647 // -----------------------------------------------------------------------------
       
   648 // CM2GSVGProxy::GetSegmentParameterL
       
   649 // -----------------------------------------------------------------------------
       
   650 void CM2GSVGProxy::GetSegmentParameterL(
       
   651     const TM2GSvgPathHandle& aPathHandle,
       
   652     TInt aSegmentIndex, TInt aParamIndex,
       
   653     TReal32& aSegmentParam)
       
   654 {
       
   655     M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::SvgPathGetSegmentParameter(): index=%d, paramIndex=%d - begin", aSegmentIndex, aParamIndex);
       
   656     aSegmentParam = iNative->SvgPathGetSegmentParameter(
       
   657                         aPathHandle,
       
   658                         aSegmentIndex,
       
   659                         aParamIndex);
       
   660     M2G_DEBUG_3("M2G_DEBUG: CM2GSVGProxy::SvgPathGetSegmentParameter(): index=%d, paramIndex=%d, param=%d - end", aSegmentIndex, aParamIndex, aSegmentParam);
       
   661 }
       
   662 
       
   663 // -----------------------------------------------------------------------------
       
   664 // CM2GSVGProxy::GetSegmentTypeL
       
   665 // -----------------------------------------------------------------------------
       
   666 void CM2GSVGProxy::GetSegmentTypeL(
       
   667     const TM2GSvgPathHandle& aPathHandle,
       
   668     TInt aSegmentIndex,
       
   669     TInt16& aSegmentType)
       
   670 {
       
   671     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetSegmentTypeL(): index=%d - begin", aSegmentIndex);
       
   672     aSegmentType = iNative->SvgPathGetSegmentType(
       
   673                        aPathHandle,
       
   674                        aSegmentIndex);
       
   675     M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::GetSegmentTypeL(): index=%d, type=%d - end", aSegmentIndex, aSegmentType);
       
   676 }
       
   677 
       
   678 // -----------------------------------------------------------------------------
       
   679 // CM2GSVGProxy::GetStringTraitL
       
   680 // -----------------------------------------------------------------------------
       
   681 TInt CM2GSVGProxy::GetStringTraitL(
       
   682     const TM2GSvgElementHandle& aElementHandle,
       
   683     const TM2GSvgAttrType& aAttributeType,
       
   684     TPtrC16& aStr)
       
   685 {
       
   686     M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::GetStringTraitL(): attribute type:%d, handle:%u - begin", aAttributeType, aElementHandle);
       
   687 
       
   688     TInt result = iNative->SvgElementGetStringAttribute(aElementHandle,  aAttributeType, aStr);
       
   689     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetStringTraitL(): attribute sz:%d", aStr.Length());
       
   690     return result;
       
   691 }
       
   692 
       
   693 // -----------------------------------------------------------------------------
       
   694 // CM2GSVGProxy::GetSvgSurfaceHeightL
       
   695 // -----------------------------------------------------------------------------
       
   696 TInt CM2GSVGProxy::GetSvgSurfaceHeightL(const TM2GBitmapHandle& /* aSurfaceHandle */)
       
   697 {
       
   698     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetSvgSurfaceHeightL - not supported");
       
   699 
       
   700     User::Leave(KErrNotSupported);
       
   701 
       
   702     return 0;
       
   703 }
       
   704 
       
   705 // -----------------------------------------------------------------------------
       
   706 // CM2GSVGProxy::GetSvgSurfaceWidthL
       
   707 // -----------------------------------------------------------------------------
       
   708 TInt CM2GSVGProxy::GetSvgSurfaceWidthL(const TM2GBitmapHandle& /* aSurfaceHandle */)
       
   709 {
       
   710     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetSvgSurfaceWidthL - not supported");
       
   711 
       
   712     User::Leave(KErrNotSupported);
       
   713 
       
   714     return 0;
       
   715 }
       
   716 
       
   717 // -----------------------------------------------------------------------------
       
   718 // CM2GSVGProxy::GetUsedFromElementL
       
   719 // -----------------------------------------------------------------------------
       
   720 void CM2GSVGProxy::GetUsedFromElementL(
       
   721     const TM2GSvgElementHandle& aElementHandle,
       
   722     TM2GSvgElementHandle& aHandle)
       
   723 {
       
   724     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetUsedFromElementL() used from element=%d - begin", aElementHandle);
       
   725     aHandle = iNative->SvgElementGetUsedFromElement(aElementHandle);
       
   726     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetUsedFromElementL() found element=%d - end", aHandle);
       
   727 }
       
   728 
       
   729 // -----------------------------------------------------------------------------
       
   730 // CM2GSVGProxy::GetViewportHeightL
       
   731 // -----------------------------------------------------------------------------
       
   732 void CM2GSVGProxy::GetViewportHeightL(
       
   733     const TM2GSvgDocumentHandle& aDocumentHandle,
       
   734     TInt& aHeight)
       
   735 {
       
   736     aHeight = iNative->SvgDocumentGetViewportHeight(aDocumentHandle);
       
   737 }
       
   738 
       
   739 // -----------------------------------------------------------------------------
       
   740 // CM2GSVGProxy::GetViewportWidthL
       
   741 // -----------------------------------------------------------------------------
       
   742 void CM2GSVGProxy::GetViewportWidthL(
       
   743     const TM2GSvgDocumentHandle& aDocumentHandle,
       
   744     TInt& aWidth)
       
   745 {
       
   746     aWidth = iNative->SvgDocumentGetViewportWidth(aDocumentHandle);
       
   747 }
       
   748 
       
   749 // -----------------------------------------------------------------------------
       
   750 // CM2GSVGProxy::InitViewportL
       
   751 // -----------------------------------------------------------------------------
       
   752 void CM2GSVGProxy::InitViewportL(const TM2GSvgDocumentHandle& aDocumentHandle)
       
   753 {
       
   754     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::InitViewportL()");
       
   755     return iNative->SvgDocumentViewportInit(aDocumentHandle);
       
   756 }
       
   757 
       
   758 // -----------------------------------------------------------------------------
       
   759 // CM2GSVGProxy::InsertBeforeL
       
   760 // -----------------------------------------------------------------------------
       
   761 void CM2GSVGProxy::InsertBeforeL(
       
   762     const TM2GSvgElementHandle& aElementHandle,
       
   763     const TM2GSvgElementHandle& aNewChildElementHandle,
       
   764     const TM2GSvgElementHandle& aReferenceElementHandle)
       
   765 {
       
   766     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::InsertBeforeL() - begin");
       
   767     iNative->SvgElementInsertBefore(
       
   768         aElementHandle,
       
   769         aNewChildElementHandle,
       
   770         aReferenceElementHandle);
       
   771     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::InsertBeforeL() - end");
       
   772 }
       
   773 
       
   774 // -----------------------------------------------------------------------------
       
   775 // CM2GSVGProxy::IsActiveL
       
   776 // -----------------------------------------------------------------------------
       
   777 void CM2GSVGProxy::IsActiveL(const TM2GSvgElementHandle& aElementHandle, TInt& aActive)
       
   778 {
       
   779     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::IsActiveL() - begin");
       
   780     aActive = iNative->SvgElementIsActive(aElementHandle);
       
   781     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::IsActiveL() active:%d - end", aActive);
       
   782 }
       
   783 
       
   784 // -----------------------------------------------------------------------------
       
   785 // CM2GSVGProxy::IsElementInDomL
       
   786 // -----------------------------------------------------------------------------
       
   787 void CM2GSVGProxy::IsElementInDomL(
       
   788     const TM2GSvgDocumentHandle& aDocumentHandle,
       
   789     const TM2GSvgElementHandle& aElementHandle,
       
   790     TInt& aIsElementInDom)
       
   791 {
       
   792     M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::IsElementInDomL() doc handle=%d, elem handle=%d - begin", aDocumentHandle, aElementHandle);
       
   793     aIsElementInDom = iNative->SvgElementElementInDOM(
       
   794                           aDocumentHandle, aElementHandle);
       
   795     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::IsElementInDomL() result=%d - end", aIsElementInDom);
       
   796 }
       
   797 
       
   798 // -----------------------------------------------------------------------------
       
   799 // CM2GSVGProxy::IsUsedL
       
   800 // -----------------------------------------------------------------------------
       
   801 void CM2GSVGProxy::IsUsedL(const TM2GSvgElementHandle& aElementHandle, TInt& aResult)
       
   802 {
       
   803     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::IsUsedL() - begin");
       
   804     aResult = iNative->SvgElementIsUsed(aElementHandle);
       
   805     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::IsUsedL(), result=%d - end", aResult);
       
   806 }
       
   807 
       
   808 // -----------------------------------------------------------------------------
       
   809 // CM2GSVGProxy::RemoveChildL
       
   810 // -----------------------------------------------------------------------------
       
   811 void CM2GSVGProxy::RemoveChildL(
       
   812     const TM2GSvgElementHandle& aElementHandle,
       
   813     const TM2GSvgElementHandle& aChildElementHandle,
       
   814     TM2GSvgElementHandle& aHandle)
       
   815 {
       
   816     M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::RemoveChildL() parent=%d, child=%d - begin", aElementHandle, aChildElementHandle);
       
   817     aHandle = iNative->SvgElementRemoveChild(aElementHandle, aChildElementHandle);
       
   818     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::RemoveChildL() result handle=%d - end", aHandle);
       
   819 }
       
   820 
       
   821 
       
   822 // -----------------------------------------------------------------------------
       
   823 // CM2GSVGProxy::RenderDocumentL
       
   824 // -----------------------------------------------------------------------------
       
   825 void CM2GSVGProxy::RenderDocumentL(
       
   826     const TM2GSvgEngineHandle& aEngineHandle,
       
   827     const TM2GSvgDocumentHandle& aDocumentHandle,
       
   828     const TM2GBitmapHandle& aSurfaceHandle,
       
   829     TM2GBitmapHandle aSurfaceMaskHandle,
       
   830     TReal32 aCurrentTime)
       
   831 {
       
   832     M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() native:%d, time=%f - begin", iNative, aCurrentTime);
       
   833     M2G_DEBUG_3("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() engine:%d, doc:%d, surface:%d", aEngineHandle, aDocumentHandle, aSurfaceHandle);
       
   834     iNative->SvgEngineRenderDocument(
       
   835         aEngineHandle, aDocumentHandle, aSurfaceHandle, aSurfaceMaskHandle, aCurrentTime);
       
   836     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() - end");
       
   837 }
       
   838 
       
   839 //TODO following changes done for Qimage
       
   840 //Check for TUint or TInt for subsequent API Call
       
   841 void CM2GSVGProxy::RenderDocumentL(
       
   842     const TM2GSvgEngineHandle& aEngineHandle,
       
   843     const TM2GSvgDocumentHandle& aDocumentHandle,
       
   844     const TM2GSvgBitmapHandle& aSurfaceHandle,
       
   845     TM2GSvgBitmapHandle aSurfaceMaskHandle,
       
   846     TReal32 aCurrentTime)
       
   847     {
       
   848     M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() Qimage variant native:%d, time=%f - begin", iNative, aCurrentTime);
       
   849     M2G_DEBUG_3("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() engine:%d, doc:%d, SvgBitmapHandle:%d", aEngineHandle, aDocumentHandle, aSurfaceHandle);
       
   850     iNative->SvgEngineRenderDocument(
       
   851         aEngineHandle, aDocumentHandle, aSurfaceHandle, aSurfaceMaskHandle, aCurrentTime);
       
   852     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() - end");
       
   853     
       
   854     }
       
   855 
       
   856 // -----------------------------------------------------------------------------
       
   857 // CM2GSVGProxy::RenderQualityL
       
   858 // -----------------------------------------------------------------------------
       
   859 void CM2GSVGProxy::RenderQualityL(
       
   860     const TM2GSvgDocumentHandle& aEngineHandle,
       
   861     TInt aQuality)
       
   862 {
       
   863     iNative->SvgEngineSetRenderQuality(aEngineHandle, aQuality);
       
   864 }
       
   865 
       
   866 // -----------------------------------------------------------------------------
       
   867 // CM2GSVGProxy::RequestCompletedL
       
   868 // -----------------------------------------------------------------------------
       
   869 void CM2GSVGProxy::RequestCompletedL(
       
   870     const TM2GSvgDocumentHandle& aDocumentHandle,
       
   871     const TPtrC16& aURI,
       
   872     const TPtrC8& aResourceData,
       
   873     TInt& aCompleted)
       
   874 {
       
   875     M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::RequestCompleted() uri sz=%d, resource sz= %d ", aURI.Length(), aResourceData.Length());
       
   876     aCompleted = iNative->SvgDocumentRequestCompleted(
       
   877                      aDocumentHandle,
       
   878                      aURI,
       
   879                      aResourceData);
       
   880     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::RequestCompletedL() completed=%d - end", aCompleted);
       
   881 }
       
   882 
       
   883 // -----------------------------------------------------------------------------
       
   884 // CM2GSVGProxy::SetColorTraitL
       
   885 // -----------------------------------------------------------------------------
       
   886 void CM2GSVGProxy::SetColorTraitL(
       
   887     const TM2GSvgElementHandle& aElementHandle,
       
   888     const TM2GSvgAttrType& aAttributeType,
       
   889     const TM2GColorData& aColor)
       
   890 {
       
   891     iNative->SvgElementSetColorAttribute(
       
   892         aElementHandle,
       
   893         aAttributeType,
       
   894         aColor[ 0 ],  // red
       
   895         aColor[ 1 ],  // green
       
   896         aColor[ 2 ]);  // blue
       
   897 }
       
   898 
       
   899 // -----------------------------------------------------------------------------
       
   900 // CM2GSVGProxy::SetEnumTraitL
       
   901 // -----------------------------------------------------------------------------
       
   902 void CM2GSVGProxy::SetEnumTraitL(
       
   903     const TM2GSvgElementHandle& aElementHandle,
       
   904     const TM2GSvgAttrType& aAttributeType,
       
   905     TInt16 aValue)
       
   906 {
       
   907     iNative->SvgElementSetEnumAttribute(
       
   908         aElementHandle,
       
   909         aAttributeType,
       
   910         aValue);
       
   911 }
       
   912 
       
   913 // -----------------------------------------------------------------------------
       
   914 // CM2GSVGProxy::SetFloatTraitL
       
   915 // -----------------------------------------------------------------------------
       
   916 void CM2GSVGProxy::SetFloatTraitL(
       
   917     const TM2GSvgElementHandle& aElementHandle,
       
   918     const TM2GSvgAttrType& aAttributeType,
       
   919     const TReal32& aValue)
       
   920 {
       
   921     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetFloatTraitL() - %f", aValue);
       
   922     iNative->SvgElementSetFloatAttribute(
       
   923         aElementHandle,
       
   924         aAttributeType,
       
   925         aValue);
       
   926 }
       
   927 
       
   928 // -----------------------------------------------------------------------------
       
   929 // CM2GSVGProxy::SetMatrixTraitL
       
   930 // -----------------------------------------------------------------------------
       
   931 void CM2GSVGProxy::SetMatrixTraitL(
       
   932     const TM2GSvgElementHandle& aElementHandle,
       
   933     const TM2GSvgAttrType& aAttributeType,
       
   934     const TM2GMatrixData& aMatrix)
       
   935 {
       
   936     // [ m00 m01 m02 ]
       
   937     // [ m10 m11 m12 ]
       
   938     // [  0   0   1  ]
       
   939     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetMatrixTraitL() - begin");
       
   940     iNative->SvgElementSetMatrixAttribute(
       
   941         aElementHandle,
       
   942         aAttributeType,
       
   943         aMatrix[ 0 ],  // m00 - A
       
   944         aMatrix[ 1 ],  // m10 - B
       
   945         aMatrix[ 2 ],  // m01 - C
       
   946         aMatrix[ 3 ],  // m11 - D
       
   947         aMatrix[ 4 ],  // m02 - E
       
   948         aMatrix[ 5 ]);  // m12 - F
       
   949     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetMatrixTraitL() - end");
       
   950 }
       
   951 
       
   952 // -----------------------------------------------------------------------------
       
   953 // CM2GSVGProxy::SetMediaTimeL
       
   954 // -----------------------------------------------------------------------------
       
   955 void CM2GSVGProxy::SetMediaTimeL(
       
   956     const TM2GSvgDocumentHandle& aDocumentHandle,
       
   957     const TReal32& aSeconds)
       
   958 {
       
   959     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetMediaTimeL() %f - begin", aSeconds);
       
   960     iNative->SvgDocumentSetMediaTime(aDocumentHandle, aSeconds);
       
   961     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetMediaTimeL() - end");
       
   962 }
       
   963 
       
   964 // -----------------------------------------------------------------------------
       
   965 // CM2GSVGProxy::SetPathTraitL
       
   966 // -----------------------------------------------------------------------------
       
   967 void CM2GSVGProxy::SetPathTraitL(
       
   968     const TM2GSvgElementHandle& aElementHandle,
       
   969     const TM2GSvgAttrType& aAttributeType,
       
   970     const TM2GSvgPathHandle& aPathHandle)
       
   971 {
       
   972     iNative->SvgElementSetPathAttribute(
       
   973         aElementHandle,
       
   974         aAttributeType,
       
   975         aPathHandle);
       
   976 }
       
   977 
       
   978 // -----------------------------------------------------------------------------
       
   979 // CM2GSVGProxy::SetRectTraitL
       
   980 // -----------------------------------------------------------------------------
       
   981 void CM2GSVGProxy::SetRectTraitL(
       
   982     const TM2GSvgElementHandle& aElementHandle,
       
   983     const TM2GSvgAttrType& aAttributeType,
       
   984     const TM2GRectData& aRect)
       
   985 {
       
   986     iNative->SvgElementSetRectAttribute(
       
   987         aElementHandle,
       
   988         aAttributeType,
       
   989         aRect[ 0 ],  // aX
       
   990         aRect[ 1 ],  // aY
       
   991         aRect[ 2 ],  // aWidth
       
   992         aRect[ 3 ]);  // aHeight
       
   993 }
       
   994 
       
   995 // -----------------------------------------------------------------------------
       
   996 // CM2GSVGProxy::SetRenderingQualityL
       
   997 // -----------------------------------------------------------------------------
       
   998 void CM2GSVGProxy::SetRenderingQualityL(
       
   999     const TM2GSvgDocumentHandle& aEngineHandle,
       
  1000     TInt aMode)
       
  1001 {
       
  1002     iNative->SvgEngineSetRenderQuality(aEngineHandle, aMode);
       
  1003 }
       
  1004 
       
  1005 // -----------------------------------------------------------------------------
       
  1006 // CM2GSVGProxy::SetStringTraitL
       
  1007 // -----------------------------------------------------------------------------
       
  1008 void CM2GSVGProxy::SetStringTraitL(
       
  1009     const TM2GSvgElementHandle& aElementHandle,
       
  1010     const TM2GSvgAttrType& aAttributeTypeId,
       
  1011     const TPtrC16& aStr)
       
  1012 {
       
  1013     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetStringTraitL() - begin");
       
  1014     iNative->SvgElementSetStringAttribute(
       
  1015         aElementHandle,
       
  1016         aAttributeTypeId,
       
  1017         aStr);
       
  1018     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetStringTraitL(): str sz:%d - end", aStr.Length());
       
  1019 }
       
  1020 
       
  1021 // -----------------------------------------------------------------------------
       
  1022 // CM2GSVGProxy::SetViewportWidthL
       
  1023 // -----------------------------------------------------------------------------
       
  1024 void CM2GSVGProxy::SetViewportWidthL(
       
  1025     const TM2GSvgDocumentHandle& aDocumentHandle,
       
  1026     TInt aWidth)
       
  1027 {
       
  1028     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetViewportWidthL(): %d - begin", aWidth);
       
  1029     iNative->SvgDocumentSetViewportWidth(aDocumentHandle, aWidth);
       
  1030     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetViewportWidthL() - end");
       
  1031 }
       
  1032 
       
  1033 // -----------------------------------------------------------------------------
       
  1034 // CM2GSVGProxy::SetViewportHeightL
       
  1035 // -----------------------------------------------------------------------------
       
  1036 void CM2GSVGProxy::SetViewportHeightL(
       
  1037     const TM2GSvgDocumentHandle& aDocumentHandle,
       
  1038     TInt aHeight)
       
  1039 {
       
  1040     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetViewportHeightL(): %d - begin", aHeight);
       
  1041     iNative->SvgDocumentSetViewportHeight(aDocumentHandle, aHeight);
       
  1042     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetViewportHeightL() - end");
       
  1043 }
       
  1044 
       
  1045 // == PROTECTED METHODS ==
       
  1046 
       
  1047 // -----------------------------------------------------------------------------
       
  1048 // CM2GSVGProxy::CloseContainers
       
  1049 // -----------------------------------------------------------------------------
       
  1050 void CM2GSVGProxy::CloseContainers()
       
  1051 {
       
  1052     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CloseContainers() - begin");
       
  1053     if (iNative)
       
  1054     {
       
  1055         // Clear document container
       
  1056         TInt count = iSvgDocuments.Count();
       
  1057         M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::CloseContainers() - document count=%d", count);
       
  1058         for (TInt index = 0; index < count; index++)
       
  1059         {
       
  1060             iNative->SvgDocumentDestroy(iSvgDocuments[index]);
       
  1061         }
       
  1062         iSvgDocuments.Reset();
       
  1063         iSvgDocuments.Close();
       
  1064         // Clear engine container
       
  1065         count = iSvgEngines.Count();
       
  1066         M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::CloseContainers() - engine count=%d", count);
       
  1067         for (TInt index = 0; index < count; index++)
       
  1068         {
       
  1069             iNative->SvgEngineDestroy(iSvgEngines[index]);
       
  1070         }
       
  1071         iSvgEngines.Reset();
       
  1072         iSvgEngines.Close();
       
  1073     }
       
  1074     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CloseContainers() - end");
       
  1075 }
       
  1076 
       
  1077 // == PRIVATE METHODS ==
       
  1078 
       
  1079 // -----------------------------------------------------------------------------
       
  1080 // CM2GSVGProxy::CM2GSVGProxy
       
  1081 // -----------------------------------------------------------------------------
       
  1082 CM2GSVGProxy::CM2GSVGProxy()
       
  1083         : CBase(),
       
  1084         iNative(NULL),
       
  1085         iSvgEngines(),
       
  1086         iSvgDocuments()
       
  1087 {
       
  1088     iSvgEngines.Compress();
       
  1089     iSvgDocuments.Compress();
       
  1090 }
       
  1091 
       
  1092 // -----------------------------------------------------------------------------
       
  1093 // CM2GSVGProxy::ConstructL
       
  1094 // -----------------------------------------------------------------------------
       
  1095 void CM2GSVGProxy::ConstructL()
       
  1096 {
       
  1097     M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::ConstructL() - begin");
       
  1098 
       
  1099     //Get the font spec with variant default font
       
  1100     const TInt KApacFontId   = EApacPlain16;
       
  1101     const TInt KLatintFontId = ELatinBold12;
       
  1102     TInt fontId = KLatintFontId;
       
  1103 
       
  1104     switch (AknLayoutUtils::Variant())
       
  1105     {
       
  1106     case EApacVariant:
       
  1107     {
       
  1108         fontId = KApacFontId;
       
  1109     }
       
  1110     break;
       
  1111 
       
  1112     case EEuropeanVariant:
       
  1113     default:
       
  1114         break;
       
  1115     }
       
  1116 
       
  1117     const CFont* font = AknLayoutUtils::FontFromId(fontId);
       
  1118     TFontSpec spec = font->FontSpecInTwips();
       
  1119 
       
  1120     iNative = CSvgJavaInterfaceImpl::NewL(spec);
       
  1121     M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::ConstructL() - SVGTopt created: %d", iNative);
       
  1122 }
       
  1123 
       
  1124 M2G_NS_END