summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-02-18 13:50:15 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-02-18 18:20:26 +0100
commit77a0cb2839c7770346bf97a273a36715a6cc0be4 (patch)
tree4186d21afbc8cc37df9e53ee220daa10fb3707bd /sfx2
parent051d0ccc16954ec423f91ac148e34ce3bff7aca4 (diff)
Resolves: tdf#122355 search help for active notebook page
before checking for the dialog, to get more specific help results. Change-Id: I2d6128fa39d3f7ebf15e194354307dd924590009 Reviewed-on: https://gerrit.libreoffice.org/67973 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/sfxhelp.cxx34
1 files changed, 15 insertions, 19 deletions
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index ce484741909d..80d521b39a47 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -1231,26 +1231,22 @@ bool SfxHelp::Start_Impl(const OUString& rURL, weld::Widget* pWidget, const OUSt
if ( impl_hasHelpInstalled() && pWidget && SfxContentHelper::IsHelpErrorDocument( aHelpURL ) )
{
- // no help found -> try with parent help id.
- std::unique_ptr<weld::Widget> xParent(pWidget->weld_parent());
- while (xParent)
+ bool bUseFinalFallback = true;
+ // no help found -> try ids of parents.
+ pWidget->help_hierarchy_foreach([&aHelpModuleName, &aHelpURL, &bUseFinalFallback](const OString& rHelpId){
+ if (rHelpId.isEmpty())
+ return false;
+ aHelpURL = CreateHelpURL( OStringToOUString(rHelpId, RTL_TEXTENCODING_UTF8), aHelpModuleName);
+ bool bFinished = !SfxContentHelper::IsHelpErrorDocument(aHelpURL);
+ if (bFinished)
+ bUseFinalFallback = false;
+ return bFinished;
+ });
+
+ if (bUseFinalFallback)
{
- OString aHelpId = xParent->get_help_id();
- aHelpURL = CreateHelpURL( OStringToOUString(aHelpId, RTL_TEXTENCODING_UTF8), aHelpModuleName );
-
- if ( !SfxContentHelper::IsHelpErrorDocument( aHelpURL ) )
- {
- break;
- }
- else
- {
- xParent.reset(xParent->weld_parent());
- if (!xParent)
- {
- // create help url of start page ( helpid == 0 -> start page)
- aHelpURL = CreateHelpURL( OUString(), aHelpModuleName );
- }
- }
+ // create help url of start page ( helpid == 0 -> start page)
+ aHelpURL = CreateHelpURL( OUString(), aHelpModuleName );
}
}
break;