1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
23 #include <com/sun/star/frame/XInterceptorInfo.hpp>
24 #include <com/sun/star/frame/XDispatch.hpp>
25 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
26 #include <com/sun/star/frame/XFrame.hpp>
27 #include <cppuhelper/implbase.hxx>
28 #include <com/sun/star/frame/XStatusListener.hpp>
29 #include <tools/link.hxx>
30 #include <vcl/vclptr.hxx>
31 #include "newhelp.hxx"
34 class SfxHelpWindow_Impl
;
35 class HelpInterceptor_Impl
: public ::cppu::WeakImplHelper
<
36 css::frame::XDispatchProviderInterceptor
,
37 css::frame::XInterceptorInfo
,
38 css::frame::XDispatch
>
42 friend class HelpDispatch_Impl
;
43 friend class SfxHelpWindow_Impl
;
45 // the component which's dispatches we're intercepting
46 css::uno::Reference
< css::frame::XDispatchProviderInterception
> m_xIntercepted
;
49 css::uno::Reference
< css::frame::XDispatchProvider
> m_xSlaveDispatcher
;
50 css::uno::Reference
< css::frame::XDispatchProvider
> m_xMasterDispatcher
;
52 css::uno::Reference
< css::frame::XStatusListener
> m_xListener
;
54 std::vector
<OUString
> m_vHistoryUrls
;
55 VclPtr
<SfxHelpWindow_Impl
> m_pWindow
;
57 OUString m_aCurrentURL
;
59 void addURL( const OUString
& rURL
);
62 HelpInterceptor_Impl();
63 virtual ~HelpInterceptor_Impl() override
;
65 void setInterception( const css::uno::Reference
< css::frame::XFrame
>& xFrame
);
66 const OUString
& GetCurrentURL() const { return m_aCurrentURL
; }
68 bool HasHistoryPred() const; // is there a predecessor for the current in the history
69 bool HasHistorySucc() const; // is there a successor for the current in the history
72 virtual css::uno::Reference
< css::frame::XDispatch
> SAL_CALL
73 queryDispatch( const css::util::URL
& aURL
, const OUString
& aTargetFrameName
, sal_Int32 nSearchFlags
) override
;
74 virtual css::uno::Sequence
< css::uno::Reference
< css::frame::XDispatch
> > SAL_CALL
75 queryDispatches( const css::uno::Sequence
< css::frame::DispatchDescriptor
>& aDescripts
) override
;
77 // XDispatchProviderInterceptor
78 virtual css::uno::Reference
< css::frame::XDispatchProvider
> SAL_CALL
79 getSlaveDispatchProvider( ) override
;
80 virtual void SAL_CALL
setSlaveDispatchProvider( const css::uno::Reference
< css::frame::XDispatchProvider
>& xNewSlave
) override
;
81 virtual css::uno::Reference
< css::frame::XDispatchProvider
> SAL_CALL
82 getMasterDispatchProvider( ) override
;
83 virtual void SAL_CALL
setMasterDispatchProvider( const css::uno::Reference
< css::frame::XDispatchProvider
>& xNewMaster
) override
;
86 virtual css::uno::Sequence
< OUString
> SAL_CALL
87 getInterceptedURLs( ) override
;
90 virtual void SAL_CALL
dispatch( const css::util::URL
& aURL
, const css::uno::Sequence
< css::beans::PropertyValue
>& aArgs
) override
;
91 virtual void SAL_CALL
addStatusListener( const css::uno::Reference
< css::frame::XStatusListener
>& xControl
, const css::util::URL
& aURL
) override
;
92 virtual void SAL_CALL
removeStatusListener( const css::uno::Reference
< css::frame::XStatusListener
>& xControl
, const css::util::URL
& aURL
) override
;
95 void InitWaiter( SfxHelpWindow_Impl
* pWindow
)
96 { m_pWindow
= pWindow
; }
97 SfxHelpWindow_Impl
* GetHelpWindow() const { return m_pWindow
; }
100 // HelpListener_Impl -----------------------------------------------------
102 class HelpListener_Impl
: public ::cppu::WeakImplHelper
< css::frame::XStatusListener
>
105 HelpInterceptor_Impl
* pInterceptor
;
106 Link
<HelpListener_Impl
&,void> aChangeLink
;
110 explicit HelpListener_Impl( HelpInterceptor_Impl
* pInter
);
112 virtual void SAL_CALL
statusChanged( const css::frame::FeatureStateEvent
& Event
) override
;
113 virtual void SAL_CALL
disposing( const css::lang::EventObject
& obj
) override
;
115 void SetChangeHdl( const Link
<HelpListener_Impl
&,void>& rLink
) { aChangeLink
= rLink
; }
116 const OUString
& GetFactory() const { return aFactory
; }
118 // HelpStatusListener_Impl -----------------------------------------------------
120 class HelpStatusListener_Impl
: public cppu::WeakImplHelper
< css::frame::XStatusListener
>
123 css::uno::Reference
< css::frame::XDispatch
> xDispatch
;
124 css::frame::FeatureStateEvent aStateEvent
;
127 HelpStatusListener_Impl(
128 css::uno::Reference
< css::frame::XDispatch
> const & xDispatch
,
129 css::util::URL
const & rURL
);
130 virtual ~HelpStatusListener_Impl() override
;
132 virtual void SAL_CALL
statusChanged( const css::frame::FeatureStateEvent
& Event
) override
;
133 virtual void SAL_CALL
disposing( const css::lang::EventObject
& obj
) override
;
134 const css::frame::FeatureStateEvent
&
135 GetStateEvent() const {return aStateEvent
;}
139 #endif // INCLUDED_SFX2_SOURCE_APPL_HELPINTERCEPTOR_HXX
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */