Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / svx / sidebar / SelectionChangeHandler.hxx
blobdeaa2581a9a2344a28016f983b0660c3948adc2c
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 .
19 #ifndef INCLUDED_SVX_SIDEBAR_SELECTIONCHANGEHANDLER_HXX
20 #define INCLUDED_SVX_SIDEBAR_SELECTIONCHANGEHANDLER_HXX
22 #include <svx/svxdllapi.h>
23 #include <vcl/EnumContext.hxx>
24 #include <com/sun/star/frame/XController.hpp>
25 #include <com/sun/star/view/XSelectionSupplier.hpp>
26 #include <com/sun/star/view/XSelectionChangeListener.hpp>
28 #include <cppuhelper/compbase.hxx>
29 #include <cppuhelper/basemutex.hxx>
31 #include <functional>
33 class SdrMarkView;
36 namespace svx { namespace sidebar {
38 typedef cppu::WeakComponentImplHelper<
39 css::view::XSelectionChangeListener
40 > SelectionChangeHandlerInterfaceBase;
42 class SVX_DLLPUBLIC SelectionChangeHandler
43 : private ::cppu::BaseMutex,
44 public SelectionChangeHandlerInterfaceBase
46 public:
47 SelectionChangeHandler (
48 const std::function<rtl::OUString ()>& rSelectionChangeCallback,
49 const css::uno::Reference<css::frame::XController>& rxController,
50 const vcl::EnumContext::Context eDefaultContext);
51 virtual ~SelectionChangeHandler() override;
53 virtual void SAL_CALL selectionChanged (const css::lang::EventObject& rEvent) override;
55 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) override;
57 virtual void SAL_CALL disposing() override;
59 void Connect();
60 void Disconnect();
62 private:
63 SelectionChangeHandler(const SelectionChangeHandler&) = delete;
64 SelectionChangeHandler& operator=(const SelectionChangeHandler&) = delete;
66 const std::function<rtl::OUString ()> maSelectionChangeCallback;
67 css::uno::Reference<css::frame::XController> mxController;
68 const vcl::EnumContext::Context meDefaultContext;
69 bool mbIsConnected;
73 } } // end of namespace svx::sidebar
76 #endif
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */