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 23 #ifndef CHART2_STATUSBARCOMMANDDISPATCH_HXX 24 #define CHART2_STATUSBARCOMMANDDISPATCH_HXX 25 26 #include "CommandDispatch.hxx" 27 #include "ObjectIdentifier.hxx" 28 #include <cppuhelper/implbase1.hxx> 29 #include <com/sun/star/frame/XModel.hpp> 30 #include <com/sun/star/view/XSelectionSupplier.hpp> 31 #include <com/sun/star/util/XModifiable.hpp> 32 33 namespace chart 34 { 35 36 /** This is a CommandDispatch implementation for all commands the status bar offers 37 38 This class reads the information needed from the XModel passed here. 39 */ 40 41 namespace impl 42 { 43 typedef ::cppu::ImplInheritanceHelper1< 44 CommandDispatch, 45 ::com::sun::star::view::XSelectionChangeListener > 46 StatusBarCommandDispatch_Base; 47 } 48 49 class StatusBarCommandDispatch : public impl::StatusBarCommandDispatch_Base 50 { 51 public: 52 explicit StatusBarCommandDispatch( 53 const ::com::sun::star::uno::Reference< 54 ::com::sun::star::uno::XComponentContext > & xContext, 55 const ::com::sun::star::uno::Reference< 56 ::com::sun::star::frame::XModel > & xModel, 57 const ::com::sun::star::uno::Reference< 58 ::com::sun::star::view::XSelectionSupplier > & xSelSupp ); 59 virtual ~StatusBarCommandDispatch(); 60 61 // late initialisation, especially for adding as listener 62 virtual void initialize(); 63 64 protected: 65 // ____ XDispatch ____ 66 virtual void SAL_CALL dispatch( 67 const ::com::sun::star::util::URL& URL, 68 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ); 69 70 // ____ WeakComponentImplHelperBase ____ 71 /// is called when this is disposed 72 virtual void SAL_CALL disposing(); 73 74 // ____ XModifyListener (override from CommandDispatch) ____ 75 virtual void SAL_CALL modified( 76 const ::com::sun::star::lang::EventObject& aEvent ); 77 78 // ____ XEventListener (base of XModifyListener) ____ 79 virtual void SAL_CALL disposing( 80 const ::com::sun::star::lang::EventObject& Source ); 81 82 virtual void fireStatusEvent( 83 const ::rtl::OUString & rURL, 84 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener ); 85 86 // ____ XSelectionChangeListener ____ 87 virtual void SAL_CALL selectionChanged( 88 const ::com::sun::star::lang::EventObject& aEvent ); 89 90 private: 91 ::com::sun::star::uno::Reference< 92 ::com::sun::star::util::XModifiable > m_xModifiable; 93 ::com::sun::star::uno::Reference< 94 ::com::sun::star::view::XSelectionSupplier > m_xSelectionSupplier; 95 bool m_bIsModified; 96 ObjectIdentifier m_aSelectedOID; 97 }; 98 99 } // namespace chart 100 101 // CHART2_STATUSBARCOMMANDDISPATCH_HXX 102 #endif 103