summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorAriel Constenla-Haile <arielch@apache.org>2013-05-28 10:01:32 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-06-24 11:25:34 +0100
commit57207cab004cb78c3fa6d9ed43cc4bf81f4e6981 (patch)
tree064fa263ec60f38b437df1d93c570e2e787f4173 /framework
parenta1748501d81425d26d09509eec2fd141f2f28f05 (diff)
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
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/uielement/popuptoolbarcontroller.hxx3
-rw-r--r--framework/source/uielement/popuptoolbarcontroller.cxx40
2 files changed, 42 insertions, 1 deletions
diff --git a/framework/inc/uielement/popuptoolbarcontroller.hxx b/framework/inc/uielement/popuptoolbarcontroller.hxx
index 89acb766c0e1..f8e8bf951ebd 100644
--- a/framework/inc/uielement/popuptoolbarcontroller.hxx
+++ b/framework/inc/uielement/popuptoolbarcontroller.hxx
@@ -78,7 +78,10 @@ namespace framework
private:
void functionExecuted( const OUString &rCommand );
void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& rEvent ) throw ( ::com::sun::star::uno::RuntimeException );
+ void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
void setItemImage( const OUString &rCommand );
+
+ OUString m_aLastURL;
};
class WizardsToolbarController : public PopupMenuToolbarController
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 <uielement/popuptoolbarcontroller.hxx>
+#include <framework/menuconfiguration.hxx>
+#include <toolkit/awt/vclxmenu.hxx>
#include <comphelper/processfactory.hxx>
#include <svtools/imagemgr.hxx>
#include <svtools/miscopt.hxx>
@@ -28,9 +30,10 @@
#include <com/sun/star/awt/PopupMenuDirection.hpp>
#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
-
+#include <com/sun/star/frame/XDispatchProvider.hpp>
#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;
}