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-23 21:28:16 +0100 |
commit | f27bfc190d4105b9d057980a5e6f0eac07f88aba (patch) | |
tree | 8d0fbaad824a09d86bd22294d72f551490c42313 /sfx2/source/appl | |
parent | 9c0c5bc5ba01f1a07abe918730675dd3c7497bb7 (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>
Diffstat (limited to 'sfx2/source/appl')
-rw-r--r-- | sfx2/source/appl/sfxhelp.cxx | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 30aa68b840f4..4a8929af5a31 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -620,6 +620,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); |