From 3fdbf5935e0aff6350e861e868c7e0a12dd1bc8f Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 5 Nov 2015 09:30:03 +0200 Subject: use uno::Reference::set method instead of assignment Change-Id: I6cb508e392d5e194c80fc6d0927c86414e4ab05b --- stoc/source/implementationregistration/implreg.cxx | 2 +- stoc/source/inspect/introspection.cxx | 38 ++++----- stoc/source/invocation/invocation.cxx | 69 ++++++++-------- stoc/source/javaloader/javaloader.cxx | 3 +- stoc/source/javavm/javavm.cxx | 12 +-- stoc/source/uriproc/UriReferenceFactory.cxx | 3 +- .../javavm/jvm_interaction/interactionhandler.cxx | 4 +- .../registry_tdprovider/testregistrytdprovider.cxx | 93 +++++++++------------- stoc/test/testcorefl.cxx | 5 +- stoc/test/testintrosp.cxx | 3 +- stoc/test/testsmgr_cpnt.cxx | 2 +- svl/source/fsstor/fsstorage.cxx | 11 ++- svl/source/fsstor/ostreamcontainer.cxx | 18 ++--- svl/source/misc/sharecontrolfile.cxx | 10 +-- svl/source/misc/strmadpt.cxx | 3 +- svl/source/passwordcontainer/passwordcontainer.cxx | 2 +- 16 files changed, 125 insertions(+), 153 deletions(-) diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx index 671fffaaa0f8..dc1a17a0da70 100644 --- a/stoc/source/implementationregistration/implreg.cxx +++ b/stoc/source/implementationregistration/implreg.cxx @@ -1553,7 +1553,7 @@ sal_Bool ImplementationRegistration::revokeImplementation(const OUString& locati xRegistry = xReg; } else { - Reference < XPropertySet > xPropSet = Reference< XPropertySet >::query( m_xSMgr ); + Reference < XPropertySet > xPropSet( m_xSMgr, UNO_QUERY ); if( xPropSet.is() ) { try { Any aAny = xPropSet->getPropertyValue( spool().Registry ); diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index 175354c50f57..aedda924a1f9 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -886,7 +886,7 @@ Reference ImplIntrospectionAccess::getXElementAccess() if( !mxObjElementAccess.is() ) { aGuard.clear(); - Reference xElementAccess = Reference::query( mxIface ); + Reference xElementAccess( mxIface, UNO_QUERY ); aGuard.reset(); if( !mxObjElementAccess.is() ) mxObjElementAccess = xElementAccess; @@ -901,18 +901,18 @@ void ImplIntrospectionAccess::cacheXNameContainer() Reference xNameAccess; if (mpStaticImpl->mbNameContainer) { - xNameContainer = Reference::query( mxIface ); - xNameReplace = Reference::query( xNameContainer ); - xNameAccess = Reference::query( xNameContainer ); + xNameContainer.set( mxIface, UNO_QUERY ); + xNameReplace.set( xNameContainer, UNO_QUERY ); + xNameAccess.set( xNameContainer, UNO_QUERY ); } else if (mpStaticImpl->mbNameReplace) { - xNameReplace = Reference::query( mxIface ); - xNameAccess = Reference::query( xNameReplace ); + xNameReplace.set( mxIface, UNO_QUERY ); + xNameAccess.set( xNameReplace, UNO_QUERY ); } else if (mpStaticImpl->mbNameAccess) { - xNameAccess = Reference::query( mxIface ); + xNameAccess.set( mxIface, UNO_QUERY ); } { @@ -969,18 +969,18 @@ void ImplIntrospectionAccess::cacheXIndexContainer() Reference xIndexAccess; if (mpStaticImpl->mbIndexContainer) { - xIndexContainer = Reference::query( mxIface ); - xIndexReplace = Reference::query( xIndexContainer ); - xIndexAccess = Reference::query( xIndexContainer ); + xIndexContainer.set( mxIface, UNO_QUERY ); + xIndexReplace.set( xIndexContainer, UNO_QUERY ); + xIndexAccess.set( xIndexContainer, UNO_QUERY ); } else if (mpStaticImpl->mbIndexReplace) { - xIndexReplace = Reference::query( mxIface ); - xIndexAccess = Reference::query( xIndexReplace ); + xIndexReplace.set( mxIface, UNO_QUERY ); + xIndexAccess.set( xIndexReplace, UNO_QUERY ); } else if (mpStaticImpl->mbIndexAccess) { - xIndexAccess = Reference::query( mxIface ); + xIndexAccess.set( mxIface, UNO_QUERY ); } { @@ -1037,7 +1037,7 @@ Reference ImplIntrospectionAccess::getXEnumerationAccess() if( !mxObjEnumerationAccess.is() ) { aGuard.clear(); - Reference xEnumerationAccess = Reference::query( mxIface ); + Reference xEnumerationAccess( mxIface, UNO_QUERY ); aGuard.reset(); if( !mxObjEnumerationAccess.is() ) mxObjEnumerationAccess = xEnumerationAccess; @@ -1052,7 +1052,7 @@ Reference ImplIntrospectionAccess::getXIdlArray() if( !mxObjIdlArray.is() ) { aGuard.clear(); - Reference xIdlArray = Reference::query( mxIface ); + Reference xIdlArray( mxIface, UNO_QUERY ); aGuard.reset(); if( !mxObjIdlArray.is() ) mxObjIdlArray = xIdlArray; @@ -1763,7 +1763,7 @@ css::uno::Reference Implementation::inspect( // Look for interfaces XTypeProvider and PropertySet if( eType == TypeClass_INTERFACE ) { - xTypeProvider = Reference::query( x ); + xTypeProvider.set( x, UNO_QUERY ); if( xTypeProvider.is() ) { SupportedTypesSeq = xTypeProvider->getTypes(); @@ -1775,7 +1775,7 @@ css::uno::Reference Implementation::inspect( { if( pTypes[i].getTypeName() == "com.sun.star.beans.XPropertySet" ) { - xPropSet = Reference::query( x ); + xPropSet.set( x, UNO_QUERY ); break; } } @@ -1786,7 +1786,7 @@ css::uno::Reference Implementation::inspect( "object of type \"" << aToInspectObj.getValueTypeName() << "\" lacks XTypeProvider"); SupportedTypesSeq = Sequence(&aToInspectObj.getValueType(), 1); - xPropSet = Reference::query( x ); + xPropSet.set( x, UNO_QUERY ); } // Now try to get the PropertySetInfo @@ -1856,7 +1856,7 @@ css::uno::Reference Implementation::inspect( if( xPropSet.is() && xPropSetInfo.is() ) { // Is there also a FastPropertySet? - Reference xDummy = Reference::query( x ); + Reference xDummy( x, UNO_QUERY ); bool bFast = pAccess->mbFastPropSet = xDummy.is(); Sequence aPropSeq = xPropSetInfo->getProperties(); diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx index 42657baa9f5c..494fa4037b92 100644 --- a/stoc/source/invocation/invocation.cxx +++ b/stoc/source/invocation/invocation.cxx @@ -351,12 +351,12 @@ Any Invocation_Impl::getMaterial() throw(RuntimeException, std::exception) Reference xMaterialHolder; if( _xDirect.is() ) { - xMaterialHolder = Reference::query( _xDirect ); + xMaterialHolder.set( _xDirect, UNO_QUERY ); //_xDirect->queryInterface( XMaterialHolder::getSmartUik(), xMaterialHolder ); } else if( _xIntrospectionAccess.is() ) { - xMaterialHolder = Reference::query( _xIntrospectionAccess ); + xMaterialHolder.set( _xIntrospectionAccess, UNO_QUERY ); //_xIntrospectionAccess->queryInterface( XMaterialHolder::getSmartUik(), xMaterialHolder ); } if( xMaterialHolder.is() ) @@ -377,21 +377,21 @@ void Invocation_Impl::setMaterial( const Any& rMaterial ) _aMaterial = rMaterial; // First do this outside the guard - _xDirect = Reference::query( xObj ); + _xDirect.set( xObj, UNO_QUERY ); if( _xDirect.is() ) { // Consult object directly - _xElementAccess = Reference::query( _xDirect ); - _xEnumerationAccess = Reference::query( _xDirect ); - _xIndexAccess = Reference::query( _xDirect ); - _xIndexReplace = Reference::query( _xDirect ); - _xIndexContainer = Reference::query( _xDirect ); - _xNameAccess = Reference::query( _xDirect ); - _xNameReplace = Reference::query( _xDirect ); - _xNameContainer = Reference::query( _xDirect ); - _xENDirect = Reference::query( _xDirect ); - _xDirect2 = Reference::query( _xDirect ); + _xElementAccess.set( _xDirect, UNO_QUERY ); + _xEnumerationAccess.set( _xDirect, UNO_QUERY ); + _xIndexAccess.set( _xDirect, UNO_QUERY ); + _xIndexReplace.set( _xDirect, UNO_QUERY ); + _xIndexContainer.set( _xDirect, UNO_QUERY ); + _xNameAccess.set( _xDirect, UNO_QUERY ); + _xNameReplace.set( _xDirect, UNO_QUERY ); + _xNameContainer.set( _xDirect, UNO_QUERY ); + _xENDirect.set( _xDirect, UNO_QUERY ); + _xDirect2.set( _xDirect, UNO_QUERY ); // only once!!! //_xIntrospectionAccess = XIntrospectionAccessRef(); @@ -405,52 +405,51 @@ void Invocation_Impl::setMaterial( const Any& rMaterial ) _xIntrospectionAccess = xIntrospection->inspect( _aMaterial ); if( _xIntrospectionAccess.is() ) { - _xElementAccess = Reference::query( + _xElementAccess.set( _xIntrospectionAccess->queryAdapter( - cppu::UnoType::get()) ); + cppu::UnoType::get()), UNO_QUERY ); if( _xElementAccess.is() ) { - _xEnumerationAccess = Reference::query( + _xEnumerationAccess.set( _xIntrospectionAccess->queryAdapter( - cppu::UnoType::get()) ); + cppu::UnoType::get()), UNO_QUERY ); - _xIndexAccess = Reference::query( + _xIndexAccess.set( _xIntrospectionAccess->queryAdapter( - cppu::UnoType::get()) ); + cppu::UnoType::get()), UNO_QUERY ); if( _xIndexAccess.is() ) { - _xIndexReplace = Reference::query( + _xIndexReplace.set( _xIntrospectionAccess->queryAdapter( - cppu::UnoType::get()) ); + cppu::UnoType::get()), UNO_QUERY ); - _xIndexContainer = Reference::query( + _xIndexContainer.set( _xIntrospectionAccess->queryAdapter( - cppu::UnoType::get()) ); + cppu::UnoType::get()), UNO_QUERY ); } - _xNameAccess = Reference::query( + _xNameAccess.set( _xIntrospectionAccess->queryAdapter( - cppu::UnoType::get()) ); + cppu::UnoType::get()), UNO_QUERY ); if( _xNameAccess.is() ) { - _xNameReplace = Reference::query( + _xNameReplace.set( _xIntrospectionAccess->queryAdapter( - cppu::UnoType::get()) ); + cppu::UnoType::get()), UNO_QUERY ); - _xNameContainer = Reference::query( + _xNameContainer.set( _xIntrospectionAccess->queryAdapter( - cppu::UnoType::get()) ); + cppu::UnoType::get()), UNO_QUERY ); } } - _xPropertySet = Reference::query( - _xIntrospectionAccess->queryAdapter( - cppu::UnoType::get()) ); + _xPropertySet.set( _xIntrospectionAccess->queryAdapter( cppu::UnoType::get()), + UNO_QUERY ); - _xENIntrospection = Reference::query( _xIntrospectionAccess ); + _xENIntrospection.set( _xIntrospectionAccess, UNO_QUERY ); } } /* only once !!! @@ -1114,7 +1113,7 @@ InvocationService::InvocationService( const Reference & xCtx , mxSMgr( xCtx->getServiceManager() ) , xCoreReflection( css::reflection::theCoreReflection::get(mxCtx) ) { - xTypeConverter = Reference( + xTypeConverter.set( mxSMgr->createInstanceWithContext( "com.sun.star.script.Converter", xCtx ), UNO_QUERY ); xIntrospection = theIntrospection::get(xCtx); @@ -1169,7 +1168,7 @@ Reference InvocationService::createInstanceWithArguments( Reference SAL_CALL InvocationService_CreateInstance( const Reference & xCtx ) throw( RuntimeException ) { - Reference xService = Reference< XInterface > ( *new InvocationService( xCtx ) ); + Reference xService( *new InvocationService( xCtx ) ); return xService; } diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx index 684d96761db3..a602619607fa 100644 --- a/stoc/source/javaloader/javaloader.cxx +++ b/stoc/source/javaloader/javaloader.cxx @@ -247,8 +247,7 @@ const css::uno::Reference & JavaComponentLoader::getJavaL throw RuntimeException( "javaloader error - no type information for XImplementationLoader"); - m_javaLoader = css::uno::Reference(static_cast( - java_curr.mapInterface(joJavaLoader, pType_XImplementationLoader))); + m_javaLoader.set(static_cast(java_curr.mapInterface(joJavaLoader, pType_XImplementationLoader))); pJNIEnv->DeleteLocalRef( joJavaLoader ); if(!m_javaLoader.is()) throw RuntimeException( diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index 9d1571186a47..0bcad2c3ac2e 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -152,8 +152,7 @@ css::uno::Reference< css::uno::XInterface > SingletonFactory::getSingleton( { if (m_bDisposed) throw css::lang::DisposedException(); - xComponent = css::uno::Reference< css::lang::XComponent >( - rContext, css::uno::UNO_QUERY_THROW); + xComponent.set( rContext, css::uno::UNO_QUERY_THROW); m_xSingleton = static_cast< cppu::OWeakObject * >( new JavaVirtualMachine(rContext)); } @@ -183,8 +182,7 @@ void SingletonFactory::dispose() css::uno::Reference< css::lang::XComponent > xComponent; { osl::MutexGuard aGuard(m_aMutex); - xComponent = css::uno::Reference< css::lang::XComponent >( - m_xSingleton, css::uno::UNO_QUERY); + xComponent.set( m_xSingleton, css::uno::UNO_QUERY); m_xSingleton.clear(); m_bDisposed = true; } @@ -1349,8 +1347,7 @@ void JavaVirtualMachine::registerConfigChangesListener() css::uno::makeAny( (sal_Int32)-1), css::beans::PropertyState_DIRECT_VALUE); - m_xInetConfiguration - = css::uno::Reference< css::container::XContainer >( + m_xInetConfiguration.set( xConfigProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", aArguments), @@ -1373,8 +1370,7 @@ void JavaVirtualMachine::registerConfigChangesListener() css::uno::makeAny( (sal_Int32)-1), css::beans::PropertyState_DIRECT_VALUE); - m_xJavaConfiguration - = css::uno::Reference< css::container::XContainer >( + m_xJavaConfiguration.set( xConfigProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", aArguments2), diff --git a/stoc/source/uriproc/UriReferenceFactory.cxx b/stoc/source/uriproc/UriReferenceFactory.cxx index 16ffe39ed597..021a80651e58 100644 --- a/stoc/source/uriproc/UriReferenceFactory.cxx +++ b/stoc/source/uriproc/UriReferenceFactory.cxx @@ -381,8 +381,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::parse( css::uno::makeAny(e)); //TODO: preserve type of e } if (service.is()) { - parser = css::uno::Reference< css::uri::XUriSchemeParser >( - service, css::uno::UNO_QUERY_THROW); + parser.set( service, css::uno::UNO_QUERY_THROW); } } } diff --git a/stoc/test/javavm/jvm_interaction/interactionhandler.cxx b/stoc/test/javavm/jvm_interaction/interactionhandler.cxx index 39a6305c5829..b8dd3819cc52 100644 --- a/stoc/test/javavm/jvm_interaction/interactionhandler.cxx +++ b/stoc/test/javavm/jvm_interaction/interactionhandler.cxx @@ -94,13 +94,13 @@ void SAL_CALL InteractionHandler::handle( const Reference< XInteractionRequest > for (sal_Int32 i= 0; i < seqCont.getLength(); i++) { - abort= Reference::query( seqCont[i]); + abort.set( seqCont[i], UNO_QUERY ); if(abort.is()) break; } for (sal_Int32 i= 0; i < seqCont.getLength(); i++) { - retry= Reference::query( seqCont[i]); + retry.set( seqCont[i], UNO_QUERY ); if(retry.is()) break; } diff --git a/stoc/test/registry_tdprovider/testregistrytdprovider.cxx b/stoc/test/registry_tdprovider/testregistrytdprovider.cxx index f6fd89843b19..359c4b789f3b 100644 --- a/stoc/test/registry_tdprovider/testregistrytdprovider.cxx +++ b/stoc/test/registry_tdprovider/testregistrytdprovider.cxx @@ -151,8 +151,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) OUString( "com.sun.star.uno.XComponentContext::getValueByName"))); css::uno::Reference< css::reflection::XCompoundTypeDescription > exception; - exception - = css::uno::Reference< css::reflection::XCompoundTypeDescription >( + exception.set( provider->getByHierarchicalName( OUString( "com.sun.star.uno.Exception")), css::uno::UNO_QUERY_THROW); @@ -160,8 +159,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) assertEqual( OUString( "com.sun.star.uno.Exception"), exception->getName()); assertFalse(exception->getBaseType().is()); - exception - = css::uno::Reference< css::reflection::XCompoundTypeDescription >( + exception.set( provider->getByHierarchicalName( OUString( "com.sun.star.uno.RuntimeException")), css::uno::UNO_QUERY_THROW); @@ -173,7 +171,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::Reference< css::reflection::XStructTypeDescription > structure; - structure = css::uno::Reference< css::reflection::XStructTypeDescription >( + structure.set( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Struct2")), css::uno::UNO_QUERY_THROW); @@ -192,7 +190,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) assertEqual< sal_Int32 >(0, structure->getTypeParameters().getLength()); assertEqual< sal_Int32 >(0, structure->getTypeArguments().getLength()); - structure = css::uno::Reference< css::reflection::XStructTypeDescription >( + structure.set( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Struct3")), css::uno::UNO_QUERY_THROW); @@ -221,7 +219,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) structure->getTypeParameters()[1]); assertEqual< sal_Int32 >(0, structure->getTypeArguments().getLength()); - structure = css::uno::Reference< css::reflection::XStructTypeDescription >( + structure.set( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Struct4")), css::uno::UNO_QUERY_THROW); @@ -248,8 +246,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::Reference< css::reflection::XInterfaceTypeDescription2 > interface; - interface - = css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >( + interface.set( provider->getByHierarchicalName( OUString( "test.registrytdprovider.XTest1")), css::uno::UNO_QUERY_THROW); @@ -289,9 +286,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::Reference< css::reflection::XInterfaceMethodTypeDescription > method; - attribute = css::uno::Reference< - css::reflection::XInterfaceAttributeTypeDescription2 >( - members[0], css::uno::UNO_QUERY_THROW); + attribute.set( members[0], css::uno::UNO_QUERY_THROW); assertEqual( css::uno::TypeClass_INTERFACE_ATTRIBUTE, attribute->getTypeClass()); assertEqual( @@ -311,9 +306,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) setExceptions = attribute->getSetExceptions(); assertEqual< sal_Int32 >(0, setExceptions.getLength()); - attribute = css::uno::Reference< - css::reflection::XInterfaceAttributeTypeDescription2 >( - members[1], css::uno::UNO_QUERY_THROW); + attribute.set( members[1], css::uno::UNO_QUERY_THROW); assertEqual( css::uno::TypeClass_INTERFACE_ATTRIBUTE, attribute->getTypeClass()); assertEqual( @@ -345,9 +338,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) OUString( "com.sun.star.lang.WrappedTargetException"), setExceptions[1]->getName()); - attribute = css::uno::Reference< - css::reflection::XInterfaceAttributeTypeDescription2 >( - members[2], css::uno::UNO_QUERY_THROW); + attribute.set( members[2], css::uno::UNO_QUERY_THROW); assertEqual( css::uno::TypeClass_INTERFACE_ATTRIBUTE, attribute->getTypeClass()); assertEqual( @@ -371,9 +362,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) setExceptions = attribute->getSetExceptions(); assertEqual< sal_Int32 >(0, setExceptions.getLength()); - method = css::uno::Reference< - css::reflection::XInterfaceMethodTypeDescription >( - members[3], css::uno::UNO_QUERY_THROW); + method.set( members[3], css::uno::UNO_QUERY_THROW); assertEqual(css::uno::TypeClass_INTERFACE_METHOD, method->getTypeClass()); assertEqual( OUString( "test.registrytdprovider.XTest1::f1"), @@ -398,9 +387,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) OUString( "com.sun.star.uno.RuntimeException"), method->getExceptions()[0]->getName()); - method = css::uno::Reference< - css::reflection::XInterfaceMethodTypeDescription >( - members[4], css::uno::UNO_QUERY_THROW); + method.set( members[4], css::uno::UNO_QUERY_THROW); assertEqual(css::uno::TypeClass_INTERFACE_METHOD, method->getTypeClass()); assertEqual( OUString( "test.registrytdprovider.XTest1::f2"), @@ -413,8 +400,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) assertEqual< sal_Int32 >(0, method->getParameters().getLength()); assertEqual< sal_Int32 >(0, method->getExceptions().getLength()); - interface - = css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >( + interface.set( provider->getByHierarchicalName( OUString( "test.registrytdprovider.XTest2")), css::uno::UNO_QUERY_THROW); @@ -431,7 +417,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::Reference< css::reflection::XServiceTypeDescription2 > service; - service = css::uno::Reference< css::reflection::XServiceTypeDescription2 >( + service.set( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Service1")), css::uno::UNO_QUERY_THROW); @@ -483,7 +469,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) OUString( "com.sun.star.uno.RuntimeException"), service->getConstructors()[1]->getExceptions()[0]->getName()); - service = css::uno::Reference< css::reflection::XServiceTypeDescription2 >( + service.set( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Service2")), css::uno::UNO_QUERY_THROW); @@ -505,7 +491,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) assertFalse(service->getInterface().is()); assertEqual< sal_Int32 >(0, service->getConstructors().getLength()); - service = css::uno::Reference< css::reflection::XServiceTypeDescription2 >( + service.set( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Service3")), css::uno::UNO_QUERY_THROW); @@ -528,8 +514,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::Reference< css::reflection::XSingletonTypeDescription2 > singleton; - singleton = css::uno::Reference< - css::reflection::XSingletonTypeDescription2 >( + singleton.set( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Singleton1")), css::uno::UNO_QUERY_THROW); @@ -545,8 +530,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) "test.registrytdprovider.XTest1"), singleton->getInterface()->getName()); - singleton = css::uno::Reference< - css::reflection::XSingletonTypeDescription2 >( + singleton.set( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Singleton2")), css::uno::UNO_QUERY_THROW); @@ -562,8 +546,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) assertEqual< bool >(false, singleton->isInterfaceBased()); assertFalse(singleton->getInterface().is()); - singleton = css::uno::Reference< - css::reflection::XSingletonTypeDescription2 >( + singleton.set( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Singleton3")), css::uno::UNO_QUERY_THROW); @@ -580,7 +563,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) singleton->getInterface()->getName()); css::uno::Reference< css::reflection::XPublished > published; - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Enum1")), @@ -588,7 +571,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::UNO_QUERY); assertTrue(published.is()); assertTrue(published->isPublished()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Enum2")), @@ -596,7 +579,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::UNO_QUERY); assertTrue(published.is()); assertFalse(published->isPublished()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Struct1")), @@ -604,7 +587,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::UNO_QUERY); assertTrue(published.is()); assertTrue(published->isPublished()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Struct2")), @@ -612,7 +595,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::UNO_QUERY); assertTrue(published.is()); assertFalse(published->isPublished()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Struct3")), @@ -620,14 +603,14 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::UNO_QUERY); assertTrue(published.is()); assertTrue(published->isPublished()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XStructTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Struct3")), css::uno::UNO_QUERY_THROW)->getMemberTypes()[0], css::uno::UNO_QUERY); assertFalse(published.is()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Struct3a")), @@ -635,7 +618,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::UNO_QUERY); assertTrue(published.is()); assertFalse(published->isPublished()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Exception1")), @@ -643,7 +626,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::UNO_QUERY); assertTrue(published.is()); assertTrue(published->isPublished()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Exception2")), @@ -651,7 +634,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::UNO_QUERY); assertTrue(published.is()); assertFalse(published->isPublished()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.XTest1")), @@ -659,7 +642,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::UNO_QUERY); assertTrue(published.is()); assertTrue(published->isPublished()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.XTest2")), @@ -667,7 +650,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::UNO_QUERY); assertTrue(published.is()); assertFalse(published->isPublished()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Typedef1")), @@ -675,7 +658,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::UNO_QUERY); assertTrue(published.is()); assertTrue(published->isPublished()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Typedef2")), @@ -687,7 +670,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) // test.registrytdprovider.Const2 (unpublished), and // test.registrytdprovider.Consts1.C (no XPublished), which are not // accessible via provider->getByHierarchicalName (see #i31428) - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Consts1")), @@ -695,7 +678,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::UNO_QUERY); assertTrue(published.is()); assertTrue(published->isPublished()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Consts2")), @@ -703,14 +686,14 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::UNO_QUERY); assertTrue(published.is()); assertFalse(published->isPublished()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider")), css::uno::UNO_QUERY_THROW), css::uno::UNO_QUERY); assertFalse(published.is()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Service1")), @@ -718,7 +701,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::UNO_QUERY); assertTrue(published.is()); assertTrue(published->isPublished()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Service2")), @@ -726,7 +709,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::UNO_QUERY); assertTrue(published.is()); assertFalse(published->isPublished()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Singleton2")), @@ -734,7 +717,7 @@ sal_Int32 Service::run(css::uno::Sequence< OUString > const &) css::uno::UNO_QUERY); assertTrue(published.is()); assertTrue(published->isPublished()); - published = css::uno::Reference< css::reflection::XPublished >( + published.set( css::uno::Reference< css::reflection::XTypeDescription >( provider->getByHierarchicalName( OUString( "test.registrytdprovider.Singleton1")), diff --git a/stoc/test/testcorefl.cxx b/stoc/test/testcorefl.cxx index 5fbd2cbdfd75..3d875b94efc7 100644 --- a/stoc/test/testcorefl.cxx +++ b/stoc/test/testcorefl.cxx @@ -246,7 +246,7 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) Any blup; blup <<= aStructC; Any gulp; - rField = Reference< XIdlField2 > ( xRefl->forName("ModuleA.StructC")->getField(OUString("aString")) , UNO_QUERY); + rField.set( xRefl->forName("ModuleA.StructC")->getField(OUString("aString")) , UNO_QUERY); rField->set( blup, gulp); OSL_ENSURE(sal_False, "test_RegCoreReflection(): error 64"); return sal_False; @@ -262,8 +262,7 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) gulp <<= 3.14f; Any blup; blup <<= aStructC; - rField = Reference< XIdlField2 > ( - xRefl->forName("ModuleA.StructC")->getField(OUString("aString")) , UNO_QUERY); + rField.set( xRefl->forName("ModuleA.StructC")->getField(OUString("aString")) , UNO_QUERY); xRefl->forName("ModuleA.StructC")->getField(OUString("aString"))->set(blup, gulp); OSL_ENSURE(sal_False, "test_RegCoreReflection(): error 65"); return sal_False; diff --git a/stoc/test/testintrosp.cxx b/stoc/test/testintrosp.cxx index 2aedac97cf5f..a3f694bb3bfc 100644 --- a/stoc/test/testintrosp.cxx +++ b/stoc/test/testintrosp.cxx @@ -70,8 +70,7 @@ Reference TypeToIdlClass( const Type& rType, const Reference< XMultiS OUString sOWName( pTD->pTypeName ); if( !xRefl.is() ) { - xRefl = Reference< XIdlReflection >( xMgr->createInstance( - "com.sun.star.reflection.CoreReflection" ), UNO_QUERY ); + xRefl.set( xMgr->createInstance( "com.sun.star.reflection.CoreReflection" ), UNO_QUERY ); OSL_ENSURE( xRefl.is(), "### no corereflection!" ); } xRetClass = xRefl->forName( sOWName ); diff --git a/stoc/test/testsmgr_cpnt.cxx b/stoc/test/testsmgr_cpnt.cxx index 9fb7a64d813e..8540061650f5 100644 --- a/stoc/test/testsmgr_cpnt.cxx +++ b/stoc/test/testsmgr_cpnt.cxx @@ -203,7 +203,7 @@ extern "C" void SAL_CALL test_ServiceManager() Reference xImplEnum(xSMgr, UNO_QUERY); OSL_ENSURE( xImplEnum.is() , "query on XEnumeration failed" ); - xEnum = Reference(xImplEnum->createEnumeration()); + xEnum.set(xImplEnum->createEnumeration()); OSL_ENSURE( xEnum.is() , "createEnumeration failed" ); nLen = 0; while( xEnum->hasMoreElements() ) diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx index cbe3664b9c15..86ba08f7218e 100644 --- a/svl/source/fsstor/fsstorage.cxx +++ b/svl/source/fsstor/fsstorage.cxx @@ -410,7 +410,7 @@ uno::Reference< io::XStream > SAL_CALL FSStorage::openStreamElement( if ( pStream ) { if ( !pStream->GetError() ) - xResult = uno::Reference < io::XStream >( new ::utl::OStreamWrapper( *pStream ) ); + xResult.set( new ::utl::OStreamWrapper( *pStream ) ); else delete pStream; } @@ -540,11 +540,10 @@ uno::Reference< embed::XStorage > SAL_CALL FSStorage::openStorageElement( throw io::IOException(); // there is no such folder ::ucbhelper::Content aResultContent( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, comphelper::getProcessComponentContext() ); - xResult = uno::Reference< embed::XStorage >( - static_cast< OWeakObject* >( new FSStorage( aResultContent, - nStorageMode, - m_pImpl->m_xContext ) ), - uno::UNO_QUERY ); + xResult.set( static_cast< OWeakObject* >( new FSStorage( aResultContent, + nStorageMode, + m_pImpl->m_xContext ) ), + uno::UNO_QUERY ); } catch( embed::InvalidStorageException& ) { diff --git a/svl/source/fsstor/ostreamcontainer.cxx b/svl/source/fsstor/ostreamcontainer.cxx index 48fafcde9460..5ed416ee3a33 100644 --- a/svl/source/fsstor/ostreamcontainer.cxx +++ b/svl/source/fsstor/ostreamcontainer.cxx @@ -37,20 +37,20 @@ OFSStreamContainer::OFSStreamContainer( const uno::Reference < io::XStream >& xS if ( !m_xStream.is() ) throw uno::RuntimeException(); - m_xSeekable = uno::Reference< io::XSeekable >( xStream, uno::UNO_QUERY ); + m_xSeekable.set( xStream, uno::UNO_QUERY ); m_xInputStream = xStream->getInputStream(); m_xOutputStream = xStream->getOutputStream(); - m_xTruncate = uno::Reference< io::XTruncate >( m_xOutputStream, uno::UNO_QUERY ); - m_xAsyncOutputMonitor = uno::Reference< io::XAsyncOutputMonitor >( m_xOutputStream, uno::UNO_QUERY ); + m_xTruncate.set( m_xOutputStream, uno::UNO_QUERY ); + m_xAsyncOutputMonitor.set( m_xOutputStream, uno::UNO_QUERY ); } catch( uno::Exception& ) { - m_xStream = uno::Reference< io::XStream >(); - m_xSeekable = uno::Reference< io::XSeekable >(); - m_xInputStream = uno::Reference< io::XInputStream >(); - m_xOutputStream = uno::Reference< io::XOutputStream >(); - m_xTruncate = uno::Reference< io::XTruncate >(); - m_xAsyncOutputMonitor = uno::Reference< io::XAsyncOutputMonitor >(); + m_xStream.clear(); + m_xSeekable.clear(); + m_xInputStream.clear(); + m_xOutputStream.clear(); + m_xTruncate.clear(); + m_xAsyncOutputMonitor.clear(); } } diff --git a/svl/source/misc/sharecontrolfile.cxx b/svl/source/misc/sharecontrolfile.cxx index 009eceac7276..aa11ebce8b49 100644 --- a/svl/source/misc/sharecontrolfile.cxx +++ b/svl/source/misc/sharecontrolfile.cxx @@ -144,11 +144,11 @@ void ShareControlFile::Close() catch( uno::Exception& ) {} - m_xStream = uno::Reference< io::XStream >(); - m_xInputStream = uno::Reference< io::XInputStream >(); - m_xOutputStream = uno::Reference< io::XOutputStream >(); - m_xSeekable = uno::Reference< io::XSeekable >(); - m_xTruncate = uno::Reference< io::XTruncate >(); + m_xStream.clear(); + m_xInputStream.clear(); + m_xOutputStream.clear(); + m_xSeekable.clear(); + m_xTruncate.clear(); m_aUsersData.clear(); } } diff --git a/svl/source/misc/strmadpt.cxx b/svl/source/misc/strmadpt.cxx index 399a4cc03efd..a661bfa32755 100644 --- a/svl/source/misc/strmadpt.cxx +++ b/svl/source/misc/strmadpt.cxx @@ -222,8 +222,7 @@ bool SvInputStream::open() SetError(ERRCODE_IO_INVALIDDEVICE); return false; } - m_xSeekable - = uno::Reference< io::XSeekable >(m_xStream, uno::UNO_QUERY); + m_xSeekable.set(m_xStream, uno::UNO_QUERY); if (!m_xSeekable.is()) m_pPipe = new SvDataPipe_Impl; } diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index bd9bd61cd897..4aae066a5b82 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -395,7 +395,7 @@ PasswordContainer::PasswordContainer( const Reference& xSe // m_pStorageFile->Notify() can be called ::osl::MutexGuard aGuard( mMutex ); - mComponent = Reference< XComponent >( xServiceFactory, UNO_QUERY ); + mComponent.set( xServiceFactory, UNO_QUERY ); mComponent->addEventListener( this ); m_pStorageFile = new StorageItem( this, OUString("Office.Common/Passwords") ); -- cgit