tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / include / comphelper / SelectionMultiplex.hxx
blob6e599f5440782f283ebc77251b3c17561701d759
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 <config_options.h>
24 #include <com/sun/star/view/XSelectionChangeListener.hpp>
25 #include <com/sun/star/lang/EventObject.hpp>
26 #include <cppuhelper/implbase.hxx>
27 #include <comphelper/comphelperdllapi.h>
29 namespace com::sun::star::view { class XSelectionSupplier; }
31 //= selection helper classes
34 namespace comphelper
38 //= OSelectionChangeListener
40 /// simple listener adapter for selections
41 class UNLESS_MERGELIBS_MORE(COMPHELPER_DLLPUBLIC) OSelectionChangeListener
43 friend class OSelectionChangeMultiplexer;
45 public:
46 virtual ~OSelectionChangeListener();
48 /// @throws css::uno::RuntimeException
49 virtual void _selectionChanged( const css::lang::EventObject& aEvent ) = 0;
50 /// @throws css::uno::RuntimeException
51 virtual void _disposing(const css::lang::EventObject& _rSource);
55 //= OSelectionChangeMultiplexer
57 /// multiplexer for selection changes
58 class UNLESS_MERGELIBS_MORE(COMPHELPER_DLLPUBLIC) OSelectionChangeMultiplexer final : public cppu::WeakImplHelper< css::view::XSelectionChangeListener>
60 friend class OSelectionChangeListener;
61 css::uno::Reference< css::view::XSelectionSupplier> m_xSet;
62 OSelectionChangeListener* m_pListener;
63 sal_Int32 m_nLockCount;
65 OSelectionChangeMultiplexer(const OSelectionChangeMultiplexer&) = delete;
66 OSelectionChangeMultiplexer& operator=(const OSelectionChangeMultiplexer&) = delete;
68 virtual ~OSelectionChangeMultiplexer() override;
69 public:
70 OSelectionChangeMultiplexer(OSelectionChangeListener* _pListener, const css::uno::Reference< css::view::XSelectionSupplier>& _rxSet);
72 // XEventListener
73 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
75 // XSelectionChangeListener
76 virtual void SAL_CALL selectionChanged( const css::lang::EventObject& aEvent ) override;
78 /// incremental lock
79 void lock();
80 /// incremental unlock
81 void unlock();
82 /// get the lock count
83 sal_Int32 locked() const { return m_nLockCount; }
85 void dispose();
89 } // namespace comphelper
92 #endif // INCLUDED_COMPHELPER_SELECTIONMULTIPLEX_HXX
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */