diff options
author | Philipp Lohmann <pl@openoffice.org> | 2001-05-30 10:15:34 +0000 |
---|---|---|
committer | Philipp Lohmann <pl@openoffice.org> | 2001-05-30 10:15:34 +0000 |
commit | 24e1def1acac42662fd3d05800e3133479fed162 (patch) | |
tree | 2f832d2335372b070b5912a6ce31c69c942c6c60 /extensions/source/plugin/win | |
parent | a214a93b58257d0dc63f2923633f258ded4cd1a7 (diff) |
#79029# #87573# #83080# access plugins only in solar thread on windows
Diffstat (limited to 'extensions/source/plugin/win')
-rw-r--r-- | extensions/source/plugin/win/sysplug.cxx | 285 | ||||
-rw-r--r-- | extensions/source/plugin/win/winmgr.cxx | 6 |
2 files changed, 219 insertions, 72 deletions
diff --git a/extensions/source/plugin/win/sysplug.cxx b/extensions/source/plugin/win/sysplug.cxx index 57e537a70625..c704ffc0449f 100644 --- a/extensions/source/plugin/win/sysplug.cxx +++ b/extensions/source/plugin/win/sysplug.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sysplug.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dbo $ $Date: 2001-02-02 14:37:04 $ + * last change: $Author: pl $ $Date: 2001-05-30 11:15:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -101,32 +101,8 @@ PluginComm_Impl::PluginComm_Impl( const OUString& rMIME, const OUString& rName, #endif DBG_ASSERT( _plDLL, "### loading plugin dll failed!" ); - NPError nErr; - NPError (WINAPI * pEntry)( NPPluginFuncs* ); - if (_plDLL && retrieveFunction( _T("NP_GetEntryPoints"), (void**)&pEntry )) - { - _NPPfuncs.size = sizeof( _NPPfuncs ); - _NPPfuncs.version = 0; - nErr = (*pEntry)( &_NPPfuncs ); - - DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NP_GetEntryPoints() failed!" ); - DBG_ASSERT( (_NPPfuncs.version >> 8) >= NP_VERSION_MAJOR, - "### version failure!" ); - - NPError (WINAPI * pInit)( NPNetscapeFuncs* ); - if (nErr == NPERR_NO_ERROR && - (_NPPfuncs.version >> 8) >= NP_VERSION_MAJOR && - (retrieveFunction( _T("NP_Initialize"), (void**)&pInit ) || - retrieveFunction( _T("NP_PluginInit"), (void**)&pInit ))) - { - nErr = (*pInit)( &aNPNFuncs ); - DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NP_Initialize() failed!" ); - -// WIN obsolete: called by NP_Initialize() -// nErr = NPP_Initialize(); -// DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NPP_Initialize() failed!" ); - } - } + m_eCall = eNP_Initialize; + execute(); } //-------------------------------------------------------------------------------------------------- @@ -161,21 +137,168 @@ BOOL PluginComm_Impl::retrieveFunction( TCHAR* pName, void** ppFunc ) const } //-------------------------------------------------------------------------------------------------- + +long PluginComm_Impl::doIt() +{ + long nRet = 0; + switch( m_eCall ) + { + case eNP_Initialize: + { + NPError nErr = NPERR_NO_ERROR; + NPError (WINAPI * pEntry)( NPPluginFuncs* ); + if (_plDLL && retrieveFunction( _T("NP_GetEntryPoints"), (void**)&pEntry )) + { + _NPPfuncs.size = sizeof( _NPPfuncs ); + _NPPfuncs.version = 0; + nErr = (*pEntry)( &_NPPfuncs ); + + DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NP_GetEntryPoints() failed!" ); + DBG_ASSERT( (_NPPfuncs.version >> 8) >= NP_VERSION_MAJOR, + "### version failure!" ); + + NPError (WINAPI * pInit)( NPNetscapeFuncs* ); + if (nErr == NPERR_NO_ERROR && + (_NPPfuncs.version >> 8) >= NP_VERSION_MAJOR && + (retrieveFunction( _T("NP_Initialize"), (void**)&pInit ) || + retrieveFunction( _T("NP_PluginInit"), (void**)&pInit ))) + { + nErr = (*pInit)( &aNPNFuncs ); + DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NP_Initialize() failed!" ); + } + } + nRet = nErr; + } + break; + case eNPP_Destroy: + nRet = (_NPPfuncs.destroy + ? (*_NPPfuncs.destroy)( + (NPP)m_aArgs[0], + (NPSavedData**)m_aArgs[1] ) + : NPERR_GENERIC_ERROR); + break; + case eNPP_DestroyStream: + nRet = (_NPPfuncs.destroystream + ? (*_NPPfuncs.destroystream)( + (NPP)m_aArgs[0], + (NPStream*)m_aArgs[1], + (NPError)m_aArgs[2] ) + : NPERR_GENERIC_ERROR); + break; + case eNPP_New: + nRet = (_NPPfuncs.newp + ? (*_NPPfuncs.newp)( + (NPMIMEType)m_aArgs[0], + (NPP)m_aArgs[1], + (uint16)m_aArgs[2], + (int16)m_aArgs[3], + (char**)m_aArgs[4], + (char**)m_aArgs[5], + (NPSavedData*)m_aArgs[6] ) + : NPERR_GENERIC_ERROR); + break; + case eNPP_NewStream: + nRet = (_NPPfuncs.newstream + ? (*_NPPfuncs.newstream)( + (NPP)m_aArgs[0], + (NPMIMEType)m_aArgs[1], + (NPStream*)m_aArgs[2], + (NPBool)m_aArgs[3], + (uint16*)m_aArgs[4] ) + : NPERR_GENERIC_ERROR); + break; + case eNPP_Print: + if (_NPPfuncs.print) + (*_NPPfuncs.print)( + (NPP)m_aArgs[0], + (NPPrint*)m_aArgs[1] ); + break; + case eNPP_SetWindow: + nRet = (_NPPfuncs.setwindow + ? (*_NPPfuncs.setwindow)( + (NPP)m_aArgs[0], + (NPWindow*)m_aArgs[1] ) + : NPERR_GENERIC_ERROR); + break; + case eNPP_StreamAsFile: + if (_NPPfuncs.asfile) + (*_NPPfuncs.asfile)( + (NPP)m_aArgs[0], + (NPStream*)m_aArgs[1], + (char*)m_aArgs[2] ); + break; + case eNPP_URLNotify: + if (_NPPfuncs.urlnotify) + (*_NPPfuncs.urlnotify)( + (NPP)m_aArgs[0], + (char*)m_aArgs[1], + (NPReason)m_aArgs[2], + m_aArgs[3] ); + break; + case eNPP_Write: + nRet = (_NPPfuncs.write + ? (*_NPPfuncs.write)( + (NPP)m_aArgs[0], + (NPStream*)m_aArgs[1], + (int32)m_aArgs[2], + (int32)m_aArgs[3], + m_aArgs[4] ) + : 0); + break; + case eNPP_WriteReady: + nRet = (_NPPfuncs.writeready + ? (*_NPPfuncs.writeready)( + (NPP)m_aArgs[0], + (NPStream*)m_aArgs[1] ) + : 0); + break; + case eNPP_GetValue: + nRet = (_NPPfuncs.getvalue + ? (*_NPPfuncs.getvalue)( + (NPP)m_aArgs[0], + (NPPVariable)(int)m_aArgs[1], + m_aArgs[2] ) + : NPERR_GENERIC_ERROR); + break; + case eNPP_SetValue: + nRet = (_NPPfuncs.setvalue + ? (*_NPPfuncs.setvalue)( + (NPP)m_aArgs[0], + (NPNVariable)(int)m_aArgs[1], + m_aArgs[2] ) + : NPERR_GENERIC_ERROR); + break; + case eNPP_Shutdown: + { + NPP_ShutdownUPP pFunc; + if (retrieveFunction( _T("NPP_Shutdown"), (void**)&pFunc )) + (*pFunc)(); + } + break; + + } + return nRet; +} + +//-------------------------------------------------------------------------------------------------- NPError PluginComm_Impl::NPP_Destroy( NPP instance, NPSavedData** save ) { DBG_ASSERT( _NPPfuncs.destroy, "### NPP_Destroy(): null pointer in NPP functions table!" ); - return (_NPPfuncs.destroy - ? (*_NPPfuncs.destroy)( instance, save ) - : NPERR_GENERIC_ERROR); + m_eCall = eNPP_Destroy; + m_aArgs[0] = (void*)instance; + m_aArgs[1] = (void*)save; + return (NPError)execute(); } //-------------------------------------------------------------------------------------------------- NPError PluginComm_Impl::NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason ) { DBG_ASSERT( _NPPfuncs.destroystream, "### NPP_DestroyStream(): null pointer in NPP functions table!" ); - return (_NPPfuncs.destroystream - ? (*_NPPfuncs.destroystream)( instance, stream, reason ) - : NPERR_GENERIC_ERROR); + m_eCall = eNPP_DestroyStream; + m_aArgs[0] = (void*)instance; + m_aArgs[1] = (void*)stream; + m_aArgs[2] = (void*)reason; + return (NPError)execute(); } //-------------------------------------------------------------------------------------------------- @@ -183,9 +306,15 @@ NPError PluginComm_Impl::NPP_New( NPMIMEType pluginType, NPP instance, uint16 mo char* argn[], char* argv[], NPSavedData *saved ) { DBG_ASSERT( _NPPfuncs.newp, "### NPP_New(): null pointer in NPP functions table!" ); - return (_NPPfuncs.newp - ? (*_NPPfuncs.newp)( pluginType, instance, mode, argc, argn, argv, saved ) - : NPERR_GENERIC_ERROR); + m_eCall = eNPP_New; + m_aArgs[0] = (void*)pluginType; + m_aArgs[1] = (void*)instance; + m_aArgs[2] = (void*)mode; + m_aArgs[3] = (void*)argc; + m_aArgs[4] = (void*)argn; + m_aArgs[5] = (void*)argv; + m_aArgs[6] = (void*)saved; + return (NPError)execute(); } //-------------------------------------------------------------------------------------------------- @@ -193,78 +322,101 @@ NPError PluginComm_Impl::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* NPBool seekable, uint16* stype ) { DBG_ASSERT( _NPPfuncs.newstream, "### NPP_NewStream(): null pointer in NPP functions table!" ); - return (_NPPfuncs.newstream - ? (*_NPPfuncs.newstream)( instance, type, stream, seekable, stype ) - : NPERR_GENERIC_ERROR); + m_eCall = eNPP_NewStream; + m_aArgs[0] = (void*)instance; + m_aArgs[1] = (void*)type; + m_aArgs[2] = (void*)stream; + m_aArgs[3] = (void*)seekable; + m_aArgs[4] = (void*)stype; + return (NPError)execute(); } //-------------------------------------------------------------------------------------------------- void PluginComm_Impl::NPP_Print( NPP instance, NPPrint* platformPrint ) { DBG_ASSERT( _NPPfuncs.print, "### NPP_Print(): null pointer in NPP functions table!" ); - if (_NPPfuncs.print) - (*_NPPfuncs.print)( instance, platformPrint ); + m_eCall = eNPP_Print; + m_aArgs[0] = (void*)instance; + m_aArgs[1] = (void*)platformPrint; + execute(); } //-------------------------------------------------------------------------------------------------- NPError PluginComm_Impl::NPP_SetWindow( NPP instance, NPWindow* window ) { DBG_ASSERT( _NPPfuncs.setwindow, "### NPP_SetWindow(): null pointer in NPP functions table!" ); - return (_NPPfuncs.setwindow - ? (*_NPPfuncs.setwindow)( instance, window ) - : NPERR_GENERIC_ERROR); + m_eCall = eNPP_SetWindow; + m_aArgs[0] = (void*)instance; + m_aArgs[1] = (void*)window; + return (NPError)execute(); } //-------------------------------------------------------------------------------------------------- void PluginComm_Impl::NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname ) { DBG_ASSERT( _NPPfuncs.asfile, "### NPP_StreamAsFile(): null pointer in NPP functions table!" ); - if (_NPPfuncs.asfile) - (*_NPPfuncs.asfile)( instance, stream, fname ); + m_eCall = eNPP_StreamAsFile; + m_aArgs[0] = (void*)instance; + m_aArgs[1] = (void*)stream; + m_aArgs[2] = (void*)fname; + execute(); } //-------------------------------------------------------------------------------------------------- void PluginComm_Impl::NPP_URLNotify( NPP instance, const char* url, NPReason reason, void* notifyData ) { DBG_ASSERT( _NPPfuncs.urlnotify, "### NPP_URLNotify(): null pointer in NPP functions table!" ); - if (_NPPfuncs.urlnotify) - (*_NPPfuncs.urlnotify)( instance, url, reason, notifyData ); + m_eCall = eNPP_URLNotify; + m_aArgs[0] = (void*)instance; + m_aArgs[1] = (void*)url; + m_aArgs[2] = (void*)reason; + m_aArgs[3] = notifyData; + execute(); } //-------------------------------------------------------------------------------------------------- int32 PluginComm_Impl::NPP_Write( NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer ) { DBG_ASSERT( _NPPfuncs.write, "### NPP_Write(): null pointer in NPP functions table!" ); - return (_NPPfuncs.write - ? (*_NPPfuncs.write)( instance, stream, offset, len, buffer ) - : 0); + m_eCall = eNPP_Write; + m_aArgs[0] = (void*)instance; + m_aArgs[1] = (void*)stream; + m_aArgs[2] = (void*)offset; + m_aArgs[3] = (void*)len; + m_aArgs[4] = buffer; + return (NPError)execute(); } //-------------------------------------------------------------------------------------------------- int32 PluginComm_Impl::NPP_WriteReady( NPP instance, NPStream* stream ) { DBG_ASSERT( _NPPfuncs.writeready, "### NPP_WriteReady(): null pointer in NPP functions table!" ); - return (_NPPfuncs.writeready - ? (*_NPPfuncs.writeready)( instance, stream ) - : 0); + m_eCall = eNPP_WriteReady; + m_aArgs[0] = (void*)instance; + m_aArgs[1] = (void*)stream; + return execute(); } //-------------------------------------------------------------------------------------------------- -NPError PluginComm_Impl::NPP_GetValue( NPP instance, NPPVariable variable, void *ret_alue ) +NPError PluginComm_Impl::NPP_GetValue( NPP instance, NPPVariable variable, void *ret_value ) { DBG_ASSERT( _NPPfuncs.getvalue, "### NPP_GetValue(): null pointer in NPP functions table!" ); - return (_NPPfuncs.getvalue - ? (*_NPPfuncs.getvalue)( instance, variable, ret_alue ) - : NPERR_GENERIC_ERROR); + m_eCall = eNPP_GetValue; + m_aArgs[0] = (void*)instance; + m_aArgs[1] = (void*)variable; + m_aArgs[2] = ret_value; + return (NPError)execute(); } //-------------------------------------------------------------------------------------------------- -NPError PluginComm_Impl::NPP_SetValue( NPP instance, NPNVariable variable, void *ret_alue ) +NPError PluginComm_Impl::NPP_SetValue( NPP instance, NPNVariable variable, void *set_value ) { DBG_ASSERT( _NPPfuncs.setvalue, "### NPP_SetValue(): null pointer in NPP functions table!" ); - return (_NPPfuncs.setvalue - ? (*_NPPfuncs.setvalue)( instance, variable, ret_alue ) - : NPERR_GENERIC_ERROR); + m_eCall = eNPP_SetValue; + m_aArgs[0] = (void*)instance; + m_aArgs[1] = (void*)variable; + m_aArgs[2] = set_value; + return (NPError)execute(); } //-------------------------------------------------------------------------------------------------- @@ -283,9 +435,6 @@ NPError PluginComm_Impl::NPP_Initialize() //-------------------------------------------------------------------------------------------------- void PluginComm_Impl::NPP_Shutdown() { - NPP_ShutdownUPP pFunc; - if (retrieveFunction( _T("NPP_Shutdown"), (void**)&pFunc )) - (*pFunc)(); + m_eCall = eNPP_Shutdown; + execute(); } - - diff --git a/extensions/source/plugin/win/winmgr.cxx b/extensions/source/plugin/win/winmgr.cxx index a58fed0809f2..0a94cc55b7f9 100644 --- a/extensions/source/plugin/win/winmgr.cxx +++ b/extensions/source/plugin/win/winmgr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: winmgr.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dbo $ $Date: 2001-05-16 12:13:17 $ + * last change: $Author: pl $ $Date: 2001-05-30 11:15:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -360,8 +360,6 @@ Sequence< PluginDescription > XPluginManager_Impl::getPluginDescriptions(void) t OString aExtToken2( aExt.getToken( 0, '|', nIndex2 ) ); OUString aExtToken( aExtToken2.getStr(), aExtToken2.getLength(), RTL_TEXTENCODING_MS_1252 ); #endif - if (! aExtToken.getLength()) - break; rDescr.PluginName = aName; rDescr.Description = aComment; |