Update ooo320-m1
[ooovba.git] / desktop / source / offacc / acceptor.hxx
blobc54d63c7ccacb68f67ffb4dae0ef87df65ba4103
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: acceptor.hxx,v $
10 * $Revision: 1.7 $
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 <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/uno/Exception.hpp>
33 #include <com/sun/star/uno/Reference.h>
34 #include <com/sun/star/lang/XComponent.hpp>
35 #include <com/sun/star/connection/XAcceptor.hpp>
36 #include <com/sun/star/lang/XInitialization.hpp>
37 #include <com/sun/star/bridge/XInstanceProvider.hpp>
38 #include <com/sun/star/bridge/XBridgeFactory.hpp>
39 #include <com/sun/star/beans/XPropertySet.hpp>
40 #include <cppuhelper/implbase1.hxx>
41 #include <cppuhelper/implbase2.hxx>
42 #include <cppuhelper/interfacecontainer.h>
43 #include <rtl/logfile.hxx>
45 #include <com/sun/star/registry/XRegistryKey.hpp>
46 #include <comphelper/weakbag.hxx>
47 #include <osl/mutex.hxx>
48 #include <osl/conditn.hxx>
49 #include <osl/thread.hxx>
52 using namespace ::rtl;
53 using namespace ::osl;
54 using namespace ::com::sun::star::uno;
55 using namespace ::com::sun::star::beans;
56 using namespace ::com::sun::star::bridge;
57 using namespace ::com::sun::star::lang;
58 using namespace ::com::sun::star::connection;
59 using namespace ::com::sun::star::container;
60 using namespace ::com::sun::star::registry;
62 namespace desktop {
64 class Acceptor
65 : public ::cppu::WeakImplHelper2<XServiceInfo, XInitialization>
67 private:
68 static const sal_Char *serviceName;
69 static const sal_Char *implementationName;
70 static const sal_Char *supportedServiceNames[];
72 static Mutex m_aMutex;
74 oslThread m_thread;
75 comphelper::WeakBag< com::sun::star::bridge::XBridge > m_bridges;
77 Condition m_cEnable;
79 Reference< XMultiServiceFactory > m_rSMgr;
80 Reference< XInterface > m_rContext;
81 Reference< XAcceptor > m_rAcceptor;
82 Reference< XBridgeFactory > m_rBridgeFactory;
84 OUString m_aAcceptString;
85 OUString m_aConnectString;
86 OUString m_aProtocol;
88 sal_Bool m_bInit;
90 public:
91 Acceptor( const Reference< XMultiServiceFactory >& aFactory );
92 virtual ~Acceptor();
94 void SAL_CALL run();
96 // XService info
97 static OUString impl_getImplementationName();
98 virtual OUString SAL_CALL getImplementationName()
99 throw (RuntimeException);
100 static Sequence<OUString> impl_getSupportedServiceNames();
101 virtual Sequence<OUString> SAL_CALL getSupportedServiceNames()
102 throw (RuntimeException);
103 virtual sal_Bool SAL_CALL supportsService( const OUString& aName )
104 throw (RuntimeException);
106 // XInitialize
107 virtual void SAL_CALL initialize( const Sequence<Any>& aArguments )
108 throw ( Exception );
110 static Reference<XInterface> impl_getInstance( const Reference< XMultiServiceFactory >& aFactory );
113 class AccInstanceProvider : public ::cppu::WeakImplHelper1<XInstanceProvider>
115 private:
116 Reference<XMultiServiceFactory> m_rSMgr;
117 Reference<XConnection> m_rConnection;
119 public:
120 AccInstanceProvider(const Reference< XMultiServiceFactory >& aFactory,
121 const Reference< XConnection >& rConnection);
122 virtual ~AccInstanceProvider();
124 // XInstanceProvider
125 virtual Reference<XInterface> SAL_CALL getInstance (const OUString& aName )
126 throw ( NoSuchElementException );
130 } //namespace desktop