1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 #ifndef _SVX_SIDEBAR_SELECTION_CHANGE_HANDLER_HXX_ 23 #define _SVX_SIDEBAR_SELECTION_CHANGE_HANDLER_HXX_ 24 25 #include "svx/svxdllapi.h" 26 #include <sfx2/sidebar/EnumContext.hxx> 27 #include <com/sun/star/frame/XController.hpp> 28 #include <com/sun/star/view/XSelectionSupplier.hpp> 29 #include <com/sun/star/view/XSelectionChangeListener.hpp> 30 31 #include <cppuhelper/compbase1.hxx> 32 #include <cppuhelper/basemutex.hxx> 33 34 #include <boost/noncopyable.hpp> 35 #include <boost/function.hpp> 36 37 namespace css = ::com::sun::star; 38 namespace cssu = ::com::sun::star::uno; 39 40 41 class SdrMarkView; 42 43 44 namespace svx { namespace sidebar { 45 46 namespace { 47 typedef ::cppu::WeakComponentImplHelper1 < 48 css::view::XSelectionChangeListener 49 > SelectionChangeHandlerInterfaceBase; 50 } 51 52 53 class SVX_DLLPUBLIC SelectionChangeHandler 54 : private ::boost::noncopyable, 55 private ::cppu::BaseMutex, 56 public SelectionChangeHandlerInterfaceBase 57 { 58 public: 59 SelectionChangeHandler ( 60 const boost::function<rtl::OUString(void)>& rSelectionChangeCallback, 61 const cssu::Reference<css::frame::XController>& rxController, 62 const sfx2::sidebar::EnumContext::Context eDefaultContext); 63 virtual ~SelectionChangeHandler (void); 64 65 virtual void SAL_CALL selectionChanged (const css::lang::EventObject& rEvent); 66 67 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent); 68 69 virtual void SAL_CALL disposing (void); 70 71 void Connect (void); 72 void Disconnect (void); 73 74 private: 75 const boost::function<rtl::OUString(void)> maSelectionChangeCallback; 76 cssu::Reference<css::frame::XController> mxController; 77 const sfx2::sidebar::EnumContext::Context meDefaultContext; 78 bool mbIsConnected; 79 }; 80 81 82 } } // end of namespace svx::sidebar 83 84 85 #endif 86