diff options
Diffstat (limited to 'sfx2/source/doc/objmisc.cxx')
-rw-r--r-- | sfx2/source/doc/objmisc.cxx | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index cdb13902c3..dce679dd85 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -462,7 +462,7 @@ void SfxObjectShell::SetReadOnlyUI( sal_Bool bReadOnly ) void SfxObjectShell::SetReadOnly() { - // Let the document be completely readonly, means that the + // Let the document be completely readonly, means that the // medium open mode is adjusted accordingly, and the write lock // on the file is removed. @@ -471,13 +471,13 @@ void SfxObjectShell::SetReadOnly() sal_Bool bWasROUI = IsReadOnly(); pMedium->UnlockFile( sal_False ); - + // the storage-based mediums are already based on the temporary file // so UnlockFile has already closed the locking stream if ( !pMedium->HasStorage_Impl() && IsLoadingFinished() ) pMedium->CloseInStream(); - pMedium->SetOpenMode( SFX_STREAM_READONLY, pMedium->IsDirect(), sal_True ); + pMedium->SetOpenMode( SFX_STREAM_READONLY, pMedium->IsDirect(), sal_True ); pMedium->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) ); if ( !bWasROUI ) @@ -1700,7 +1700,7 @@ namespace } ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const ::rtl::OUString& _rScriptURL, - const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError ) + const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError, const ::com::sun::star::uno::Any* pCaller ) { OSL_TRACE( "in CallXScript" ); ErrCode nErr = ERRCODE_NONE; @@ -1731,7 +1731,16 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon // obtain the script, and execute it Reference< provider::XScript > xScript( xScriptProvider->getScript( _rScriptURL ), UNO_QUERY_THROW ); - + if ( pCaller && pCaller->hasValue() ) + { + Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY ); + if ( xProps.is() ) + { + Sequence< uno::Any > aArgs( 1 ); + aArgs[ 0 ] = *pCaller; + xProps->setPropertyValue( rtl::OUString::createFromAscii("Caller"), uno::makeAny( aArgs ) ); + } + } aRet = xScript->invoke( aParams, aOutParamIndex, aOutParam ); } catch ( const uno::Exception& ) @@ -1764,10 +1773,10 @@ ErrCode SfxObjectShell::CallXScript( const String& rScriptURL, aParams, ::com::sun::star::uno::Any& aRet, ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex, - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam - , bool bRaiseError ) + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& + aOutParam, bool bRaiseError, const ::com::sun::star::uno::Any* pCaller ) { - return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError ); + return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError, pCaller ); } //------------------------------------------------------------------------- |