diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-11-30 21:19:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-12-02 08:01:57 +0100 |
commit | 264498b4baeb4d451c17153ae354bf9c241709eb (patch) | |
tree | 1a04f7e410b1d427333578870e95d896fc55c6c6 /framework/source | |
parent | 70a7ed7fe8959988b58c0ef3c3f04a2a7db0625b (diff) |
simplify SvtDynamicMenuOptions
just use the struct instead of passing around sequence
of sequence of PropertyValue
Change-Id: Ic03c066962a10daac6f83f30413a5ab09e1bfd5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106915
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework/source')
-rw-r--r-- | framework/source/uielement/newmenucontroller.cxx | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index feb9df4bf408..76f7bc6eb194 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -325,40 +325,24 @@ void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > const & if(xMenuItemDispatch == nullptr) return; - const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aDynamicMenuEntries = + const std::vector< SvtDynMenuEntry > aDynamicMenuEntries = SvtDynamicMenuOptions().GetMenu( m_bNewMenu ? EDynamicMenuType::NewMenu : EDynamicMenuType::WizardMenu ); - OUString aTitle; - OUString aURL; - OUString aTargetFrame; - OUString aImageId; sal_uInt16 nItemId = 1; for ( const auto& aDynamicMenuEntry : aDynamicMenuEntries ) { - for ( const auto& aProperty : aDynamicMenuEntry ) - { - if ( aProperty.Name == DYNAMICMENU_PROPERTYNAME_URL ) - aProperty.Value >>= aURL; - else if ( aProperty.Name == DYNAMICMENU_PROPERTYNAME_TITLE ) - aProperty.Value >>= aTitle; - else if ( aProperty.Name == DYNAMICMENU_PROPERTYNAME_IMAGEIDENTIFIER ) - aProperty.Value >>= aImageId; - else if ( aProperty.Name == DYNAMICMENU_PROPERTYNAME_TARGETNAME ) - aProperty.Value >>= aTargetFrame; - } - - if ( aTitle.isEmpty() && aURL.isEmpty() ) + if ( aDynamicMenuEntry.sTitle.isEmpty() && aDynamicMenuEntry.sURL.isEmpty() ) continue; - if ( aURL == "private:separator" ) + if ( aDynamicMenuEntry.sURL == "private:separator" ) pVCLPopupMenu->InsertSeparator(); else { - pVCLPopupMenu->InsertItem( nItemId, aTitle ); - pVCLPopupMenu->SetItemCommand( nItemId, aURL ); + pVCLPopupMenu->InsertItem( nItemId, aDynamicMenuEntry.sTitle ); + pVCLPopupMenu->SetItemCommand( nItemId, aDynamicMenuEntry.sURL ); - void* nAttributePtr = MenuAttributes::CreateAttribute( aTargetFrame, aImageId ); + void* nAttributePtr = MenuAttributes::CreateAttribute( aDynamicMenuEntry.sTargetName, aDynamicMenuEntry.sImageIdentifier ); pVCLPopupMenu->SetUserValue( nItemId, nAttributePtr, MenuAttributes::ReleaseAttribute ); nItemId++; |