2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 #ifndef _SVX_SIDEBAR_SELECTION_CHANGE_HANDLER_HXX_
19 #define _SVX_SIDEBAR_SELECTION_CHANGE_HANDLER_HXX_
21 #include "svx/svxdllapi.h"
22 #include <sfx2/sidebar/EnumContext.hxx>
23 #include <com/sun/star/frame/XController.hpp>
24 #include <com/sun/star/view/XSelectionSupplier.hpp>
25 #include <com/sun/star/view/XSelectionChangeListener.hpp>
27 #include <cppuhelper/compbase1.hxx>
28 #include <cppuhelper/basemutex.hxx>
30 #include <boost/noncopyable.hpp>
31 #include <boost/function.hpp>
33 namespace css
= ::com::sun::star
;
34 namespace cssu
= ::com::sun::star::uno
;
40 namespace svx
{ namespace sidebar
{
43 typedef ::cppu::WeakComponentImplHelper1
<
44 css::view::XSelectionChangeListener
45 > SelectionChangeHandlerInterfaceBase
;
49 class SVX_DLLPUBLIC SelectionChangeHandler
50 : private ::boost::noncopyable
,
51 private ::cppu::BaseMutex
,
52 public SelectionChangeHandlerInterfaceBase
55 SelectionChangeHandler (
56 const boost::function
<rtl::OUString(void)>& rSelectionChangeCallback
,
57 const cssu::Reference
<css::frame::XController
>& rxController
,
58 const sfx2::sidebar::EnumContext::Context eDefaultContext
);
59 virtual ~SelectionChangeHandler (void);
61 virtual void SAL_CALL
selectionChanged (const css::lang::EventObject
& rEvent
)
62 throw (cssu::RuntimeException
);
64 virtual void SAL_CALL
disposing (const css::lang::EventObject
& rEvent
)
65 throw (cssu::RuntimeException
);
67 virtual void SAL_CALL
disposing (void)
68 throw (cssu::RuntimeException
);
71 void Disconnect (void);
74 const boost::function
<rtl::OUString(void)> maSelectionChangeCallback
;
75 cssu::Reference
<css::frame::XController
> mxController
;
76 const sfx2::sidebar::EnumContext::Context meDefaultContext
;
81 } } // end of namespace svx::sidebar