You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by da...@apache.org on 2020/10/05 15:53:30 UTC

[openoffice] branch AOO418 updated: Improve routing of URLs in events.

This is an automated email from the ASF dual-hosted git repository.

damjan pushed a commit to branch AOO418
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/AOO418 by this push:
     new 5e07d63  Improve routing of URLs in events.
5e07d63 is described below

commit 5e07d634ef81b4e2fae682304719f1a0745cfa23
Author: Damjan Jovanovic <da...@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 0a797ae..73a7eb9 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 );
+					}
 				}
 			}
 		}