Bump version to 5.0-14
[LibreOffice.git] / dbaccess / source / core / inc / ContainerMediator.hxx
blobe0360bf6a0e10eecf984d9c2dbf1acd13632bdc8
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 .
19 #ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTAINERMEDIATOR_HXX
20 #define INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTAINERMEDIATOR_HXX
22 #include <com/sun/star/container/XContainerListener.hpp>
23 #include <com/sun/star/container/XContainer.hpp>
24 #include <com/sun/star/container/XNameContainer.hpp>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/sdbc/XConnection.hpp>
28 #include <comphelper/broadcasthelper.hxx>
29 #include <cppuhelper/implbase1.hxx>
30 #include <rtl/ref.hxx>
32 #include <map>
34 namespace dbaccess
37 class OPropertyForward;
39 class OContainerMediator : public ::comphelper::OBaseMutex
40 ,public ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener >
42 private:
43 typedef ::rtl::Reference< OPropertyForward > TPropertyForward;
44 typedef ::std::map< OUString, TPropertyForward > PropertyForwardList;
45 PropertyForwardList m_aForwardList;
46 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xSettings; // can not be weak
47 ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer > m_xContainer; // can not be weak
48 ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XConnection > m_aConnection;
50 protected:
51 virtual ~OContainerMediator();
53 public:
54 OContainerMediator(
55 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >& _xContainer,
56 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xSettings,
57 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection
60 virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
61 virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
62 virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
63 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
65 void notifyElementCreated(const OUString& _sElementName
66 ,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xElement);
68 private:
69 /** cleans up the instance, by deregistering as listener at the containers,
70 and resetting them to <NULL/>
72 void impl_cleanup_nothrow();
74 /** initializes the properties of the given object from its counterpart in our settings container
76 void impl_initSettings_nothrow(
77 const OUString& _rName,
78 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDestination
82 } // namespace dbaccess
84 #endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTAINERMEDIATOR_HXX
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */