LibreOffice Module sfx2 (master) 1
helpinterceptor.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#ifndef INCLUDED_SFX2_SOURCE_APPL_HELPINTERCEPTOR_HXX
20#define INCLUDED_SFX2_SOURCE_APPL_HELPINTERCEPTOR_HXX
21
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>
28#include <com/sun/star/frame/XStatusListener.hpp>
29#include <tools/link.hxx>
30#include <vcl/vclptr.hxx>
31#include "newhelp.hxx"
32#include <vector>
33
35class HelpInterceptor_Impl : public ::cppu::WeakImplHelper<
36 css::frame::XDispatchProviderInterceptor,
37 css::frame::XInterceptorInfo,
38 css::frame::XDispatch >
39
40{
41private:
42friend class HelpDispatch_Impl;
43friend class SfxHelpWindow_Impl;
44
45 // the component which's dispatches we're intercepting
46 css::uno::Reference< css::frame::XDispatchProviderInterception > m_xIntercepted;
47
48 // chaining
49 css::uno::Reference< css::frame::XDispatchProvider > m_xSlaveDispatcher;
50 css::uno::Reference< css::frame::XDispatchProvider > m_xMasterDispatcher;
51
52 css::uno::Reference< css::frame::XStatusListener > m_xListener;
53
54 std::vector<OUString> m_vHistoryUrls;
56 size_t m_nCurPos;
57 OUString m_aCurrentURL;
58
59 void addURL( const OUString& rURL );
60
61public:
63 virtual ~HelpInterceptor_Impl() override;
64
65 void setInterception( const css::uno::Reference< css::frame::XFrame >& xFrame );
66 const OUString& GetCurrentURL() const { return m_aCurrentURL; }
67
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
70
71 // XDispatchProvider
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;
76
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;
84
85 // XInterceptorInfo
86 virtual css::uno::Sequence< OUString > SAL_CALL
87 getInterceptedURLs( ) override;
88
89 // XDispatch
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;
93
94 // extras
96 { m_pWindow = pWindow; }
98};
99
100// HelpListener_Impl -----------------------------------------------------
101
102class HelpListener_Impl : public ::cppu::WeakImplHelper< css::frame::XStatusListener >
103{
104private:
107 OUString aFactory;
108
109public:
110 explicit HelpListener_Impl( HelpInterceptor_Impl* pInter );
111
112 virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override;
113 virtual void SAL_CALL disposing( const css::lang::EventObject& obj ) override;
114
116 const OUString& GetFactory() const { return aFactory; }
117};
118// HelpStatusListener_Impl -----------------------------------------------------
119
120class HelpStatusListener_Impl : public cppu::WeakImplHelper< css::frame::XStatusListener >
121{
122private:
123 css::uno::Reference < css::frame::XDispatch > xDispatch;
124 css::frame::FeatureStateEvent aStateEvent;
125
126public:
128 css::uno::Reference < css::frame::XDispatch > const & xDispatch,
129 css::util::URL const & rURL);
130 virtual ~HelpStatusListener_Impl() override;
131
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;}
136};
137
138
139#endif // INCLUDED_SFX2_SOURCE_APPL_HELPINTERCEPTOR_HXX
140
141/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxHelpWindow_Impl * GetHelpWindow() const
virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(const css::util::URL &aURL, const OUString &aTargetFrameName, sal_Int32 nSearchFlags) override
virtual void SAL_CALL dispatch(const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &aArgs) override
css::uno::Reference< css::frame::XDispatchProvider > m_xSlaveDispatcher
void setInterception(const css::uno::Reference< css::frame::XFrame > &xFrame)
virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener > &xControl, const css::util::URL &aURL) override
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches(const css::uno::Sequence< css::frame::DispatchDescriptor > &aDescripts) override
virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener > &xControl, const css::util::URL &aURL) override
virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider() override
css::uno::Reference< css::frame::XStatusListener > m_xListener
virtual css::uno::Sequence< OUString > SAL_CALL getInterceptedURLs() override
css::uno::Reference< css::frame::XDispatchProviderInterception > m_xIntercepted
VclPtr< SfxHelpWindow_Impl > m_pWindow
std::vector< OUString > m_vHistoryUrls
void addURL(const OUString &rURL)
virtual void SAL_CALL setMasterDispatchProvider(const css::uno::Reference< css::frame::XDispatchProvider > &xNewMaster) override
bool HasHistorySucc() const
const OUString & GetCurrentURL() const
virtual void SAL_CALL setSlaveDispatchProvider(const css::uno::Reference< css::frame::XDispatchProvider > &xNewSlave) override
virtual ~HelpInterceptor_Impl() override
virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider() override
bool HasHistoryPred() const
void InitWaiter(SfxHelpWindow_Impl *pWindow)
css::uno::Reference< css::frame::XDispatchProvider > m_xMasterDispatcher
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &Event) override
HelpInterceptor_Impl * pInterceptor
virtual void SAL_CALL disposing(const css::lang::EventObject &obj) override
Link< HelpListener_Impl &, void > aChangeLink
const OUString & GetFactory() const
void SetChangeHdl(const Link< HelpListener_Impl &, void > &rLink)
HelpListener_Impl(HelpInterceptor_Impl *pInter)
css::uno::Reference< css::frame::XDispatch > xDispatch
virtual void SAL_CALL disposing(const css::lang::EventObject &obj) override
css::frame::FeatureStateEvent aStateEvent
const css::frame::FeatureStateEvent & GetStateEvent() const
virtual ~HelpStatusListener_Impl() override
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &Event) override
HelpStatusListener_Impl(css::uno::Reference< css::frame::XDispatch > const &xDispatch, css::util::URL const &rURL)
css::uno::Reference< css::frame::XFrame2 > xFrame
Definition: newhelp.hxx:428