From d4b67611c421ebe9b75284106fe389b434419961 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 16 Mar 2012 11:16:14 +0100 Subject: Introduced SystemShellExecuteFlags::URIS_ONLY --- cui/source/dialogs/SpellDialog.cxx | 2 +- cui/source/dialogs/about.cxx | 2 +- cui/source/options/optlingu.cxx | 2 +- desktop/source/deployment/gui/dp_gui_dialog2.cxx | 2 +- .../source/deployment/gui/dp_gui_updatedialog.cxx | 2 +- embeddedobj/source/msole/oleembed.cxx | 2 +- extensions/source/update/check/updatecheck.cxx | 2 +- filter/source/xsltdialog/xmlfiltertestdialog.cxx | 2 +- framework/source/dispatch/mailtodispatcher.cxx | 2 +- framework/source/dispatch/systemexec.cxx | 2 +- framework/source/services/backingwindow.cxx | 2 +- .../complextoolbarcontrols/MyProtocolHandler.cxx | 2 +- .../sun/star/system/SystemShellExecuteFlags.idl | 6 + offapi/com/sun/star/system/XSystemShellExecute.idl | 6 +- sfx2/Library_sfx.mk | 1 + sfx2/source/appl/app.hrc | 2 +- sfx2/source/appl/app.src | 7 + sfx2/source/appl/appopen.cxx | 195 ++++++++------------- sfx2/source/appl/appserv.cxx | 4 +- sfx2/source/appl/openuriexternally.cxx | 101 +++++++++++ sfx2/source/appl/sfxhelp.cxx | 2 +- sfx2/source/inc/openuriexternally.hxx | 57 ++++++ sfx2/source/view/view.hrc | 2 +- sfx2/source/view/view.src | 18 -- sfx2/source/view/viewsh.cxx | 27 +-- shell/source/unix/exec/shellexec.cxx | 44 ++++- shell/source/win32/SysShExec.cxx | 26 ++- shell/source/win32/SysShExec.hxx | 6 +- shell/source/win32/SysShentry.cxx | 13 +- svtools/source/contnr/templwin.cxx | 2 +- sw/source/ui/docvw/extedit.cxx | 2 +- sw/source/ui/lingu/olmenu.cxx | 2 +- swext/mediawiki/src/com/sun/star/wiki/Helper.java | 2 +- toolkit/source/awt/vclxwindows.cxx | 2 +- uui/source/newerverwarn.cxx | 2 +- 35 files changed, 351 insertions(+), 202 deletions(-) create mode 100644 sfx2/source/appl/openuriexternally.cxx create mode 100644 sfx2/source/inc/openuriexternally.hxx diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 21ab29cf5684..570e7eba404c 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -2146,7 +2146,7 @@ IMPL_LINK( SpellDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink ) uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute") ), uno::UNO_QUERY_THROW ); - xSystemShellExecute->execute( sURL, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::DEFAULTS ); + xSystemShellExecute->execute( sURL, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY ); } catch ( uno::Exception& ) { diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx index 92748c58b4e1..c04c6d0873c3 100644 --- a/cui/source/dialogs/about.cxx +++ b/cui/source/dialogs/about.cxx @@ -311,7 +311,7 @@ IMPL_LINK( AboutDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink ) uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute") ), uno::UNO_QUERY_THROW ); - xSystemShellExecute->execute( sURL, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::DEFAULTS ); + xSystemShellExecute->execute( sURL, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY ); } catch ( uno::Exception& ) { diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index 034216a0fc81..b23de8b7aba3 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -158,7 +158,7 @@ static void lcl_OpenURL( ::rtl::OUString sURL ) RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ), uno::UNO_QUERY_THROW ); if ( xSystemShell.is() ) - xSystemShell->execute( sURL, ::rtl::OUString(), css::system::SystemShellExecuteFlags::DEFAULTS ); + xSystemShell->execute( sURL, ::rtl::OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY ); } catch( const uno::Exception& e ) { diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 95b90c9f0b86..5e94e31438fd 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -634,7 +634,7 @@ void DialogHelper::openWebBrowser( const OUString & sURL, const OUString &sTitle uno::Reference< XSystemShellExecute > xSystemShellExecute( m_xContext->getServiceManager()->createInstanceWithContext( OUSTR( "com.sun.star.system.SystemShellExecute" ), m_xContext), uno::UNO_QUERY_THROW); //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException - xSystemShellExecute->execute( sURL, OUString(), SystemShellExecuteFlags::DEFAULTS ); + xSystemShellExecute->execute( sURL, OUString(), SystemShellExecuteFlags::URIS_ONLY ); } catch ( const uno::Exception& ) { diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 13f2df1cdd7d..f7dbbfb0e401 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -1419,7 +1419,7 @@ IMPL_LINK( UpdateDialog, hyperlink_clicked, svt::FixedHyperlink*, pHyperlink ) m_context), uno::UNO_QUERY_THROW); //throws lang::IllegalArgumentException, system::SystemShellExecuteException xSystemShellExecute->execute( - sURL, ::rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::DEFAULTS); + sURL, ::rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY); } catch ( const uno::Exception& ) { diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx index d4c9e2ef4f73..04d20caf7b4f 100644 --- a/embeddedobj/source/msole/oleembed.cxx +++ b/embeddedobj/source/msole/oleembed.cxx @@ -879,7 +879,7 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID ) uno::Reference< ::com::sun::star::system::XSystemShellExecute > xSystemShellExecute( m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.system.SystemShellExecute"))), uno::UNO_QUERY_THROW); - xSystemShellExecute->execute(m_aTempDumpURL, ::rtl::OUString(), ::com::sun::star::system::SystemShellExecuteFlags::DEFAULTS); + xSystemShellExecute->execute(m_aTempDumpURL, ::rtl::OUString(), ::com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY); } else throw embed::UnreachableStateException(); diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx index 2db3a532f180..54f9b4cfac38 100644 --- a/extensions/source/update/check/updatecheck.cxx +++ b/extensions/source/update/check/updatecheck.cxx @@ -1495,7 +1495,7 @@ UpdateCheck::showReleaseNote(const rtl::OUString& rURL) const try { if( xShellExecute.is() ) - xShellExecute->execute(rURL, rtl::OUString(), c3s::SystemShellExecuteFlags::DEFAULTS); + xShellExecute->execute(rURL, rtl::OUString(), c3s::SystemShellExecuteFlags::URIS_ONLY); } catch(const c3s::SystemShellExecuteException&) { } } diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx index 9e8638078ef8..40606d776cd0 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx @@ -568,7 +568,7 @@ void XMLFilterTestDialog::doExport( Reference< XComponent > xComp ) void XMLFilterTestDialog::displayXMLFile( const OUString& rURL ) { ::com::sun::star::uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute(comphelper::getProcessServiceFactory()->createInstance(DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute") ), com::sun::star::uno::UNO_QUERY_THROW ); - xSystemShellExecute->execute( rURL, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::DEFAULTS ); + xSystemShellExecute->execute( rURL, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY ); } void XMLFilterTestDialog::onImportBrowse() diff --git a/framework/source/dispatch/mailtodispatcher.cxx b/framework/source/dispatch/mailtodispatcher.cxx index 095ff5500549..ee00c47b0c12 100644 --- a/framework/source/dispatch/mailtodispatcher.cxx +++ b/framework/source/dispatch/mailtodispatcher.cxx @@ -283,7 +283,7 @@ sal_Bool MailToDispatcher::implts_dispatch( const css::util::URL& // start mail client // Because there is no notofocation about success - we use case of // no detected exception as SUCCESS - FAILED otherwhise. - xSystemShellExecute->execute( aURL.Complete, ::rtl::OUString(), css::system::SystemShellExecuteFlags::DEFAULTS ); + xSystemShellExecute->execute( aURL.Complete, ::rtl::OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY ); bSuccess = sal_True; } catch (const css::lang::IllegalArgumentException&) diff --git a/framework/source/dispatch/systemexec.cxx b/framework/source/dispatch/systemexec.cxx index e516a38ef577..d3f5e78270dd 100644 --- a/framework/source/dispatch/systemexec.cxx +++ b/framework/source/dispatch/systemexec.cxx @@ -192,7 +192,7 @@ void SAL_CALL SystemExec::dispatchWithNotification( const css::util::URL& xFactory->createInstance(SERVICENAME_SYSTEMSHELLEXECUTE), css::uno::UNO_QUERY_THROW); - xShell->execute(sSystemURL, ::rtl::OUString(), css::system::SystemShellExecuteFlags::DEFAULTS); + xShell->execute(sSystemURL, ::rtl::OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY); impl_notifyResultListener(xListener, css::frame::DispatchResultState::SUCCESS); } catch(const css::uno::Exception&) diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx index ace2caa7c7be..d930f772375b 100644 --- a/framework/source/services/backingwindow.cxx +++ b/framework/source/services/backingwindow.cxx @@ -858,7 +858,7 @@ IMPL_LINK_NOARG(BackingWindow, ToolboxHdl) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ), UNO_QUERY_THROW); //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException - xSystemShellExecute->execute( sURL, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::DEFAULTS); + xSystemShellExecute->execute( sURL, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY); } } } diff --git a/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx b/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx index 1238cf934a68..e7d933615cfc 100644 --- a/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx +++ b/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx @@ -277,7 +277,7 @@ void SAL_CALL BaseDispatch::dispatch( const URL& aURL, const Sequence < Property try { - xSystemShellExecute->execute( sURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS ); + xSystemShellExecute->execute( sURL, ::rtl::OUString(), SystemShellExecuteFlags::URIS_ONLY ); } catch( Exception& rEx ) { diff --git a/offapi/com/sun/star/system/SystemShellExecuteFlags.idl b/offapi/com/sun/star/system/SystemShellExecuteFlags.idl index ec33586a026e..be6991f912d6 100644 --- a/offapi/com/sun/star/system/SystemShellExecuteFlags.idl +++ b/offapi/com/sun/star/system/SystemShellExecuteFlags.idl @@ -48,6 +48,12 @@ published constants SystemShellExecuteFlags method XSystemShellExecute::execute() fails. */ const long NO_SYSTEM_ERROR_MESSAGE = 1; + + /** Only allows opening of absolute URI references. + + @since LibreOffice 3.6 + */ + const long URIS_ONLY = 2; }; //============================================================================= diff --git a/offapi/com/sun/star/system/XSystemShellExecute.idl b/offapi/com/sun/star/system/XSystemShellExecute.idl index 0b3e1aadc4ec..d39a627de92e 100644 --- a/offapi/com/sun/star/system/XSystemShellExecute.idl +++ b/offapi/com/sun/star/system/XSystemShellExecute.idl @@ -65,8 +65,10 @@ published interface XSystemShellExecute: com::sun::star::uno::XInterface avoid showing system error messages, in case of failures, etc. @throws com::sun::star::lang::IllegalArgumentException - when the specified flags are wrong or exclude each other. -. + when the specified flags are wrong or exclude each other; also thrown, + with an ArgumentPosition of 0, when nFlags contains URIS_ONLY and + aCommand is not an absolute URI reference + @throws com::sun::star::sys::SystemExecuteException in the case of errors when trying to executed the specified command. diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index dae3504f135c..a1db033b43d1 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -114,6 +114,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/appl/module \ sfx2/source/appl/newhelp \ sfx2/source/appl/opengrf \ + sfx2/source/appl/openuriexternally \ sfx2/source/appl/sfxhelp \ sfx2/source/appl/sfxpicklist \ sfx2/source/appl/shutdownicon \ diff --git a/sfx2/source/appl/app.hrc b/sfx2/source/appl/app.hrc index 25e4e4527e37..33b57a2341b4 100755 --- a/sfx2/source/appl/app.hrc +++ b/sfx2/source/appl/app.hrc @@ -33,7 +33,7 @@ #define ACC_IBM (RID_SFX_APP_START+2) #define MSG_ERR_NO_WEBBROWSER_FOUND (RID_SFX_APP_START+7) - +#define MSG_ERR_NO_ABS_URI_REF (RID_SFX_APP_START+8) #define MSG_ISPRINTING_QUERYABORT (RID_SFX_APP_START+9) #define MSG_CANT_QUIT (RID_SFX_APP_START+10) #define STR_ISMODIFIED (RID_SFX_APP_START+11) diff --git a/sfx2/source/appl/app.src b/sfx2/source/appl/app.src index 53515a90e4e5..aa634f5ac0aa 100644 --- a/sfx2/source/appl/app.src +++ b/sfx2/source/appl/app.src @@ -82,6 +82,13 @@ ErrorBox MSG_ERR_NO_WEBBROWSER_FOUND Message[ en-US ] = "%PRODUCTNAME could not find a web browser on your system. Please check your Desktop Preferences or install a web browser (for example, Mozilla) in the default location requested during the browser installation." ; }; +ErrorBox MSG_ERR_NO_ABS_URI_REF +{ + BUTTONS = WB_OK ; + DEFBUTTON = WB_DEF_OK ; + Message[ en-US ] = "\"$(ARG1)\" is not an absolute URL that can be passed to an external application to open it." ; +}; + Resource SID_UNKNOWN { String 1 "-" ; diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 3b45dc69585b..ae5a6968e3f4 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -39,9 +39,8 @@ #include #include #include -#include +#include #include -#include #include #include #include @@ -108,6 +107,7 @@ #include #include #include +#include "openuriexternally.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::beans; @@ -115,7 +115,6 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; -using namespace ::com::sun::star::system; using namespace ::com::sun::star::task; using namespace ::com::sun::star::container; using namespace ::cppu; @@ -952,140 +951,100 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) if (!pFilter || !lcl_isFilterNativelySupported(*pFilter)) { // hyperlink does not link to own type => special handling (http, ftp) browser and (other external protocols) OS - Reference< XSystemShellExecute > xSystemShellExecute( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.system.SystemShellExecute"))), UNO_QUERY ); - if ( xSystemShellExecute.is() ) + if ( aINetProtocol == INET_PROT_MAILTO ) { - if ( aINetProtocol == INET_PROT_MAILTO ) - { - // don't dispatch mailto hyperlink to desktop dispatcher - rReq.RemoveItem( SID_TARGETNAME ); - rReq.AppendItem( SfxStringItem( SID_TARGETNAME, String::CreateFromAscii("_self") ) ); - } - else if ( aINetProtocol == INET_PROT_FTP || - aINetProtocol == INET_PROT_HTTP || - aINetProtocol == INET_PROT_HTTPS ) - { - try - { - // start browser - ::rtl::OUString aURLString( aURL.Complete ); - xSystemShellExecute->execute( aURLString, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS ); - } - catch ( ::com::sun::star::lang::IllegalArgumentException& ) - { - SolarMutexGuard aGuard; - Window *pWindow = SFX_APP()->GetTopWindow(); - ErrorBox( pWindow, SfxResId( MSG_ERR_NO_WEBBROWSER_FOUND )).Execute(); - } - catch ( ::com::sun::star::system::SystemShellExecuteException& ) - { - SolarMutexGuard aGuard; - Window *pWindow = SFX_APP()->GetTopWindow(); - ErrorBox( pWindow, SfxResId( MSG_ERR_NO_WEBBROWSER_FOUND )).Execute(); - } - - return; - } - else - { - // check for "internal" protocols that should not be forwarded to the system - Sequence < ::rtl::OUString > aProtocols(2); + // don't dispatch mailto hyperlink to desktop dispatcher + rReq.RemoveItem( SID_TARGETNAME ); + rReq.AppendItem( SfxStringItem( SID_TARGETNAME, String::CreateFromAscii("_self") ) ); + } + else if ( aINetProtocol == INET_PROT_FTP || + aINetProtocol == INET_PROT_HTTP || + aINetProtocol == INET_PROT_HTTPS ) + { + sfx2::openUriExternally(aURL.Complete, true); + return; + } + else + { + // check for "internal" protocols that should not be forwarded to the system + Sequence < ::rtl::OUString > aProtocols(2); - // add special protocols that always should be treated as internal - aProtocols[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:*")); - aProtocols[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.*")); + // add special protocols that always should be treated as internal + aProtocols[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:*")); + aProtocols[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.*")); - try + try + { + // get registered protocol handlers from configuration + Reference < XNameAccess > xAccess( ::comphelper::ConfigurationHelper::openConfig( ::comphelper::getProcessServiceFactory(), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.ProtocolHandler/HandlerSet")), ::comphelper::ConfigurationHelper::E_READONLY ), UNO_QUERY ); + if ( xAccess.is() ) { - // get registered protocol handlers from configuration - Reference < XNameAccess > xAccess( ::comphelper::ConfigurationHelper::openConfig( ::comphelper::getProcessServiceFactory(), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.ProtocolHandler/HandlerSet")), ::comphelper::ConfigurationHelper::E_READONLY ), UNO_QUERY ); - if ( xAccess.is() ) + Sequence < ::rtl::OUString > aNames = xAccess->getElementNames(); + for ( sal_Int32 nName = 0; nName < aNames.getLength(); nName ++) { - Sequence < ::rtl::OUString > aNames = xAccess->getElementNames(); - for ( sal_Int32 nName = 0; nName < aNames.getLength(); nName ++) + Reference < XPropertySet > xSet; + Any aRet = xAccess->getByName( aNames[nName] ); + aRet >>= xSet; + if ( xSet.is() ) { - Reference < XPropertySet > xSet; - Any aRet = xAccess->getByName( aNames[nName] ); - aRet >>= xSet; - if ( xSet.is() ) - { - // copy protocols - aRet = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Protocols")) ); - Sequence < ::rtl::OUString > aTmp; - aRet >>= aTmp; - - // todo: add operator+= to SequenceAsVector class and use SequenceAsVector for aProtocols - sal_Int32 nLength = aProtocols.getLength(); - aProtocols.realloc( nLength+aTmp.getLength() ); - for ( sal_Int32 n=0; ngetPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Protocols")) ); + Sequence < ::rtl::OUString > aTmp; + aRet >>= aTmp; + + // todo: add operator+= to SequenceAsVector class and use SequenceAsVector for aProtocols + sal_Int32 nLength = aProtocols.getLength(); + aProtocols.realloc( nLength+aTmp.getLength() ); + for ( sal_Int32 n=0; n we have to check the referer before executing - if (SFX_APP()->IsSecureURL(rtl::OUString(), &aReferer)) + // security reservation: => we have to check the referer before executing + if (SFX_APP()->IsSecureURL(rtl::OUString(), &aReferer)) + { + try { - ::rtl::OUString aURLString( aURL.Complete ); - - try - { - // give os this file - xSystemShellExecute->execute( aURLString, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS ); - } - catch ( ::com::sun::star::lang::IllegalArgumentException& ) - { - SolarMutexGuard aGuard; - Window *pWindow = SFX_APP()->GetTopWindow(); - ErrorBox( pWindow, SfxResId( MSG_ERR_NO_WEBBROWSER_FOUND )).Execute(); - } - catch ( ::com::sun::star::system::SystemShellExecuteException& ) - { - if ( !pFilter ) - { - SolarMutexGuard aGuard; - Window *pWindow = SFX_APP()->GetTopWindow(); - ErrorBox( pWindow, SfxResId( MSG_ERR_NO_WEBBROWSER_FOUND )).Execute(); - } - else - { - rReq.RemoveItem( SID_TARGETNAME ); - rReq.AppendItem( SfxStringItem( SID_TARGETNAME, String::CreateFromAscii("_default") ) ); - bLoadInternal = sal_True; - } - } + sfx2::openUriExternally( + aURL.Complete, pFilter == 0); } - else + catch ( ::com::sun::star::system::SystemShellExecuteException& ) { - SfxErrorContext aCtx( ERRCTX_SFX_OPENDOC, aURL.Complete ); - ErrorHandler::HandleError( ERRCODE_IO_ACCESSDENIED ); + rReq.RemoveItem( SID_TARGETNAME ); + rReq.AppendItem( SfxStringItem( SID_TARGETNAME, String::CreateFromAscii("_default") ) ); + bLoadInternal = sal_True; } - - if ( !bLoadInternal ) - return; } + else + { + SfxErrorContext aCtx( ERRCTX_SFX_OPENDOC, aURL.Complete ); + ErrorHandler::HandleError( ERRCODE_IO_ACCESSDENIED ); + } + + if ( !bLoadInternal ) + return; } } } diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index a5314b9c7f5c..f547e000da00 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -439,7 +439,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute") ), uno::UNO_QUERY_THROW ); - xSystemShellExecute->execute( sURL, ::rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::DEFAULTS ); + xSystemShellExecute->execute( sURL, ::rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY ); } catch ( uno::Exception& ) { @@ -1013,7 +1013,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) xSystemShell->execute( aURLBuf.makeStringAndClear(), ::rtl::OUString(), - css::system::SystemShellExecuteFlags::DEFAULTS ); + css::system::SystemShellExecuteFlags::URIS_ONLY ); } } catch( const ::com::sun::star::uno::Exception& ) diff --git a/sfx2/source/appl/openuriexternally.cxx b/sfx2/source/appl/openuriexternally.cxx new file mode 100644 index 000000000000..381946987844 --- /dev/null +++ b/sfx2/source/appl/openuriexternally.cxx @@ -0,0 +1,101 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * [ Copyright (C) 2012 Red Hat, Inc., Stephan Bergmann + * (initial developer) ] + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "sal/config.h" + +#include "com/sun/star/lang/IllegalArgumentException.hpp" +#include "com/sun/star/system/XSystemShellExecute.hpp" +#include "com/sun/star/system/SystemShellExecuteException.hpp" +#include "com/sun/star/system/SystemShellExecuteFlags.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "comphelper/processfactory.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sfx2/app.hxx" +#include "sfx2/sfxresid.hxx" +#include "tools/string.hxx" +#include "vcl/msgbox.hxx" +#include "vcl/svapp.hxx" + +#include "openuriexternally.hxx" + +#include "app.hrc" + +namespace { + +namespace css = com::sun::star; + +} + +bool sfx2::openUriExternally( + rtl::OUString const & uri, bool handleSystemShellExecuteException) +{ + css::uno::Reference< css::system::XSystemShellExecute > exec( + comphelper::getProcessServiceFactory()->createInstance( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.system.SystemShellExecute"))), + css::uno::UNO_QUERY_THROW); + try { + exec->execute( + uri, rtl::OUString(), + css::system::SystemShellExecuteFlags::URIS_ONLY); + return true; + } catch (css::lang::IllegalArgumentException & e) { + if (e.ArgumentPosition != 0) { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "unexpected IllegalArgumentException: ")) + + e.Message), + css::uno::Reference< css::uno::XInterface >()); + } + SolarMutexGuard g; + ErrorBox eb( + SfxGetpApp()->GetTopWindow(), SfxResId(MSG_ERR_NO_ABS_URI_REF)); + String msg(eb.GetMessText()); + msg.SearchAndReplaceAscii("$(ARG1)", uri); + eb.SetMessText(msg); + eb.Execute(); + } catch (css::system::SystemShellExecuteException &) { + if (!handleSystemShellExecuteException) { + throw; + } + SolarMutexGuard g; + ErrorBox( + SfxGetpApp()->GetTopWindow(), + SfxResId(MSG_ERR_NO_WEBBROWSER_FOUND)). + Execute(); + } + return false; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 9bf2be90cccb..9c6567b86407 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -690,7 +690,7 @@ static bool impl_showOnlineHelp( const String& rURL ) if ( xSystemShell.is() ) { - xSystemShell->execute( aHelpLink, rtl::OUString(), SystemShellExecuteFlags::DEFAULTS ); + xSystemShell->execute( aHelpLink, rtl::OUString(), SystemShellExecuteFlags::URIS_ONLY ); return true; } } diff --git a/sfx2/source/inc/openuriexternally.hxx b/sfx2/source/inc/openuriexternally.hxx new file mode 100644 index 000000000000..79a05a86b03d --- /dev/null +++ b/sfx2/source/inc/openuriexternally.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * [ Copyright (C) 2012 Red Hat, Inc., Stephan Bergmann + * (initial developer) ] + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef INCLUDED_SFX2_SOURCE_INC_OPENURIEXTERNALLY_HXX +#define INCLUDED_SFX2_SOURCE_INC_OPENURIEXTERNALLY_HXX + +#include "sal/config.h" + +namespace rtl { class OUString; } + +namespace sfx2 { + +/// Open a URI via com.sun.star.system.SystemShellExecute +/// +/// Handles XSystemShellExecute.execute's IllegalArgumentException (throwing a +/// RuntimeException if it is unexpected, i.e., not caused by the given uri not +/// being an absolute URI reference). +/// +/// Handles XSystemShellExecute.execute's SystemShellExecuteException unless the +/// given handleSystemShellExecuteException is false (in which case the +/// exception is re-thrown). +/// +/// @return true iff execution was successful +bool openUriExternally( + rtl::OUString const & uri, bool handleSystemShellExecuteException); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/view.hrc b/sfx2/source/view/view.hrc index 3dce1ec795bb..adcc3a811b92 100755 --- a/sfx2/source/view/view.hrc +++ b/sfx2/source/view/view.hrc @@ -63,7 +63,7 @@ #define MSG_QUERY_OPENASTEMPLATE (RID_SFX_VIEW_START+41) #define MSG_CANT_CLOSE (RID_SFX_VIEW_START+42) -#define MSG_ERROR_NO_WEBBROWSER_FOUND (RID_SFX_VIEW_START+43) + #define TP_FRAMEPROPERTIES (RID_SFX_VIEW_START+44) #define FT_FRAMENAME 3 diff --git a/sfx2/source/view/view.src b/sfx2/source/view/view.src index b4c09a0677ed..40a686248f1c 100644 --- a/sfx2/source/view/view.src +++ b/sfx2/source/view/view.src @@ -170,21 +170,3 @@ String STR_REPAIREDDOCUMENT { Text [ en-US ] = " (repaired document)" ; }; - -ErrorBox MSG_ERROR_NO_WEBBROWSER_FOUND -{ - BUTTONS = WB_OK ; - DEFBUTTON = WB_DEF_OK ; - Message[ en-US ] = "%PRODUCTNAME could not find a web browser on your system. Please check your Desktop Preferences or install a web browser (for example, Mozilla) in the default location requested during the browser installation." ; -}; - - - - - - - - - - - diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 66cf7ad61563..cbb5cdabf5b0 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -39,8 +39,6 @@ #include #include #include -#include -#include #include #include #include @@ -86,6 +84,7 @@ #include "workwin.hxx" #include #include +#include "openuriexternally.hxx" #include @@ -94,7 +93,6 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::util; -using namespace ::com::sun::star::system; using namespace ::cppu; namespace css = ::com::sun::star; @@ -728,28 +726,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) return; } - ::com::sun::star::uno::Reference< XSystemShellExecute > xSystemShellExecute( xSMGR->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.system.SystemShellExecute"))), - css::uno::UNO_QUERY ); - - sal_Bool bRet( sal_True ); - if ( xSystemShellExecute.is() ) - { - try - { - xSystemShellExecute->execute( - aFileURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS ); - } - catch (const uno::Exception&) - { - SolarMutexGuard aGuard; - Window *pParent = SFX_APP()->GetTopWindow(); - ErrorBox( pParent, SfxResId( MSG_ERROR_NO_WEBBROWSER_FOUND )).Execute(); - bRet = sal_False; - } - } - - rReq.Done(bRet); + rReq.Done(sfx2::openUriExternally(aFileURL, true)); break; } else diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx index 912132103cdd..3b41f5b7e1c1 100644 --- a/shell/source/unix/exec/shellexec.cxx +++ b/shell/source/unix/exec/shellexec.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include "uno/current_context.hxx" @@ -76,6 +77,8 @@ using namespace cppu; namespace // private { + namespace css = com::sun::star; + Sequence< OUString > SAL_CALL ShellExec_getSupportedServiceNames() { Sequence< OUString > aRet(1); @@ -132,10 +135,10 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar // DESKTOP_LAUNCH, see http://freedesktop.org/pipermail/xdg/2004-August/004489.html static const char *pDesktopLaunch = getenv( "DESKTOP_LAUNCH" ); - // Check whether aCommand contains a document url or not - sal_Int32 nIndex = aCommand.indexOf( OUString( RTL_CONSTASCII_USTRINGPARAM(":/") ) ); - - if( nIndex > 0 || 0 == aCommand.compareToAscii("mailto:", 7) ) + // Check whether aCommand contains an absolute URI reference: + css::uno::Reference< css::uri::XUriReference > uri( + css::uri::UriReferenceFactory::create(m_xContext)->parse(aCommand)); + if (uri.is() && uri->isAbsolute()) { // It seems to be a url .. // We need to re-encode file urls because osl_getFileURLFromSystemPath converts @@ -155,7 +158,29 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar } #ifdef MACOSX - aBuffer.append("open"); + //TODO: Using open(1) with an argument that syntactically is an absolute + // URI reference does not necessarily give expected results: + // 1 If the given URI reference matches a supported scheme (e.g., + // "mailto:foo"): + // 1.1 If it matches an existing pathname (relative to CWD): Results + // in "mailto:foo?\n[0]\tcancel\n[1]\tOpen the file\tmailto:foo\n[2]\t + // Open the URL\tmailto:foo\n\nWhich did you mean? Cancelled." on + // stderr and SystemShellExecuteException. + // 1.2 If it does not match an exitsting pathname (relative to CWD): + // Results in the corresponding application being opened with the given + // document (e.g., Mail with a New Message). + // 2 If the given URI reference does not match a supported scheme + // (e.g., "foo:bar"): + // 2.1 If it matches an existing pathname (relative to CWD) pointing to + // an executable: Results in execution of that executable. + // 2.2 If it matches an existing pathname (relative to CWD) pointing to + // a non-executable regular file: Results in opening it in TextEdit. + // 2.3 If it matches an existing pathname (relative to CWD) pointing to + // a directory: Results in opening it in Finder. + // 2.4 If it does not match an exitsting pathname (relative to CWD): + // Results in "The file /.../foo:bar does not exits." (where "/..." is + // the CWD) on stderr and SystemShellExecuteException. + aBuffer.append("open --"); #else // The url launchers are expected to be in the $BRAND_BASE_DIR/program // directory: @@ -233,6 +258,15 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar aLaunchBuffer.append(" "); escapeForShell(aLaunchBuffer, OUStringToOString(aURL, osl_getThreadTextEncoding())); } + } else if ((nFlags & css::system::SystemShellExecuteFlags::URIS_ONLY) != 0) + { + throw css::lang::IllegalArgumentException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "XSystemShellExecute.execute URIS_ONLY with non-absolute" + " URI reference ")) + + aCommand), + static_cast< cppu::OWeakObject * >(this), 0); } else { escapeForShell(aBuffer, OUStringToOString(aCommand, osl_getThreadTextEncoding())); aBuffer.append(" "); diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx index b4c656c1f9fa..d0c7a90b1e10 100644 --- a/shell/source/win32/SysShExec.cxx +++ b/shell/source/win32/SysShExec.cxx @@ -36,6 +36,7 @@ #include #include +#include #define WIN32_LEAN_AND_MEAN #if defined _MSC_VER @@ -79,6 +80,8 @@ using namespace cppu; namespace // private { + namespace css = com::sun::star; + Sequence< OUString > SAL_CALL SysShExec_getSupportedServiceNames() { Sequence< OUString > aRet(1); @@ -258,8 +261,9 @@ namespace // private //----------------------------------------------------------------------------------------- -CSysShExec::CSysShExec( ) : - WeakComponentImplHelper2< XSystemShellExecute, XServiceInfo >( m_aMutex ) +CSysShExec::CSysShExec( const Reference< css::uno::XComponentContext >& xContext ) : + WeakComponentImplHelper2< XSystemShellExecute, XServiceInfo >( m_aMutex ), + m_xContext(xContext) { /* * As this service is declared thread-affine, it is ensured to be called from a @@ -284,12 +288,28 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa static_cast< XSystemShellExecute* >( this ), 1 ); - if (!(nFlags >= DEFAULTS && nFlags <= NO_SYSTEM_ERROR_MESSAGE)) + if ((nFlags & ~(NO_SYSTEM_ERROR_MESSAGE | URIS_ONLY)) != 0) throw IllegalArgumentException( OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid Flags specified")), static_cast< XSystemShellExecute* >( this ), 3 ); + if ((nFlags & URIS_ONLY) != 0) + { + css::uno::Reference< css::uri::XUriReference > uri( + css::uri::UriReferenceFactory::create(m_xContext)->parse(aCommand)); + if (!(uri.is() && uri->isAbsolute())) + { + throw css::lang::IllegalArgumentException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "XSystemShellExecute.execute URIS_ONLY with" + " non-absolute URI reference ")) + + aCommand), + static_cast< cppu::OWeakObject * >(this), 0); + } + } + /* #i4789#; jump mark detection on system paths if the given command is a system path (not http or other uri schemes) and seems to have a jump mark diff --git a/shell/source/win32/SysShExec.hxx b/shell/source/win32/SysShExec.hxx index 84b9a746d076..3ba357f2ff1b 100644 --- a/shell/source/win32/SysShExec.hxx +++ b/shell/source/win32/SysShExec.hxx @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -55,8 +56,11 @@ class CSysShExec : com::sun::star::system::XSystemShellExecute, com::sun::star::lang::XServiceInfo > { + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; + public: - CSysShExec( ); + CSysShExec(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext); //------------------------------------------------ // XSystemShellExecute diff --git a/shell/source/win32/SysShentry.cxx b/shell/source/win32/SysShentry.cxx index 874be551aa59..37a93672249e 100644 --- a/shell/source/win32/SysShentry.cxx +++ b/shell/source/win32/SysShentry.cxx @@ -59,9 +59,9 @@ using com::sun::star::system::XSystemShellExecute; namespace { - Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& ) + Reference< XInterface > SAL_CALL createInstance( const Reference< XComponentContext >& xContext ) { - return Reference< XInterface >( static_cast< XSystemShellExecute* >( new CSysShExec( ) ) ); + return Reference< XInterface >( static_cast< XSystemShellExecute* >( new CSysShExec(xContext) ) ); } } @@ -72,19 +72,18 @@ extern "C" // returns a factory to create XFilePicker-Services //---------------------------------------------------------------------- -SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* /*pRegistryKey*/ ) +SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface*, uno_Interface* /*pRegistryKey*/ ) { void* pRet = 0; - if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, SYSSHEXEC_IMPL_NAME ) ) ) + if ( 0 == rtl_str_compare( pImplName, SYSSHEXEC_IMPL_NAME ) ) { Sequence< OUString > aSNS( 1 ); aSNS.getArray( )[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( SYSSHEXEC_SERVICE_NAME )); - Reference< XSingleServiceFactory > xFactory ( createOneInstanceFactory( - reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ), - OUString::createFromAscii( pImplName ), + Reference< XSingleComponentFactory > xFactory ( createSingleComponentFactory( createInstance, + OUString::createFromAscii( pImplName ), aSNS ) ); if ( xFactory.is() ) { diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index a2a8315a58da..fa15bf909c55 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -1696,7 +1696,7 @@ IMPL_LINK_NOARG(SvtDocumentTemplateDialog, OpenLinkHdl_Impl) RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ), uno::UNO_QUERY_THROW ); if ( xSystemShell.is() ) - xSystemShell->execute( sURL, ::rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::DEFAULTS ); + xSystemShell->execute( sURL, ::rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY ); EndDialog( RET_CANCEL ); } catch( const uno::Exception& e ) diff --git a/sw/source/ui/docvw/extedit.cxx b/sw/source/ui/docvw/extedit.cxx index 1063682d4198..98dc6aa495d6 100644 --- a/sw/source/ui/docvw/extedit.cxx +++ b/sw/source/ui/docvw/extedit.cxx @@ -96,7 +96,7 @@ void pWorker(void *pThreadData) uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute") ), uno::UNO_QUERY_THROW ); - xSystemShellExecute->execute( pData->fileName, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::DEFAULTS ); + xSystemShellExecute->execute( pData->fileName, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY ); } void EditWithExternalTool(GraphicObject *pGraphicObject, SwWrtShell *rSh) diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 23e5535700c6..49f7e5e6312a 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -844,7 +844,7 @@ void SwSpellPopup::Execute( sal_uInt16 nId ) ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute") ), uno::UNO_QUERY_THROW ); xSystemShellExecute->execute( sExplanationLink, rtl::OUString(), - com::sun::star::system::SystemShellExecuteFlags::DEFAULTS ); + com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY ); } catch (const uno::Exception&) { diff --git a/swext/mediawiki/src/com/sun/star/wiki/Helper.java b/swext/mediawiki/src/com/sun/star/wiki/Helper.java index 7ecd9ecb0e7c..e392811984cd 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/Helper.java +++ b/swext/mediawiki/src/com/sun/star/wiki/Helper.java @@ -708,7 +708,7 @@ public class Helper Object oSystemShell = xContext.getServiceManager().createInstanceWithContext( "com.sun.star.system.SystemShellExecute", xContext ); XSystemShellExecute xSystemShell = (XSystemShellExecute)UnoRuntime.queryInterface( XSystemShellExecute.class, oSystemShell ); if ( xSystemShell != null ) - xSystemShell.execute( sURL, "", SystemShellExecuteFlags.DEFAULTS ); + xSystemShell.execute( sURL, "", SystemShellExecuteFlags.URIS_ONLY ); } catch( Exception e ) { diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index f85bc3ce8da4..64a4ad8111b9 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -2979,7 +2979,7 @@ void VCLXFixedHyperlink::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve { // start browser xSystemShellExecute->execute( - sURL, ::rtl::OUString(), ::com::sun::star::system::SystemShellExecuteFlags::DEFAULTS ); + sURL, ::rtl::OUString(), ::com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY ); } catch( uno::Exception& ) { diff --git a/uui/source/newerverwarn.cxx b/uui/source/newerverwarn.cxx index 8ecc3190e255..a18825cd9e4c 100644 --- a/uui/source/newerverwarn.cxx +++ b/uui/source/newerverwarn.cxx @@ -113,7 +113,7 @@ IMPL_LINK_NOARG(NewerVersionWarningDialog, UpdateHdl) if ( xSystemShell.is() && !sNotifyURL.isEmpty() ) { xSystemShell->execute( - sNotifyURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS ); + sNotifyURL, ::rtl::OUString(), SystemShellExecuteFlags::URIS_ONLY ); } } else -- cgit