javauis/m2g_qt/src/jni/M2GSVGImage.cpp
changeset 87 1627c337e51e
parent 80 d6dafc5d983f
equal deleted inserted replaced
80:d6dafc5d983f 87:1627c337e51e
     1 /*
     1 /*
     2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    62 {
    62 {
    63     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _dispatchMouseEvent - begin");
    63     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _dispatchMouseEvent - begin");
    64 
    64 
    65     TInt elementHandle = M2G_INVALID_HANDLE;
    65     TInt elementHandle = M2G_INVALID_HANDLE;
    66     TInt err = KM2GNotOk;
    66     TInt err = KM2GNotOk;
    67     
    67 
    68     M2G_DO_LOCK
    68     M2G_DO_LOCK
    69     if (aSvgProxyHandle)
    69     if (aSvgProxyHandle)
    70         {
    70     {
    71             MM2GSVGProxy *  aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
    71         MM2GSVGProxy *  aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
    72             TRAP(err, aProxy->DispatchMouseEventL(
    72         TRAP(err, aProxy->DispatchMouseEventL(
    73                     STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
    73                  STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
    74                     aX, aY, elementHandle); );
    74                  aX, aY, elementHandle););
    75         }
    75     }
    76     M2G_DO_UNLOCK(aJni)
    76     M2G_DO_UNLOCK(aJni)
    77 
    77 
    78     M2GGeneral::CheckErrorCode(aJni, err);
    78     M2GGeneral::CheckErrorCode(aJni, err);
    79 
    79 
    80     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _dispatchMouseEvent: %d - end", elementHandle);
    80     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _dispatchMouseEvent: %d - end", elementHandle);
    98     jint aSvgProxyHandle,
    98     jint aSvgProxyHandle,
    99     jint aDocumentHandle, jint aElementHandle)
    99     jint aDocumentHandle, jint aElementHandle)
   100 {
   100 {
   101     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOn - begin");
   101     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOn - begin");
   102 
   102 
   103     // TInt elementHandle = M2G_INVALID_HANDLE;
   103     TInt err = KM2GNotOk;
   104      TInt err = KM2GNotOk;  
   104 
   105      
   105     if (aSvgProxyHandle)
   106      if (aSvgProxyHandle)
   106     {
   107          {
   107         MM2GSVGProxy *     aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
   108          MM2GSVGProxy *     aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
   108         TRAP(err, aProxy->FocusOnL(
   109          TRAP(err, aProxy->FocusOnL(
   109                  STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
   110                  STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
   110                  STATIC_CAST(TM2GSvgElementHandle, aElementHandle)););
   111                  STATIC_CAST(TM2GSvgElementHandle, aElementHandle)); ); 
   111     }
   112          }
   112 
   113      
       
   114     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOn: %d - end", err);
   113     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOn: %d - end", err);
   115 }
   114 }
   116 
   115 
   117 
   116 
   118 // -----------------------------------------------------------------------------
   117 // -----------------------------------------------------------------------------
   132     jclass,
   131     jclass,
   133     jint aSvgProxyHandle,
   132     jint aSvgProxyHandle,
   134     jint aDocumentHandle, jint aElementHandle)
   133     jint aDocumentHandle, jint aElementHandle)
   135 {
   134 {
   136     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOut - begin");
   135     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOut - begin");
   137     TInt err = KM2GNotOk; 
   136     TInt err = KM2GNotOk;
   138     
   137 
   139     if (aSvgProxyHandle)
   138     if (aSvgProxyHandle)
   140         {
   139     {
   141         MM2GSVGProxy *    aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
   140         MM2GSVGProxy *    aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
   142         TRAP(err,aProxy->FocusOutL(
   141         TRAP(err,aProxy->FocusOutL(
   143             STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
   142                  STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
   144             STATIC_CAST(TM2GSvgElementHandle, aElementHandle));  ); 
   143                  STATIC_CAST(TM2GSvgElementHandle, aElementHandle)););
   145         }
   144     }
   146 
   145 
   147     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOut: %d - end", err);
   146     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOut: %d - end", err);
   148 
   147 
   149 }
   148 }
   150 
   149 
   171     jint aIndex)
   170     jint aIndex)
   172 {
   171 {
   173     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListItem - begin");
   172     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListItem - begin");
   174     TPtrC16 lItem;
   173     TPtrC16 lItem;
   175     TInt err    = KM2GNotOk;
   174     TInt err    = KM2GNotOk;
   176         
   175 
   177     M2G_DO_LOCK
   176     M2G_DO_LOCK
   178     if (aSvgProxyHandle)
   177     if (aSvgProxyHandle)
   179         {
   178     {
   180          MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
   179         MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
   181          TRAP(err, aProxy->GetExternalListItemL(
   180         TRAP(err, aProxy->GetExternalListItemL(
   182                              STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
   181                  STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
   183                              aIndex,
   182                  aIndex,
   184                              lItem); );
   183                  lItem););
   185         }
   184     }
   186     M2G_DO_UNLOCK(aJni)
   185     M2G_DO_UNLOCK(aJni)
   187 
   186 
   188     if ((M2GGeneral::CheckErrorCode(aJni, err) == KM2GOk) && (lItem.Length() > 0))
   187     if ((M2GGeneral::CheckErrorCode(aJni, err) == KM2GOk) && (lItem.Length() > 0))
   189     {
   188     {
   190         return CreateJavaString(*aJni, lItem);
   189         return CreateJavaString(*aJni, lItem);
   209     jint aSvgProxyHandle,
   208     jint aSvgProxyHandle,
   210     jint aDocumentHandle)
   209     jint aDocumentHandle)
   211 {
   210 {
   212     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListSize - begin");
   211     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListSize - begin");
   213 
   212 
   214     // TInt elementHandle = M2G_INVALID_HANDLE;
       
   215     TInt err           = KM2GNotOk;
   213     TInt err           = KM2GNotOk;
   216     TInt listSz = 0;
   214     TInt listSz = 0;
   217     
   215 
   218     M2G_DO_LOCK
   216     M2G_DO_LOCK
   219     if (aSvgProxyHandle)
   217     if (aSvgProxyHandle)
   220         {
   218     {
   221          MM2GSVGProxy *  aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
   219         MM2GSVGProxy *  aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
   222          TRAP(err, aProxy->GetExternalListSizeL(
   220         TRAP(err, aProxy->GetExternalListSizeL(
   223                 STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle), listSz); );
   221                  STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle), listSz););
   224         }
   222     }
   225     M2G_DO_UNLOCK(aJni)
   223     M2G_DO_UNLOCK(aJni)
   226 
   224 
   227     M2GGeneral::CheckErrorCode(aJni, err);
   225     M2GGeneral::CheckErrorCode(aJni, err);
   228 
   226 
   229     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListSize: %d - end", listSz);
   227     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListSize: %d - end", listSz);
   249     jclass,
   247     jclass,
   250     jint aSvgProxyHandle,
   248     jint aSvgProxyHandle,
   251     jint aDocumentHandle)
   249     jint aDocumentHandle)
   252 {
   250 {
   253     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _initViewport - begin");
   251     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _initViewport - begin");
   254     // TInt elementHandle = M2G_INVALID_HANDLE;
   252 
   255      TInt err           = KM2GNotOk;
   253     TInt err           = KM2GNotOk;
   256      
   254 
   257      if (aSvgProxyHandle)
   255     if (aSvgProxyHandle)
   258          {
   256     {
   259            MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
   257         MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
   260            TRAP(err, aProxy->InitViewportL(
   258         TRAP(err, aProxy->InitViewportL(
   261                 STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle));  ); 
   259                  STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle)););
   262          }
   260     }
   263      M2GGeneral::CheckErrorCode(aJni, err);
   261     M2GGeneral::CheckErrorCode(aJni, err);
   264      
   262 
   265      M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _initViewport: %d - end", err);
   263     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _initViewport: %d - end", err);
   266 
   264 
   267 }
   265 }
   268 
   266 
   269 M2G_NS_END
   267 M2G_NS_END