LibreOffice Module comphelper (master) 1
SelectionMultiplex.hxx
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
20#ifndef INCLUDED_COMPHELPER_SELECTIONMULTIPLEX_HXX
21#define INCLUDED_COMPHELPER_SELECTIONMULTIPLEX_HXX
22
23#include <com/sun/star/view/XSelectionChangeListener.hpp>
24#include <com/sun/star/lang/EventObject.hpp>
27
28namespace com::sun::star::view { class XSelectionSupplier; }
29
30//= selection helper classes
31
32
33namespace comphelper
34{
35
36
37 //= OSelectionChangeListener
38
41 {
43
44 public:
46
48 virtual void _selectionChanged( const css::lang::EventObject& aEvent ) = 0;
50 virtual void _disposing(const css::lang::EventObject& _rSource);
51 };
52
53
54 //= OSelectionChangeMultiplexer
55
57 class COMPHELPER_DLLPUBLIC OSelectionChangeMultiplexer final : public cppu::WeakImplHelper< css::view::XSelectionChangeListener>
58 {
60 css::uno::Reference< css::view::XSelectionSupplier> m_xSet;
62 sal_Int32 m_nLockCount;
63
66
67 virtual ~OSelectionChangeMultiplexer() override;
68 public:
69 OSelectionChangeMultiplexer(OSelectionChangeListener* _pListener, const css::uno::Reference< css::view::XSelectionSupplier>& _rxSet);
70
71 // XEventListener
72 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
73
74 // XSelectionChangeListener
75 virtual void SAL_CALL selectionChanged( const css::lang::EventObject& aEvent ) override;
76
78 void lock();
80 void unlock();
82 sal_Int32 locked() const { return m_nLockCount; }
83 };
84
85
86} // namespace comphelper
87
88
89#endif // INCLUDED_COMPHELPER_SELECTIONMULTIPLEX_HXX
90
91/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AnyEventRef aEvent
simple listener adapter for selections
virtual void _selectionChanged(const css::lang::EventObject &aEvent)=0
multiplexer for selection changes
sal_Int32 locked() const
get the lock count
css::uno::Reference< css::view::XSelectionSupplier > m_xSet
OSelectionChangeMultiplexer(const OSelectionChangeMultiplexer &)=delete
OSelectionChangeMultiplexer(OSelectionChangeListener *_pListener, const css::uno::Reference< css::view::XSelectionSupplier > &_rxSet)
OSelectionChangeMultiplexer & operator=(const OSelectionChangeMultiplexer &)=delete
#define COMPHELPER_DLLPUBLIC
virtual DECL_LISTENERMULTIPLEXER_END void SAL_CALL selectionChanged(const css::lang::EventObject &aEvent) override
std::shared_ptr< osl::Mutex > const & lock()