Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sfx2/source/appl/helpdispatch.cxx
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
20
21
#include "helpdispatch.hxx"
22
#include "newhelp.hxx"
23
#include <tools/debug.hxx>
24
#include <utility>
25
26
using namespace ::com::sun::star::beans;
27
using namespace ::com::sun::star::frame;
28
using namespace ::com::sun::star::uno;
29
using namespace ::com::sun::star::util;
30
31
// class HelpInterceptor_Impl --------------------------------------------
32
33
HelpDispatch_Impl::HelpDispatch_Impl( HelpInterceptor_Impl& _rInterceptor,
34
                                      css::uno::Reference< css::frame::XDispatch > _xDisp ) :
35
36
0
    m_rInterceptor  ( _rInterceptor ),
37
0
    m_xRealDispatch (std::move( _xDisp ))
38
39
0
{
40
0
}
41
42
43
HelpDispatch_Impl::~HelpDispatch_Impl()
44
0
{
45
0
}
46
47
48
// XDispatch
49
50
void SAL_CALL HelpDispatch_Impl::dispatch(
51
52
    const URL& aURL, const Sequence< PropertyValue >& aArgs )
53
54
0
{
55
0
    DBG_ASSERT( m_xRealDispatch.is(), "invalid dispatch" );
56
57
    // search for a keyword (dispatch from the basic ide)
58
0
    bool bHasKeyword = false;
59
0
    OUString sKeyword;
60
0
    for ( const PropertyValue& rArg : aArgs )
61
0
    {
62
0
        if ( rArg.Name == "HelpKeyword" )
63
0
        {
64
0
            OUString sHelpKeyword;
65
0
            if ( ( rArg.Value >>= sHelpKeyword ) && !sHelpKeyword.isEmpty() )
66
0
            {
67
0
                sKeyword = sHelpKeyword;
68
0
                bHasKeyword = !sKeyword.isEmpty();
69
0
                break;
70
0
            }
71
0
        }
72
0
    }
73
74
    // if a keyword was found, then open it
75
0
    SfxHelpWindow_Impl* pHelpWin = m_rInterceptor.GetHelpWindow();
76
0
    DBG_ASSERT( pHelpWin, "invalid HelpWindow" );
77
0
    if ( bHasKeyword )
78
0
    {
79
0
        pHelpWin->OpenKeyword( sKeyword );
80
0
        return;
81
0
    }
82
83
0
    pHelpWin->loadHelpContent(aURL.Complete);
84
0
}
85
86
87
void SAL_CALL HelpDispatch_Impl::addStatusListener(
88
89
    const Reference< XStatusListener >& xControl, const URL& aURL )
90
91
0
{
92
0
    DBG_ASSERT( m_xRealDispatch.is(), "invalid dispatch" );
93
0
    m_xRealDispatch->addStatusListener( xControl, aURL );
94
0
}
95
96
97
void SAL_CALL HelpDispatch_Impl::removeStatusListener(
98
99
    const Reference< XStatusListener >& xControl, const URL& aURL )
100
101
0
{
102
0
    DBG_ASSERT( m_xRealDispatch.is(), "invalid dispatch" );
103
0
    m_xRealDispatch->removeStatusListener( xControl, aURL );
104
0
}
105
106
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */