Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / binaryurp / source / bridgefactory.hxx
blob048cbb8deeaf9810f7409354b9643057b6be71f7
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 <exception>
26 #include <vector>
27 #include <map>
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/basemutex.hxx>
35 #include <cppuhelper/compbase.hxx>
36 #include <sal/types.h>
38 namespace com { namespace sun { namespace star {
39 namespace connection { class XConnection; }
40 namespace uno {
41 class XComponentContext;
42 class XInterface;
44 } } }
46 namespace binaryurp {
48 // That BridgeFactory derives from XComponent appears to be a historic mistake;
49 // the implementation does not care about a disposed state:
51 typedef
52 cppu::WeakComponentImplHelper<
53 com::sun::star::lang::XServiceInfo,
54 com::sun::star::bridge::XBridgeFactory2 >
55 BridgeFactoryBase;
57 class BridgeFactory : private cppu::BaseMutex, public BridgeFactoryBase
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);
65 static OUString SAL_CALL static_getImplementationName();
67 static com::sun::star::uno::Sequence< OUString > SAL_CALL
68 static_getSupportedServiceNames();
70 void removeBridge(
71 com::sun::star::uno::Reference< com::sun::star::bridge::XBridge >
72 const & bridge);
74 using BridgeFactoryBase::acquire;
75 using BridgeFactoryBase::release;
77 private:
78 BridgeFactory(const BridgeFactory&) = delete;
79 BridgeFactory& operator=(const BridgeFactory&) = delete;
81 BridgeFactory();
83 virtual ~BridgeFactory() override;
85 virtual OUString SAL_CALL getImplementationName() override;
87 virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
89 virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
90 getSupportedServiceNames() override;
92 virtual com::sun::star::uno::Reference< com::sun::star::bridge::XBridge >
93 SAL_CALL createBridge(
94 OUString const & sName, OUString const & sProtocol,
95 com::sun::star::uno::Reference<
96 com::sun::star::connection::XConnection > const & aConnection,
97 com::sun::star::uno::Reference<
98 com::sun::star::bridge::XInstanceProvider > const &
99 anInstanceProvider) override;
101 virtual com::sun::star::uno::Reference< com::sun::star::bridge::XBridge >
102 SAL_CALL getBridge(
103 OUString const & sName) override;
105 virtual
106 com::sun::star::uno::Sequence<
107 com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > >
108 SAL_CALL getExistingBridges() override;
110 void SAL_CALL disposing() override;
112 typedef
113 std::vector<
114 com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > >
115 BridgeVector;
117 typedef
118 std::map<
119 OUString,
120 com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > >
121 BridgeMap;
123 BridgeVector unnamed_;
124 BridgeMap named_;
129 #endif
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */