svgtviewer/SvgtViewerPlugin/ScreenSaverPluginSrc/Svgtpluginmain.cpp
branchRCL_3
changeset 14 20b99a6d6175
equal deleted inserted replaced
13:e52958d06c29 14:20b99a6d6175
       
     1 /*
       
     2 * Copyright (c) 2005 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:  SVGT Plugin Implementation source file
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include <implementationproxy.h>
       
    20 #include <cecombrowserplugininterface.h>
       
    21 
       
    22 #include "Svgtplugin.h"
       
    23 
       
    24 const TInt KPluginVersion = 1;
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // CSvgtPluginEcomMain::NewL
       
    28 // -----------------------------------------------------------------------------
       
    29 //  
       
    30 CSvgtPluginEcomMain* CSvgtPluginEcomMain::NewL(TAny* aInitParam)
       
    31     {
       
    32     if ( !aInitParam )
       
    33         {
       
    34         User::Leave(KErrArgument);
       
    35         }
       
    36         
       
    37     // aInitParam has both the NPNImplementation Functions implemented by
       
    38     // the ScreensaverAnimPlugin and the functions  implemented by the 
       
    39     // SVGPlugin for animation plugin.  
       
    40         
       
    41     TFuncs* funcs = REINTERPRET_CAST( TFuncs*, aInitParam);
       
    42     CSvgtPluginEcomMain* self = new(ELeave)
       
    43                                 CSvgtPluginEcomMain(funcs->iNetscapeFuncs);
       
    44     CleanupStack::PushL(self);
       
    45     self->ConstructL(funcs->iPluginFuncs);
       
    46     CleanupStack::Pop( self );
       
    47     Dll :: SetTls ( (void*) self );
       
    48     return self;
       
    49     }
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // CSvgtPluginEcomMain::ConstructL
       
    53 // -----------------------------------------------------------------------------
       
    54 //  
       
    55 void CSvgtPluginEcomMain::ConstructL(NPPluginFuncs* aPluginFuncs)
       
    56     {
       
    57     InitializeFuncs(aPluginFuncs);
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CSvgtPluginEcomMain::CSvgtPluginEcomMain
       
    62 // -----------------------------------------------------------------------------
       
    63 //  
       
    64 CSvgtPluginEcomMain::CSvgtPluginEcomMain(NPNetscapeFuncs* aNpf) : 
       
    65                             CEcomBrowserPluginInterface(),iNpf(aNpf)
       
    66     {
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CSvgtPluginEcomMain::~CSvgtPluginEcomMain
       
    71 // -----------------------------------------------------------------------------
       
    72 // 
       
    73 CSvgtPluginEcomMain::~CSvgtPluginEcomMain()
       
    74     {    
       
    75     }
       
    76       
       
    77 const TImplementationProxy KImplementationTable[] =
       
    78     {
       
    79     {{KSvgtPluginImplementationValue}, 
       
    80     (TProxyNewLPtr) CSvgtPluginEcomMain::NewL}
       
    81     };
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // ImplementationGroupProxy
       
    85 // -----------------------------------------------------------------------------
       
    86 // 
       
    87 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
    88     {
       
    89     aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy);
       
    90     return KImplementationTable;
       
    91     }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // InitializeFuncs
       
    95 // -----------------------------------------------------------------------------
       
    96 // 
       
    97 EXPORT_C NPError InitializeFuncs(NPPluginFuncs* aPpf)
       
    98     {
       
    99     if ( !aPpf )
       
   100         {
       
   101         return NPERR_GENERIC_ERROR;
       
   102         }
       
   103     aPpf->size = sizeof(NPPluginFuncs);
       
   104     aPpf->version = KPluginVersion;
       
   105     aPpf->newp          = NewNPP_NewProc(SvgtPluginNewp);
       
   106     aPpf->destroy       = NewNPP_DestroyProc(SvgtPluginDestroy);
       
   107     aPpf->setwindow     = NewNPP_SetWindowProc(SvgtPluginSetWindow);
       
   108     aPpf->newstream     = NULL;
       
   109     aPpf->destroystream = NULL;
       
   110     aPpf->asfile        = NewNPP_StreamAsFileProc(SvgtPluginAsFile);
       
   111     aPpf->writeready    = NULL;
       
   112     aPpf->write         = NULL;
       
   113     aPpf->print         = NULL;
       
   114     aPpf->event         = NULL;
       
   115     aPpf->urlnotify     = NULL;
       
   116     aPpf->javaClass     = NULL;
       
   117     aPpf->getvalue      = NewNPP_GetValueProc(SvgtPluginGetValue);
       
   118     aPpf->setvalue      = NewNPP_SetValueProc(SvgtPluginSetValue);
       
   119     return NPERR_NO_ERROR;
       
   120     
       
   121     }
       
   122 
       
   123 // -----------------------------------------------------------------------------
       
   124 // NPP_Shutdown
       
   125 // -----------------------------------------------------------------------------
       
   126 // 
       
   127 EXPORT_C void NPP_Shutdown(void)
       
   128     {
       
   129     CSvgtPluginEcomMain* npm = (CSvgtPluginEcomMain*) Dll :: Tls ();
       
   130     delete npm;
       
   131     Dll :: SetTls ( NULL );
       
   132     }
       
   133 
       
   134 
       
   135 // End of File