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 .
21 #include "helpdispatch.hxx"
22 #include "newhelp.hxx"
23 #include <tools/debug.hxx>
25 using namespace ::com::sun::star::beans
;
26 using namespace ::com::sun::star::frame
;
27 using namespace ::com::sun::star::uno
;
28 using namespace ::com::sun::star::util
;
30 // class HelpInterceptor_Impl --------------------------------------------
32 HelpDispatch_Impl::HelpDispatch_Impl( HelpInterceptor_Impl
& _rInterceptor
,
33 const css::uno::Reference
< css::frame::XDispatch
>& _xDisp
) :
35 m_rInterceptor ( _rInterceptor
),
36 m_xRealDispatch ( _xDisp
)
42 HelpDispatch_Impl::~HelpDispatch_Impl()
49 void SAL_CALL
HelpDispatch_Impl::dispatch(
51 const URL
& aURL
, const Sequence
< PropertyValue
>& aArgs
)
54 DBG_ASSERT( m_xRealDispatch
.is(), "invalid dispatch" );
56 // search for a keyword (dispatch from the basic ide)
57 bool bHasKeyword
= false;
59 for ( const PropertyValue
& rArg
: aArgs
)
61 if ( rArg
.Name
== "HelpKeyword" )
63 OUString sHelpKeyword
;
64 if ( ( rArg
.Value
>>= sHelpKeyword
) && !sHelpKeyword
.isEmpty() )
66 sKeyword
= sHelpKeyword
;
67 bHasKeyword
= !sKeyword
.isEmpty();
73 // if a keyword was found, then open it
74 SfxHelpWindow_Impl
* pHelpWin
= m_rInterceptor
.GetHelpWindow();
75 DBG_ASSERT( pHelpWin
, "invalid HelpWindow" );
78 pHelpWin
->OpenKeyword( sKeyword
);
82 pHelpWin
->loadHelpContent(aURL
.Complete
);
86 void SAL_CALL
HelpDispatch_Impl::addStatusListener(
88 const Reference
< XStatusListener
>& xControl
, const URL
& aURL
)
91 DBG_ASSERT( m_xRealDispatch
.is(), "invalid dispatch" );
92 m_xRealDispatch
->addStatusListener( xControl
, aURL
);
96 void SAL_CALL
HelpDispatch_Impl::removeStatusListener(
98 const Reference
< XStatusListener
>& xControl
, const URL
& aURL
)
101 DBG_ASSERT( m_xRealDispatch
.is(), "invalid dispatch" );
102 m_xRealDispatch
->removeStatusListener( xControl
, aURL
);
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */