Update ooo320-m1
[ooovba.git] / remotebridges / source / bridge / remote_bridge.hxx
blobe894204cc5a52ef2aac0ac1f3505b86a9b273735
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: remote_bridge.hxx,v $
10 * $Revision: 1.6 $
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;
55 struct MyMutex
57 ::osl::Mutex m_mutex;
60 class ORemoteBridge :
61 public MyMutex,
62 public remote_DisposingListener,
63 public ::com::sun::star::lang::XInitialization,
64 public ::com::sun::star::bridge::XBridge,
65 public ::cppu::OComponentHelper
67 public:
68 ORemoteBridge();
69 ~ORemoteBridge();
71 // XInterface
72 public:
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(); }
81 public:
82 virtual void SAL_CALL disposing(); // called by OComponentHelper
84 public:
85 // Methods
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);
90 public:
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);
100 public:
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);
106 public:
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 );
112 public:
113 void objectMappedSuccesfully();
115 public:
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
126 public:
127 OInstanceProviderWrapper( const ::com::sun::star::uno::Reference <
128 ::com::sun::star::bridge::XInstanceProvider > & rProvider ,
129 ORemoteBridge * pBridgeCallback );
131 ~OInstanceProviderWrapper();
132 public:
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 );
142 private:
143 ::com::sun::star::uno::Reference <
144 ::com::sun::star::bridge::XInstanceProvider > m_rProvider;
145 oslInterlockedCount m_nRef;
146 ORemoteBridge *m_pBridgeCallback;