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