include/vcl/menu.hxx | 1 - vcl/source/window/menu.cxx | 17 ++++++----------- 2 files changed, 6 insertions(+), 12 deletions(-)
New commits: commit b9487ea0403872fb1e6e33550afc5c9b47bd196a Author: Michael Weghorn <[email protected]> AuthorDate: Fri Feb 13 10:15:12 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Sat Feb 14 00:49:01 2026 +0100 vcl: Simplify Menu::GetHelpText a bit If `pData->aHelpText` is non-empty, it is always returned at the end. Return it early, which gets rid of the need to repeatedly check whether `pData->aHelpText` is empty. Change-Id: Ie3956caa5e51ec755a2603e75962a5ff24d187d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199338 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index f6248502f73c..8a30f278f6a2 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -1094,8 +1094,10 @@ OUString Menu::GetHelpText( sal_uInt16 nItemId ) const if (!pData) return OUString(); - if ( pData->aHelpText.isEmpty() && - (( !pData->aHelpId.isEmpty() ) || ( !pData->aCommandStr.isEmpty() ))) + if (!pData->aHelpText.isEmpty()) + return pData->aHelpText; + + if (!pData->aHelpId.isEmpty() || !pData->aCommandStr.isEmpty()) { Help* pHelp = Application::GetHelp(); if ( pHelp ) @@ -1108,9 +1110,7 @@ OUString Menu::GetHelpText( sal_uInt16 nItemId ) const } //Fallback to Menu::GetAccessibleDescription without reentry to GetHelpText() - if (pData->aHelpText.isEmpty()) - return pData->aAccessibleDescription; - return pData->aHelpText; + return pData->aAccessibleDescription; } void Menu::SetTipHelpText( sal_uInt16 nItemId, const OUString& rStr ) commit 51df905eeebcec925efe9994aa62dfe97252f4dc Author: Michael Weghorn <[email protected]> AuthorDate: Fri Feb 13 10:12:22 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Sat Feb 14 00:48:54 2026 +0100 vcl: Merge Menu::ImplGetHelpText into Menu::GetHelpText Change-Id: Id1bea5254b7d1be586dce2fe79baf31b5106ebb0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199337 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 3f45295442f4..62867b32518e 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -182,7 +182,6 @@ protected: SAL_DLLPRIVATE void ImplFillLayoutData() const; SAL_DLLPRIVATE SalMenu* ImplGetSalMenu() const { return mpSalMenu.get(); } - SAL_DLLPRIVATE OUString ImplGetHelpText( sal_uInt16 nItemId ) const; // returns native check and option menu symbol height in rCheckHeight and rRadioHeight // return value is maximum width and height of checkboxes and radiobuttons diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 612f34741b3e..f6248502f73c 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -1087,7 +1087,7 @@ void Menu::SetHelpText( sal_uInt16 nItemId, const OUString& rStr ) pData->aHelpText = rStr; } -OUString Menu::ImplGetHelpText( sal_uInt16 nItemId ) const +OUString Menu::GetHelpText( sal_uInt16 nItemId ) const { MenuItemData* pData = pItemList->GetData( nItemId ); @@ -1113,11 +1113,6 @@ OUString Menu::ImplGetHelpText( sal_uInt16 nItemId ) const return pData->aHelpText; } -OUString Menu::GetHelpText( sal_uInt16 nItemId ) const -{ - return ImplGetHelpText( nItemId ); -} - void Menu::SetTipHelpText( sal_uInt16 nItemId, const OUString& rStr ) { MenuItemData* pData = pItemList->GetData( nItemId );
