Bump version to 4.3-4
[LibreOffice.git] / binaryurp / source / bridgefactory.hxx
blob8607626d8226817982206a95645fc9bf6efb1fe9
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 <list>
27 #include <map>
29 #include "boost/noncopyable.hpp"
30 #include "com/sun/star/bridge/XBridgeFactory2.hpp"
31 #include "com/sun/star/lang/XServiceInfo.hpp"
32 #include "com/sun/star/uno/Exception.hpp"
33 #include "com/sun/star/uno/Reference.hxx"
34 #include "com/sun/star/uno/RuntimeException.hpp"
35 #include "cppuhelper/basemutex.hxx"
36 #include "cppuhelper/compbase2.hxx"
37 #include "sal/types.h"
39 namespace com { namespace sun { namespace star {
40 namespace connection { class XConnection; }
41 namespace uno {
42 class XComponentContext;
43 class XInterface;
45 } } }
47 namespace binaryurp {
49 // That BridgeFactory derives from XComponent appears to be a historic mistake;
50 // the implementation does not care about a disposed state:
52 typedef
53 cppu::WeakComponentImplHelper2<
54 com::sun::star::lang::XServiceInfo,
55 com::sun::star::bridge::XBridgeFactory2 >
56 BridgeFactoryBase;
58 class BridgeFactory:
59 private cppu::BaseMutex, public BridgeFactoryBase,
60 private boost::noncopyable
62 public:
63 static com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
64 SAL_CALL static_create(
65 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
66 const & xContext)
67 SAL_THROW((com::sun::star::uno::Exception));
69 static OUString SAL_CALL static_getImplementationName();
71 static com::sun::star::uno::Sequence< OUString > SAL_CALL
72 static_getSupportedServiceNames();
74 void removeBridge(
75 com::sun::star::uno::Reference< com::sun::star::bridge::XBridge >
76 const & bridge);
78 using BridgeFactoryBase::acquire;
79 using BridgeFactoryBase::release;
81 private:
82 explicit BridgeFactory(
83 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
84 const & context);
86 virtual ~BridgeFactory();
88 virtual OUString SAL_CALL getImplementationName()
89 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
92 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
95 getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 virtual com::sun::star::uno::Reference< com::sun::star::bridge::XBridge >
98 SAL_CALL createBridge(
99 OUString const & sName, OUString const & sProtocol,
100 com::sun::star::uno::Reference<
101 com::sun::star::connection::XConnection > const & aConnection,
102 com::sun::star::uno::Reference<
103 com::sun::star::bridge::XInstanceProvider > const &
104 anInstanceProvider)
105 throw (
106 com::sun::star::bridge::BridgeExistsException,
107 com::sun::star::lang::IllegalArgumentException,
108 com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
110 virtual com::sun::star::uno::Reference< com::sun::star::bridge::XBridge >
111 SAL_CALL getBridge(
112 OUString const & sName)
113 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
115 virtual
116 com::sun::star::uno::Sequence<
117 com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > >
118 SAL_CALL getExistingBridges() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
120 void SAL_CALL disposing() SAL_OVERRIDE;
122 typedef
123 std::list<
124 com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > >
125 BridgeList;
127 typedef
128 std::map<
129 OUString,
130 com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > >
131 BridgeMap;
133 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
134 context_;
135 BridgeList unnamed_;
136 BridgeMap named_;
141 #endif
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */