summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-01-21 12:41:39 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-01-21 14:49:41 +0000
commit1dbc6d05ded0dc1df75f7b9ff779571c98800035 (patch)
treebb760a852f67cf16b9edec22751a8b7fb440caf4
parent44b2fb6d0ba8c3fc8aa6edb4e539c484e21b7fc5 (diff)
Resolves: fdo#87636 New button not clickable when Templates preselected
regression from commit 57207cab004cb78c3fa6d9ed43cc4bf81f4e6981 Author: Ariel Constenla-Haile <arielch@apache.org> 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
-rw-r--r--framework/inc/uielement/newmenucontroller.hxx9
-rw-r--r--framework/source/uielement/newmenucontroller.cxx13
-rw-r--r--framework/source/uielement/popuptoolbarcontroller.cxx1
3 files changed, 10 insertions, 13 deletions
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 <svtools/popupmenucontrollerbase.hxx>
#include <toolkit/awt/vclxmenu.hxx>
+#include <framework/menuconfiguration.hxx>
#include <cppuhelper/weak.hxx>
#include <rtl/ustring.hxx>
#include <vcl/accel.hxx>
@@ -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<AddInfo> > 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<MenuConfiguration::Attributes *>(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<AddInfo>(new AddInfo(*pBmkAttributes))));
+ MenuConfiguration::Attributes *pNewInfo = result.first->second.get();
+ pVCLPopupMenu->SetUserValue(nItemId, reinterpret_cast<sal_uIntPtr>(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() ) );