diff options
Diffstat (limited to 'extensions/source/plugin/unx')
-rw-r--r-- | extensions/source/plugin/unx/mediator.cxx | 4 | ||||
-rw-r--r-- | extensions/source/plugin/unx/npnapi.cxx | 198 | ||||
-rw-r--r-- | extensions/source/plugin/unx/nppapi.cxx | 134 | ||||
-rw-r--r-- | extensions/source/plugin/unx/npwrap.cxx | 38 | ||||
-rw-r--r-- | extensions/source/plugin/unx/plugcon.cxx | 64 | ||||
-rw-r--r-- | extensions/source/plugin/unx/sysplug.cxx | 2 | ||||
-rw-r--r-- | extensions/source/plugin/unx/unxmgr.cxx | 20 |
7 files changed, 230 insertions, 230 deletions
diff --git a/extensions/source/plugin/unx/mediator.cxx b/extensions/source/plugin/unx/mediator.cxx index 4cbab9e0c9a2..afd42fa308bf 100644 --- a/extensions/source/plugin/unx/mediator.cxx +++ b/extensions/source/plugin/unx/mediator.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -198,7 +198,7 @@ void MediatorListener::run() { ULONG nHeader[ 3 ]; int nBytes; - + if( m_pMediator && ( nBytes = read( m_pMediator->m_nSocket, nHeader, sizeof( nHeader ) ) ) == sizeof( nHeader ) && nHeader[2] == MEDIATOR_MAGIC) { if( nHeader[ 0 ] == 0 && nHeader[ 1 ] == 0 ) diff --git a/extensions/source/plugin/unx/npnapi.cxx b/extensions/source/plugin/unx/npnapi.cxx index 6e862f67b2c0..f1f58fcc08bf 100644 --- a/extensions/source/plugin/unx/npnapi.cxx +++ b/extensions/source/plugin/unx/npnapi.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -61,12 +61,12 @@ static void* l_NPN_MemAlloc( uint32 nBytes ) void* pMem = new char[nBytes]; return pMem; } - + static void l_NPN_MemFree( void* pMem ) { delete [] (char*)pMem; } - + static uint32 l_NPN_MemFlush( uint32 /*nSize*/ ) { return 0; @@ -77,7 +77,7 @@ static NPError l_NPN_DestroyStream( NPP instance, NPStream* stream, NPError reas UINT32 nInstance = pConnector->GetNPPID( instance ); if( nInstance == PluginConnector::UnknownNPPID ) return NPERR_GENERIC_ERROR; - + UINT32 nFileID = pConnector->GetStreamID( stream ); MediatorMessage* pMes= pConnector-> @@ -128,14 +128,14 @@ static NPError l_NPN_GetURL( NPP instance, const char* url, const char* window ) UINT32 nInstance = pConnector->GetNPPID( instance ); if( nInstance == PluginConnector::UnknownNPPID ) return NPERR_GENERIC_ERROR; - + MediatorMessage* pMes= pConnector-> Transact( eNPN_GetURL, &nInstance, sizeof( nInstance ), POST_STRING(url), POST_STRING(window), - NULL ); + NULL ); medDebug( !pMes, "geturl: message unaswered\n" ); if( ! pMes ) return NPERR_GENERIC_ERROR; @@ -200,7 +200,7 @@ static NPError l_NPN_NewStream( NPP instance, NPMIMEType type, const char* targe pStream->end = pMes->GetUINT32(); pStream->lastmodified = pMes->GetUINT32(); pStream->ndata = pStream->pdata = pStream->notifyData = NULL; - + pConnector->getStreamList().push_back( pStream ); *stream = pStream; } @@ -268,7 +268,7 @@ static NPError l_NPN_RequestRead( NPStream* stream, NPByteRange* rangeList ) nRanges++; pRange = pRange->next; } - + UINT32* pArray = new UINT32[ 2 * nRanges ]; pRange = rangeList; UINT32 n = 0; @@ -305,7 +305,7 @@ static void l_NPN_Status( NPP instance, const char* message ) pConnector->Send( eNPN_Status, &nInstance, sizeof( nInstance ), POST_STRING( message ), - NULL ); + NULL ); } static const char* l_NPN_UserAgent( NPP instance ) @@ -382,7 +382,7 @@ static int32 l_NPN_Write( NPP instance, NPStream* stream, int32 len, void* buffe return 0; INT32 nRet = pMes->GetUINT32(); - return nRet; + return nRet; } static void l_NPN_ReloadPlugins( NPBool /*reloadPages*/ ) @@ -519,9 +519,9 @@ static NPPluginFuncs aPluginFuncs = oslModule pPluginLib = NULL; -char*(*pNPP_GetMIMEDescription)() = NULL; -NPError (*pNP_Initialize)(NPNetscapeFuncs*,NPPluginFuncs*) = NULL; -NPError (*pNP_Shutdown)() = NULL; +char*(*pNPP_GetMIMEDescription)() = NULL; +NPError (*pNP_Initialize)(NPNetscapeFuncs*,NPPluginFuncs*) = NULL; +NPError (*pNP_Shutdown)() = NULL; std::vector< PluginConnector* > PluginConnector::allConnectors; @@ -547,11 +547,11 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) { case eNPP_DestroyStream: { - UINT32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - UINT32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; - NPError aReason = GetNPError( pMessage ); + UINT32 nInstance = pMessage->GetUINT32(); + NPP instance = m_aInstances[ nInstance ]->instance; + UINT32 nFileID = pMessage->GetUINT32(); + NPStream* pStream = m_aNPWrapStreams[ nFileID ]; + NPError aReason = GetNPError( pMessage ); m_aNPWrapStreams.erase( m_aNPWrapStreams.begin() + nFileID ); aReason = aPluginFuncs.destroystream( instance, pStream, aReason ); @@ -565,7 +565,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) break; case eNPP_Destroy: { - UINT32 nInstance = pMessage->GetUINT32(); + UINT32 nInstance = pMessage->GetUINT32(); ConnectorInstance* pInst= m_aInstances[ nInstance ]; // some plugin rely on old netscapes behaviour @@ -573,9 +573,9 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) // the instance, so mimic that behaviour here if( pInst->pShell ) XtDestroyWidget( (Widget)pInst->pShell ); - + pInst->pWidget = pInst->pShell = NULL; - + // the other side will call eNPP_DestroyPhase2 after this NPError aReason = NPERR_NO_ERROR; Respond( pMessage->m_nID, (char*)&aReason, sizeof( aReason ), NULL ); @@ -584,9 +584,9 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) case eNPP_DestroyPhase2: { // now really destroy the instance - UINT32 nInstance = pMessage->GetUINT32(); + UINT32 nInstance = pMessage->GetUINT32(); ConnectorInstance* pInst= m_aInstances[ nInstance ]; - NPP instance = pInst->instance; + NPP instance = pInst->instance; NPSavedData* pSave = NULL; NPError aRet = aPluginFuncs.destroy( instance, &pSave ); @@ -619,15 +619,15 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) break; case eNPP_NewStream: { - UINT32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pType = pMessage->GetString(); - NPStream* pStream = new NPStream; - pStream->url = pMessage->GetString(); - pStream->end = pMessage->GetUINT32(); - pStream->lastmodified = pMessage->GetUINT32(); + UINT32 nInstance = pMessage->GetUINT32(); + NPP instance = m_aInstances[ nInstance ]->instance; + char* pType = pMessage->GetString(); + NPStream* pStream = new NPStream; + pStream->url = pMessage->GetString(); + pStream->end = pMessage->GetUINT32(); + pStream->lastmodified = pMessage->GetUINT32(); pStream->pdata = pStream->ndata = pStream->notifyData = NULL; - NPBool* pSeekable = (NPBool*)pMessage->GetBytes(); + NPBool* pSeekable = (NPBool*)pMessage->GetBytes(); m_aNPWrapStreams.push_back( pStream ); uint16 nStype = NP_ASFILE; NPError aRet = aPluginFuncs.newstream( instance, pType, pStream, @@ -646,10 +646,10 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) break; case eNPP_New: { - char* pType = pMessage->GetString(); - uint16* pMode = (uint16*)pMessage->GetBytes(); - int16* pArgc = (int16*)pMessage->GetBytes(); - NPP instance = new NPP_t; + char* pType = pMessage->GetString(); + uint16* pMode = (uint16*)pMessage->GetBytes(); + int16* pArgc = (int16*)pMessage->GetBytes(); + NPP instance = new NPP_t; instance->pdata = instance->ndata = NULL; ULONG nArgnBytes, nArgvBytes; char* pArgn = (char*)pMessage->GetBytes( nArgnBytes ); @@ -692,7 +692,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) medDebug( 1, "should use xembed = %s\n", pInst->bShouldUseXEmbed ? "true" : "false" ); } #endif - + Respond( pMessage->m_nID, (char*)&aRet, sizeof( aRet ), NULL ); @@ -703,10 +703,10 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) break; case eNPP_SetWindow: { - UINT32 nInstance = pMessage->GetUINT32(); + UINT32 nInstance = pMessage->GetUINT32(); ConnectorInstance* pInst= m_aInstances[ nInstance ]; - NPWindow* pWindow = (NPWindow*)pMessage->GetBytes(); - + NPWindow* pWindow = (NPWindow*)pMessage->GetBytes(); + if( pWindow->width < 1 ) pWindow->width = 1; if( pWindow->height < 1 ) @@ -718,7 +718,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) if( ! pInst->pGtkWidget ) { medDebug( 1, "creating gtk plug and socket\n" ); - + pInst->pGtkWindow = gtk_plug_new((GdkNativeWindow)reinterpret_cast<sal_uIntPtr>(pWindow->window)); gtk_widget_show( pInst->pGtkWindow ); pInst->pGtkWidget = gtk_socket_new(); @@ -733,56 +733,56 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) XSync( pAppDisplay, False ); } - + // update widget size; alas out parent is not yet really XEMBED conformant gtk_widget_set_size_request( pInst->pGtkWidget, pWindow->width, pWindow->height ); gtk_window_resize( GTK_WINDOW(pInst->pGtkWindow), pWindow->width, pWindow->height ); - + GdkScreen* pGdkScreen = gtk_widget_get_screen( pInst->pGtkWidget ); Screen* pScreen = ScreenOfDisplay( pAppDisplay, gdk_screen_get_number( pGdkScreen ) ); - pInst->window.x = 0; - pInst->window.y = 0; - pInst->window.width = pWindow->width; - pInst->window.height = pWindow->height; - pInst->window.clipRect.left = 0; - pInst->window.clipRect.top = 0; - pInst->window.clipRect.right = pWindow->width; - pInst->window.clipRect.bottom = pWindow->height; - pInst->window.ws_info = &pInst->ws_info; - pInst->window.type = NPWindowTypeWindow; - pInst->ws_info.type = NP_SETWINDOW; - pInst->ws_info.display = pAppDisplay; - pInst->ws_info.visual = DefaultVisualOfScreen( pScreen ); - pInst->ws_info.colormap = DefaultColormapOfScreen( pScreen ); - pInst->ws_info.depth = DefaultDepthOfScreen( pScreen ); + pInst->window.x = 0; + pInst->window.y = 0; + pInst->window.width = pWindow->width; + pInst->window.height = pWindow->height; + pInst->window.clipRect.left = 0; + pInst->window.clipRect.top = 0; + pInst->window.clipRect.right = pWindow->width; + pInst->window.clipRect.bottom = pWindow->height; + pInst->window.ws_info = &pInst->ws_info; + pInst->window.type = NPWindowTypeWindow; + pInst->ws_info.type = NP_SETWINDOW; + pInst->ws_info.display = pAppDisplay; + pInst->ws_info.visual = DefaultVisualOfScreen( pScreen ); + pInst->ws_info.colormap = DefaultColormapOfScreen( pScreen ); + pInst->ws_info.depth = DefaultDepthOfScreen( pScreen ); } else #endif { if( ! pInst->pWidget ) { - pInst->pWidget = CreateNewShell( &(pInst->pShell), (XLIB_Window)pWindow->window ); + pInst->pWidget = CreateNewShell( &(pInst->pShell), (XLIB_Window)pWindow->window ); } - + // fill in NPWindow and NPCallbackStruct - pInst->window.window = (void*)XtWindow( (Widget)pInst->pWidget ); - pInst->window.x = 0; - pInst->window.y = 0; - pInst->window.width = pWindow->width; - pInst->window.height = pWindow->height; - pInst->window.clipRect.left = 0; - pInst->window.clipRect.top = 0; - pInst->window.clipRect.right = pWindow->width; - pInst->window.clipRect.bottom = pWindow->height; - pInst->window.ws_info = &pInst->ws_info; - pInst->window.type = NPWindowTypeWindow; - pInst->ws_info.type = NP_SETWINDOW; - pInst->ws_info.display = XtDisplay( (Widget)pInst->pWidget ); - pInst->ws_info.visual = DefaultVisualOfScreen( XtScreen( (Widget)pInst->pWidget ) ); - pInst->ws_info.colormap = DefaultColormapOfScreen( XtScreen( (Widget)pInst->pWidget ) ); - pInst->ws_info.depth = DefaultDepthOfScreen( XtScreen( (Widget)pInst->pWidget ) ); - + pInst->window.window = (void*)XtWindow( (Widget)pInst->pWidget ); + pInst->window.x = 0; + pInst->window.y = 0; + pInst->window.width = pWindow->width; + pInst->window.height = pWindow->height; + pInst->window.clipRect.left = 0; + pInst->window.clipRect.top = 0; + pInst->window.clipRect.right = pWindow->width; + pInst->window.clipRect.bottom = pWindow->height; + pInst->window.ws_info = &pInst->ws_info; + pInst->window.type = NPWindowTypeWindow; + pInst->ws_info.type = NP_SETWINDOW; + pInst->ws_info.display = XtDisplay( (Widget)pInst->pWidget ); + pInst->ws_info.visual = DefaultVisualOfScreen( XtScreen( (Widget)pInst->pWidget ) ); + pInst->ws_info.colormap = DefaultColormapOfScreen( XtScreen( (Widget)pInst->pWidget ) ); + pInst->ws_info.depth = DefaultDepthOfScreen( XtScreen( (Widget)pInst->pWidget ) ); + XtResizeWidget( (Widget)pInst->pShell, pInst->window.width, pInst->window.height, @@ -803,11 +803,11 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) break; case eNPP_StreamAsFile: { - UINT32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - UINT32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; - char* fname = pMessage->GetString(); + UINT32 nInstance = pMessage->GetUINT32(); + NPP instance = m_aInstances[ nInstance ]->instance; + UINT32 nFileID = pMessage->GetUINT32(); + NPStream* pStream = m_aNPWrapStreams[ nFileID ]; + char* fname = pMessage->GetString(); medDebug( 1, "pluginapp: NPP_StreamAsFile %s\n", fname ); aPluginFuncs.asfile( instance, pStream, fname ); delete [] fname; @@ -815,11 +815,11 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) break; case eNPP_URLNotify: { - UINT32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* url = pMessage->GetString(); - NPReason* pReason = (NPReason*)pMessage->GetBytes(); - void** notifyData = (void**)pMessage->GetBytes(); + UINT32 nInstance = pMessage->GetUINT32(); + NPP instance = m_aInstances[ nInstance ]->instance; + char* url = pMessage->GetString(); + NPReason* pReason = (NPReason*)pMessage->GetBytes(); + void** notifyData = (void**)pMessage->GetBytes(); aPluginFuncs.urlnotify( instance, url, *pReason, *notifyData ); delete [] url; delete [] pReason; @@ -828,15 +828,15 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) break; case eNPP_WriteReady: { - UINT32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - UINT32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; + UINT32 nInstance = pMessage->GetUINT32(); + NPP instance = m_aInstances[ nInstance ]->instance; + UINT32 nFileID = pMessage->GetUINT32(); + NPStream* pStream = m_aNPWrapStreams[ nFileID ]; int32 nRet = aPluginFuncs.writeready( instance, pStream ); - + medDebug( 1, "pluginapp: NPP_WriteReady( %p, %p ) (stream id = %d) returns %d\n", instance, pStream, nFileID, nRet ); - + Respond( pMessage->m_nID, (char*)&nRet, sizeof( nRet ), NULL ); @@ -844,15 +844,15 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) break; case eNPP_Write: { - UINT32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - UINT32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; - int32 offset = pMessage->GetUINT32(); + UINT32 nInstance = pMessage->GetUINT32(); + NPP instance = m_aInstances[ nInstance ]->instance; + UINT32 nFileID = pMessage->GetUINT32(); + NPStream* pStream = m_aNPWrapStreams[ nFileID ]; + int32 offset = pMessage->GetUINT32(); ULONG len; - char* buffer = (char*)pMessage->GetBytes( len ); + char* buffer = (char*)pMessage->GetBytes( len ); int32 nRet = aPluginFuncs.write( instance, pStream, offset, len, buffer ); - + medDebug( 1,"pluginapp: NPP_Write( %p, %p, %d, %d, %p ) returns %d\n" "stream = { pdata = %p, ndata = %p, url = %s, end = %d, lastmodified = %d, notifyData = %p }\n", instance, pStream, offset, len, buffer, nRet, diff --git a/extensions/source/plugin/unx/nppapi.cxx b/extensions/source/plugin/unx/nppapi.cxx index bf0faabf15dc..c6dd6a59895d 100644 --- a/extensions/source/plugin/unx/nppapi.cxx +++ b/extensions/source/plugin/unx/nppapi.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -109,10 +109,10 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) { case eNPN_GetURL: { - UINT32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pUrl = pMessage->GetString(); - char* pWindow = pMessage->GetString(); + UINT32 nInstance = pMessage->GetUINT32(); + NPP instance = m_aInstances[ nInstance ]->instance; + char* pUrl = pMessage->GetString(); + char* pWindow = pMessage->GetString(); NPError aRet = NPN_GetURL( instance, pUrl, pWindow ); Respond( pMessage->m_nID, (char*)(&aRet), sizeof( NPError ), NULL ); @@ -122,11 +122,11 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) break; case eNPN_GetURLNotify: { - UINT32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pUrl = pMessage->GetString(); - char* pWindow = pMessage->GetString(); - void** pNotifyData = (void**)pMessage->GetBytes(); + UINT32 nInstance = pMessage->GetUINT32(); + NPP instance = m_aInstances[ nInstance ]->instance; + char* pUrl = pMessage->GetString(); + char* pWindow = pMessage->GetString(); + void** pNotifyData = (void**)pMessage->GetBytes(); NPError aRet = NPN_GetURLNotify( instance, pUrl, pWindow, *pNotifyData ); Respond( pMessage->m_nID, @@ -138,11 +138,11 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) break; case eNPN_DestroyStream: { - UINT32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - UINT32 nFileID = pMessage->GetUINT32(); - char* pUrl = pMessage->GetString(); - NPError* pReason = (NPError*)pMessage->GetBytes(); + UINT32 nInstance = pMessage->GetUINT32(); + NPP instance = m_aInstances[ nInstance ]->instance; + UINT32 nFileID = pMessage->GetUINT32(); + char* pUrl = pMessage->GetString(); + NPError* pReason = (NPError*)pMessage->GetBytes(); NPError aRet = NPERR_FILE_NOT_FOUND; if( nFileID < static_cast<UINT32>(m_aNPWrapStreams.size()) ) { @@ -169,10 +169,10 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) break; case eNPN_NewStream: { - UINT32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - NPMIMEType pType = pMessage->GetString(); - char* pTarget = pMessage->GetString(); + UINT32 nInstance = pMessage->GetUINT32(); + NPP instance = m_aInstances[ nInstance ]->instance; + NPMIMEType pType = pMessage->GetString(); + char* pTarget = pMessage->GetString(); NPStream* pStream = NULL; @@ -200,21 +200,21 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) &pStream->lastmodified, sizeof(UINT32), NULL ); } - + delete [] pTarget; delete [] pType; } break; case eNPN_PostURLNotify: { - UINT32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pUrl = pMessage->GetString(); - char* pTarget = pMessage->GetString(); - UINT32 nLen = pMessage->GetUINT32(); - char* pBuf = (char*)pMessage->GetBytes(); - NPBool* pFile = (NPBool*)pMessage->GetBytes(); - void** pNData = (void**)pMessage->GetBytes(); + UINT32 nInstance = pMessage->GetUINT32(); + NPP instance = m_aInstances[ nInstance ]->instance; + char* pUrl = pMessage->GetString(); + char* pTarget = pMessage->GetString(); + UINT32 nLen = pMessage->GetUINT32(); + char* pBuf = (char*)pMessage->GetBytes(); + NPBool* pFile = (NPBool*)pMessage->GetBytes(); + void** pNData = (void**)pMessage->GetBytes(); NPError aRet = NPN_PostURLNotify( instance, pUrl, pTarget, nLen, pBuf, *pFile, *pNData ); Respond( pMessage->m_nID, (char*)&aRet, sizeof( aRet ), NULL ); @@ -227,13 +227,13 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) break; case eNPN_PostURL: { - UINT32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pUrl = pMessage->GetString(); - char* pWindow = pMessage->GetString(); - UINT32 nLen = pMessage->GetUINT32(); - char* pBuf = (char*)pMessage->GetBytes(); - NPBool* pFile = (NPBool*)pMessage->GetBytes(); + UINT32 nInstance = pMessage->GetUINT32(); + NPP instance = m_aInstances[ nInstance ]->instance; + char* pUrl = pMessage->GetString(); + char* pWindow = pMessage->GetString(); + UINT32 nLen = pMessage->GetUINT32(); + char* pBuf = (char*)pMessage->GetBytes(); + NPBool* pFile = (NPBool*)pMessage->GetBytes(); NPError aRet = NPN_PostURL( instance, pUrl, pWindow, nLen, pBuf, *pFile ); Respond( pMessage->m_nID, (char*)&aRet, sizeof( aRet ), NULL ); @@ -245,13 +245,13 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) break; case eNPN_RequestRead: { - UINT32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; - UINT32 nRanges = pMessage->GetUINT32(); - UINT32* pArray = (UINT32*)pMessage->GetBytes(); + UINT32 nFileID = pMessage->GetUINT32(); + NPStream* pStream = m_aNPWrapStreams[ nFileID ]; + UINT32 nRanges = pMessage->GetUINT32(); + UINT32* pArray = (UINT32*)pMessage->GetBytes(); // build ranges table NPByteRange* pFirst = new NPByteRange; - NPByteRange* pRun = pFirst; + NPByteRange* pRun = pFirst; for( UINT32 n = 0; n < nRanges; n++ ) { pRun->offset = pArray[ 2*n ]; @@ -272,9 +272,9 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) break; case eNPN_Status: { - UINT32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pString = pMessage->GetString(); + UINT32 nInstance = pMessage->GetUINT32(); + NPP instance = m_aInstances[ nInstance ]->instance; + char* pString = pMessage->GetString(); NPN_Status( instance, pString ); delete [] pString; } @@ -293,12 +293,12 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) break; case eNPN_Write: { - UINT32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - UINT32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; - INT32 nLen = pMessage->GetUINT32(); - void* pBuffer = pMessage->GetBytes(); + UINT32 nInstance = pMessage->GetUINT32(); + NPP instance = m_aInstances[ nInstance ]->instance; + UINT32 nFileID = pMessage->GetUINT32(); + NPStream* pStream = m_aNPWrapStreams[ nFileID ]; + INT32 nLen = pMessage->GetUINT32(); + void* pBuffer = pMessage->GetBytes(); INT32 nRet = NPN_Write( instance, pStream, nLen, pBuffer ); Respond( pMessage->m_nID, (char*)&nRet, sizeof( nRet ), @@ -309,8 +309,8 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) break; case eNPN_UserAgent: { - UINT32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; + UINT32 nInstance = pMessage->GetUINT32(); + NPP instance = m_aInstances[ nInstance ]->instance; const char* pAnswer = NPN_UserAgent( instance ); Respond( pMessage->m_nID, (char*)pAnswer, strlen( pAnswer ), @@ -320,7 +320,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) default: medDebug( 1, "caught unknown NPN request %d\n", nCommand ); } - + delete pMessage; } return 0; @@ -342,7 +342,7 @@ NPError UnxPluginComm::NPP_Destroy( NPP instance, NPSavedData** save ) { NPError aRet = NPERR_GENERIC_ERROR; GET_INSTANCE_RET( aRet ); - MediatorMessage* pMes = + MediatorMessage* pMes = Transact( eNPP_Destroy, POST_INSTANCE(), NULL ); @@ -379,8 +379,8 @@ NPError UnxPluginComm::NPP_DestroyStream( NPP instance, NPStream* stream, NPErro UINT32 nFileID = GetStreamID( stream ); if( nFileID == PluginConnector::UnknownStreamID ) return NPERR_GENERIC_ERROR; - - MediatorMessage* pMes = + + MediatorMessage* pMes = Transact( eNPP_DestroyStream, POST_INSTANCE(), &nFileID, sizeof( nFileID ), @@ -402,7 +402,7 @@ void* UnxPluginComm::NPP_GetJavaClass() NPError UnxPluginComm::NPP_Initialize() { - MediatorMessage* pMes = + MediatorMessage* pMes = Transact( eNPP_Initialize, NULL ); if( ! pMes ) @@ -444,7 +444,7 @@ NPError UnxPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode MediatorMessage* pMes; if( saved ) - pMes = + pMes = Transact( eNPP_New, pluginType, strlen( pluginType ), &mode, sizeof( mode ), @@ -454,7 +454,7 @@ NPError UnxPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode saved->buf, static_cast<size_t>(saved->len), NULL ); else - pMes = + pMes = Transact( eNPP_New, pluginType, strlen( pluginType ), &mode, sizeof( mode ), @@ -481,7 +481,7 @@ NPError UnxPluginComm::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* s GET_INSTANCE_RET( aRet ); m_aNPWrapStreams.push_back( stream ); - MediatorMessage* pMes = + MediatorMessage* pMes = Transact( eNPP_NewStream, POST_INSTANCE(), type, strlen( type ), @@ -505,14 +505,14 @@ NPError UnxPluginComm::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* s void UnxPluginComm::NPP_Print( NPP /*instance*/, NPPrint* /*platformPrint*/ ) { -} +} NPError UnxPluginComm::NPP_SetWindow( NPP instance, NPWindow* window ) { NPError aRet = NPERR_GENERIC_ERROR; GET_INSTANCE_RET( aRet ); - MediatorMessage* pMes = + MediatorMessage* pMes = Transact( eNPP_SetWindow, POST_INSTANCE(), window, sizeof( NPWindow ), @@ -547,7 +547,7 @@ void UnxPluginComm::NPP_StreamAsFile( NPP instance, NPStream* stream, const char void UnxPluginComm::NPP_URLNotify( NPP instance, const char* url, NPReason reason, void* notifyData ) { GET_INSTANCE(); - + Send( eNPP_URLNotify, POST_INSTANCE(), url, strlen( url ), @@ -563,7 +563,7 @@ int32 UnxPluginComm::NPP_Write( NPP instance, NPStream* stream, int32 offset, in if( nFileID == PluginConnector::UnknownStreamID ) return -1; - MediatorMessage* pMes = + MediatorMessage* pMes = Transact( eNPP_Write, POST_INSTANCE(), &nFileID, sizeof( nFileID ), @@ -575,7 +575,7 @@ int32 UnxPluginComm::NPP_Write( NPP instance, NPStream* stream, int32 offset, in int32 aRet = pMes->GetUINT32(); delete pMes; - + return aRet; } @@ -586,7 +586,7 @@ int32 UnxPluginComm::NPP_WriteReady( NPP instance, NPStream* stream ) if( nFileID == PluginConnector::UnknownStreamID ) return -1; - MediatorMessage* pMes = + MediatorMessage* pMes = Transact( eNPP_WriteReady, POST_INSTANCE(), &nFileID, sizeof( nFileID ), @@ -597,14 +597,14 @@ int32 UnxPluginComm::NPP_WriteReady( NPP instance, NPStream* stream ) int32 aRet = pMes->GetUINT32(); delete pMes; - + return aRet; } char* UnxPluginComm::NPP_GetMIMEDescription() { static char* pDesc = NULL; - MediatorMessage* pMes = + MediatorMessage* pMes = Transact( eNPP_GetMIMEDescription, NULL ); if( ! pMes ) diff --git a/extensions/source/plugin/unx/npwrap.cxx b/extensions/source/plugin/unx/npwrap.cxx index 7124972d8578..04f4bbbacf5a 100644 --- a/extensions/source/plugin/unx/npwrap.cxx +++ b/extensions/source/plugin/unx/npwrap.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -47,9 +47,9 @@ PluginConnector* pConnector = NULL; -int nAppArguments = 0; -char** pAppArguments = NULL; -Display* pAppDisplay = NULL; +int nAppArguments = 0; +char** pAppArguments = NULL; +Display* pAppDisplay = NULL; Display* pXtAppDisplay = NULL; extern oslModule pPluginLib; @@ -65,7 +65,7 @@ static bool bPluginAppQuit = false; static long GlobalConnectionLostHdl( void* /*pInst*/, void* /*pArg*/ ) { medDebug( 1, "pluginapp exiting due to connection lost\n" ); - + write( wakeup_fd[1], "xxxx", 4 ); return 0; } @@ -76,14 +76,14 @@ extern "C" { return 0; } - + #ifndef ENABLE_GTK static void ThreadEventHandler( XtPointer /*client_data*/, int* /*source*/, XtInputId* id ) { char buf[256]; // clear pipe int len, nLast = -1; - + while( (len = read( wakeup_fd[0], buf, sizeof( buf ) ) ) > 0 ) nLast = len-1; if( ! bPluginAppQuit ) @@ -114,7 +114,7 @@ IMPL_LINK( PluginConnector, NewMessageHdl, Mediator*, /*pMediator*/ ) medDebug( 1, "new message handler\n" ); write( wakeup_fd[1], "cccc", 4 ); return 0; - + } Widget createSubWidget( char* /*pPluginText*/, Widget shell, XLIB_Window aParentWindow ) @@ -145,7 +145,7 @@ Widget createSubWidget( char* /*pPluginText*/, Widget shell, XLIB_Window aParent 0, 0 ); XtMapWidget( shell ); XtMapWidget( newWidget ); - XRaiseWindow( pXtAppDisplay, XtWindow( shell ) ); + XRaiseWindow( pXtAppDisplay, XtWindow( shell ) ); XSync( pXtAppDisplay, False ); return newWidget; @@ -192,7 +192,7 @@ static oslModule LoadModule( const char* pPath ) static void CheckPlugin( const char* pPath ) { oslModule pLib = LoadModule( pPath ); - + char*(*pNP_GetMIMEDescription)() = (char*(*)()) osl_getAsciiFunctionSymbol( pLib, "NP_GetMIMEDescription" ); if( pNP_GetMIMEDescription ) @@ -279,7 +279,7 @@ static gboolean pollXtTimerCallback(gpointer) static gboolean prepareWakeupEvent( GSource*, gint* ) { struct pollfd aPoll = { wakeup_fd[0], POLLIN, 0 }; - poll( &aPoll, 1, 0 ); + poll( &aPoll, 1, 0 ); return (aPoll.revents & POLLIN ) != 0; } @@ -294,7 +294,7 @@ static gboolean dispatchWakeupEvent( GSource*, GSourceFunc, gpointer ) char buf[256]; // clear pipe int len, nLast = -1; - + while( (len = read( wakeup_fd[0], buf, sizeof( buf ) ) ) > 0 ) nLast = len-1; if( ( nLast == -1 || buf[nLast] != 'x' ) && pConnector ) @@ -307,7 +307,7 @@ static gboolean dispatchWakeupEvent( GSource*, GSourceFunc, gpointer ) delete pConnector; pConnector = NULL; } - + return TRUE; } @@ -359,7 +359,7 @@ int main( int argc, char **argv) } // initialize 'wakeup' pipe. int flags; - + // set close-on-exec descriptor flag. if ((flags = fcntl (wakeup_fd[0], F_GETFD)) != -1) { @@ -371,7 +371,7 @@ int main( int argc, char **argv) flags |= FD_CLOEXEC; fcntl (wakeup_fd[1], F_SETFD, flags); } - + // set non-blocking I/O flag. if ((flags = fcntl (wakeup_fd[0], F_GETFL)) != -1) { @@ -390,7 +390,7 @@ int main( int argc, char **argv) exit(255); } int nSocket = atol( argv[1] ); - + #ifdef ENABLE_GTK g_thread_init(NULL); gtk_init(&argc, &argv); @@ -416,7 +416,7 @@ int main( int argc, char **argv) medDebug( 1, "could not get Xt GSource" ); return 1; } - + g_source_set_priority( pXTSource, GDK_PRIORITY_EVENTS ); g_source_set_can_recurse( pXTSource, TRUE ); g_source_attach( pXTSource, NULL ); @@ -424,7 +424,7 @@ int main( int argc, char **argv) aXtPollDesc.events = G_IO_IN; aXtPollDesc.revents = 0; g_source_add_poll( pXTSource, &aXtPollDesc ); - + gint xt_polling_timer_id = g_timeout_add( 25, pollXtTimerCallback, NULL); // Initialize wakeup events listener GSource *pWakeupSource = g_source_new( &aWakeupEventFuncs, sizeof(GSource) ); @@ -491,7 +491,7 @@ int main( int argc, char **argv) #ifdef ENABLE_GTK g_source_remove(xt_polling_timer_id); #endif - + pNP_Shutdown(); medDebug( 1, "NP_Shutdown done\n" ); osl_unloadModule( pPluginLib ); diff --git a/extensions/source/plugin/unx/plugcon.cxx b/extensions/source/plugin/unx/plugcon.cxx index 607ae05d9877..52be98fdae87 100644 --- a/extensions/source/plugin/unx/plugcon.cxx +++ b/extensions/source/plugin/unx/plugcon.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -82,7 +82,7 @@ struct PtrStruct { char* pData; ULONG nBytes; - + PtrStruct( char* i_pData, ULONG i_nBytes ) : pData( i_pData ), nBytes( i_nBytes ) {} }; @@ -94,7 +94,7 @@ ULONG PluginConnector::FillBuffer( char*& rpBuffer, { std::vector< PtrStruct > aList; aList.reserve( 5 ); - + ULONG nDataSize = nFunctionLen + sizeof( ULONG ); char* pNext; @@ -164,7 +164,7 @@ void PluginConnector::Respond( ULONG nID, { va_list ap; char* pBuffer; - + va_start( ap, nFunctionLen ); ULONG nSize = FillBuffer( pBuffer, pFunction, nFunctionLen, ap ); va_end( ap ); @@ -257,34 +257,34 @@ const char* GetCommandName( CommandAtoms eCommand ) { switch( eCommand ) { - case eNPN_GetURL: return "NPN_GetURL"; - case eNPN_GetURLNotify: return "NPN_GetURLNotify"; - case eNPN_DestroyStream: return "NPN_DestroyStream"; - case eNPN_NewStream: return "NPN_NewStream"; - case eNPN_PostURLNotify: return "NPN_PostURLNotify"; - case eNPN_PostURL: return "NPN_PostURL"; - case eNPN_RequestRead: return "NPN_RequestRead"; - case eNPN_Status: return "NPN_Status"; - case eNPN_Version: return "NPN_Version"; - case eNPN_Write: return "NPN_Write"; - case eNPN_UserAgent: return "NPN_UserAgent"; - - case eNPP_DestroyStream: return "NPP_DestroyStream"; - case eNPP_Destroy: return "NPP_Destroy"; - case eNPP_DestroyPhase2: return "NPP_DestroyPhase2"; - case eNPP_NewStream: return "NPP_NewStream"; - case eNPP_New: return "NPP_New"; - case eNPP_SetWindow: return "NPP_SetWindow"; - case eNPP_StreamAsFile: return "NPP_StreamAsFile"; - case eNPP_URLNotify: return "NPP_URLNotify"; - case eNPP_WriteReady: return "NPP_WriteReady"; - case eNPP_Write: return "NPP_Write"; - case eNPP_GetMIMEDescription: return "NPP_GetMIMEDescription"; - case eNPP_Initialize: return "NPP_Initialize"; - case eNPP_Shutdown: return "NPP_Shutdown"; - - case eMaxCommand: return "eMaxCommand"; - default: return "unknown command"; + case eNPN_GetURL: return "NPN_GetURL"; + case eNPN_GetURLNotify: return "NPN_GetURLNotify"; + case eNPN_DestroyStream: return "NPN_DestroyStream"; + case eNPN_NewStream: return "NPN_NewStream"; + case eNPN_PostURLNotify: return "NPN_PostURLNotify"; + case eNPN_PostURL: return "NPN_PostURL"; + case eNPN_RequestRead: return "NPN_RequestRead"; + case eNPN_Status: return "NPN_Status"; + case eNPN_Version: return "NPN_Version"; + case eNPN_Write: return "NPN_Write"; + case eNPN_UserAgent: return "NPN_UserAgent"; + + case eNPP_DestroyStream: return "NPP_DestroyStream"; + case eNPP_Destroy: return "NPP_Destroy"; + case eNPP_DestroyPhase2: return "NPP_DestroyPhase2"; + case eNPP_NewStream: return "NPP_NewStream"; + case eNPP_New: return "NPP_New"; + case eNPP_SetWindow: return "NPP_SetWindow"; + case eNPP_StreamAsFile: return "NPP_StreamAsFile"; + case eNPP_URLNotify: return "NPP_URLNotify"; + case eNPP_WriteReady: return "NPP_WriteReady"; + case eNPP_Write: return "NPP_Write"; + case eNPP_GetMIMEDescription: return "NPP_GetMIMEDescription"; + case eNPP_Initialize: return "NPP_Initialize"; + case eNPP_Shutdown: return "NPP_Shutdown"; + + case eMaxCommand: return "eMaxCommand"; + default: return "unknown command"; } return NULL; } diff --git a/extensions/source/plugin/unx/sysplug.cxx b/extensions/source/plugin/unx/sysplug.cxx index dc7be6799ae3..f5221aa027c8 100644 --- a/extensions/source/plugin/unx/sysplug.cxx +++ b/extensions/source/plugin/unx/sysplug.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/extensions/source/plugin/unx/unxmgr.cxx b/extensions/source/plugin/unx/unxmgr.cxx index 0ecd12b65ff7..b042815f8343 100644 --- a/extensions/source/plugin/unx/unxmgr.cxx +++ b/extensions/source/plugin/unx/unxmgr.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -121,18 +121,18 @@ static bool CheckPlugin( const ByteString& rPath, list< PluginDescription* >& rD if( aMIME.getLength() > 0 ) { OString aLine = aMIME.makeStringAndClear(); - + sal_Int32 nIndex = 0; while( nIndex != -1 ) { OString aType = aLine.getToken( 0, ';', nIndex ); sal_Int32 nTypeIndex = 0; - OString aMimetype = aType.getToken( 0, ':', nTypeIndex ); - OString aExtLine = aType.getToken( 0, ':', nTypeIndex ); + OString aMimetype = aType.getToken( 0, ':', nTypeIndex ); + OString aExtLine = aType.getToken( 0, ':', nTypeIndex ); if( nTypeIndex < 0 ) // ensure at least three tokens continue; - OString aDesc = aType.getToken( 0, ':', nTypeIndex ); + OString aDesc = aType.getToken( 0, ':', nTypeIndex ); // create extension list string sal_Int32 nExtIndex = 0; @@ -149,11 +149,11 @@ static bool CheckPlugin( const ByteString& rPath, list< PluginDescription* >& rD PluginDescription* pNew = new PluginDescription; // set plugin name (path to library) - pNew->PluginName = OStringToOUString( rPath, aEncoding ); + pNew->PluginName = OStringToOUString( rPath, aEncoding ); // set mimetype - pNew->Mimetype = OStringToOUString( aMimetype, aEncoding ); + pNew->Mimetype = OStringToOUString( aMimetype, aEncoding ); // set extension line - pNew->Extension = OStringToOUString( aExtension.makeStringAndClear(), aEncoding ); + pNew->Extension = OStringToOUString( aExtension.makeStringAndClear(), aEncoding ); // set description pNew->Description= OStringToOUString( aDesc, aEncoding ); rDescriptions.push_back( pNew ); @@ -209,7 +209,7 @@ static void CheckPluginRegistryFiles( const rtl::OString& rPath, list< PluginDes } fclose( fp ); } - + // check subdirectories DIR* pDIR = opendir( rPath.getStr() ); struct dirent* pDirEnt = NULL; @@ -224,7 +224,7 @@ static void CheckPluginRegistryFiles( const rtl::OString& rPath, list< PluginDes aBuf.append( rPath ); aBuf.append( '/' ); aBuf.append( pBaseName ); - + if( ! stat( aBuf.getStr(), &aStat ) ) { if( S_ISDIR( aStat.st_mode ) ) |