Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / sfx2 / source / appl / helpinterceptor.hxx
blobf610d9d94fdef75ebf4ab0a8f8a3ad5adb224b0f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef INCLUDED_SFX_HELPINTERCEPTOR_HXX
29 #define INCLUDED_SFX_HELPINTERCEPTOR_HXX
31 #include <cppuhelper/implbase3.hxx>
32 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
33 #include <com/sun/star/frame/XInterceptorInfo.hpp>
34 #include <com/sun/star/frame/XDispatch.hpp>
35 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
36 #include <com/sun/star/frame/XFrame.hpp>
37 #include <cppuhelper/implbase1.hxx>
38 #include <com/sun/star/frame/XStatusListener.hpp>
39 #include <tools/string.hxx>
40 #include <tools/link.hxx>
41 #include <vector>
43 struct HelpHistoryEntry_Impl
45 String aURL;
46 com::sun::star::uno::Any aViewData;
48 HelpHistoryEntry_Impl( const String& rURL, const com::sun::star::uno::Any& rViewData ) :
49 aURL( rURL ), aViewData(rViewData) {}
52 typedef ::std::vector< HelpHistoryEntry_Impl* > HelpHistoryList_Impl;
54 class SfxHelpWindow_Impl;
55 class HelpInterceptor_Impl : public ::cppu::WeakImplHelper3<
57 ::com::sun::star::frame::XDispatchProviderInterceptor,
58 ::com::sun::star::frame::XInterceptorInfo,
59 ::com::sun::star::frame::XDispatch >
62 private:
63 friend class HelpDispatch_Impl;
64 friend class SfxHelpWindow_Impl;
66 // the component which's dispatches we're intercepting
67 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception > m_xIntercepted;
69 // chaining
70 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xSlaveDispatcher;
71 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xMasterDispatcher;
73 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > m_xListener;
75 HelpHistoryList_Impl* m_pHistory;
76 SfxHelpWindow_Impl* m_pWindow;
77 sal_uIntPtr m_nCurPos;
78 String m_aCurrentURL;
79 com::sun::star::uno::Any m_aViewData;
81 void addURL( const String& rURL );
83 public:
84 HelpInterceptor_Impl();
85 ~HelpInterceptor_Impl();
87 void setInterception( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame );
88 String GetCurrentURL() const { return m_aCurrentURL; }
92 const com::sun::star::uno::Any& GetViewData()const {return m_aViewData;}
94 sal_Bool HasHistoryPred() const; // is there a predecessor for the current in the history
95 sal_Bool HasHistorySucc() const; // is there a successor for the current in the history
97 // XDispatchProvider
98 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL
99 queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw(::com::sun::star::uno::RuntimeException);
100 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL
101 queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) throw(::com::sun::star::uno::RuntimeException);
103 // XDispatchProviderInterceptor
104 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL
105 getSlaveDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException);
106 virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSlave ) throw(::com::sun::star::uno::RuntimeException);
107 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL
108 getMasterDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException);
109 virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewMaster ) throw(::com::sun::star::uno::RuntimeException);
111 // XInterceptorInfo
112 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
113 getInterceptedURLs( ) throw(::com::sun::star::uno::RuntimeException);
115 // XDispatch
116 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);
117 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);
118 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);
120 // extras
121 void InitWaiter( SfxHelpWindow_Impl* pWindow )
122 { m_pWindow = pWindow; }
123 SfxHelpWindow_Impl* GetHelpWindow() const { return m_pWindow; }
126 // HelpListener_Impl -----------------------------------------------------
128 class HelpListener_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XStatusListener >
130 private:
131 HelpInterceptor_Impl* pInterceptor;
132 Link aChangeLink;
133 String aFactory;
135 public:
136 HelpListener_Impl( HelpInterceptor_Impl* pInter );
138 virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event )
139 throw( ::com::sun::star::uno::RuntimeException );
140 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& obj )
141 throw( ::com::sun::star::uno::RuntimeException );
143 void SetChangeHdl( const Link& rLink ) { aChangeLink = rLink; }
144 String GetFactory() const { return aFactory; }
146 // HelpStatusListener_Impl -----------------------------------------------------
148 class HelpStatusListener_Impl : public
149 ::cppu::WeakImplHelper1< ::com::sun::star::frame::XStatusListener >
151 private:
152 ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > xDispatch;
153 ::com::sun::star::frame::FeatureStateEvent aStateEvent;
155 public:
156 HelpStatusListener_Impl(
157 ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > xDispatch,
158 com::sun::star::util::URL& rURL);
159 ~HelpStatusListener_Impl();
161 virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event )
162 throw( ::com::sun::star::uno::RuntimeException );
163 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& obj )
164 throw( ::com::sun::star::uno::RuntimeException );
165 const ::com::sun::star::frame::FeatureStateEvent&
166 GetStateEvent() const {return aStateEvent;}
170 #endif // #ifndef INCLUDED_SFX_HELPINTERCEPTOR_HXX
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */