Anonymous avatar Anonymous committed d53bf70 Merge

Comments (0)

Files changed (485)

accessibility/inc/accessibility/standard/vclxaccessiblelistboxlist.hxx

+/*************************************************************************
+ *
+ * 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
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOXLIST_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOXLIST_HXX
+
+#include <accessibility/standard/vclxaccessiblelist.hxx>
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#ifndef _COMPHELPER_BROADCASTHELPER_HXX
+#include <comphelper/broadcasthelper.hxx>
+#endif
+#ifndef _COMPHELPER_UNO3_HXX
+#include <comphelper/uno3.hxx>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE1_HXX
+#include <cppuhelper/implbase1.hxx>
+#endif
+
+typedef ::cppu::ImplHelper1	<	::com::sun::star::accessibility::XAccessibleSelection
+							>	VCLXAccessibleListBoxList_BASE;
+
+
+class ListBox;
+/** This class extends the list of the <type>VCLXAccessibleList</type> class
+    about selection.
+*/
+class VCLXAccessibleListBoxList :
+    public VCLXAccessibleList,
+    public VCLXAccessibleListBoxList_BASE
+{
+public:
+	VCLXAccessibleListBoxList (VCLXWindow* pVCLXindow, BoxType aBoxType,
+							   const ::com::sun::star::uno::Reference<
+							   	::com::sun::star::accessibility::XAccessible >& _xParent);
+
+	// XInterface
+	DECLARE_XINTERFACE( )
+
+	// XTypeProvider
+	DECLARE_XTYPEPROVIDER( )
+
+	// XServiceInfo
+	virtual ::rtl::OUString SAL_CALL getImplementationName (void)
+        throw (::com::sun::star::uno::RuntimeException);
+    // Return list box list specific services.
+	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+        getSupportedServiceNames (void)
+        throw (::com::sun::star::uno::RuntimeException);
+
+	// XAccessibleSelection
+	void        SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	sal_Bool    SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	void        SAL_CALL clearAccessibleSelection(  ) throw (::com::sun::star::uno::RuntimeException);
+	void        SAL_CALL selectAllAccessibleChildren(  ) throw (::com::sun::star::uno::RuntimeException);
+	sal_Int32   SAL_CALL getSelectedAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
+	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	void        SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+    /** Create the specified child and insert it into the list of children.
+        Sets the child's states.
+    */
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+        CreateChild (sal_Int32 i);
+
+
+protected:
+	virtual ~VCLXAccessibleListBoxList (void);
+
+	virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent);
+
+private:
+	sal_Int32	m_nLastTopEntry;
+	sal_uInt16		m_nLastSelectedPos;
+	bool		m_bDisableProcessEvent;
+
+	void UpdateEntryRange_Impl (void);
+    using VCLXAccessibleList::UpdateSelection_Impl;
+    void UpdateSelection_Impl (void);
+    using VCLXAccessibleList::checkEntrySelected;
+	sal_Bool checkEntrySelected(ListBox* _pListBox,
+							sal_uInt16 _nPos,
+							::com::sun::star::uno::Any& _rNewValue,
+							::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxNewAcc);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOX_HXX
+

bridges/inc/bridges/remote/bridgeimpl.hxx

+/*************************************************************************
+ *
+ * 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
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BRIDGES_REMOTE_BRIDGEIMPL_HXX_
+#define _BRIDGES_REMOTE_BRIDGEIMPL_HXX_
+#include <osl/interlck.h>
+
+#include <uno/environment.h>
+
+#include <bridges/remote/context.h>
+#include <bridges/remote/remote.h>
+
+
+struct remote_BridgeImpl
+{
+	void (SAL_CALL * m_allThreadsAreGone ) ( uno_Environment * );
+	requestClientSideDispatcher m_sendRequest;
+	oslInterlockedCount m_nRemoteThreads;
+	sal_Bool  m_bDisposed;
+	sal_Bool  m_bReleaseStubsCalled;
+};
+
+namespace bridges_remote {
+
+	enum RemoteThreadCounter_HoldEnvWeak
+	{
+		RTC_HOLDENVWEAK = 0x1
+	};
+	
+	class RemoteThreadCounter
+	{
+	public:
+		// performance optimization. In some cases, it is not necessary to acquire the
+		// environment.
+		RemoteThreadCounter( uno_Environment *pEnvRemote, RemoteThreadCounter_HoldEnvWeak )
+			: m_bReleaseEnvironment( sal_False )
+			, m_pEnvRemote( pEnvRemote )
+		{
+  			remote_Context *pContext = ((remote_Context *) m_pEnvRemote->pContext );
+			osl_incrementInterlockedCount( &( pContext->m_pBridgeImpl->m_nRemoteThreads ) );
+		}
+		
+		RemoteThreadCounter( uno_Environment *pEnvRemote )
+			: m_bReleaseEnvironment( sal_True )
+			, m_pEnvRemote( pEnvRemote )
+		{
+			m_pEnvRemote->acquire( m_pEnvRemote );
+			
+  			remote_Context *pContext = ((remote_Context *) m_pEnvRemote->pContext );
+			osl_incrementInterlockedCount( &( pContext->m_pBridgeImpl->m_nRemoteThreads ) );
+		}
+
+	~RemoteThreadCounter( )
+		{
+  			remote_Context *pContext = ((remote_Context *) m_pEnvRemote->pContext );
+			if( 0 == osl_decrementInterlockedCount( &( pContext->m_pBridgeImpl->m_nRemoteThreads)) &&
+				pContext->m_pBridgeImpl->m_bDisposed &&
+				! pContext->m_pBridgeImpl->m_bReleaseStubsCalled )
+			{
+				pContext->m_pBridgeImpl->m_allThreadsAreGone( m_pEnvRemote );
+			}
+			if( m_bReleaseEnvironment )
+				m_pEnvRemote->release( m_pEnvRemote );
+		}
+		
+		sal_Bool m_bReleaseEnvironment;
+		uno_Environment *m_pEnvRemote;
+	};
+}
+
+#endif

bridges/inc/bridges/remote/connection.h

+/*************************************************************************
+ *
+ * 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
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BRIDGES_REMOTE_CONNECTION_H_
+#define _BRIDGES_REMOTE_CONNECTION_H_
+#include <sal/types.h>
+
+/** Specfies a C-interface for a bidirectional bytestream,
+	which is used by a UNO remote environment.
+ */
+struct remote_Connection
+{
+	void ( SAL_CALL * acquire ) ( remote_Connection *);
+	
+	void ( SAL_CALL * release ) ( remote_Connection *);
+	
+	/**
+	  reads nSize bytes from the connection. This method blocks, until
+	  all bytes are available or an error occurs.
+	  @return Number of bytes read.
+	          If the return value is less than nSize, an unrecoverable
+	          i/o error has occured or the connection was closed.
+	                      
+	 */
+	sal_Int32 (SAL_CALL * read)(remote_Connection *, sal_Int8 *pDest, sal_Int32 nSize );
+
+	/**
+	  @return Number of bytes written.
+	          if the return value is less than nSize an unrecoverable
+	          i/o error has occured or the connection was closed.
+	 */
+	sal_Int32 (SAL_CALL * write)(remote_Connection *, const sal_Int8 *pSource, sal_Int32 nSize );
+
+	void ( SAL_CALL * flush ) ( remote_Connection * );
+
+	/** closes the connection.
+        Any read or write operation after this call shall not be served
+        anymore. Any ongoing read or write operation must return immeadiatly after this call.
+        The implementation should cope with multiple calls to this method.
+	 */
+	void (SAL_CALL * close) ( remote_Connection * );
+};
+
+#endif

bridges/inc/bridges/remote/context.h

+/*************************************************************************
+ *
+ * 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
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _BRIDGES_REMOTE_CONTEXT_H_
+#define _BRIDGES_REMOTE_CONTEXT_H_
+#include <osl/interlck.h>
+#include <osl/conditn.h>
+
+#include <typelib/typedescription.h>
+
+#include <uno/environment.h>
+#include <uno/any2.h>
+
+
+/** Interface for refcounted contexts of uno-environments.
+
+    Not all uno_Contexts need to be refcounted, in case they are,
+    they should be 'derived' from this struct.
+    This is used as a base class for the remote_Context. 
+    @see uno_Environment
+    @see uno_getEnvironment()
+    @see remote_Context
+ */
+struct uno_Context
+{
+    /** increase the refcount of the context
+     */
+	void (SAL_CALL * acquire)( uno_Context *pContext );
+
+    /** decrements the recount of the context. In case the recount drops to zero,
+        the context gets destroye. 
+    */
+	void (SAL_CALL * release)( uno_Context *pContext);
+
+    /** Allows to query for a different interface of the uno_Context.
+        The result of the void pointer is unspecified and depends on the concrete context.
+     */
+	void * (SAL_CALL *query ) ( uno_Context *pContext , rtl_uString *pId);
+};
+
+struct remote_Connection;
+struct remote_Context;
+struct remote_Interface;
+
+
+
+/** performs a query-interface for a certain interface via the remote connection !
+ 
+  @param pEnvRemote The environment, that shall perform the call.
+  @param ppRemoteI  in/out parameter contains the interface returned by queryInterface
+  @param pOid       the oid of the 'ghost' object on which the call must be done.
+ ***/
+typedef void ( SAL_CALL * remote_getInstanceFunc ) (
+	uno_Environment *pEnvRemote,
+	remote_Interface **ppRemoteI,
+	rtl_uString *pOid,
+	typelib_TypeDescriptionReference *pInterfaceTypeRef,
+	uno_Any **ppException );
+
+
+/** refcounted C-interface, which provides object by name.
+ */
+struct remote_InstanceProvider
+{
+	void (SAL_CALL * acquire ) ( remote_InstanceProvider * pProvider );
+	void (SAL_CALL * release ) ( remote_InstanceProvider * pProvider );
+	void (SAL_CALL * getInstance ) ( remote_InstanceProvider * pProvider ,
+									 uno_Environment *pEnvRemote,
+									 remote_Interface **ppRemoteI,
+									 rtl_uString *pInstanceName,
+									 typelib_InterfaceTypeDescription *pType,
+									 uno_Any **ppException );
+};
+
+/** refcounted C-interface, which allows to register a listener to an
+    remote bridge to be informed when the bridge gets disposed.
+    
+   @see remote_Context
+ */
+struct remote_DisposingListener
+{
+	void (SAL_CALL * acquire     ) ( remote_DisposingListener * pProvider );
+	void (SAL_CALL * release     ) ( remote_DisposingListener * pProvider );
+	void (SAL_CALL * disposing   ) ( remote_DisposingListener * pProvider,
+									 rtl_uString *pBridgeName );
+};
+
+
+/**
+  Try to get an existing context characterized by the pIdString. Each ID-String must
+  uniquely charcterize a certain connection. The context can't be retrieved via this
+  function anymore, after it got disposed.
+  
+  @return 0 when such a context does not exist, otherwise 
+          a pointer to an acquired remote_Context.
+ **/
+extern "C" remote_Context * SAL_CALL
+remote_getContext( rtl_uString *pIdString );
+
+/**
+  Create an acquired remote context. The Context is weakly held by the context administration
+  and can be accessed later through remote_getContext() (using the same id-string).
+ 
+  @param pIdString A string, that uniquely describes the connection. For e.g. a socket connection,
+                   host and port of the local and remote host should be in the string.
+                   
+  @param pDescription
+                   Description of the connection, that may brought up to the user.
+ 
+  @param pProtocol
+                   The protocol, that the environment uses for
+                   communicating with the remote process.
+                   The format of the protocol string is : "protocolname,para1=para1value,..."
+  @return 0, when a context with this name already exists.
+  
+  @see remote_getContext()
+  @see remote_Context
+ */
+extern "C" remote_Context * SAL_CALL
+remote_createContext( remote_Connection *pConnection,
+					  rtl_uString *pIdStr,
+					  rtl_uString *pDescription,
+					  rtl_uString *pProtocol,
+	                  remote_InstanceProvider *);
+
+const sal_Int32 REMOTE_CONTEXT_CREATE = 1;
+const sal_Int32 REMOTE_CONTEXT_DESTROY = 2;
+
+typedef void ( SAL_CALL * remote_contextListenerFunc ) (
+	void *pThis,
+	sal_Int32 nRemoteContextMode,
+	rtl_uString *sName,
+	rtl_uString *sDescription
+	);
+
+/** Registers a listener at the context administration, which allows to keep
+    track of existing remote connections.
+    @param pObject object which is handed to the listener function, when called.
+ */
+extern "C" void SAL_CALL
+remote_addContextListener( remote_contextListenerFunc listener, void *pObject );
+
+
+/** Removes a listener from the context administration.
+ */
+extern "C" void SAL_CALL
+remote_removeContextListener( remote_contextListenerFunc listener , void *pObject );
+
+/** Allows to retrieve all existing context strings.
+    
+   @param pnStringCount out parameter. Contains the number of rtl_uStrings in the array
+   @param memAlloc      a memory allocation function for the array of  pointers to rtl_uStrings
+ 
+   @return array of rtl strings. The caller must call release on all rtl_uString s and must free
+           the pointer array.
+ */
+extern "C" rtl_uString ** SAL_CALL
+remote_getContextList(
+	sal_Int32 *pnStringCount,
+	void * ( SAL_CALL * memAlloc ) ( sal_Size nBytesToAlloc ) );
+
+
+struct remote_BridgeImpl;
+
+/** The context structure for a remote bridge.
+
+    @see uno_getEnvironment()
+ */
+struct remote_Context
+{
+    struct uno_Context aBase;
+
+	/**
+       These methods are implemented by context administration
+	 */
+    void ( SAL_CALL * addDisposingListener ) ( remote_Context *,
+											   remote_DisposingListener * );
+	void ( SAL_CALL * removeDisposingListener ) ( remote_Context *,
+												  remote_DisposingListener * );
+    /**
+       will be called by the environment when it gets disposed
+	 */	
+    void ( SAL_CALL * dispose ) ( remote_Context * );
+	
+	/** The method is set by the remote-environment during environment initialization.
+      @see remote_getInstanceFunc
+	 */
+	remote_getInstanceFunc getRemoteInstance;
+
+	/**
+	  The protocol, that the environment uses for communicating with the remote process.
+	  The format of the protocol string is : "protocolname,para1=para1value,..."
+	  The parameters are protocol dependend
+	 */
+	rtl_uString *m_pProtocol;
+	
+	/**
+       It may be the same as m_pName.
+       Livetime is handled by the context administration.
+	 */
+	rtl_uString *m_pDescription;
+
+	/**
+	  The name of this context at context administration.
+	  A string, that uniquely describes this environment.
+	  Livetime is handled by the context administration.
+	 */
+	rtl_uString *m_pName;
+	
+    /** The instance-provider, which is used to look up unknown object identifiers.
+	  Is usually called on server side,  when the first client request comes in.
+	  Maybe 0. Livetime is handled by the context administration.
+	 */
+    remote_InstanceProvider *m_pInstanceProvider;
+
+	/**
+       The connection of this context.
+       Livetime is handled by the context administration.
+	 */
+	remote_Connection *m_pConnection;
+
+	/**
+	  Here arbitrary data may be stored. It may be used by a connection
+      service to store environment specific data. The bridge does not
+	  use it.
+	 */
+	void *m_pAdditionalInformation;
+
+	/**
+	  here the bridge stores its private per environment data.
+	 */
+	struct remote_BridgeImpl *m_pBridgeImpl;
+};
+
+#endif
+

bridges/inc/bridges/remote/counter.hxx

+/*************************************************************************
+ *
+ * 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
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BRIDGES_REMOTE_COUNTER_H_
+#define _BRIDGES_REMOTE_COUNTER_H_
+#include <stdio.h>
+#if OSL_DEBUG_LEVEL > 1
+struct MyCounter
+{
+	MyCounter( sal_Char const *pName ) :
+		m_nCounter( 0 ),
+		m_pName ( pName )
+		{
+		}
+	~MyCounter()
+		{
+			if( m_nCounter ) {
+				printf(
+                    "%s : %ld left\n", m_pName,
+                    sal::static_int_cast< long >(m_nCounter) );
+			}
+		}
+	void acquire()
+		{ m_nCounter ++; }
+	void release()
+		{ m_nCounter --; }
+
+
+	sal_Int32 m_nCounter;
+	sal_Char const *m_pName;
+};
+#endif
+
+#endif

bridges/inc/bridges/remote/helper.hxx

+/*************************************************************************
+ *
+ * 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
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <bridges/remote/bridgeimpl.hxx>
+
+typedef void ( SAL_CALL * ReleaseRemoteCallbackFunc ) (
+	remote_Interface *ppRemoteI,
+	rtl_uString *pOid,
+	typelib_TypeDescriptionReference *pTypeRef,
+	uno_Environment *pEnvRemote
+	);
+
+typedef void ( SAL_CALL * remote_createStubFunc ) (
+	remote_Interface **ppRemoteI,
+	rtl_uString *pOid ,
+	typelib_TypeDescriptionReference *pTypeRef,
+	uno_Environment *pEnvRemote,
+	ReleaseRemoteCallbackFunc callback
+	);
+namespace bridges_remote
+{
+
+	/** @param callback If the bridge implementation wants to handle the remote release call,
+		                it can do it giving this callback. If callback == 0, the releaseRemote
+						method of the stub is called.
+	*/						
+	void SAL_CALL remote_createStub (
+		remote_Interface **ppRemoteI,
+		rtl_uString *pOid ,
+		typelib_TypeDescriptionReference *pType,
+		uno_Environment *pEnvRemote,
+		ReleaseRemoteCallbackFunc callback );
+
+	void SAL_CALL remote_retrieveOidFromProxy(
+		remote_Interface *pRemtoeI,
+		rtl_uString **ppOid );
+		
+	void SAL_CALL remote_sendQueryInterface(
+		uno_Environment *pEnvRemote,
+		remote_Interface **ppRemoteI,
+		rtl_uString *pOid ,
+		typelib_TypeDescriptionReference *pType,
+		uno_Any **ppException
+		);
+}

bridges/inc/bridges/remote/mapping.hxx

+/*************************************************************************
+ *
+ * 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
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BRIDGES_REMOTE_MAPPING_HXX_
+#define _BRIDGES_REMOTE_MAPPING_HXX_
+
+#include <osl/interlck.h>
+#include <rtl/ustring.hxx>
+
+#include <typelib/typedescription.h>
+
+#include <bridges/remote/remote.h>
+
+typedef struct _uno_Environment uno_Environment;
+
+namespace bridges_remote
+{
+    extern "C" typedef void SAL_CALL RemoteToUno(
+        uno_Mapping *pMapping, void **ppOut, void *pInterface,
+        typelib_InterfaceTypeDescription *pInterfaceTypeDescr );
+    RemoteToUno remoteToUno;
+	
+    extern "C" typedef void SAL_CALL UnoToRemote(
+        uno_Mapping *pMapping, void **ppOut, void *pInterface,
+        typelib_InterfaceTypeDescription *pInterfaceTypeDescr );
+    UnoToRemote unoToRemote;
+		
+    extern "C" typedef void SAL_CALL FreeRemoteMapping(uno_Mapping * mapping);
+    FreeRemoteMapping freeRemoteMapping;
+
+	class RemoteMapping :
+		public remote_Mapping
+	{
+	public:
+		RemoteMapping( uno_Environment *pEnvUno ,
+					   uno_Environment *pEnvRemote,
+					   uno_MapInterfaceFunc func ,
+					   const ::rtl::OUString sPurpose);
+		~RemoteMapping();
+		
+		oslInterlockedCount	m_nRef;
+		::rtl::OUString m_sPurpose;
+	};
+	
+}
+#endif

bridges/inc/bridges/remote/proxy.hxx

+/*************************************************************************
+ *
+ * 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
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <osl/interlck.h>
+
+#include <uno/environment.h>
+#include <uno/dispatcher.h>
+#include <uno/mapping.hxx>
+
+#include <bridges/remote/remote.h>
+
+namespace bridges_remote {
+
+extern "C" typedef void SAL_CALL FreeRemote2UnoProxy(
+    uno_ExtEnvironment * environment, void * proxy);
+FreeRemote2UnoProxy freeRemote2UnoProxy;
+
+// private:
+extern "C" typedef void SAL_CALL AcquireRemote2UnoProxy(uno_Interface *);
+AcquireRemote2UnoProxy acquireRemote2UnoProxy;
+
+// private:
+extern "C" typedef void SAL_CALL ReleaseRemote2UnoProxy(uno_Interface *);
+ReleaseRemote2UnoProxy releaseRemote2UnoProxy;
+
+// private:	
+extern "C" typedef void SAL_CALL DispatchRemote2UnoProxy(
+	uno_Interface *, typelib_TypeDescription const *, void *, void **,
+    uno_Any **);
+DispatchRemote2UnoProxy dispatchRemote2UnoProxy;
+
+extern "C" void SAL_CALL remote_release( void * );
+
+class Remote2UnoProxy :
+	public uno_Interface
+{
+public:
+	Remote2UnoProxy(
+		remote_Interface *pRemoteI,
+		rtl_uString *pOid,
+		typelib_InterfaceTypeDescription *pType ,
+		uno_Environment *pEnvUno,
+		uno_Environment *pEnvRemote
+		);
+	
+	~Remote2UnoProxy();
+	
+private:
+	::rtl::OUString m_sOid;
+	typelib_InterfaceTypeDescription *m_pType;
+	remote_Interface *m_pRemoteI;
+	uno_Environment *m_pEnvUno;
+	uno_Environment *m_pEnvRemote;
+	::com::sun::star::uno::Mapping m_mapRemote2Uno;
+	::com::sun::star::uno::Mapping m_mapUno2Remote;
+	
+	oslInterlockedCount	m_nRef;
+
+    friend void SAL_CALL acquireRemote2UnoProxy(uno_Interface *);
+
+    friend void SAL_CALL releaseRemote2UnoProxy(uno_Interface *);
+
+    friend void SAL_CALL dispatchRemote2UnoProxy(
+        uno_Interface *, typelib_TypeDescription const *, void *, void **,
+        uno_Any **);
+};
+
+}

bridges/inc/bridges/remote/remote.h

+/*************************************************************************
+ *
+ * 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
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BRIDGES_REMOTE_REMOTE_H
+#define _BRIDGES_REMOTE_REMOTE_H
+#include <uno/mapping.h>
+#include <uno/any2.h>
+
+#include <typelib/typedescription.h>
+#include <uno/environment.h>
+
+#define CORBA_STRING8_NAME "com.sun.star.corba.CorbaString8"
+#define CORBA_STRING8_NAME_LENGTH (sizeof(CORBA_STRING8_NAME)-1)
+
+#define CORBA_UNION_NAME   "com.sun.star.corba.CorbaUnion"
+#define CORBA_UNION_NAME_LENGTH   (sizeof(CORBA_UNION_NAME)-1)
+
+#define REMOTE_MARSHALED_MSGHDR_SIZE 12
+#define REMOTE_RELEASE_METHOD_INDEX 2
+#define REMOTE_RELEASE_METHOD_NAME "release"
+
+#define CURRENT_IIOP_PROTOCOL_MAJOR 1
+#define CURRENT_IIOP_PROTOCOL_MINOR 2
+
+extern "C" {
+
+struct remote_Interface;
+
+/** @internal
+ */
+typedef void (SAL_CALL * remote_DispatchMethod)(
+    remote_Interface * pRemoteI, typelib_TypeDescription const * pMemberType,
+    void * pReturn, void * pArgs[], uno_Any ** ppException );
+
+/** 
+   @internal
+ */
+typedef void ( SAL_CALL * requestClientSideDispatcher ) (
+	uno_Environment *pEnvRemote,
+	typelib_TypeDescription const * pMemberType,
+	rtl_uString *pOid,
+	typelib_InterfaceTypeDescription *pInterfaceType,
+	void *pReturn,
+	void *ppArgs[],
+	uno_Any **ppException );
+
+/** The base class of an UNO interface in a remote environment.
+ */
+struct remote_Interface
+{
+	void (SAL_CALL * acquire)( remote_Interface * pInterface );
+
+	void (SAL_CALL * release)( remote_Interface * pInterface );
+
+	remote_DispatchMethod pDispatcher;
+};
+
+/** The mapping between an binary-c-uno and a remote environment.
+    @internal
+ */
+struct remote_Mapping
+{
+	uno_Mapping aBase;
+	uno_Environment *pEnvRemote;
+	uno_Environment *pEnvUno;
+};
+
+}
+
+#endif

bridges/inc/bridges/remote/remote.hxx

+/*************************************************************************
+ *
+ * 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
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BRIDGES_REMOTE_REMOTE_HXX_
+#define _BRIDGES_REMOTE_REMOTE_HXX_
+#include <list>
+
+#include <osl/mutex.hxx>
+#include <osl/conditn.h>
+#include <osl/interlck.h>
+
+#include <uno/environment.h>
+
+#include <bridges/remote/remote.h>
+#include <bridges/remote/connection.h>
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace bridges_remote {
+
+extern "C" typedef void SAL_CALL AcquireRemote2RemoteStub(
+    remote_Interface * pThis);
+AcquireRemote2RemoteStub acquireRemote2RemoteStub;
+
+extern "C" typedef void SAL_CALL FreeRemote2RemoteStub(
+    uno_ExtEnvironment * environment, void * stub);
+FreeRemote2RemoteStub freeRemote2RemoteStub;
+
+class Remote2RemoteStub :
+	public remote_Interface
+{
+public:
+	Remote2RemoteStub(rtl_uString *pOid,
+					  typelib_InterfaceTypeDescription *pType,
+					  uno_Environment *pEnvRemote,
+					  requestClientSideDispatcher dispatch );
+	~Remote2RemoteStub();
+
+	void releaseRemote();
+public:
+	::rtl::OUString                   m_sOid;
+	typelib_InterfaceTypeDescription  *m_pType;
+	oslInterlockedCount               m_nRef;
+	uno_Environment                   *m_pEnvRemote;
+	requestClientSideDispatcher       m_dispatch;
+	oslInterlockedCount m_nReleaseRemote;
+};
+
+}
+#endif

bridges/inc/bridges/remote/stub.hxx

+/*************************************************************************
+ *
+ * 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
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <bridges/remote/remote.hxx>
+
+#include <uno/dispatcher.h>
+#include <uno/mapping.hxx>
+
+namespace bridges_remote {
+
+extern "C" typedef void SAL_CALL AcquireUno2RemoteStub( remote_Interface *pThis );
+AcquireUno2RemoteStub acquireUno2RemoteStub;
+
+extern "C" typedef void SAL_CALL FreeUno2RemoteStub(
+    uno_ExtEnvironment * environment, void * stub);
+FreeUno2RemoteStub freeUno2RemoteStub;
+
+class Uno2RemoteStub :
+	public remote_Interface
+{
+public:
+	Uno2RemoteStub( uno_Interface *pUnoI,
+					rtl_uString *pOid,
+					typelib_InterfaceTypeDescription *pType,
+					uno_Environment *pEnvUno,
+					uno_Environment *pEnvRemote );
+	~Uno2RemoteStub();
+
+public:
+	::rtl::OUString m_sOid;
+	typelib_InterfaceTypeDescription *m_pType;
+	uno_Interface *m_pUnoI;
+	oslInterlockedCount	m_nRef;
+
+	uno_Environment *m_pEnvUno;
+	uno_Environment *m_pEnvRemote;
+	::com::sun::star::uno::Mapping m_mapRemote2Uno;
+	::com::sun::star::uno::Mapping m_mapUno2Remote;
+};
+
+}

bridges/source/remote/context/context.cxx

+/*************************************************************************
+ *
+ * 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
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_bridges.hxx"
+#include <stdio.h>
+#include <string.h>
+#include <list>
+#include <hash_map>
+#include <utility>
+
+#include <osl/diagnose.h>
+#include <osl/interlck.h>
+#include <osl/mutex.hxx>
+
+#include "rtl/ustring.hxx"
+#include "rtl/instance.hxx"
+
+#include <bridges/remote/context.h>
+#include <bridges/remote/remote.h>
+#include <bridges/remote/connection.h>
+#include <bridges/remote/counter.hxx>
+
+using namespace ::std;
+using namespace ::osl;
+using namespace ::rtl;
+
+namespace {
+
+extern "C" typedef void * (SAL_CALL * MemAlloc)(sal_Size);
+
+}
+
+namespace remote_context
+{
+
+class remote_ContextImpl :
+	public remote_Context
+{
+public:
+	remote_ContextImpl( remote_Connection *pConnection,
+						rtl_uString *pIdStr,
+						rtl_uString *pDescription,
+						rtl_uString *pProtocol,
+						remote_InstanceProvider *pProvider );
+	~remote_ContextImpl();
+
+	static void SAL_CALL thisAcquire( uno_Context * );
+	static void SAL_CALL thisRelease( uno_Context * );
+	static void * SAL_CALL thisQuery( uno_Context * , rtl_uString * );
+	static void SAL_CALL thisAddDisposingListener( remote_Context * , remote_DisposingListener * );
+	static void SAL_CALL thisRemoveDisposingListener( remote_Context *, remote_DisposingListener *);
+	static void SAL_CALL thisDispose( remote_Context *);
+public:
+	oslInterlockedCount	m_nRef;
+	sal_Bool m_bDisposed;
+	list < remote_DisposingListener * > m_lstListener;
+	Mutex m_mutex;
+};
+
+
+
+
+struct equalOUString_Impl
+{
+	sal_Bool operator()(const OUString & s1, const OUString & s2) const
+		{ return s1 == s2; }
+};
+
+struct hashOUString_Impl
+{
+	size_t operator()(const OUString & rName) const
+		{ return rName.hashCode(); }
+};
+
+typedef hash_map
+<
+	OUString,
+	void *,
+	hashOUString_Impl,
+	equalOUString_Impl
+>
+ContextMap;
+
+#if OSL_DEBUG_LEVEL > 1
+static MyCounter thisCounter( "DEBUG : Context" );
+#endif
+
+class ContextAdmin
+{
+public:
+	// listener administration
+	void addContextListener( remote_contextListenerFunc listener , void *pObject );
+	void removeContextListener( remote_contextListenerFunc listener , void *pObject );
+
+	void fire( sal_Int32 nRemoteContextMode,
+			   rtl_uString *sName,
+			   rtl_uString *sDescription );
+
+	// context administration
+	uno_Context *createAndRegisterContext(
+		remote_Connection *pConnection,
+		rtl_uString *pIdStr,
+		rtl_uString *pDescription,
+		rtl_uString *pProtocol,
+		remote_InstanceProvider *pInstanceProvider );
+
+	void revokeContext( uno_Context *pRemoteContext );
+
+	uno_Context *getContext( rtl_uString *pHost );
+
+	rtl_uString ** getConnectionList(
+        sal_Int32 *pnStringCount, MemAlloc memAlloc );
+
+private:
+	::osl::Mutex          m_mutex;
+
+	ContextMap m_mapContext;
+
+    typedef std::list< std::pair< remote_contextListenerFunc, void * > > List;
+    List m_lstListener;
+};
+
+void ContextAdmin::addContextListener( remote_contextListenerFunc listener , void  *pObject )
+{
+	::osl::MutexGuard guard( m_mutex );
+
+	m_lstListener.push_back( std::make_pair( listener, pObject ) );
+}
+
+void ContextAdmin::removeContextListener( remote_contextListenerFunc listener , void *pObject )
+{
+	::osl::MutexGuard guard( m_mutex );
+
+	for (List::iterator ii(m_lstListener.begin()); ii != m_lstListener.end();
+         ++ii)
+	{
+		if (ii->first == listener && ii->second == pObject) {
+			m_lstListener.erase( ii );
+			break;
+		}
+	}
+}
+
+void ContextAdmin::fire(
+	sal_Int32 nRemoteContextMode,
+	rtl_uString *pName,
+	rtl_uString *sDescription )
+{
+    List lst;
+    {
+        ::osl::MutexGuard guard( m_mutex );
+        lst = m_lstListener;
+    }
+	for (List::iterator i(lst.begin()); i != lst.end(); ++i) {
+        (i->first)(i->second, nRemoteContextMode, pName, sDescription);
+	}
+}
+
+uno_Context *ContextAdmin::createAndRegisterContext( remote_Connection *pConnection,
+													 rtl_uString *pIdStr,
+													 rtl_uString *pDescription,
+													 rtl_uString *pProtocol,
+													 remote_InstanceProvider *pInstanceProvider )
+{
+	::osl::MutexGuard guard( m_mutex );
+
+	uno_Context *pContext = getContext( pIdStr );
+	if( pContext )
+	{
+		pContext->release( pContext );
+		return 0;
+	}
+
+	remote_ContextImpl *p = new remote_ContextImpl( pConnection,
+													pIdStr,
+													pDescription,
+													pProtocol,
+													pInstanceProvider );
+
+	p->aBase.acquire( (uno_Context*) p );
+
+	m_mapContext[ OUString( pIdStr) ] = (void*) p;
+
+	fire( REMOTE_CONTEXT_CREATE , pIdStr , pDescription );
+	return ( uno_Context * )p;
+}
+
+
+void ContextAdmin::revokeContext( uno_Context *pRemoteContext )
+{
+	::osl::MutexGuard guard( m_mutex );
+
+	remote_ContextImpl *p = ( remote_ContextImpl * ) pRemoteContext;
+
+	ContextMap::iterator ii = m_mapContext.find(  p->m_pName );
+	OSL_ASSERT( ii != m_mapContext.end() );
+	m_mapContext.erase( ii );
+
+	fire( REMOTE_CONTEXT_DESTROY , p->m_pName , p->m_pDescription );
+
+}
+
+uno_Context *ContextAdmin::getContext( rtl_uString *pHost )
+{
+	::osl::MutexGuard guard( m_mutex );
+
+	ContextMap::iterator ii = m_mapContext.find( OUString( (rtl_uString*)pHost ) );
+	if( ii == m_mapContext.end() )
+	{
+		return 0;
+	}
+
+	uno_Context *p =  ( uno_Context * ) (*ii).second;
+	p->acquire( p );
+	return p;
+}
+
+
+rtl_uString ** ContextAdmin::getConnectionList(
+    sal_Int32 *pnStringCount, MemAlloc memAlloc )
+{
+	::osl::MutexGuard guard( m_mutex );
+
+	*pnStringCount = m_mapContext.size();
+
+	if (*pnStringCount == 0)
+		return NULL;
+
+	rtl_uString **ppReturn = ( rtl_uString ** )
+		memAlloc( sizeof( rtl_uString * ) * m_mapContext.size() );
+	memset( ppReturn , 0 , sizeof( rtl_uString * ) * m_mapContext.size() );
+
+	sal_Int32 i = 0;
+	for( ContextMap::iterator ii = m_mapContext.begin() ;
+		 ii != m_mapContext.end();
+		 ++ii, i++ )
+	{
+		rtl_uString_assign( &( ppReturn[i] ), (*ii).first.pData  );
+	}
+
+	return ppReturn;
+}
+
+
+struct theContextAdmin : public rtl::Static<ContextAdmin, theContextAdmin> {};
+
+/*****************************
+ * remote_ContextImpl implementation
+ ****************************/
+
+
+
+remote_ContextImpl::remote_ContextImpl( remote_Connection *pConnection ,
+										rtl_uString *pIdStr,
+										rtl_uString *pDescription,
+										rtl_uString *pProtocol,
+										remote_InstanceProvider *pProvider ) :
+	m_nRef( 0 ),
+	m_bDisposed( sal_False )
+{
+	m_pConnection = pConnection;
+	m_pConnection->acquire( m_pConnection );
+
+	m_pInstanceProvider = pProvider;
+	if( m_pInstanceProvider )
+	{
+		m_pInstanceProvider->acquire( pProvider );
+	}
+
+	m_pName = pIdStr;
+	rtl_uString_acquire( m_pName );
+
+	m_pDescription = pDescription;
+	rtl_uString_acquire( m_pDescription );
+
+	m_pProtocol = pProtocol;
+	rtl_uString_acquire( pProtocol );
+
+	aBase.acquire = thisAcquire;
+	aBase.release = thisRelease;
+	addDisposingListener = thisAddDisposingListener;
+	removeDisposingListener = thisRemoveDisposingListener;
+	dispose = thisDispose;
+#if OSL_DEBUG_LEVEL > 1
+	thisCounter.acquire();
+#endif
+}
+
+remote_ContextImpl::~remote_ContextImpl()
+{
+	// disposed must have been called
+	OSL_ASSERT( m_bDisposed );
+
+	rtl_uString_release( m_pName );
+	rtl_uString_release( m_pDescription );
+	rtl_uString_release( m_pProtocol );
+#if OSL_DEBUG_LEVEL > 1
+	thisCounter.release();