Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sfx2/source/appl/helpinterceptor.hxx
Line
Count
Source
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>
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"
32
#include <vector>
33
34
class HelpInterceptor_Impl : public ::cppu::WeakImplHelper<
35
        css::frame::XDispatchProviderInterceptor,
36
        css::frame::XInterceptorInfo,
37
        css::frame::XDispatch >
38
39
{
40
private:
41
friend class HelpDispatch_Impl;
42
friend class SfxHelpWindow_Impl;
43
44
    // the component which's dispatches we're intercepting
45
    css::uno::Reference< css::frame::XDispatchProviderInterception > m_xIntercepted;
46
47
    // chaining
48
    css::uno::Reference< css::frame::XDispatchProvider > m_xSlaveDispatcher;
49
    css::uno::Reference< css::frame::XDispatchProvider > m_xMasterDispatcher;
50
51
    css::uno::Reference< css::frame::XStatusListener > m_xListener;
52
53
    std::vector<OUString>       m_vHistoryUrls;
54
    VclPtr<SfxHelpWindow_Impl>  m_pWindow;
55
    size_t                      m_nCurPos;
56
    OUString                    m_aCurrentURL;
57
58
    void                        addURL( const OUString& rURL );
59
60
public:
61
    HelpInterceptor_Impl();
62
    virtual ~HelpInterceptor_Impl() override;
63
64
    void                    setInterception( const css::uno::Reference< css::frame::XFrame >& xFrame );
65
0
    const OUString&         GetCurrentURL() const { return m_aCurrentURL; }
66
67
    bool                HasHistoryPred() const;     // is there a predecessor for the current in the history
68
    bool                HasHistorySucc() const;     // is there a successor for the current in the history
69
70
    // XDispatchProvider
71
    virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL
72
                            queryDispatch( const css::util::URL& aURL, const OUString& aTargetFrameName, sal_Int32 nSearchFlags ) override;
73
    virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL
74
                            queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& aDescripts ) override;
75
76
    // XDispatchProviderInterceptor
77
    virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL
78
                            getSlaveDispatchProvider(  ) override;
79
    virtual void SAL_CALL   setSlaveDispatchProvider( const css::uno::Reference< css::frame::XDispatchProvider >& xNewSlave ) override;
80
    virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL
81
                            getMasterDispatchProvider(  ) override;
82
    virtual void SAL_CALL   setMasterDispatchProvider( const css::uno::Reference< css::frame::XDispatchProvider >& xNewMaster ) override;
83
84
    // XInterceptorInfo
85
    virtual css::uno::Sequence< OUString > SAL_CALL
86
                            getInterceptedURLs(  ) override;
87
88
    // XDispatch
89
    virtual void SAL_CALL   dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& aArgs ) override;
90
    virtual void SAL_CALL   addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) override;
91
    virtual void SAL_CALL   removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) override;
92
93
    // extras
94
    void                    InitWaiter( SfxHelpWindow_Impl* pWindow )
95
0
                                { m_pWindow = pWindow; }
96
0
    SfxHelpWindow_Impl*     GetHelpWindow() const { return m_pWindow; }
97
};
98
99
// HelpListener_Impl -----------------------------------------------------
100
101
class HelpListener_Impl : public ::cppu::WeakImplHelper< css::frame::XStatusListener >
102
{
103
private:
104
    HelpInterceptor_Impl*   pInterceptor;
105
    Link<HelpListener_Impl&,void> aChangeLink;
106
    OUString                aFactory;
107
108
public:
109
    explicit HelpListener_Impl( HelpInterceptor_Impl* pInter );
110
111
    virtual void SAL_CALL   statusChanged( const css::frame::FeatureStateEvent& Event ) override;
112
    virtual void SAL_CALL   disposing( const css::lang::EventObject& obj ) override;
113
114
0
    void                    SetChangeHdl( const Link<HelpListener_Impl&,void>& rLink ) { aChangeLink = rLink; }
115
0
    const OUString&         GetFactory() const { return aFactory; }
116
};
117
// HelpStatusListener_Impl -----------------------------------------------------
118
119
class HelpStatusListener_Impl : public cppu::WeakImplHelper< css::frame::XStatusListener >
120
{
121
private:
122
    css::uno::Reference < css::frame::XDispatch > xDispatch;
123
    css::frame::FeatureStateEvent                 aStateEvent;
124
125
public:
126
    HelpStatusListener_Impl(
127
        css::uno::Reference < css::frame::XDispatch > const & xDispatch,
128
        css::util::URL const & rURL);
129
    virtual ~HelpStatusListener_Impl() override;
130
131
    virtual void SAL_CALL   statusChanged( const css::frame::FeatureStateEvent& Event ) override;
132
    virtual void SAL_CALL   disposing( const css::lang::EventObject& obj ) override;
133
    const css::frame::FeatureStateEvent&
134
0
                            GetStateEvent() const {return aStateEvent;}
135
};
136
137
138
#endif // INCLUDED_SFX2_SOURCE_APPL_HELPINTERCEPTOR_HXX
139
140
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */