update emoji autocorrect entries from po-files
[LibreOffice.git] / include / comphelper / SelectionMultiplex.hxx
blobc645ec88f98bb78862a46e992ca7d6f21677342e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_COMPHELPER_SELECTIONMULTIPLEX_HXX
21 #define INCLUDED_COMPHELPER_SELECTIONMULTIPLEX_HXX
23 #include <com/sun/star/view/XSelectionChangeListener.hpp>
24 #include <com/sun/star/view/XSelectionSupplier.hpp>
25 #include <cppuhelper/implbase1.hxx>
26 #include <comphelper/comphelperdllapi.h>
29 //= selection helper classes
33 namespace comphelper
37 class OSelectionChangeMultiplexer;
40 //= OSelectionChangeListener
42 /// simple listener adapter for selections
43 class COMPHELPER_DLLPUBLIC OSelectionChangeListener
45 friend class OSelectionChangeMultiplexer;
47 OSelectionChangeMultiplexer* m_pAdapter;
48 ::osl::Mutex& m_rMutex;
50 public:
51 OSelectionChangeListener(::osl::Mutex& _rMutex)
52 : m_pAdapter(NULL), m_rMutex(_rMutex) { }
53 virtual ~OSelectionChangeListener();
55 virtual void _selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException) = 0;
56 virtual void _disposing(const ::com::sun::star::lang::EventObject& _rSource)
57 throw (::com::sun::star::uno::RuntimeException, std::exception);
59 protected:
60 // pseudo-private. Making it private now could break compatibility
61 void setAdapter( OSelectionChangeMultiplexer* _pAdapter );
65 //= OSelectionChangeMultiplexer
67 /// multiplexer for selection changes
68 class COMPHELPER_DLLPUBLIC OSelectionChangeMultiplexer :public cppu::WeakImplHelper1< ::com::sun::star::view::XSelectionChangeListener>
70 friend class OSelectionChangeListener;
71 ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier> m_xSet;
72 OSelectionChangeListener* m_pListener;
73 sal_Int32 m_nLockCount;
74 bool m_bListening : 1;
75 bool m_bAutoSetRelease : 1;
77 OSelectionChangeMultiplexer(const OSelectionChangeMultiplexer&) SAL_DELETED_FUNCTION;
78 OSelectionChangeMultiplexer& operator=(const OSelectionChangeMultiplexer&) SAL_DELETED_FUNCTION;
79 protected:
80 virtual ~OSelectionChangeMultiplexer();
81 public:
82 OSelectionChangeMultiplexer(OSelectionChangeListener* _pListener, const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier>& _rxSet, bool _bAutoReleaseSet = true);
84 // XEventListener
85 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
87 // XSelectionChangeListener
88 virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 /// incremental lock
91 void lock();
92 /// incremental unlock
93 void unlock();
94 /// get the lock count
95 sal_Int32 locked() const { return m_nLockCount; }
97 void dispose();
101 } // namespace comphelper
104 #endif // INCLUDED_COMPHELPER_SELECTIONMULTIPLEX_HXX
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */