From 57207cab004cb78c3fa6d9ed43cc4bf81f4e6981 Mon Sep 17 00:00:00 2001 From: Ariel Constenla-Haile Date: Tue, 28 May 2013 10:01:32 +0000 Subject: Add missing copy&paste of SfxAppToolBoxControl_Impl::Select (cherry picked from commit 47204c74d9e52f54f6983af19b66af2a96b42e61) Conflicts: framework/inc/uielement/popuptoolbarcontroller.hxx svtools/inc/svtools/toolboxcontroller.hxx Change-Id: I304d17c662450f29eeffb17f576b418986f3fb0a --- .../source/uielement/popuptoolbarcontroller.cxx | 40 +++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'framework/source') diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index 0340c03c07fd..b38c6177a311 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -17,6 +17,8 @@ */ #include +#include +#include #include #include #include @@ -28,9 +30,10 @@ #include #include - +#include #define UNO_COMMAND_RECENT_FILE_LIST ".uno:RecentFileList" +#define SFX_REFERER_USER "private:user" namespace css = ::com::sun::star; @@ -270,6 +273,39 @@ NewToolbarController::statusChanged( enable( rEvent.IsEnabled ); } +void SAL_CALL +NewToolbarController::execute( sal_Int16 /*KeyModifier*/ ) + throw ( css::uno::RuntimeException ) +{ + osl::MutexGuard aGuard( m_aMutex ); + if ( !m_aLastURL.getLength() ) + return; + + OUString aTarget( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ); + if ( m_xPopupMenu.is() ) + { + // TODO investigate how to wrap Get/SetUserValue in css::awt::XMenu + MenuConfiguration::Attributes* pMenuAttributes( 0 ); + VCLXPopupMenu* pTkPopupMenu = dynamic_cast< VCLXPopupMenu * >( + VCLXMenu::GetImplementation( m_xPopupMenu ) ); + + SolarMutexGuard aSolarMutexGuard; + PopupMenu* pVCLPopupMenu = dynamic_cast< PopupMenu * >( pTkPopupMenu->GetMenu() ); + if ( pVCLPopupMenu ) + pMenuAttributes = reinterpret_cast< MenuConfiguration::Attributes* >( + pVCLPopupMenu->GetUserValue( pVCLPopupMenu->GetCurItemId() ) ); + + if ( pMenuAttributes ) + aTarget = pMenuAttributes->aTargetFrame; + } + + css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 ); + aArgs[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Referer" )); + aArgs[0].Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( SFX_REFERER_USER ) ); + + dispatchCommand( m_aLastURL, aArgs, aTarget ); +} + void NewToolbarController::functionExecuted( const OUString &rCommand ) { setItemImage( rCommand ); @@ -400,6 +436,8 @@ void NewToolbarController::setItemImage( const OUString &rCommand ) } else pToolBox->SetItemImage( m_nToolBoxId, aImage ); + + m_aLastURL = aURL; } -- cgit