1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_FORMS_SOURCE_INC_LISTENERCONTAINERS_HXX
21 #define INCLUDED_FORMS_SOURCE_INC_LISTENERCONTAINERS_HXX
23 #include <com/sun/star/form/XResetListener.hpp>
24 #include <comphelper/listenernotification.hxx>
25 #include <cppuhelper/weak.hxx>
31 template < class LISTENER
>
32 class EventListeners
: public ::comphelper::OListenerContainerBase
< LISTENER
, css::lang::EventObject
>
35 typedef ::comphelper::OListenerContainerBase
< LISTENER
, css::lang::EventObject
>
39 ::cppu::OWeakObject
& m_rInstigator
;
42 inline EventListeners( ::cppu::OWeakObject
& _rInstigator
, ::osl::Mutex
& _rMutex
)
43 :EventListeners_Base( _rMutex
)
44 ,m_rInstigator( _rInstigator
)
51 css::lang::EventObject
aEvent( m_rInstigator
);
52 return EventListeners_Base::notify( aEvent
);
55 inline void disposing()
57 css::lang::EventObject
aEvent( m_rInstigator
);
58 EventListeners_Base::disposing( aEvent
);
61 using EventListeners_Base::notify
;
62 using EventListeners_Base::disposing
;
65 typedef EventListeners
< css::form::XResetListener
66 > ResetListeners_Base
;
67 class ResetListeners
: public ResetListeners_Base
75 NotificationType m_eCurrentNotificationType
;
78 inline ResetListeners( ::cppu::OWeakObject
& _rInstigator
, ::osl::Mutex
& _rMutex
)
79 :ResetListeners_Base( _rInstigator
, _rMutex
)
80 ,m_eCurrentNotificationType( eApproval
)
84 /** see whether all our listeners approve the reset
88 m_eCurrentNotificationType
= eApproval
;
92 /** tell all our listeners that the reset happened
96 m_eCurrentNotificationType
= eFinal
;
101 virtual bool implTypedNotify(
102 const css::uno::Reference
< css::form::XResetListener
>& _rxListener
,
103 const css::lang::EventObject
& _rEvent
111 #endif // INCLUDED_FORMS_SOURCE_INC_LISTENERCONTAINERS_HXX
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */