diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-11-23 09:14:32 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-11-24 15:41:30 +0100 |
commit | 4be36ad16cf8c43c343b8ff3bfc3f58556b00f7f (patch) | |
tree | 987666f6b75ed68eec116c85e1c371bdd0f2252a /sfx2 | |
parent | 5b624ddf5c6c60111194961b06cfed7f5274b23d (diff) |
weld SfxMacroTabPage
Change-Id: I167dd233c8af64e31f0e266bac5cf5b9c4658ca6
Reviewed-on: https://gerrit.libreoffice.org/63893
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit f27bfc190d4105b9d057980a5e6f0eac07f88aba)
Reviewed-on: https://gerrit.libreoffice.org/63915
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/sfxhelp.cxx | 43 | ||||
-rw-r--r-- | sfx2/source/dialog/filedlghelper.cxx | 2 |
2 files changed, 44 insertions, 1 deletions
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 19d08453f1d7..3651e9425c96 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -634,6 +634,49 @@ OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const vcl::Window* p return sHelpText; } +OUString SfxHelp::GetHelpText(const OUString& aCommandURL, const weld::Widget* pWidget) +{ + OUString sModuleName = GetHelpModuleName_Impl(aCommandURL); + OUString sRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( aCommandURL, getCurrentModuleIdentifier_Impl() ); + OUString sHelpText = SfxHelp_Impl::GetHelpText( sRealCommand.isEmpty() ? aCommandURL : sRealCommand, sModuleName ); + + OString aNewHelpId; + + if (pWidget && sHelpText.isEmpty()) + { + // no help text found -> try with parent help id. + std::unique_ptr<weld::Widget> xParent(pWidget->weld_parent()); + while (xParent) + { + aNewHelpId = xParent->get_help_id(); + sHelpText = SfxHelp_Impl::GetHelpText( OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8), sModuleName ); + if (!sHelpText.isEmpty()) + xParent.reset(); + else + xParent.reset(xParent->weld_parent()); + } + + if (bIsDebug && sHelpText.isEmpty()) + aNewHelpId.clear(); + } + + // add some debug information? + if ( bIsDebug ) + { + sHelpText += "\n-------------\n"; + sHelpText += sModuleName; + sHelpText += ": "; + sHelpText += aCommandURL; + if ( !aNewHelpId.isEmpty() ) + { + sHelpText += " - "; + sHelpText += OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8); + } + } + + return sHelpText; +} + void SfxHelp::SearchKeyword( const OUString& rKeyword ) { Start_Impl(OUString(), static_cast<vcl::Window*>(nullptr), rKeyword); diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index d0e885c506fa..0e5a3610ee3e 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -276,7 +276,7 @@ OUString FileDialogHelper_Impl::handleHelpRequested( const FilePickerEvent& aEve OUString aHelpText; Help* pHelp = Application::GetHelp(); if ( pHelp ) - aHelpText = pHelp->GetHelpText( OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), nullptr ); + aHelpText = pHelp->GetHelpText(OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), static_cast<weld::Widget*>(nullptr)); return aHelpText; } |