bump product version to 4.2.0.1
[LibreOffice.git] / sfx2 / source / appl / helpinterceptor.hxx
blob7b0ec31bb37b23af5483c774662b2cc2ae851054
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SFX2_SOURCE_APPL_HELPINTERCEPTOR_HXX
20 #define INCLUDED_SFX2_SOURCE_APPL_HELPINTERCEPTOR_HXX
22 #include <cppuhelper/implbase3.hxx>
23 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
24 #include <com/sun/star/frame/XInterceptorInfo.hpp>
25 #include <com/sun/star/frame/XDispatch.hpp>
26 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
27 #include <com/sun/star/frame/XFrame.hpp>
28 #include <cppuhelper/implbase1.hxx>
29 #include <com/sun/star/frame/XStatusListener.hpp>
30 #include <tools/link.hxx>
31 #include <vector>
33 struct HelpHistoryEntry_Impl
35 OUString aURL;
36 com::sun::star::uno::Any aViewData;
38 HelpHistoryEntry_Impl( const OUString& rURL, const com::sun::star::uno::Any& rViewData ) :
39 aURL( rURL ), aViewData(rViewData) {}
42 typedef ::std::vector< HelpHistoryEntry_Impl* > HelpHistoryList_Impl;
44 class SfxHelpWindow_Impl;
45 class HelpInterceptor_Impl : public ::cppu::WeakImplHelper3<
47 ::com::sun::star::frame::XDispatchProviderInterceptor,
48 ::com::sun::star::frame::XInterceptorInfo,
49 ::com::sun::star::frame::XDispatch >
52 private:
53 friend class HelpDispatch_Impl;
54 friend class SfxHelpWindow_Impl;
56 // the component which's dispatches we're intercepting
57 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception > m_xIntercepted;
59 // chaining
60 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xSlaveDispatcher;
61 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xMasterDispatcher;
63 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > m_xListener;
65 HelpHistoryList_Impl* m_pHistory;
66 SfxHelpWindow_Impl* m_pWindow;
67 sal_uIntPtr m_nCurPos;
68 OUString m_aCurrentURL;
69 com::sun::star::uno::Any m_aViewData;
71 void addURL( const OUString& rURL );
73 public:
74 HelpInterceptor_Impl();
75 ~HelpInterceptor_Impl();
77 void setInterception( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame );
78 OUString GetCurrentURL() const { return m_aCurrentURL; }
82 const com::sun::star::uno::Any& GetViewData()const {return m_aViewData;}
84 sal_Bool HasHistoryPred() const; // is there a predecessor for the current in the history
85 sal_Bool HasHistorySucc() const; // is there a successor for the current in the history
87 // XDispatchProvider
88 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL
89 queryDispatch( const ::com::sun::star::util::URL& aURL, const OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw(::com::sun::star::uno::RuntimeException);
90 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL
91 queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) throw(::com::sun::star::uno::RuntimeException);
93 // XDispatchProviderInterceptor
94 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL
95 getSlaveDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException);
96 virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSlave ) 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< ::com::sun::star::frame::XDispatchProvider >& xNewMaster ) throw(::com::sun::star::uno::RuntimeException);
101 // XInterceptorInfo
102 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
103 getInterceptedURLs( ) throw(::com::sun::star::uno::RuntimeException);
105 // XDispatch
106 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);
107 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);
108 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);
110 // extras
111 void InitWaiter( SfxHelpWindow_Impl* pWindow )
112 { m_pWindow = pWindow; }
113 SfxHelpWindow_Impl* GetHelpWindow() const { return m_pWindow; }
116 // HelpListener_Impl -----------------------------------------------------
118 class HelpListener_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XStatusListener >
120 private:
121 HelpInterceptor_Impl* pInterceptor;
122 Link aChangeLink;
123 OUString aFactory;
125 public:
126 HelpListener_Impl( HelpInterceptor_Impl* pInter );
128 virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event )
129 throw( ::com::sun::star::uno::RuntimeException );
130 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& obj )
131 throw( ::com::sun::star::uno::RuntimeException );
133 void SetChangeHdl( const Link& rLink ) { aChangeLink = rLink; }
134 OUString GetFactory() const { return aFactory; }
136 // HelpStatusListener_Impl -----------------------------------------------------
138 class HelpStatusListener_Impl : public
139 ::cppu::WeakImplHelper1< ::com::sun::star::frame::XStatusListener >
141 private:
142 ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > xDispatch;
143 ::com::sun::star::frame::FeatureStateEvent aStateEvent;
145 public:
146 HelpStatusListener_Impl(
147 ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > xDispatch,
148 com::sun::star::util::URL& rURL);
149 ~HelpStatusListener_Impl();
151 virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event )
152 throw( ::com::sun::star::uno::RuntimeException );
153 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& obj )
154 throw( ::com::sun::star::uno::RuntimeException );
155 const ::com::sun::star::frame::FeatureStateEvent&
156 GetStateEvent() const {return aStateEvent;}
160 #endif // INCLUDED_SFX2_SOURCE_APPL_HELPINTERCEPTOR_HXX
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */