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