summaryrefslogtreecommitdiff
path: root/shell/source/win32
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-03-16 11:16:14 +0100
committerStephan Bergmann <sbergman@redhat.com>2012-03-16 15:01:26 +0100
commitd4b67611c421ebe9b75284106fe389b434419961 (patch)
tree9aebc058ae712e5bb1953267261c28c5a929f306 /shell/source/win32
parent1a6b52a1bfc184524fc63d4a9d0b51055bf9af23 (diff)
Introduced SystemShellExecuteFlags::URIS_ONLY
Diffstat (limited to 'shell/source/win32')
-rw-r--r--shell/source/win32/SysShExec.cxx26
-rw-r--r--shell/source/win32/SysShExec.hxx6
-rw-r--r--shell/source/win32/SysShentry.cxx13
3 files changed, 34 insertions, 11 deletions
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 <sal/macros.h>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+#include <com/sun/star/uri/UriReferenceFactory.hpp>
#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 <cppuhelper/compbase2.hxx>
#include <osl/mutex.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/system/XSystemShellExecute.hpp>
@@ -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() )
{