framework/source/fwe/helper/actiontriggerhelper.cxx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
New commits: commit da6b70633ac6bf78ce0a68022518396a2c650970 Author: Mike Kaganski <[email protected]> AuthorDate: Wed Oct 29 22:45:15 2025 +0500 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Oct 30 09:42:23 2025 +0100 tdf#168314: check if xGraphic is empty, not Any Regression after commit 9d6e1594a298c9d41f3dc64ad80edf4b9868c2e8 (Deduplicate and unify using vcl::GetBitmap, 2024-11-08). An Any with an empty graphic is not itself empty; such an any caused the outer check to succeed, and therefore its 'else' branch never executed, when it ought to. Change-Id: I97115c7f7dbab4ec54b5e999e4b47ecdc8874e47 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193161 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> (cherry picked from commit a8216f500c223797b13976678924b76c5effec65) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193170 Reviewed-by: Xisco Fauli <[email protected]> diff --git a/framework/source/fwe/helper/actiontriggerhelper.cxx b/framework/source/fwe/helper/actiontriggerhelper.cxx index e1ae01a4da28..00a2aed51661 100644 --- a/framework/source/fwe/helper/actiontriggerhelper.cxx +++ b/framework/source/fwe/helper/actiontriggerhelper.cxx @@ -65,7 +65,7 @@ static void GetMenuItemAttributes( const Reference< XPropertySet >& xActionTrigg OUString& aMenuLabel, OUString& aCommandURL, OUString& aHelpURL, - Any& rImage, + Reference<css::graphic::XGraphic>& xGraphic, Reference< XIndexContainer >& xSubContainer ) { try @@ -73,7 +73,7 @@ static void GetMenuItemAttributes( const Reference< XPropertySet >& xActionTrigg // mandatory properties xActionTriggerPropertySet->getPropertyValue(u"Text"_ustr) >>= aMenuLabel; xActionTriggerPropertySet->getPropertyValue(u"CommandURL"_ustr) >>= aCommandURL; - rImage = xActionTriggerPropertySet->getPropertyValue(u"Image"_ustr); + xGraphic = vcl::GetGraphic(xActionTriggerPropertySet->getPropertyValue(u"Image"_ustr)); xActionTriggerPropertySet->getPropertyValue(u"SubContainer"_ustr) >>= xSubContainer; } catch (const Exception&) @@ -117,11 +117,11 @@ static void InsertSubMenuItems(const Reference<XPopupMenu>& rSubMenu, sal_uInt16 OUString aLabel; OUString aCommandURL; OUString aHelpURL; - Any aImage; + Reference<css::graphic::XGraphic> xGraphic; Reference< XIndexContainer > xSubContainer; sal_uInt16 nNewItemId = nItemId++; - GetMenuItemAttributes( xPropSet, aLabel, aCommandURL, aHelpURL, aImage, xSubContainer ); + GetMenuItemAttributes( xPropSet, aLabel, aCommandURL, aHelpURL, xGraphic, xSubContainer ); { // insert new menu item @@ -142,10 +142,9 @@ static void InsertSubMenuItems(const Reference<XPopupMenu>& rSubMenu, sal_uInt16 } // handle bitmap - if (aImage.hasValue()) + if (xGraphic) { - if (auto xGraphic = vcl::GetGraphic(aImage)) - rSubMenu->setItemImage(nNewItemId, xGraphic, false); + rSubMenu->setItemImage(nNewItemId, xGraphic, false); } else {
