LibreOffice Module chart2 (master) 1
ModifyListenerHelper.cxx
Go to the documentation of this file.
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
21
22using namespace ::com::sun::star;
23
24using ::com::sun::star::uno::Reference;
25
26namespace chart
27{
28
30{
31}
32
33// ____ XModifyBroadcaster ____
35{
36 std::unique_lock aGuard(m_aMutex);
37
38 m_aModifyListeners.addInterface( aGuard, aListener );
39}
40
42{
43 std::unique_lock aGuard(m_aMutex);
44
45 m_aModifyListeners.removeInterface( aGuard, aListener );
46}
47
48// ____ XModifyListener ____
49void SAL_CALL ModifyEventForwarder::modified( const lang::EventObject& aEvent )
50{
51 std::unique_lock aGuard(m_aMutex);
52
53 if( m_aModifyListeners.getLength(aGuard) == 0 )
54 return;
55
56 m_aModifyListeners.notifyEach( aGuard, &util::XModifyListener::modified, aEvent );
57}
58
59// ____ XEventListener (base of XModifyListener) ____
60void SAL_CALL ModifyEventForwarder::disposing( const lang::EventObject& /* Source */ )
61{
62 // nothing
63}
64
65// ____ WeakComponentImplHelperBase ____
66void ModifyEventForwarder::disposing(std::unique_lock<std::mutex>& rGuard)
67{
68 // dispose was called at this
69 m_aModifyListeners.disposeAndClear( rGuard, lang::EventObject( static_cast<cppu::OWeakObject*>(this) ) );
70}
71
72} // namespace chart::ModifyListenerHelper
73
74/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AnyEventRef aEvent
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
comphelper::OInterfaceContainerHelper4< css::util::XModifyListener > m_aModifyListeners
virtual void SAL_CALL modified(const css::lang::EventObject &aEvent) override
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
sal_Int32 addInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
void notifyEach(std::unique_lock< std::mutex > &rGuard, void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event) const
void disposeAndClear(::std::unique_lock<::std::mutex > &rGuard, const css::lang::EventObject &rEvt)
sal_Int32 getLength(std::unique_lock< std::mutex > &rGuard) const
sal_Int32 removeInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)