update credits
[LibreOffice.git] / binaryurp / source / bridgefactory.hxx
bloba949e636402e4a9024a92bb8c42614ec48c1ccb3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_BINARYURP_SOURCE_BRIDGEFACTORY_HXX
21 #define INCLUDED_BINARYURP_SOURCE_BRIDGEFACTORY_HXX
23 #include "sal/config.h"
25 #include <list>
26 #include <map>
28 #include "boost/noncopyable.hpp"
29 #include "com/sun/star/bridge/XBridgeFactory2.hpp"
30 #include "com/sun/star/lang/XServiceInfo.hpp"
31 #include "com/sun/star/uno/Exception.hpp"
32 #include "com/sun/star/uno/Reference.hxx"
33 #include "com/sun/star/uno/RuntimeException.hpp"
34 #include "cppuhelper/compbase2.hxx"
35 #include "sal/types.h"
37 namespace com { namespace sun { namespace star {
38 namespace connection { class XConnection; }
39 namespace uno {
40 class XComponentContext;
41 class XInterface;
43 } } }
45 namespace binaryurp {
47 // That BridgeFactory derives from XComponent appears to be a historic mistake;
48 // the implementation does not care about a disposed state:
50 typedef
51 cppu::WeakComponentImplHelper2<
52 com::sun::star::lang::XServiceInfo,
53 com::sun::star::bridge::XBridgeFactory2 >
54 BridgeFactoryBase;
56 class BridgeFactory:
57 private osl::Mutex, public BridgeFactoryBase, private boost::noncopyable
59 public:
60 static com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
61 SAL_CALL static_create(
62 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
63 const & xContext)
64 SAL_THROW((com::sun::star::uno::Exception));
66 static OUString SAL_CALL static_getImplementationName();
68 static com::sun::star::uno::Sequence< OUString > SAL_CALL
69 static_getSupportedServiceNames();
71 void removeBridge(
72 com::sun::star::uno::Reference< com::sun::star::bridge::XBridge >
73 const & bridge);
75 using BridgeFactoryBase::acquire;
76 using BridgeFactoryBase::release;
78 private:
79 explicit BridgeFactory(
80 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
81 const & context);
83 virtual ~BridgeFactory();
85 virtual OUString SAL_CALL getImplementationName()
86 throw (com::sun::star::uno::RuntimeException);
88 virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
89 throw (com::sun::star::uno::RuntimeException);
91 virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
92 getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException);
94 virtual com::sun::star::uno::Reference< com::sun::star::bridge::XBridge >
95 SAL_CALL createBridge(
96 OUString const & sName, OUString const & sProtocol,
97 com::sun::star::uno::Reference<
98 com::sun::star::connection::XConnection > const & aConnection,
99 com::sun::star::uno::Reference<
100 com::sun::star::bridge::XInstanceProvider > const &
101 anInstanceProvider)
102 throw (
103 com::sun::star::bridge::BridgeExistsException,
104 com::sun::star::lang::IllegalArgumentException,
105 com::sun::star::uno::RuntimeException);
107 virtual com::sun::star::uno::Reference< com::sun::star::bridge::XBridge >
108 SAL_CALL getBridge(
109 OUString const & sName)
110 throw (com::sun::star::uno::RuntimeException);
112 virtual
113 com::sun::star::uno::Sequence<
114 com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > >
115 SAL_CALL getExistingBridges() throw (com::sun::star::uno::RuntimeException);
117 typedef
118 std::list<
119 com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > >
120 BridgeList;
122 typedef
123 std::map<
124 OUString,
125 com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > >
126 BridgeMap;
128 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
129 context_;
130 BridgeList unnamed_;
131 BridgeMap named_;
136 #endif
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */