This is an automated email from the ASF dual-hosted git repository. damjan pushed a commit to branch AOO42X in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push: new 8343ff5 Improve routing of URLs in events. 8343ff5 is described below commit 8343ff51eaa66b4c71b1f3c29dfa6007438abdfb Author: Damjan Jovanovic <dam...@apache.org> AuthorDate: Mon Oct 5 17:43:56 2020 +0200 Improve routing of URLs in events. Patch by: me (cherry picked from commit ef39f77fbb9d299ce3074346a1bbe5351613169f) --- main/sfx2/source/notify/eventsupplier.cxx | 69 ++++++++++++++++--------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/main/sfx2/source/notify/eventsupplier.cxx b/main/sfx2/source/notify/eventsupplier.cxx index cd7cec6..3c649c4 100644 --- a/main/sfx2/source/notify/eventsupplier.cxx +++ b/main/sfx2/source/notify/eventsupplier.cxx @@ -253,40 +253,43 @@ static void Execute( ANY& aEventData, const css::document::DocumentEvent& aTrigg aURL.Complete = aScript; xTrans->parseStrict( aURL ); - ::com::sun::star::uno::Reference - < ::com::sun::star::frame::XDispatchProvider > xProv; - - if ( pView != NULL ) - { - xProv = ::com::sun::star::uno::Reference - < ::com::sun::star::frame::XDispatchProvider > ( - pView->GetFrame().GetFrameInterface(), UNO_QUERY ); - } - else + if ( aURL.Protocol.equals( ::rtl::OUString::createFromAscii( "vnd.sun.star.script:" ) ) ) { - xProv = ::com::sun::star::uno::Reference - < ::com::sun::star::frame::XDispatchProvider > ( - ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString::createFromAscii( - "com.sun.star.frame.Desktop" ) ), - UNO_QUERY ); - } - - ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > xDisp; - if ( xProv.is() ) - xDisp = xProv->queryDispatch( aURL, ::rtl::OUString(), 0 ); - - if ( xDisp.is() ) - { - //::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > aArgs(1); - //aArgs[0].Name = rtl::OUString::createFromAscii("Referer"); - //aArs[0].Value <<= ::rtl::OUString( pDoc->GetMedium()->GetName() ); - //xDisp->dispatch( aURL, aArgs ); - - css::beans::PropertyValue aEventParam; - aEventParam.Value <<= aTrigger; - css::uno::Sequence< css::beans::PropertyValue > aDispatchArgs( &aEventParam, 1 ); - xDisp->dispatch( aURL, aDispatchArgs ); + ::com::sun::star::uno::Reference + < ::com::sun::star::frame::XDispatchProvider > xProv; + + if ( pView != NULL ) + { + xProv = ::com::sun::star::uno::Reference + < ::com::sun::star::frame::XDispatchProvider > ( + pView->GetFrame().GetFrameInterface(), UNO_QUERY ); + } + else + { + xProv = ::com::sun::star::uno::Reference + < ::com::sun::star::frame::XDispatchProvider > ( + ::comphelper::getProcessServiceFactory()->createInstance( + rtl::OUString::createFromAscii( + "com.sun.star.frame.Desktop" ) ), + UNO_QUERY ); + } + + ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > xDisp; + if ( xProv.is() ) + xDisp = xProv->queryDispatch( aURL, ::rtl::OUString(), 0 ); + + if ( xDisp.is() ) + { + //::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > aArgs(1); + //aArgs[0].Name = rtl::OUString::createFromAscii("Referer"); + //aArs[0].Value <<= ::rtl::OUString( pDoc->GetMedium()->GetName() ); + //xDisp->dispatch( aURL, aArgs ); + + css::beans::PropertyValue aEventParam; + aEventParam.Value <<= aTrigger; + css::uno::Sequence< css::beans::PropertyValue > aDispatchArgs( &aEventParam, 1 ); + xDisp->dispatch( aURL, aDispatchArgs ); + } } } }