1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: remote_bridge.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <osl/mutex.hxx>
32 #include <osl/diagnose.h>
34 #include <uno/mapping.hxx>
35 #include <uno/environment.h>
37 #include <bridges/remote/context.h>
38 #include <bridges/remote/remote.h>
40 #include <cppuhelper/factory.hxx>
41 #include <cppuhelper/component.hxx>
42 #include <cppuhelper/typeprovider.hxx>
44 #include <com/sun/star/lang/XComponent.hpp>
45 #include <com/sun/star/lang/XInitialization.hpp>
47 #include <com/sun/star/bridge/XBridge.hpp>
48 #include <com/sun/star/bridge/XInstanceProvider.hpp>
51 namespace remotebridges_bridge
53 extern rtl_StandardModuleCount g_moduleCount
;
62 public remote_DisposingListener
,
63 public ::com::sun::star::lang::XInitialization
,
64 public ::com::sun::star::bridge::XBridge
,
65 public ::cppu::OComponentHelper
73 ::com::sun::star::uno::Any SAL_CALL
74 queryInterface( const ::com::sun::star::uno::Type
& aType
) throw(::com::sun::star::uno::RuntimeException
);
76 void SAL_CALL
acquire() throw()
77 { OComponentHelper::acquire(); }
78 void SAL_CALL
release() throw()
79 { OComponentHelper::release(); }
82 virtual void SAL_CALL
disposing(); // called by OComponentHelper
86 virtual void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
<
87 ::com::sun::star::uno::Any
>& aArguments
)
88 throw( ::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
91 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
92 getInstance( const ::rtl::OUString
& sInstanceName
)
93 throw(::com::sun::star::uno::RuntimeException
);
95 virtual ::rtl::OUString SAL_CALL
getName( )
96 throw(::com::sun::star::uno::RuntimeException
);
97 virtual ::rtl::OUString SAL_CALL
getDescription( )
98 throw(::com::sun::star::uno::RuntimeException
);
101 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
102 getTypes( ) throw(::com::sun::star::uno::RuntimeException
);
103 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
104 getImplementationId( ) throw(::com::sun::star::uno::RuntimeException
);
107 static void SAL_CALL
thisAcquire( remote_DisposingListener
* );
108 static void SAL_CALL
thisRelease( remote_DisposingListener
* );
109 static void SAL_CALL
thisDisposing( remote_DisposingListener
* ,
110 rtl_uString
* pBridgeName
);
113 void objectMappedSuccesfully();
116 remote_Context
*m_pContext
;
117 uno_Environment
*m_pEnvRemote
;
118 ::rtl::OUString m_sName
;
119 ::rtl::OUString m_sDescription
;
120 ::rtl::OUString m_sProtocol
;
123 class OInstanceProviderWrapper
:
124 public remote_InstanceProvider
127 OInstanceProviderWrapper( const ::com::sun::star::uno::Reference
<
128 ::com::sun::star::bridge::XInstanceProvider
> & rProvider
,
129 ORemoteBridge
* pBridgeCallback
);
131 ~OInstanceProviderWrapper();
133 static void SAL_CALL
thisAcquire( remote_InstanceProvider
* );
134 static void SAL_CALL
thisRelease( remote_InstanceProvider
* );
135 static void SAL_CALL
thisGetInstance( remote_InstanceProvider
* pProvider
,
136 uno_Environment
*pEnvRemote
,
137 remote_Interface
**ppRemoteI
,
138 rtl_uString
*pInstanceName
,
139 typelib_InterfaceTypeDescription
*pType
,
140 uno_Any
**ppException
);
143 ::com::sun::star::uno::Reference
<
144 ::com::sun::star::bridge::XInstanceProvider
> m_rProvider
;
145 oslInterlockedCount m_nRef
;
146 ORemoteBridge
*m_pBridgeCallback
;