Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : : #ifndef DBA_CONTAINERLISTENER_HXX
20 : : #define DBA_CONTAINERLISTENER_HXX
21 : :
22 : : #include <cppuhelper/implbase2.hxx>
23 : : #include <com/sun/star/container/XContainerListener.hpp>
24 : : #include <com/sun/star/container/XContainerApproveListener.hpp>
25 : :
26 : : #include <cppuhelper/weak.hxx>
27 : :
28 : : namespace dbaccess
29 : : {
30 : :
31 : : //==========================================================================
32 : : //= OContainerListener
33 : : //==========================================================================
34 : : typedef ::cppu::WeakImplHelper2 < ::com::sun::star::container::XContainerListener
35 : : , ::com::sun::star::container::XContainerApproveListener
36 : : > OContainerListener_BASE;
37 : :
38 : : /** is helper class to avoid a cycle in refcount
39 : : */
40 : : class OContainerListener : public OContainerListener_BASE
41 : : {
42 : : ::osl::Mutex& m_rMutex;
43 : : OWeakObject& m_rDestination;
44 : : bool m_bDisposed;
45 : :
46 : : public:
47 : 56 : OContainerListener( OWeakObject& _rDestination, ::osl::Mutex& _rMutex )
48 : : :m_rMutex( _rMutex )
49 : : ,m_rDestination( _rDestination )
50 : 56 : ,m_bDisposed( false )
51 : : {
52 : 56 : }
53 : :
54 : : // XContainerApproveListener
55 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XVeto > SAL_CALL approveInsertElement( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
56 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XVeto > SAL_CALL approveReplaceElement( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
57 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XVeto > SAL_CALL approveRemoveElement( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
58 : :
59 : : // XContainerListener
60 : : virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
61 : : virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
62 : : virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
63 : :
64 : : // XEventListener
65 : : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
66 : :
67 : 56 : void SAL_CALL dispose()
68 : : {
69 : 56 : m_bDisposed = true;
70 : 56 : }
71 : :
72 : : protected:
73 : : virtual ~OContainerListener();
74 : : };
75 : :
76 : : } // namespace dbaccess
77 : :
78 : : #endif // DBA_CONTAINERLISTENER_HXX
79 : :
80 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|