From 1dbc6d05ded0dc1df75f7b9ff779571c98800035 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 21 Jan 2015 12:41:39 +0000 Subject: Resolves: fdo#87636 New button not clickable when Templates preselected regression from commit 57207cab004cb78c3fa6d9ed43cc4bf81f4e6981 Author: Ariel Constenla-Haile Date: Tue May 28 10:01:32 2013 +0000 Add missing copy&paste of SfxAppToolBoxControl_Impl::Select (cherry picked from commit 47204c74d9e52f54f6983af19b66af2a96b42e61) Conflicts: framework/inc/uielement/popuptoolbarcontroller.hxx svtools/inc/svtools/toolboxcontroller.hxx The menu shown in the ui is a copy of a menu. The original menu has UserData set on it which contains the target for the command, but the copy doesn't, so looking up the target always fails and ses the "_default" frame and not the correct "_self" required for the template menu Change-Id: Ic1887467bf15f081d27286bd284929c17a2b19ad --- framework/inc/uielement/newmenucontroller.hxx | 9 +++------ framework/source/uielement/newmenucontroller.cxx | 13 ++++++------- framework/source/uielement/popuptoolbarcontroller.cxx | 1 + 3 files changed, 10 insertions(+), 13 deletions(-) (limited to 'framework') diff --git a/framework/inc/uielement/newmenucontroller.hxx b/framework/inc/uielement/newmenucontroller.hxx index 4f1502a75cf0..ad802fa0ff2a 100644 --- a/framework/inc/uielement/newmenucontroller.hxx +++ b/framework/inc/uielement/newmenucontroller.hxx @@ -37,6 +37,7 @@ #include #include +#include #include #include #include @@ -80,13 +81,9 @@ namespace framework private: virtual void impl_setPopupMenu() SAL_OVERRIDE; - struct AddInfo - { - OUString aTargetFrame; - OUString aImageId; - }; + typedef MenuConfiguration::Attributes AddInfo; - typedef std::unordered_map< int, AddInfo > AddInfoForId; + typedef std::unordered_map< int, std::unique_ptr > AddInfoForId; void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); void retrieveShortcutsFromConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration >& rAccelCfg, diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index 3abad04ebee9..216c7a1c1762 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -85,7 +85,7 @@ void NewMenuController::setMenuImages( PopupMenu* pPopupMenu, bool bSetImages ) AddInfoForId::const_iterator pInfo = m_aAddInfoForItem.find( nItemId ); if ( pInfo != m_aAddInfoForItem.end() ) - aImageId = pInfo->second.aImageId; // Retrieve image id for menu item + aImageId = pInfo->second->aImageId; // Retrieve image id for menu item if ( !aImageId.isEmpty() ) { @@ -336,7 +336,6 @@ void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopup *pVCLPopupMenu = *pSubMenu; Image aImage; - AddInfo aAddInfo; // retrieve additional parameters from bookmark menu and // store it in a unordered_map. @@ -349,10 +348,10 @@ void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopup MenuConfiguration::Attributes* pBmkAttributes = reinterpret_cast(pSubMenu->GetUserValue( nItemId )); if ( pBmkAttributes != 0 ) { - aAddInfo.aTargetFrame = pBmkAttributes->aTargetFrame; - aAddInfo.aImageId = pBmkAttributes->aImageId; - - m_aAddInfoForItem.insert( AddInfoForId::value_type( nItemId, aAddInfo )); + auto result = m_aAddInfoForItem.insert( + std::make_pair(nItemId, std::unique_ptr(new AddInfo(*pBmkAttributes)))); + MenuConfiguration::Attributes *pNewInfo = result.first->second.get(); + pVCLPopupMenu->SetUserValue(nItemId, reinterpret_cast(pNewInfo)); } } } @@ -420,7 +419,7 @@ void SAL_CALL NewMenuController::itemSelected( const css::awt::MenuEvent& rEvent OUString aTargetFrame( m_aTargetFrame ); AddInfoForId::const_iterator pItem = m_aAddInfoForItem.find( rEvent.MenuId ); if ( pItem != m_aAddInfoForItem.end() ) - aTargetFrame = pItem->second.aTargetFrame; + aTargetFrame = pItem->second->aTargetFrame; xDispatch = xDispatchProvider->queryDispatch( aTargetURL, aTargetFrame, 0 ); } diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index fbb28088e7e1..e0e0ad955df3 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -438,6 +438,7 @@ throw ( css::uno::RuntimeException, std::exception ) SolarMutexGuard aSolarMutexGuard; PopupMenu* pVCLPopupMenu = pTkPopupMenu ? dynamic_cast< PopupMenu * >( pTkPopupMenu->GetMenu() ) : NULL; + if ( pVCLPopupMenu ) pMenuAttributes = reinterpret_cast< MenuConfiguration::Attributes* >( pVCLPopupMenu->GetUserValue( pVCLPopupMenu->GetCurItemId() ) ); -- cgit