Commits

hr  committed cb54593

CWS-TOOLING: integrate CWS swffixes_DEV300

  • Participants
  • Parent commits eac9989

Comments (0)

Files changed (13)

File extensions/source/plugin/base/makefile.mk

 #
 # $RCSfile: makefile.mk,v $
 #
-# $Revision: 1.14 $
+# $Revision: 1.14.90.2 $
 #
 # This file is part of OpenOffice.org.
 #
 CFLAGSCXX+=$(OBJCXXFLAGS)
 .ENDIF  # "$(GUIBASE)"=="aqua"
 
+.IF "$(GUIBASE)" == "unx" && "$(ENABLE_GTK)" == "TRUE"
+PKGCONFIG_MODULES=gtk+-2.0
+.INCLUDE : pkg_config.mk
+.ENDIF
+
 SLOFILES=		\
 				$(SLO)$/plctrl.obj		\
 				$(SLO)$/service.obj		\

File extensions/source/plugin/inc/plugin/unx/mediator.hxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: mediator.hxx,v $
- * $Revision: 1.8 $
+ * $Revision: 1.8.90.1 $
  *
  * This file is part of OpenOffice.org.
  *
 #include <string.h>
 #include <stdarg.h>
 #include <tools/string.hxx>
-#include <tools/list.hxx>
 #include <tools/link.hxx>
 #include <vos/pipe.hxx>
 #include <vos/mutex.hxx>
 #include <stdio.h>
 #endif
 
+#include <vector>
+
 struct MediatorMessage
 {
 	ULONG	m_nID;
 	void	Rewind() { m_pRun = NULL; }
 };
 
-DECLARE_LIST( MediatorMessageList, MediatorMessage* )
-
 class MediatorListener;
 
 class Mediator
 protected:
     int									m_nSocket;
 
-	MediatorMessageList					m_aMessageQueue;
+    std::vector<MediatorMessage*>		m_aMessageQueue;
 	NAMESPACE_VOS(OMutex)				m_aQueueMutex;
 	NAMESPACE_VOS(OMutex)				m_aSendMutex;
 	// only one thread can send a message at any given time

File extensions/source/plugin/inc/plugin/unx/plugcon.hxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: plugcon.hxx,v $
- * $Revision: 1.13 $
+ * $Revision: 1.13.90.3 $
  *
  * This file is part of OpenOffice.org.
  *
 #include <string.h>
 
 #include <list>
-#include <tools/list.hxx>
+#include <vector>
 #include <plugin/unx/mediator.hxx>
 
 #if defined SOLARIS
 #include <npsdk/npupp.h>
 }
 #include <npapi.h>
+
+#if NP_VERSION_MINOR < 17
+// compatibility hack: compile with older NPN api header, but define
+// some later introduced constants
+// for gcc 3
+#define NP_ABI_MASK 0x10000000
+#define NPNVSupportsXEmbedBool ((NPNVariable)14)
+#define NPPVpluginNeedsXEmbed  ((NPPVariable)14)
+#define NPNVToolkit            ((int)(13 | NP_ABI_MASK))
+#define NPNVGtk12 1
+#define NPNVGtk2  2
+#endif
+#endif
+
+#ifdef ENABLE_GTK
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+#else
+#define GtkWidget void
 #endif
 
 #undef Window
 	void*						pShell;
 	void*						pWidget;
     void*						pForm;
+    
+    GtkWidget*                  pGtkWindow;
+    GtkWidget*                  pGtkWidget;
+    
+    bool                        bShouldUseXEmbed;
 
 	int nArg;
 	char** argn;
 	~ConnectorInstance();
 };
 
-class PluginConnector;
-
-DECLARE_LIST( NPStreamList, NPStream* )
-DECLARE_LIST( InstanceList, ConnectorInstance* )
-DECLARE_LIST( PluginConnectorList, PluginConnector* )
-
 class PluginConnector : public Mediator
 {
 protected:
 	NAMESPACE_VOS(OMutex)               m_aUserEventMutex;
 
-	static PluginConnectorList          allConnectors;
+	static std::vector<PluginConnector*>  allConnectors;
 	
 	DECL_LINK( NewMessageHdl, Mediator* );
 	DECL_LINK( WorkOnNewMessageHdl, Mediator* );
 	
-	NPStreamList	m_aNPWrapStreams;
-	InstanceList	m_aInstances;
+    std::vector<NPStream*>              m_aNPWrapStreams;
+    std::vector<ConnectorInstance*>     m_aInstances;
 	
 	ULONG	FillBuffer( char*&, const char*, ULONG, va_list );
 public:
 	UINT32	GetStreamID( NPStream* pStream );
 	UINT32	GetNPPID( NPP );
 
-    NPStreamList& getStreamList() { return m_aNPWrapStreams; }
+    std::vector<NPStream*>& getStreamList() { return m_aNPWrapStreams; }
 
 	NPError GetNPError( MediatorMessage* pMes )
 	{
 		LINK( this, PluginConnector, WorkOnNewMessageHdl ).
 			Call( (Mediator*)this );
 	}
+    
+    ConnectorInstance* getInstance( NPP );
+    ConnectorInstance* getInstanceById( UINT32 );
 };
 
 enum CommandAtoms

File extensions/source/plugin/unx/makefile.mk

 #
 # $RCSfile: makefile.mk,v $
 #
-# $Revision: 1.15 $
+# $Revision: 1.15.90.3 $
 #
 # This file is part of OpenOffice.org.
 #
 PRJNAME=extensions
 TARGET=plunx
 TARGETTYPE=CUI
+ENABLE_EXCEPTIONS=TRUE
 
 .INCLUDE :  ..$/util$/makefile.pmk
 
 CDEFS+=-DDISABLE_XAW
 .ENDIF
 
+.IF "$(ENABLE_GTK)" == "TRUE"
+CDEFS+=-DENABLE_GTK
+PKGCONFIG_MODULES=gtk+-2.0 gthread-2.0
+.INCLUDE : pkg_config.mk
+.ENDIF
+
 SLOFILES=\
 	$(SLO)$/nppapi.obj		\
 	$(SLO)$/sysplug.obj		\
 .ENDIF
 .ENDIF
 
+.IF "$(ENABLE_GTK)" == "TRUE"
+# libs for gtk plugin
+APP1STDLIBS+=$(PKGCONFIG_LIBS:s/ -lpangoxft-1.0//)
+# hack for faked SO environment
+.IF "$(PKGCONFIG_ROOT)"!=""
+.IF "$(OS)" == "SOLARIS"
+# don't ask, it's ugly
+DIRECT :=-z nodefs $(DIRECT)
+.ENDIF
+.ENDIF          # "$(PKGCONFIG_ROOT)"!=""
+.ENDIF
+    
+
 APP1DEF=	$(MISC)$/$(TARGET).def
 
 .ENDIF # $(WITH_MOZILLA) != "NO"

File extensions/source/plugin/unx/mediator.cxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: mediator.cxx,v $
- * $Revision: 1.11 $
+ * $Revision: 1.11.90.1 $
  *
  * This file is part of OpenOffice.org.
  *
 	}
     else
         close( m_nSocket );
-	while( m_aMessageQueue.Count() )
-		delete m_aMessageQueue.Remove( (ULONG)0 );
+    for( std::vector< MediatorMessage* >::iterator it = m_aMessageQueue.begin();
+         it != m_aMessageQueue.end(); ++it )
+    {
+		delete *it;
+    }
 }
 
 
     if( ! m_pListener )
         return FALSE;
 
-	ULONG nItems = m_aMessageQueue.Count();
+	size_t nItems = m_aMessageQueue.size();
 
 	if( ! nTimeOut && nItems > 0 )
 		return TRUE;
 	aValue.Seconds = nTimeOut/1000;
 	aValue.Nanosec = ( nTimeOut % 1000 ) * 1000;
 
-	while( m_aMessageQueue.Count() == nItems )
+	while( m_aMessageQueue.size() == nItems )
 	{
 		m_aNewMessageCdtn.wait( & aValue );
 		m_aNewMessageCdtn.reset();
-		if( nTimeOut && m_aMessageQueue.Count() == nItems )
+		if( nTimeOut && m_aMessageQueue.size() == nItems )
 			return FALSE;
 	}
 	return TRUE;
 	{
 		{
 			NAMESPACE_VOS(OGuard) aGuard( m_aQueueMutex );
-			for( ULONG i = 0; i < m_aMessageQueue.Count(); i++ )
+			for( size_t i = 0; i < m_aMessageQueue.size(); i++ )
 			{
-				ULONG nID = m_aMessageQueue.GetObject( i )->m_nID;
+                MediatorMessage* pMessage = m_aMessageQueue[ i ];
+				ULONG nID = pMessage->m_nID;
 				if(  ( nID & 0xff000000 ) &&
 					 ( ( nID & 0x00ffffff ) == nMessageID ) )
-					return m_aMessageQueue.Remove( i );
+                {
+					m_aMessageQueue.erase( m_aMessageQueue.begin() + i );
+                    return pMessage;
+                }
 			}
 		}
 		WaitForMessage( 10 );
 			// guard must be after WaitForMessage, else the listener
 			// cannot insert a new one -> deadlock
 			NAMESPACE_VOS(OGuard) aGuard( m_aQueueMutex );
-			for( ULONG i = 0; i < m_aMessageQueue.Count(); i++ )
-				if( ! ( m_aMessageQueue.GetObject( i )->m_nID & 0xff000000 ) )
-					return m_aMessageQueue.Remove( i );
+			for( size_t i = 0; i < m_aMessageQueue.size(); i++ )
+            {
+                MediatorMessage* pMessage = m_aMessageQueue[ i ];
+				if( ! ( pMessage->m_nID & 0xff000000 ) )
+                {
+                    m_aMessageQueue.erase( m_aMessageQueue.begin() + i );
+					return pMessage;
+                }
+            }
 			if( ! bWait )
 				return NULL;
 		}
                         aGuard( m_pMediator->m_aQueueMutex );
                     MediatorMessage* pMessage =
                         new MediatorMessage( nHeader[ 0 ], nHeader[ 1 ], pBuffer );
-                    m_pMediator->m_aMessageQueue.Insert( pMessage, LIST_APPEND );
+                    m_pMediator->m_aMessageQueue.push_back( pMessage );
                 }
                 m_pMediator->m_aNewMessageCdtn.set();
                 m_pMediator->m_aNewMessageHdl.Call( m_pMediator );

File extensions/source/plugin/unx/npnapi.cxx

 extern int wakeup_fd[];
 extern Widget topLevel, topBox;
 extern Display* pAppDisplay;
+extern Display* pXtAppDisplay;
 extern int nAppArguments;
 extern char** pAppArguments;
 
 	if( ! pMes )
 		return NPERR_GENERIC_ERROR;
 
-	pConnector->getStreamList().Remove( stream );
+    for( std::vector< NPStream* >::iterator it = pConnector->getStreamList().begin();
+         it != pConnector->getStreamList().end(); ++it )
+    {
+        if( *it == stream )
+        {
+            pConnector->getStreamList().erase( it );
+            break;
+        }
+    }
 	delete [] stream->url;
 	delete stream;
 	// returns NPError
 		pStream->lastmodified = pMes->GetUINT32();
         pStream->ndata = pStream->pdata = pStream->notifyData = NULL;
         
-		pConnector->getStreamList().Insert( pStream, LIST_APPEND );
+		pConnector->getStreamList().push_back( pStream );
 		*stream = pStream;
 	}
 
 	medDebug( 1, "NPN_ReloadPlugins: SNI\n" );
 }
 
-static NPError l_NPN_GetValue( NPP /*instance*/, NPNVariable variable, void* value )
+static NPError l_NPN_GetValue( NPP, NPNVariable variable, void* value )
 {
 	switch( variable )
 	{
 		case NPNVxDisplay:
-			*((Display**)value) = pAppDisplay;
-			medDebug( 1, "Display requested\n" );
+            *((Display**)value) = pXtAppDisplay;
+            medDebug( 1, "Display requested\n" );
 			break;
 		case NPNVxtAppContext:
 			*((XtAppContext*)value) = app_context;
             *(NPBool*)value = false;
 			medDebug( 1, "offline browsing requested\n" );
             break;
+        case NPNVSupportsXEmbedBool:
+            // asking xembed
+            *(int*)value = true;
+			medDebug( 1, "xembed requested\n" );
+            break;
+        case NPNVToolkit:
+            #ifdef ENABLE_GTK
+            *(int*)value = NPNVGtk2;
+            #else
+            *(int*)value = 0;
+            #endif
+			medDebug( 1, "toolkit requested\n" );
+            break;
  		default:
-			medDebug( 1, "unknown NPNVariable %d requested\n", variable );
+			medDebug( 1, "unknown NPNVariable %x requested\n", variable );
             return NPERR_INVALID_PARAM;
 	}
 	return NPERR_NO_ERROR;
 NPError (*pNP_Initialize)(NPNetscapeFuncs*,NPPluginFuncs*)		= NULL;
 NPError (*pNP_Shutdown)()										= NULL;
 
-PluginConnectorList PluginConnector::allConnectors;
+std::vector< PluginConnector* > PluginConnector::allConnectors;
 
 PluginConnector::PluginConnector( int nSocket ) :
 		Mediator( nSocket )
 			case eNPP_DestroyStream:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				UINT32 nFileID		= pMessage->GetUINT32();
-				NPStream* pStream	= m_aNPWrapStreams.GetObject( nFileID );
+				NPStream* pStream	= m_aNPWrapStreams[ nFileID ];
 				NPError aReason		= GetNPError( pMessage );
-                m_aNPWrapStreams.Remove( pStream );
+                m_aNPWrapStreams.erase( m_aNPWrapStreams.begin() + nFileID );
 
 				aReason = aPluginFuncs.destroystream( instance, pStream, aReason );
 				Respond( pMessage->m_nID,
 			case eNPP_Destroy:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				ConnectorInstance* pInst= m_aInstances.GetObject( nInstance );
+				ConnectorInstance* pInst= m_aInstances[ nInstance ];
 
                 // some plugin rely on old netscapes behaviour
                 // to first destroy the widget and then destroy
                 // the instance, so mimic that behaviour here
-                XtDestroyWidget( (Widget)pInst->pShell );
+                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 );
             {
                 // now really destroy the instance
 				UINT32 nInstance	= pMessage->GetUINT32();
-				ConnectorInstance* pInst= m_aInstances.GetObject( nInstance );
+				ConnectorInstance* pInst= m_aInstances[ nInstance ];
 				NPP instance		= pInst->instance;
 				NPSavedData* pSave = NULL;
 
 							 "0000", 4,
 							 NULL );
 
-				delete m_aInstances.Remove( nInstance );
+                #ifdef ENABLE_GTK
+                if( pInst->pGtkWindow )
+                    g_object_unref( G_OBJECT(pInst->pGtkWindow) );
+                if( pInst->pGtkWidget )
+                    g_object_unref( G_OBJECT(pInst->pGtkWidget) );
+                #endif
+
+				m_aInstances.erase( m_aInstances.begin() + nInstance );
+                delete pInst;
 				delete instance;
                 medDebug( 1, "destroyed instance (returning %d)\n", aRet );
 			}
 			case eNPP_NewStream:
 			{
 				UINT32 nInstance		= pMessage->GetUINT32();
-				NPP instance			= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance			= m_aInstances[ nInstance ]->instance;
 				char* pType				= pMessage->GetString();
 				NPStream* pStream		= new NPStream;
 				pStream->url			= pMessage->GetString();
 				pStream->lastmodified	= pMessage->GetUINT32();
                 pStream->pdata = pStream->ndata = pStream->notifyData = NULL;
 				NPBool* pSeekable		= (NPBool*)pMessage->GetBytes();
-				m_aNPWrapStreams.Insert( pStream, LIST_APPEND );
+				m_aNPWrapStreams.push_back( pStream );
 				uint16 nStype = NP_ASFILE;
 				NPError aRet = aPluginFuncs.newstream( instance, pType, pStream,
                                                        *pSeekable, &nStype );
 										   pArgn, nArgnBytes,
 										   pArgv, nArgvBytes,
 										   pSavedData, nSaveBytes );
-				m_aInstances.Insert( pInst, LIST_APPEND );
+				m_aInstances.push_back( pInst );
 				NPError aRet;
 				aRet = aPluginFuncs.newp( pInst->pMimeType, instance, *pMode, *pArgc,
                                           pInst->nArg ? pInst->argn : NULL,
                 for( int i = 0; i < pInst->nArg; i++ )
                     medDebug( 1, "   \"%s\"=\"%s\"\n", pInst->argn[i], pInst->argv[i] );
 #endif
+
+                #ifdef ENABLE_GTK
+                // check if XEMBED is to be used
+                // ask for Bool. there seems to be no clear definition whether the
+                // return value should be an int or unsigned char
+                // int can hold both and will be nonzero in case of "true"
+                if( aPluginFuncs.getvalue )
+                {
+                    int bNeedsXEmbed = 0;
+                    NPError error = aPluginFuncs.getvalue( instance, NPPVpluginNeedsXEmbed, (void *)&bNeedsXEmbed );
+                    if( error == NPERR_NO_ERROR )
+                        pInst->bShouldUseXEmbed = (bNeedsXEmbed != 0);
+                    medDebug( 1, "should use xembed = %s\n", pInst->bShouldUseXEmbed ? "true" : "false" );
+                }
+                #endif
+                
 				Respond( pMessage->m_nID,
 						 (char*)&aRet, sizeof( aRet ),
 						 NULL );
 			case eNPP_SetWindow:
 			{
 				UINT32 nInstance		= pMessage->GetUINT32();
-				ConnectorInstance* pInst= m_aInstances.GetObject( nInstance );
+				ConnectorInstance* pInst= m_aInstances[ nInstance ];
 				NPWindow* pWindow		= (NPWindow*)pMessage->GetBytes();
-				if( ! pInst->pWidget )
-				{
-                    static bool bFirstWindow = true;
+                
+                if( pWindow->width < 1 )
+                    pWindow->width = 1;
+                if( pWindow->height < 1 )
+                    pWindow->height = 1;
+
+                #ifdef ENABLE_GTK
+                if( pInst->bShouldUseXEmbed )
+                {
+                    if( ! pInst->pGtkWidget )
+                    {
+                        medDebug( 1, "creating gtk plug and socket\n" );
+                        
+                        pInst->pGtkWindow = gtk_plug_new((GdkNativeWindow)pWindow->window);
+                        gtk_widget_show( pInst->pGtkWindow );
+                        pInst->pGtkWidget = gtk_socket_new();
+                        gtk_widget_show( pInst->pGtkWidget );
+                        gtk_container_add( GTK_CONTAINER(pInst->pGtkWindow), pInst->pGtkWidget );
+                        gtk_widget_show_all( pInst->pGtkWindow );
+                        pInst->window.window = (void *)gtk_socket_get_id( GTK_SOCKET(pInst->pGtkWidget ) );
+
+                        XSync( pAppDisplay, False );
+
+                        XMapWindow( pAppDisplay, GDK_WINDOW_XWINDOW(pInst->pGtkWindow->window) );
+
+                        XSync( pAppDisplay, False );
+                    }
                     
-                    if( bFirstWindow )
-                    {
-                        bFirstWindow = false;
-                        pInst->pShell	= topLevel;
-                        pInst->pWidget	= topBox;
-                        medDebug( 1, "reusing app window\n" );
-                    }
-                    else
+                    // 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 );
+                }
+                else
+                #endif
+                {
+                    if( ! pInst->pWidget )
                     {
                         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 ) );
+    
+                    XtResizeWidget( (Widget)pInst->pShell,
+                                    pInst->window.width,
+                                    pInst->window.height,
+                                    0 );
+                    XtResizeWidget( (Widget)pInst->pWidget,
+                                    pInst->window.width,
+                                    pInst->window.height,
+                                    0 );
                 }
 
-                // 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 ) );
-
-				XtResizeWidget( (Widget)pInst->pShell,
-								pInst->window.width,
-								pInst->window.height,
-								0 );
-				XtResizeWidget( (Widget)pInst->pWidget,
-								pInst->window.width,
-								pInst->window.height,
-								0 );
-
 				NPError aRet = aPluginFuncs.setwindow( pInst->instance, &pInst->window );
 				medDebug( 1, "pluginapp: NPP_SetWindow returns %d\n", (int) aRet );
 				Respond( pMessage->m_nID,
 			case eNPP_StreamAsFile:
 			{
 				UINT32 nInstance		= pMessage->GetUINT32();
-				NPP instance			= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance			= m_aInstances[ nInstance ]->instance;
 				UINT32 nFileID			= pMessage->GetUINT32();
-				NPStream* pStream		= m_aNPWrapStreams.GetObject( nFileID );
+				NPStream* pStream		= m_aNPWrapStreams[ nFileID ];
 				char* fname				= pMessage->GetString();
 				medDebug( 1, "pluginapp: NPP_StreamAsFile %s\n", fname );
 				aPluginFuncs.asfile( instance, pStream, fname );
 			case eNPP_URLNotify:
 			{
 				UINT32 nInstance		= pMessage->GetUINT32();
-				NPP instance			= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance			= m_aInstances[ nInstance ]->instance;
 				char* url				= pMessage->GetString();
 				NPReason* pReason		= (NPReason*)pMessage->GetBytes();
 				void** notifyData		= (void**)pMessage->GetBytes();
 			case eNPP_WriteReady:
 			{
 				UINT32 nInstance		= pMessage->GetUINT32();
-				NPP instance			= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance			= m_aInstances[ nInstance ]->instance;
 				UINT32 nFileID			= pMessage->GetUINT32();
-				NPStream* pStream		= m_aNPWrapStreams.GetObject( nFileID );
+				NPStream* pStream		= m_aNPWrapStreams[ nFileID ];
 				int32 nRet = aPluginFuncs.writeready( instance, pStream );
                 
                 medDebug( 1, "pluginapp: NPP_WriteReady( %p, %p ) (stream id = %d) returns %d\n",
 			case eNPP_Write:
 			{
 				UINT32 nInstance		= pMessage->GetUINT32();
-				NPP instance			= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance			= m_aInstances[ nInstance ]->instance;
 				UINT32 nFileID			= pMessage->GetUINT32();
-				NPStream* pStream		= m_aNPWrapStreams.GetObject( nFileID );
+				NPStream* pStream		= m_aNPWrapStreams[ nFileID ];
 				int32 offset			= pMessage->GetUINT32();
 				ULONG len;
 				char* buffer			= (char*)pMessage->GetBytes( len );

File extensions/source/plugin/unx/nppapi.cxx

 #include <plugin/impl.hxx>
 #include <vcl/svapp.hxx>
 
-PluginConnectorList PluginConnector::allConnectors;
+std::vector<PluginConnector*> PluginConnector::allConnectors;
 
 PluginConnector::PluginConnector( int nSocket ) :
 		Mediator( nSocket )
 {
-	allConnectors.Insert( this, LIST_APPEND );
+	allConnectors.push_back( this );
 	SetNewMessageHdl( LINK( this, PluginConnector, NewMessageHdl ) );
 }
 
 PluginConnector::~PluginConnector()
 {
 	NAMESPACE_VOS(OGuard) aGuard( m_aUserEventMutex );
-	allConnectors.Remove( this );
+    for( std::vector< PluginConnector* >::iterator it = allConnectors.begin();
+         it != allConnectors.end(); ++it )
+    {
+        if( *it == this )
+        {
+            allConnectors.erase( it );
+            break;
+        }
+    }
 }
 
 IMPL_LINK( PluginConnector, NewMessageHdl, Mediator*, /*pMediator*/ )
 {
 	NAMESPACE_VOS(OGuard) aGuard( m_aUserEventMutex );
-	if( allConnectors.GetPos( this ) == LIST_ENTRY_NOTFOUND )
+    bool bFound = false;
+    for( std::vector< PluginConnector* >::iterator it = allConnectors.begin();
+         it != allConnectors.end() && bFound == false; ++it )
+    {
+        if( *it == this )
+            bFound = true;
+    }
+	if( ! bFound )
 		return 0;
     Application::PostUserEvent( LINK( this, PluginConnector, WorkOnNewMessageHdl ) );
 	return 0;
 
 IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ )
 {
-	if( allConnectors.GetPos( this ) == LIST_ENTRY_NOTFOUND )
+    bool bFound = false;
+    for( std::vector< PluginConnector* >::iterator it = allConnectors.begin();
+         it != allConnectors.end() && bFound == false; ++it )
+    {
+        if( *it == this )
+            bFound = true;
+    }
+	if( ! bFound )
 		return 0;
 /*
     {
 			case eNPN_GetURL:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				char* pUrl			= pMessage->GetString();
 				char* pWindow		= pMessage->GetString();
 				NPError aRet = NPN_GetURL( instance, pUrl, pWindow );
 			case eNPN_GetURLNotify:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				char* pUrl			= pMessage->GetString();
 				char* pWindow		= pMessage->GetString();
 				void** pNotifyData	= (void**)pMessage->GetBytes();
 			case eNPN_DestroyStream:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				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 < m_aNPWrapStreams.Count() )
+				if( nFileID < static_cast<UINT32>(m_aNPWrapStreams.size()) )
 				{
-					if( ! strcmp( m_aNPWrapStreams.GetObject( nFileID )->url, pUrl ) )
+					if( ! strcmp( m_aNPWrapStreams[ nFileID ]->url, pUrl ) )
 					{
 						aRet =
-							NPN_DestroyStream( instance, m_aNPWrapStreams.GetObject( nFileID ),
+							NPN_DestroyStream( instance, m_aNPWrapStreams[ nFileID ],
 											   *pReason );
-						m_aNPWrapStreams.Remove( nFileID );
+						m_aNPWrapStreams.erase( m_aNPWrapStreams.begin() + nFileID );
 					}
 					else
 						medDebug( 1, "StreamID %d has incoherent urls %s and %s\n",
-								  nFileID, pUrl, m_aNPWrapStreams.GetObject( nFileID )->url );
+								  nFileID, pUrl, m_aNPWrapStreams[ nFileID ]->url );
 				}
 				else
 					medDebug( 1, "Nonexistent StreamID %d\n", nFileID );
 			case eNPN_NewStream:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				NPMIMEType pType	= pMessage->GetString();
 				char* pTarget		= pMessage->GetString();
 
 				}
 				else
                 {
-					m_aNPWrapStreams.Insert( pStream, LIST_APPEND );
+					m_aNPWrapStreams.push_back( pStream );
 
                     ULONG nLen = strlen( pStream->url );
                     Respond( pMessage->m_nID,
 			case eNPN_PostURLNotify:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				char* pUrl		= pMessage->GetString();
 				char* pTarget	= pMessage->GetString();
 				UINT32 nLen		= pMessage->GetUINT32();
 			case eNPN_PostURL:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				char* pUrl		= pMessage->GetString();
 				char* pWindow	= pMessage->GetString();
 				UINT32 nLen		= pMessage->GetUINT32();
 			case eNPN_RequestRead:
 			{
 				UINT32 nFileID		= pMessage->GetUINT32();
-				NPStream* pStream	= m_aNPWrapStreams.GetObject( nFileID );
+				NPStream* pStream	= m_aNPWrapStreams[ nFileID ];
 				UINT32 nRanges		= pMessage->GetUINT32();
 				UINT32* pArray		= (UINT32*)pMessage->GetBytes();
 				// build ranges table
 			case eNPN_Status:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				char* pString	= pMessage->GetString();
 				NPN_Status( instance, pString );
 				delete [] pString;
 			case eNPN_Write:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				UINT32 nFileID		= pMessage->GetUINT32();
-				NPStream* pStream	= m_aNPWrapStreams.GetObject( nFileID );
+				NPStream* pStream	= m_aNPWrapStreams[ nFileID ];
 				INT32 nLen			= pMessage->GetUINT32();
 				void* pBuffer		= pMessage->GetBytes();
 				INT32 nRet = NPN_Write( instance, pStream, nLen, pBuffer );
 			case eNPN_UserAgent:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				const char* pAnswer = NPN_UserAgent( instance );
 				Respond( pMessage->m_nID,
 						 (char*)pAnswer, strlen( pAnswer ),
 				  &nFileID, sizeof( nFileID ),
 				  &reason, sizeof( reason ),
 				  NULL );
-	m_aNPWrapStreams.Remove( stream );
+	m_aNPWrapStreams.erase( m_aNPWrapStreams.begin() + nFileID );
 	if( ! pMes )
 		return NPERR_GENERIC_ERROR;
 
 NPError UnxPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
 				 char* argn[], char* argv[], NPSavedData *saved )
 {
-	m_aInstances.Insert(
+	m_aInstances.push_back(
 		new ConnectorInstance( instance, pluginType, 0,
 							   NULL, 0, NULL, 0,
 							   saved ? (char*)saved->buf : NULL,
-							   saved ? saved->len : 0 ),
-		LIST_APPEND );
+							   saved ? saved->len : 0 ) );
 
 	char *pArgnBuf, *pArgvBuf;
 	int nArgnLen = 0, nArgvLen = 0;
 	NPError aRet = NPERR_GENERIC_ERROR;
 	GET_INSTANCE_RET( aRet );
 
-	m_aNPWrapStreams.Insert( stream, LIST_APPEND );
+	m_aNPWrapStreams.push_back( stream );
 	MediatorMessage* pMes = 
 		Transact( eNPP_NewStream,
 				  POST_INSTANCE(),

File extensions/source/plugin/unx/npwrap.cxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: npwrap.cxx,v $
- * $Revision: 1.16 $
+ * $Revision: 1.16.90.5 $
  *
  * This file is part of OpenOffice.org.
  *
 #include <errno.h>
 #include <dlfcn.h>
 #include <unistd.h>
+#include <sys/poll.h>
 #include <fcntl.h>
 #include <signal.h>
 
 int			nAppArguments = 0;
 char**		pAppArguments = NULL;
 Display*	pAppDisplay = NULL;
+Display*    pXtAppDisplay = NULL;
 
 extern oslModule pPluginLib;
 extern NPError (*pNP_Shutdown)();
     {
         return 0;
     }
-
+    
+    #ifndef ENABLE_GTK
     static void ThreadEventHandler( XtPointer /*client_data*/, int* /*source*/, XtInputId* id )
     {
         char buf[256];
             }
         }
     }
+    #endif
 }
 
 
         XtNheight, 200,
   		(char *)NULL );
     XtRealizeWidget( shell );
+    XtRealizeWidget( newWidget );
 
     medDebug( 1, "Reparenting new widget %x to %x\n", XtWindow( newWidget ), aParentWindow );
-    XReparentWindow( pAppDisplay,
+    XReparentWindow( pXtAppDisplay,
                      XtWindow( shell ),
                      aParentWindow,
                      0, 0 );
     XtMapWidget( shell );
     XtMapWidget( newWidget );
-    XRaiseWindow( pAppDisplay, XtWindow( shell ) ); 
-    XSync( pAppDisplay, False );
+    XRaiseWindow( pXtAppDisplay, XtWindow( shell ) ); 
+    XSync( pXtAppDisplay, False );
 
 	return newWidget;
 }
 void* CreateNewShell( void** pShellReturn, XLIB_Window aParentWindow )
 {
     XLIB_String n, c;
-    XtGetApplicationNameAndClass(pAppDisplay, &n, &c);
+    XtGetApplicationNameAndClass(pXtAppDisplay, &n, &c);
 
 	Widget newShell =
 		XtVaAppCreateShell( "pane", c,
 							topLevelShellWidgetClass,
-							pAppDisplay,
+							pXtAppDisplay,
                             XtNwidth, 200,
                             XtNheight, 200,
                             XtNoverrideRedirect, True,
     oslModule pLib = osl_loadModule( sFileURL.pData, SAL_LOADMODULE_LAZY );
 	if( ! pLib )
     {
-        medDebug( 1, "could not open %s\n", pPath );
+        medDebug( 1, "could not open %s: %s\n", pPath, dlerror() );
     }
     return pLib;
 }
 static void CheckPlugin( const char* pPath )
 {
     oslModule pLib = LoadModule( pPath );
-
+    
 	char*(*pNP_GetMIMEDescription)() = (char*(*)())
         osl_getAsciiFunctionSymbol( pLib, "NP_GetMIMEDescription" );
 	if( pNP_GetMIMEDescription )
         printf( "%s\n", pNP_GetMIMEDescription() );
     else
-        medDebug( 1, "could not symbol NP_GetMIMEDescription\n" );
+        medDebug( 1, "could not get symbol NP_GetMIMEDescription %s\n", dlerror() );
 
     osl_unloadModule( pLib );
 }
     _exit(nSig);
 }
 
+#ifdef ENABLE_GTK
+
+static gboolean noClosure( gpointer )
+{
+    return TRUE;
+}
+
+// Xt events
+static gboolean prepareXtEvent( GSource*, gint* )
+{
+    int nMask = XtAppPending( app_context );
+    return (nMask & XtIMAll) != 0;
+}
+
+static gboolean checkXtEvent( GSource* )
+{
+    int nMask = XtAppPending( app_context );
+    return (nMask & XtIMAll) != 0;
+}
+
+static gboolean dispatchXtEvent( GSource*, GSourceFunc, gpointer )
+{
+    XtAppProcessEvent( app_context, XtIMAll );
+    return TRUE;
+}
+
+static GSourceFuncs aXtEventFuncs =
+{
+  prepareXtEvent,
+  checkXtEvent,
+  dispatchXtEvent,
+  NULL,
+  noClosure,
+  NULL
+};
+
+static gboolean prepareWakeupEvent( GSource*, gint* )
+{
+    struct pollfd aPoll = { wakeup_fd[0], POLLIN, 0 };
+    poll( &aPoll, 1, 0 );    
+    return (aPoll.revents & POLLIN ) != 0;
+}
+
+static gboolean checkWakeupEvent( GSource* pSource )
+{
+    gint nDum = 0;
+    return prepareWakeupEvent( pSource, &nDum );
+}
+
+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 )
+        pConnector->CallWorkHandler();
+    else
+    {
+        XtAppSetExitFlag( app_context );
+        bPluginAppQuit = true;
+
+        delete pConnector;
+        pConnector = NULL;
+    }
+    
+    return TRUE;
+}
+
+static GSourceFuncs aWakeupEventFuncs = {
+  prepareWakeupEvent,
+  checkWakeupEvent,
+  dispatchWakeupEvent,
+  NULL,
+  noClosure,
+  NULL
+};
+
+#endif // GTK
+
 }
 
 int main( int argc, char **argv)
         pBaseName--;
     LoadAdditionalLibs( pBaseName );
 
-    if( argc < 3 )
+    if( argc == 2 )
     {
         CheckPlugin(argv[1]);
         exit(0);
 		exit(255);
 	}
     int nSocket = atol( argv[1] );
+    
+    #ifdef ENABLE_GTK
+    g_thread_init(NULL);
+    gtk_init(&argc, &argv);
+    #endif
 
  	pConnector = new PluginConnector( nSocket );
  	pConnector->SetConnectionLostHdl( Link( NULL, GlobalConnectionLostHdl ) );
 
 	XtSetLanguageProc( NULL, NULL, NULL );
 
-    topLevel = XtVaOpenApplication(
-        &app_context,       /* Application context */
-        "SOPlugin",         /* Application class */
-        NULL, 0,            /* command line option list */
-        &argc, argv,        /* command line args */
-        NULL,               /* for missing app-defaults file */
-        topLevelShellWidgetClass,
-        XtNoverrideRedirect, True,
-        (char *)NULL);      /* terminate varargs list */
-	pAppDisplay = XtDisplay( topLevel );
+    XtToolkitInitialize();
+    app_context = XtCreateApplicationContext();
+    pXtAppDisplay = XtOpenDisplay( app_context, NULL, "SOPlugin", "SOPlugin", NULL, 0, &argc, argv );
 
+
+    #ifdef ENABLE_GTK
+    // integrate Xt events into GTK event loop
+    GPollFD aXtPollDesc, aWakeupPollDesc;
+
+    GSource* pXTSource = g_source_new( &aXtEventFuncs, sizeof(GSource) );
+    if( !pXTSource )
+    {
+        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 );
+    aXtPollDesc.fd = ConnectionNumber( pXtAppDisplay );
+    aXtPollDesc.events = G_IO_IN;
+    aXtPollDesc.revents = 0;
+    g_source_add_poll( pXTSource, &aXtPollDesc );
+    
+    // Initialize wakeup events listener
+    GSource *pWakeupSource = g_source_new( &aWakeupEventFuncs, sizeof(GSource) );
+    if ( pWakeupSource == NULL )
+    {
+        medDebug( 1, "could not get wakeup source" );
+        return 1;
+    }
+    g_source_set_priority( pWakeupSource, GDK_PRIORITY_EVENTS);
+    g_source_attach( pWakeupSource, NULL );
+    aWakeupPollDesc.fd = wakeup_fd[0];
+    aWakeupPollDesc.events = G_IO_IN;
+    aWakeupPollDesc.revents = 0;
+    g_source_add_poll( pWakeupSource, &aWakeupPollDesc );
+
+    pAppDisplay = gdk_x11_display_get_xdisplay( gdk_display_get_default() );
+    #else
+    pAppDisplay = pXtAppDisplay;
     XtAppAddInput( app_context,
                    wakeup_fd[0],
                    (XtPointer)XtInputReadMask,
                    ThreadEventHandler, NULL );
-
-	/*
-	 *  Create windows for widgets and map them.
-	 */
-    int nWindow;
-	sscanf( argv[3], "%d", &nWindow );
-	char pText[1024];
-	sprintf( pText, "starting plugin %s ...", pAppArguments[2] );
-	topBox = createSubWidget( pText, topLevel, (XLIB_Window)nWindow );
-
+    #endif
 
  	// send that we are ready to go
     MediatorMessage* pMessage =
     // of XtAppMainLoop
     do
     {
+        #ifdef ENABLE_GTK
+        g_main_context_iteration( NULL, TRUE );
+        #else
         XtAppProcessEvent( app_context, XtIMAll );
+        #endif
     } while( ! XtAppGetExitFlag( app_context ) && ! bPluginAppQuit );
 
     medDebug( 1, "left plugin app main loop\n" );

File extensions/source/plugin/unx/plugcon.cxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: plugcon.cxx,v $
- * $Revision: 1.8 $
+ * $Revision: 1.8.90.2 $
  *
  * This file is part of OpenOffice.org.
  *
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_extensions.hxx"
 #include <plugin/unx/plugcon.hxx>
+
 #include <cstdarg>
+#include <vector>
 
 UINT32 PluginConnector::GetStreamID( NPStream* pStream )
 {
-	for( ULONG i = 0; i < m_aNPWrapStreams.Count(); i++ )
-		if( m_aNPWrapStreams.GetObject( i ) == pStream )
-			return i;
+    size_t nLen = m_aNPWrapStreams.size();
+	for( size_t i = 0; i < nLen; i++ )
+		if( m_aNPWrapStreams[ i ] == pStream )
+			return static_cast<UINT32>(i);
 	medDebug( 1, "Error: NPStream has no ID\n" );
 	return UnknownStreamID;
 }
 
 UINT32 PluginConnector::GetNPPID( NPP instance )
 {
-	for( ULONG i=0; i < m_aInstances.Count(); i++ )
-		if( m_aInstances.GetObject( i )->instance == instance )
-			return i;
+    size_t nLen = m_aInstances.size();
+	for( size_t i=0; i <nLen; i++ )
+		if( m_aInstances[ i ]->instance == instance )
+			return static_cast<UINT32>(i);
 	medDebug( 1, "Error: NPP has no ID\n" );
 
 	return UnknownNPPID;
 }
 
+ConnectorInstance* PluginConnector::getInstance( NPP instance )
+{
+    size_t nLen = m_aInstances.size();
+	for( size_t i=0; i <nLen; i++ )
+    {
+        ConnectorInstance* pInst = m_aInstances[i];
+        if( pInst->instance == instance )
+            return pInst;
+    }
+    return NULL;
+}
+
+ConnectorInstance* PluginConnector::getInstanceById( UINT32 nInstanceID )
+{
+    return nInstanceID < static_cast<UINT32>(m_aInstances.size()) ? m_aInstances[ nInstanceID ] : NULL;
+}
+
 struct PtrStruct
 {
 	char* pData;
 	ULONG nBytes;
+    
+    PtrStruct( char* i_pData, ULONG i_nBytes )
+    : pData( i_pData ), nBytes( i_nBytes ) {}
 };
 
-DECLARE_LIST( PtrStructList, PtrStruct* )
-
 ULONG PluginConnector::FillBuffer( char*& rpBuffer,
 								   const char* pFunction,
 								   ULONG nFunctionLen,
 								   va_list ap )
 {
-	PtrStructList aList;
-	PtrStruct* pPtrStruct;
+    std::vector< PtrStruct > aList;
+    aList.reserve( 5 );
+    
 	ULONG nDataSize = nFunctionLen + sizeof( ULONG );
 	char* pNext;
 
 		pNext = va_arg( ap, char* );
 		if( pNext )
 		{
-			pPtrStruct = new PtrStruct;
-			pPtrStruct->pData = pNext;
-			pPtrStruct->nBytes = va_arg( ap, ULONG );
-			nDataSize += pPtrStruct->nBytes + sizeof(ULONG);
-			aList.Insert( pPtrStruct, LIST_APPEND );
+            aList.push_back( PtrStruct( pNext, va_arg( ap, ULONG ) ) );
+			nDataSize += aList.back().nBytes + sizeof(ULONG);
 		}
 	} while( pNext );
 
 	memcpy( pRun, pFunction, nFunctionLen );
 	pRun += nFunctionLen;
 
-	while( (pPtrStruct = aList.Remove( (ULONG) 0 )) )
+	for( std::vector<PtrStruct>::const_iterator it = aList.begin(); it != aList.end(); ++it )
 	{
-		memcpy( pRun, &pPtrStruct->nBytes, sizeof( ULONG ) );
+		memcpy( pRun, &it->nBytes, sizeof( ULONG ) );
 		pRun += sizeof( ULONG );
-		memcpy( pRun, pPtrStruct->pData, pPtrStruct->nBytes );
-		pRun += pPtrStruct->nBytes;
-		delete pPtrStruct;
+		memcpy( pRun, it->pData, it->nBytes );
+		pRun += it->nBytes;
 	}
 	return nDataSize;
 }
 	{
 		{
 			NAMESPACE_VOS(OGuard) aGuard( m_aQueueMutex );
-			for( ULONG i = 0; i < m_aMessageQueue.Count(); i++ )
+			for( size_t i = 0; i < m_aMessageQueue.size(); i++ )
 			{
-				ULONG nID = m_aMessageQueue.GetObject( i )->m_nID;
+                MediatorMessage* pMessage = m_aMessageQueue[ i ];
+				ULONG nID = pMessage->m_nID;
 				if(  ( nID & 0xff000000 ) &&
 					 ( ( nID & 0x00ffffff ) == nMessageID ) )
-					return m_aMessageQueue.Remove( i );
+                {
+                    m_aMessageQueue.erase( m_aMessageQueue.begin() + i );
+					return pMessage;
+                }
 			}
 		}
-		if( m_aMessageQueue.Count() )
+		if( ! m_aMessageQueue.empty() )
 			CallWorkHandler();
 		WaitForMessage( 2000 );
 	}
 		pShell( NULL ),
 		pWidget( NULL ),
         pForm( NULL ),
+        pGtkWindow( NULL ),
+        pGtkWidget( NULL ),
+        bShouldUseXEmbed( false ),
 		nArg( args ),
 		pArgnBuf( pargnbuf ),
 		pArgvBuf( pargvbuf )

File extensions/source/plugin/unx/unxmgr.cxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: unxmgr.cxx,v $
- * $Revision: 1.14 $
+ * $Revision: 1.14.90.1 $
  *
  * This file is part of OpenOffice.org.
  *
 	return nDescriptions > 0;
 }
 
+static void CheckPluginRegistryFiles( const rtl::OString& rPath, list< PluginDescription* >& rDescriptions )
+{
+    rtl::OStringBuffer aPath( 1024 );
+    aPath.append( rPath );
+    aPath.append( "/pluginreg.dat" );
+    FILE* fp = fopen( aPath.getStr(), "r" );
+    if( fp )
+    {
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, "parsing %s\n", aPath.getStr() );
+#endif
+        char aLine[1024];
+        while( fgets( aLine, sizeof( aLine ), fp ) )
+        {
+            int nLineLen = strlen( aLine );
+            int nDotPos;
+            for( nDotPos = nLineLen-1; nDotPos > 0 && aLine[nDotPos] != ':'; nDotPos-- )
+                ;
+            if( aLine[0] == '/' && aLine[nDotPos] == ':' && aLine[nDotPos+1] == '$' )
+                CheckPlugin( ByteString( aLine, nDotPos ), rDescriptions );
+        }
+        fclose( fp );
+    }
+    
+    // check subdirectories
+    long aBuffer[ sizeof( struct dirent ) + _PC_NAME_MAX +1 ];
+
+    DIR* pDIR = opendir( rPath.getStr() );
+    struct dirent* pDirEnt = NULL;
+    struct stat aStat;
+    while( pDIR && ! readdir_r( pDIR, (struct dirent*)aBuffer, &pDirEnt ) && pDirEnt )
+    {
+        char* pBaseName = ((struct dirent*)aBuffer)->d_name;
+        if( rtl_str_compare( ".", pBaseName ) && rtl_str_compare( "..", pBaseName ) )
+        {
+            rtl::OStringBuffer aBuf( 1024 );
+            aBuf.append( rPath );
+            aBuf.append( '/' );
+            aBuf.append( pBaseName );
+            
+            if( ! stat( aBuf.getStr(), &aStat ) )
+            {
+                if( S_ISDIR( aStat.st_mode ) )
+                    CheckPluginRegistryFiles( aBuf.makeStringAndClear(), rDescriptions );
+            }
+        }
+    }
+    if( pDIR )
+        closedir( pDIR );
+}
+
 Sequence<PluginDescription> XPluginManager_Impl::getPluginDescriptions() throw()
 {
 	static Sequence<PluginDescription> aDescriptions;
 		}
 
         // try ~/.mozilla/pluginreg.dat
-        ByteString aMozPluginreg( pHome );
-        aMozPluginreg.Append( "/.mozilla/pluginreg.dat" );
-        FILE* fp = fopen( aMozPluginreg.GetBuffer(), "r" );
-        if( fp )
-        {
-#if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "parsing %s\n", aMozPluginreg.GetBuffer() );
-#endif
-            char aLine[1024];
-            while( fgets( aLine, sizeof( aLine ), fp ) )
-            {
-                int nLineLen = strlen( aLine );
-                int nDotPos;
-                for( nDotPos = nLineLen-1; nDotPos > 0 && aLine[nDotPos] != ':'; nDotPos-- )
-                    ;
-                if( aLine[0] == '/' && aLine[nDotPos] == ':' && aLine[nDotPos+1] == '$' )
-                    CheckPlugin( ByteString( aLine, nDotPos ), aPlugins );
-            }
-            fclose( fp );
-        }
+        rtl::OStringBuffer aBuf(256);
+        aBuf.append( pHome );
+        aBuf.append( "/.mozilla" );
+        CheckPluginRegistryFiles( aBuf.makeStringAndClear(), aPlugins );
 
         // create return value
 		aDescriptions = Sequence<PluginDescription>( aPlugins.size() );

File extensions/source/plugin/win/winmgr.cxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: winmgr.cxx,v $
- * $Revision: 1.16 $
+ * $Revision: 1.16.90.1 $
  *
  * This file is part of OpenOffice.org.
  *
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_extensions.hxx"
 
-#include <vcl/svapp.hxx>
-#include <tools/fsys.hxx>
-#include <osl/mutex.hxx>
+#include "vcl/svapp.hxx"
+#include "tools/fsys.hxx"
+#include "tools/urlobj.hxx"
+#include "osl/mutex.hxx"
 
-#include <rtl/string.hxx>
-#include <rtl/ustring.hxx>
-#include <rtl/ustrbuf.hxx>
+#include "rtl/string.hxx"
+#include "rtl/ustring.hxx"
+#include "rtl/ustrbuf.hxx"
 
-#include <plugin/impl.hxx>
+#include "plugin/impl.hxx"
 
 #pragma warning (push,1)
 #pragma warning (disable:4005)
 
-    #include <tools/prewin.h>
+    #include "tools/prewin.h"
 
     #include <windows.h>
     #include <string.h>
     #include <winbase.h>
     #include <objbase.h>
 
-    #include <tools/postwin.h>
+    #include "tools/postwin.h"
 
 #pragma warning (pop)
 
     }
 }
 //__________________________________________________________________________________________________
+static void add_MozPlugin( HKEY hKey, PluginLocationMap & rPlugins )
+{
+	TCHAR value[MAX_PATH];
+	DWORD dwType, size = sizeof(value);
+
+    size = sizeof(value);
+    if (::RegQueryValueEx(
+        hKey, _T("Path"), NULL, &dwType,
+        (LPBYTE)value, &size ) == ERROR_SUCCESS &&
+        (dwType == REG_SZ || dwType == REG_EXPAND_SZ))
+    {
+		OUString aUPath( OStringToOUString( value, RTL_TEXTENCODING_MS_1252 ) );
+		INetURLObject aURL( aUPath );
+		OString aName( OUStringToOString( aURL.GetName().toAsciiLowerCase(), RTL_TEXTENCODING_MS_1252 ) );
+
+		// no netscape default plugin anymore...
+		// and no double plugin dlls
+		if ( !aName.equals( "npnul32.dll" ) &&
+			 ! aName.equals( "npnrvp.dll" ) &&
+			 rPlugins.find( aName ) == rPlugins.end())
+		{
+			rPlugins[ aName ] = aUPath;
+#if OSL_DEBUG_LEVEL > 1
+            logPlugin( aUPath );
+#endif
+		}
+    }
+}
+static void add_MozillaPlugin( HKEY hKey, PluginLocationMap & rPlugins )
+{
+	TCHAR keyName[MAX_PATH];
+    DWORD dwIndex = 0, size = sizeof (keyName);
+
+    while (::RegEnumKeyEx( hKey, dwIndex, keyName, &size, NULL, NULL, NULL, NULL ) == ERROR_SUCCESS)
+    {
+        size = sizeof (keyName);
+        HKEY hSubKey;
+        if (::RegOpenKeyEx( hKey, keyName, 0, KEY_READ, &hSubKey ) == ERROR_SUCCESS)
+        {
+            add_MozPlugin( hSubKey, rPlugins );
+            ::RegCloseKey( hSubKey );
+        }
+        ++dwIndex;
+    }
+}
+//__________________________________________________________________________________________________
 static void add_NS_Plugins( PluginLocationMap & rPlugins )
 {
 	HKEY hKey;
         add_NS_lookupRecursive( hKey, rPlugins );
 		::RegCloseKey( hKey );
     }
+    // Mozilla - plugins
+	if (::RegOpenKeyEx(
+        HKEY_LOCAL_MACHINE, _T("Software\\MozillaPlugins"),
+        0, KEY_READ, &hKey ) == ERROR_SUCCESS)
+	{
+        add_MozillaPlugin( hKey, rPlugins );
+		::RegCloseKey( hKey );
+    }
 }
 
 //__________________________________________________________________________________________________

File scp2/source/ooo/file_library_ooo.scp

 STD_LIB_FILE(gid_File_Lib_DeploymentMisc, deploymentmisc)
 
 #ifndef WITHOUT_MOZILLA
-STD_UNO_LIB_FILE( gid_File_Lib_Pl , pl)
+STD_UNO_LIB_FILE_PATCH( gid_File_Lib_Pl , pl)
 #endif
 
 STD_UNO_LIB_FILE( gid_File_Lib_Preload, preload)

File scp2/source/ooo/file_ooo.scp

     BIN_FILE_BODY;
     Dir = gid_Dir_Program;
     Name = "pluginapp.bin";
-    Styles = (PACKED);
+    Styles = (PACKED,PATCH);
 End
 
 #endif