diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/Library_sfx.mk | 1 | ||||
-rwxr-xr-x | sfx2/source/appl/app.hrc | 2 | ||||
-rw-r--r-- | sfx2/source/appl/app.src | 7 | ||||
-rw-r--r-- | sfx2/source/appl/appopen.cxx | 195 | ||||
-rw-r--r-- | sfx2/source/appl/appserv.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/appl/openuriexternally.cxx | 101 | ||||
-rw-r--r-- | sfx2/source/appl/sfxhelp.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/inc/openuriexternally.hxx | 57 | ||||
-rwxr-xr-x | sfx2/source/view/view.hrc | 2 | ||||
-rw-r--r-- | sfx2/source/view/view.src | 18 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 27 |
11 files changed, 250 insertions, 166 deletions
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 <com/sun/star/frame/XDispatchResultListener.hpp> #include <com/sun/star/util/URL.hpp> #include <com/sun/star/util/XURLTransformer.hpp> -#include <com/sun/star/system/XSystemShellExecute.hpp> +#include <com/sun/star/system/SystemShellExecuteException.hpp> #include <com/sun/star/document/XTypeDetection.hpp> -#include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/document/UpdateDocMode.hpp> #include <com/sun/star/task/ErrorCodeRequest.hpp> @@ -108,6 +107,7 @@ #include <sfx2/docfac.hxx> #include <sfx2/event.hxx> #include <svl/svstdarr.hxx> +#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; n<aTmp.getLength(); n++ ) - aProtocols[(++nLength)-1] = aTmp[n]; - } + // 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; n<aTmp.getLength(); n++ ) + aProtocols[(++nLength)-1] = aTmp[n]; } } } - catch ( Exception& ) - { - // registered protocols could not be read - } + } + catch ( Exception& ) + { + // registered protocols could not be read + } - sal_Bool bFound = sal_False; - for ( sal_Int32 nProt=0; nProt<aProtocols.getLength(); nProt++ ) + sal_Bool bFound = sal_False; + for ( sal_Int32 nProt=0; nProt<aProtocols.getLength(); nProt++ ) + { + WildCard aPattern(aProtocols[nProt]); + if ( aPattern.Matches( aURL.Complete ) ) { - WildCard aPattern(aProtocols[nProt]); - if ( aPattern.Matches( aURL.Complete ) ) - { - bFound = sal_True; - break; - } + bFound = sal_True; + break; } + } - if ( !bFound ) - { - sal_Bool bLoadInternal = sal_False; + if ( !bFound ) + { + sal_Bool bLoadInternal = sal_False; - // security reservation: => 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 <sbergman@redhat.com> + * (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 <sbergman@redhat.com> + * (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 <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/embed/EmbedStates.hpp> #include <com/sun/star/embed/EmbedMisc.hpp> -#include <com/sun/star/system/XSystemShellExecute.hpp> -#include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/container/XContainerQuery.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> @@ -86,6 +84,7 @@ #include "workwin.hxx" #include <sfx2/objface.hxx> #include <sfx2/docfilt.hxx> +#include "openuriexternally.hxx" #include <comphelper/processfactory.hxx> @@ -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 |