1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef SC_DISPUNO_HXX 29 #define SC_DISPUNO_HXX 30 31 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> 32 #include <com/sun/star/view/XSelectionChangeListener.hpp> 33 #include <cppuhelper/implbase2.hxx> 34 #include <svl/lstner.hxx> 35 #include <svl/svarray.hxx> 36 #include "global.hxx" // ScImportParam 37 38 39 namespace com { namespace sun { namespace star { namespace frame { 40 class XDispatchProviderInterception; 41 } } } } 42 43 class ScTabViewShell; 44 45 46 typedef ::com::sun::star::uno::Reference< 47 ::com::sun::star::frame::XStatusListener >* XStatusListenerPtr; 48 SV_DECL_PTRARR_DEL( XStatusListenerArr_Impl, XStatusListenerPtr, 4, 4 ) 49 50 51 class ScDispatchProviderInterceptor : public cppu::WeakImplHelper2< 52 com::sun::star::frame::XDispatchProviderInterceptor, 53 com::sun::star::lang::XEventListener>, 54 public SfxListener 55 { 56 ScTabViewShell* pViewShell; 57 58 // the component which's dispatches we're intercepting 59 ::com::sun::star::uno::Reference< 60 ::com::sun::star::frame::XDispatchProviderInterception> m_xIntercepted; 61 62 // chaining 63 ::com::sun::star::uno::Reference< 64 ::com::sun::star::frame::XDispatchProvider> m_xSlaveDispatcher; 65 ::com::sun::star::uno::Reference< 66 ::com::sun::star::frame::XDispatchProvider> m_xMasterDispatcher; 67 68 // own dispatch 69 ::com::sun::star::uno::Reference< 70 ::com::sun::star::frame::XDispatch> m_xMyDispatch; 71 72 public: 73 74 ScDispatchProviderInterceptor(ScTabViewShell* pViewSh); 75 virtual ~ScDispatchProviderInterceptor(); 76 77 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 78 79 // XDispatchProvider 80 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL 81 queryDispatch( const ::com::sun::star::util::URL& aURL, 82 const ::rtl::OUString& aTargetFrameName, 83 sal_Int32 nSearchFlags ) 84 throw(::com::sun::star::uno::RuntimeException); 85 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< 86 ::com::sun::star::frame::XDispatch > > SAL_CALL 87 queryDispatches( const ::com::sun::star::uno::Sequence< 88 ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) 89 throw(::com::sun::star::uno::RuntimeException); 90 91 // XDispatchProviderInterceptor 92 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL 93 getSlaveDispatchProvider() throw(::com::sun::star::uno::RuntimeException); 94 virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< 95 ::com::sun::star::frame::XDispatchProvider >& xNewDispatchProvider ) 96 throw(::com::sun::star::uno::RuntimeException); 97 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL 98 getMasterDispatchProvider() throw(::com::sun::star::uno::RuntimeException); 99 virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< 100 ::com::sun::star::frame::XDispatchProvider >& xNewSupplier ) 101 throw(::com::sun::star::uno::RuntimeException); 102 103 // XEventListener 104 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) 105 throw(::com::sun::star::uno::RuntimeException); 106 }; 107 108 109 class ScDispatch : public cppu::WeakImplHelper2< 110 com::sun::star::frame::XDispatch, 111 com::sun::star::view::XSelectionChangeListener >, 112 public SfxListener 113 { 114 ScTabViewShell* pViewShell; 115 XStatusListenerArr_Impl aDataSourceListeners; 116 ScImportParam aLastImport; 117 sal_Bool bListeningToView; 118 119 public: 120 121 ScDispatch(ScTabViewShell* pViewSh); 122 virtual ~ScDispatch(); 123 124 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 125 126 // XDispatch 127 virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, 128 const ::com::sun::star::uno::Sequence< 129 ::com::sun::star::beans::PropertyValue >& aArgs ) 130 throw(::com::sun::star::uno::RuntimeException); 131 virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< 132 ::com::sun::star::frame::XStatusListener >& xControl, 133 const ::com::sun::star::util::URL& aURL ) 134 throw(::com::sun::star::uno::RuntimeException); 135 virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< 136 ::com::sun::star::frame::XStatusListener >& xControl, 137 const ::com::sun::star::util::URL& aURL ) 138 throw(::com::sun::star::uno::RuntimeException); 139 140 // XSelectionChangeListener 141 virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) 142 throw (::com::sun::star::uno::RuntimeException); 143 144 // XEventListener 145 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) 146 throw (::com::sun::star::uno::RuntimeException); 147 }; 148 149 150 #endif 151 152