diff options
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/uielement/popuptoolbarcontroller.cxx | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index 5c11600c31b9..ea76be37887c 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -730,29 +730,33 @@ bool Impl_ExistURLInMenu( { bool bValidFallback( false ); sal_uInt16 nCount( 0 ); - if ( rPopupMenu.is() && ( nCount = rPopupMenu->getItemCount() ) != 0 && sURL.getLength() ) + if ( rPopupMenu.is() ) { - for ( sal_uInt16 n = 0; n < nCount; ++n ) + nCount = rPopupMenu->getItemCount(); + if (nCount != 0 && sURL.getLength() ) { - sal_uInt16 nId = rPopupMenu->getItemId( n ); - OUString aCmd( rPopupMenu->getCommand( nId ) ); - - if ( !bValidFallback && aCmd.getLength() ) - { - sFallback = aCmd; - bValidFallback = true; - } - - // match even if the menu command is more detailed - // (maybe an additional query) #i28667# - if ( aCmd.match( sURL ) ) + for ( sal_uInt16 n = 0; n < nCount; ++n ) { - sURL = aCmd; - const css::uno::Reference< css::graphic::XGraphic > xGraphic( - rPopupMenu->getItemImage( nId ) ); - if ( xGraphic.is() ) - aImage = Image( xGraphic ); - return true; + sal_uInt16 nId = rPopupMenu->getItemId( n ); + OUString aCmd( rPopupMenu->getCommand( nId ) ); + + if ( !bValidFallback && aCmd.getLength() ) + { + sFallback = aCmd; + bValidFallback = true; + } + + // match even if the menu command is more detailed + // (maybe an additional query) #i28667# + if ( aCmd.match( sURL ) ) + { + sURL = aCmd; + const css::uno::Reference< css::graphic::XGraphic > xGraphic( + rPopupMenu->getItemImage( nId ) ); + if ( xGraphic.is() ) + aImage = Image( xGraphic ); + return true; + } } } } |