From a0e8e05008e143ee5e3bbc281d1c253c7e5ed136 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 3 May 2016 08:39:03 +0200 Subject: use Any constructor instead of temporaries (cherry picked from commit 58a32075ca4f457f570af75aef368dd6c389aca7) Change-Id: Iffb82a2cee1a28d89eeea2b905aaa14086ee475a --- basic/source/classes/sbunoobj.cxx | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'basic') diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index d653720269e6..5ab19959df38 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -262,9 +262,7 @@ SbUnoObject* createOLEObject_Impl( const OUString& aType ) Reference< XInterface > xOLEObject = xOLEFactory->createInstance( aOLEType ); if( xOLEObject.is() ) { - Any aAny; - aAny <<= xOLEObject; - pUnoObj = new SbUnoObject( aType, aAny ); + pUnoObj = new SbUnoObject( aType, Any(xOLEObject) ); OUString sDfltPropName; if ( SbUnoObject::getDefaultPropName( pUnoObj, sDfltPropName ) ) @@ -2994,11 +2992,8 @@ void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, bool bWrite ) SbxVariableRef refVar = rPar.Get(0); if( xInterface.is() ) { - Any aAny; - aAny <<= xInterface; - // Create a SbUnoObject out of it and return it - SbUnoObjectRef xUnoObj = new SbUnoObject( aServiceName, aAny ); + SbUnoObjectRef xUnoObj = new SbUnoObject( aServiceName, Any(xInterface) ); if( xUnoObj->getUnoAny().getValueType().getTypeClass() != TypeClass_VOID ) { // return the object @@ -3049,11 +3044,8 @@ void RTL_Impl_CreateUnoServiceWithArguments( StarBASIC* pBasic, SbxArray& rPar, SbxVariableRef refVar = rPar.Get(0); if( xInterface.is() ) { - Any aAny; - aAny <<= xInterface; - // Create a SbUnoObject out of it and return it - SbUnoObjectRef xUnoObj = new SbUnoObject( aServiceName, aAny ); + SbUnoObjectRef xUnoObj = new SbUnoObject( aServiceName, Any(xInterface) ); if( xUnoObj->getUnoAny().getValueType().getTypeClass() != TypeClass_VOID ) { // return the object @@ -3079,11 +3071,9 @@ void RTL_Impl_GetProcessServiceManager( StarBASIC* pBasic, SbxArray& rPar, bool // get the global service manager Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() ); - Any aAny; - aAny <<= xFactory; // Create a SbUnoObject out of it and return it - SbUnoObjectRef xUnoObj = new SbUnoObject( OUString( "ProcessServiceManager" ), aAny ); + SbUnoObjectRef xUnoObj = new SbUnoObject( OUString( "ProcessServiceManager" ), Any(xFactory) ); refVar->PutObject( static_cast(xUnoObj) ); } -- cgit