1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef INCLUDED_SFX_HELPINTERCEPTOR_HXX 28*cdf0e10cSrcweir #define INCLUDED_SFX_HELPINTERCEPTOR_HXX 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #ifndef _CPPUHELPER_IMPLBASE2_HXX_ 31*cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx> 32*cdf0e10cSrcweir #endif 33*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/frame/XInterceptorInfo.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProviderInterception.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp> 38*cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 39*cdf0e10cSrcweir #include <com/sun/star/frame/XStatusListener.hpp> 40*cdf0e10cSrcweir #include <tools/string.hxx> 41*cdf0e10cSrcweir #include <tools/list.hxx> 42*cdf0e10cSrcweir #include <tools/link.hxx> 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir struct HelpHistoryEntry_Impl 45*cdf0e10cSrcweir { 46*cdf0e10cSrcweir String aURL; 47*cdf0e10cSrcweir com::sun::star::uno::Any aViewData; 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir HelpHistoryEntry_Impl( const String& rURL, const com::sun::star::uno::Any& rViewData ) : 50*cdf0e10cSrcweir aURL( rURL ), aViewData(rViewData) {} 51*cdf0e10cSrcweir }; 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir DECLARE_LIST(HelpHistoryList_Impl,HelpHistoryEntry_Impl*) 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir class SfxHelpWindow_Impl; 56*cdf0e10cSrcweir class HelpInterceptor_Impl : public ::cppu::WeakImplHelper3< 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir ::com::sun::star::frame::XDispatchProviderInterceptor, 59*cdf0e10cSrcweir ::com::sun::star::frame::XInterceptorInfo, 60*cdf0e10cSrcweir ::com::sun::star::frame::XDispatch > 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir { 63*cdf0e10cSrcweir private: 64*cdf0e10cSrcweir friend class HelpDispatch_Impl; 65*cdf0e10cSrcweir friend class SfxHelpWindow_Impl; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir // the component which's dispatches we're intercepting 68*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception > m_xIntercepted; 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir // chaining 71*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xSlaveDispatcher; 72*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xMasterDispatcher; 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > m_xListener; 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir HelpHistoryList_Impl* m_pHistory; 77*cdf0e10cSrcweir SfxHelpWindow_Impl* m_pWindow; 78*cdf0e10cSrcweir sal_uIntPtr m_nCurPos; 79*cdf0e10cSrcweir String m_aCurrentURL; 80*cdf0e10cSrcweir com::sun::star::uno::Any m_aViewData; 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir void addURL( const String& rURL ); 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir public: 85*cdf0e10cSrcweir HelpInterceptor_Impl(); 86*cdf0e10cSrcweir ~HelpInterceptor_Impl(); 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir void setInterception( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame ); 89*cdf0e10cSrcweir void SetStartURL( const String& rURL ); 90*cdf0e10cSrcweir String GetCurrentURL() const { return m_aCurrentURL; } 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir const com::sun::star::uno::Any& GetViewData()const {return m_aViewData;} 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir sal_Bool HasHistoryPred() const; // is there a predecessor for the current in the history 97*cdf0e10cSrcweir sal_Bool HasHistorySucc() const; // is there a successor for the current in the history 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir // XDispatchProvider 100*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL 101*cdf0e10cSrcweir queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw(::com::sun::star::uno::RuntimeException); 102*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL 103*cdf0e10cSrcweir queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) throw(::com::sun::star::uno::RuntimeException); 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir // XDispatchProviderInterceptor 106*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL 107*cdf0e10cSrcweir getSlaveDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException); 108*cdf0e10cSrcweir virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSlave ) throw(::com::sun::star::uno::RuntimeException); 109*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL 110*cdf0e10cSrcweir getMasterDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException); 111*cdf0e10cSrcweir virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewMaster ) throw(::com::sun::star::uno::RuntimeException); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir // XInterceptorInfo 114*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 115*cdf0e10cSrcweir getInterceptedURLs( ) throw(::com::sun::star::uno::RuntimeException); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir // XDispatch 118*cdf0e10cSrcweir virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw(::com::sun::star::uno::RuntimeException); 119*cdf0e10cSrcweir virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw(::com::sun::star::uno::RuntimeException); 120*cdf0e10cSrcweir virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw(::com::sun::star::uno::RuntimeException); 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir // extras 123*cdf0e10cSrcweir void InitWaiter( SfxHelpWindow_Impl* pWindow ) 124*cdf0e10cSrcweir { m_pWindow = pWindow; } 125*cdf0e10cSrcweir SfxHelpWindow_Impl* GetHelpWindow() const { return m_pWindow; } 126*cdf0e10cSrcweir }; 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir // HelpListener_Impl ----------------------------------------------------- 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir class HelpListener_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XStatusListener > 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir private: 133*cdf0e10cSrcweir HelpInterceptor_Impl* pInterceptor; 134*cdf0e10cSrcweir Link aChangeLink; 135*cdf0e10cSrcweir String aFactory; 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir public: 138*cdf0e10cSrcweir HelpListener_Impl( HelpInterceptor_Impl* pInter ); 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) 141*cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 142*cdf0e10cSrcweir virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& obj ) 143*cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir void SetChangeHdl( const Link& rLink ) { aChangeLink = rLink; } 146*cdf0e10cSrcweir String GetFactory() const { return aFactory; } 147*cdf0e10cSrcweir }; 148*cdf0e10cSrcweir // HelpStatusListener_Impl ----------------------------------------------------- 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir class HelpStatusListener_Impl : public 151*cdf0e10cSrcweir ::cppu::WeakImplHelper1< ::com::sun::star::frame::XStatusListener > 152*cdf0e10cSrcweir { 153*cdf0e10cSrcweir private: 154*cdf0e10cSrcweir ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > xDispatch; 155*cdf0e10cSrcweir ::com::sun::star::frame::FeatureStateEvent aStateEvent; 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir public: 158*cdf0e10cSrcweir HelpStatusListener_Impl( 159*cdf0e10cSrcweir ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > xDispatch, 160*cdf0e10cSrcweir com::sun::star::util::URL& rURL); 161*cdf0e10cSrcweir ~HelpStatusListener_Impl(); 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) 164*cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 165*cdf0e10cSrcweir virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& obj ) 166*cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 167*cdf0e10cSrcweir const ::com::sun::star::frame::FeatureStateEvent& 168*cdf0e10cSrcweir GetStateEvent() const {return aStateEvent;} 169*cdf0e10cSrcweir }; 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir #endif // #ifndef INCLUDED_SFX_HELPINTERCEPTOR_HXX 173*cdf0e10cSrcweir 174