1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ContainerMediator.hxx,v $
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 ************************************************************************/
30 #ifndef DBA_CONTAINERMEDIATOR_HXX
31 #define DBA_CONTAINERMEDIATOR_HXX
33 #ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERLISTENER_HPP_
34 #include <com/sun/star/container/XContainerListener.hpp>
36 #ifndef _COM_SUN_STAR_CONTAINER_XCONTAINER_HPP_
37 #include <com/sun/star/container/XContainer.hpp>
39 #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
40 #include <com/sun/star/container/XNameContainer.hpp>
42 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
43 #include <com/sun/star/beans/XPropertySet.hpp>
45 #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
46 #include <com/sun/star/sdbc/XConnection.hpp>
49 #ifndef _COMPHELPER_BROADCASTHELPER_HXX_
50 #include <comphelper/broadcasthelper.hxx>
52 #ifndef _COMPHELPER_BROADCASTHELPER_HXX_
53 #include <comphelper/broadcasthelper.hxx>
55 #ifndef _CPPUHELPER_IMPLBASE1_HXX_
56 #include <cppuhelper/implbase1.hxx>
59 #include <rtl/ref.hxx>
64 //........................................................................
67 //........................................................................
69 class OPropertyForward
;
71 class OContainerMediator
: public ::comphelper::OBaseMutex
72 ,public ::cppu::WeakImplHelper1
< ::com::sun::star::container::XContainerListener
>
82 typedef ::rtl::Reference
< OPropertyForward
> TPropertyForward
;
83 typedef ::std::map
< ::rtl::OUString
, TPropertyForward
> PropertyForwardList
;
84 PropertyForwardList m_aForwardList
;
85 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xSettings
; // can not be weak
86 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XContainer
> m_xContainer
; // can not be weak
87 ::com::sun::star::uno::WeakReference
< ::com::sun::star::sdbc::XConnection
> m_aConnection
;
88 ContainerType m_eType
;
91 virtual ~OContainerMediator();
95 const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XContainer
>& _xContainer
,
96 const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& _xSettings
,
97 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConnection
,
101 virtual void SAL_CALL
elementInserted( const ::com::sun::star::container::ContainerEvent
& _rEvent
) throw(::com::sun::star::uno::RuntimeException
);
102 virtual void SAL_CALL
elementRemoved( const ::com::sun::star::container::ContainerEvent
& _rEvent
) throw(::com::sun::star::uno::RuntimeException
);
103 virtual void SAL_CALL
elementReplaced( const ::com::sun::star::container::ContainerEvent
& _rEvent
) throw(::com::sun::star::uno::RuntimeException
);
104 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw(::com::sun::star::uno::RuntimeException
);
106 void notifyElementCreated(const ::rtl::OUString
& _sElementName
107 ,const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _xElement
);
110 /** cleans up the instance, by deregistering as listener at the containers,
111 and resetting them to <NULL/>
113 void impl_cleanup_nothrow();
115 /** retrieves the settings object to initialize a container element
117 Normally, this object will simply retrieve the object with the given name from our settings
118 container. Hiowever, for columns, there's a fallback in case this settings object does
119 not yet exist: Then, we check if the given destination object refers to a table column, via its
120 TableName and RealName property. If so, this table column is used as initialization object.
123 the name of the destination object in its container
124 @param _rxDestination
125 the destination object to initialize
127 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
128 impl_getSettingsForInitialization_nothrow(
129 const ::rtl::OUString
& _rName
,
130 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxDestination
133 //........................................................................
134 } // namespace dbaccess
135 //........................................................................
137 #endif // DBA_CONTAINERMEDIATOR_HXX