From cb4fa1d1e2e61b686442a9d26220c0f1a6e1d4e7 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 30 Oct 2015 07:59:06 +0200 Subject: use uno::Reference::set method instead of assignment Change-Id: I080668f86f0ab8b3bba857ee21411f907ae285c4 --- comphelper/source/container/container.cxx | 2 +- .../source/container/embeddedobjectcontainer.cxx | 21 +++++++++------------ .../source/eventattachermgr/eventattachermgr.cxx | 2 +- comphelper/source/misc/dispatchcommand.cxx | 2 +- comphelper/source/misc/instancelocker.cxx | 6 +++--- comphelper/source/misc/logging.cxx | 2 +- comphelper/source/misc/mimeconfighelper.cxx | 9 ++++----- comphelper/source/streaming/seekableinput.cxx | 8 ++++---- comphelper/source/streaming/seqinputstreamserv.cxx | 4 ++-- comphelper/source/streaming/seqoutputstreamserv.cxx | 2 +- 10 files changed, 27 insertions(+), 31 deletions(-) (limited to 'comphelper') diff --git a/comphelper/source/container/container.cxx b/comphelper/source/container/container.cxx index 9bd468e9d450..a8bd89639451 100644 --- a/comphelper/source/container/container.cxx +++ b/comphelper/source/container/container.cxx @@ -79,7 +79,7 @@ css::uno::Reference< css::uno::XInterface> IndexAccessIterator::Next() OSL_ENSURE(xChild.is(), "IndexAccessIterator::Next : a content has no appropriate interface !"); css::uno::Reference< css::uno::XInterface> xParent( xChild->getParent()); - xContainerAccess = css::uno::Reference< css::container::XIndexAccess>(xParent, css::uno::UNO_QUERY); + xContainerAccess.set(xParent, css::uno::UNO_QUERY); OSL_ENSURE(xContainerAccess.is(), "IndexAccessIterator::Next : a content has an invalid parent !"); // Remove the index that SearchLoop had within this parent from my stack diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx index caa2d251b124..fa86241957ec 100644 --- a/comphelper/source/container/embeddedobjectcontainer.cxx +++ b/comphelper/source/container/embeddedobjectcontainer.cxx @@ -174,7 +174,7 @@ void EmbeddedObjectContainer::ReleaseImageSubStorage() try { pImpl->mxImageStorage->dispose(); - pImpl->mxImageStorage = uno::Reference< embed::XStorage >(); + pImpl->mxImageStorage.clear(); } catch (const uno::Exception&) { @@ -346,7 +346,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::Get_Impl( con uno::Sequence< beans::PropertyValue > aMediaDescr( 1 ); aMediaDescr[0].Name = "ReadOnly"; aMediaDescr[0].Value <<= bReadOnlyMode; - xObj = uno::Reference < embed::XEmbeddedObject >( xFactory->createInstanceInitFromEntry( + xObj.set( xFactory->createInstanceInitFromEntry( pImpl->mxStorage, rName, aMediaDescr, aObjDescr ), uno::UNO_QUERY ); @@ -379,7 +379,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CreateEmbedde aObjDescr[0].Name = "Parent"; aObjDescr[0].Value <<= pImpl->m_xModel.get(); ::std::copy( rArgs.begin(), rArgs.end(), aObjDescr.getArray() + 1 ); - xObj = uno::Reference < embed::XEmbeddedObject >( xFactory->createInstanceInitNew( + xObj.set( xFactory->createInstanceInitNew( rClassId, OUString(), pImpl->mxStorage, rNewName, aObjDescr ), uno::UNO_QUERY ); @@ -595,7 +595,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::InsertEmbedde uno::Sequence< beans::PropertyValue > aObjDescr( 1 ); aObjDescr[0].Name = "Parent"; aObjDescr[0].Value <<= pImpl->m_xModel.get(); - xObj = uno::Reference < embed::XEmbeddedObject >( xFactory->createInstanceInitFromMediaDescriptor( + xObj.set( xFactory->createInstanceInitFromMediaDescriptor( pImpl->mxStorage, rNewName, aMedium, aObjDescr ), uno::UNO_QUERY ); uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY ); @@ -627,8 +627,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::InsertEmbedde uno::Sequence< beans::PropertyValue > aObjDescr( 1 ); aObjDescr[0].Name = "Parent"; aObjDescr[0].Value <<= pImpl->m_xModel.get(); - xObj = uno::Reference < embed::XEmbeddedObject >( xFactory->createInstanceLink( - pImpl->mxStorage, rNewName, aMedium, aObjDescr ), uno::UNO_QUERY ); + xObj.set( xFactory->createInstanceLink( pImpl->mxStorage, rNewName, aMedium, aObjDescr ), uno::UNO_QUERY ); uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY ); @@ -716,8 +715,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmb uno::Sequence< beans::PropertyValue > aObjDescr( 1 ); aObjDescr[0].Name = "Parent"; aObjDescr[0].Value <<= pImpl->m_xModel.get(); - xResult = uno::Reference < embed::XEmbeddedObject >( - xCreator->createInstanceLink( + xResult.set(xCreator->createInstanceLink( pImpl->mxStorage, rName, aMediaDescr, @@ -740,8 +738,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmb uno::Sequence< beans::PropertyValue > aObjDescr( 1 ); aObjDescr[0].Name = "Parent"; aObjDescr[0].Value <<= pImpl->m_xModel.get(); - xResult = uno::Reference < embed::XEmbeddedObject >( - xCreator->createInstanceInitNew( + xResult.set(xCreator->createInstanceInitNew( xObj->getClassID(), xObj->getClassName(), pImpl->mxStorage, @@ -791,7 +788,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmb catch (const uno::Exception&) { } - xResult = uno::Reference< embed::XEmbeddedObject >(); + xResult.clear(); } } } @@ -996,7 +993,7 @@ bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < embed xPersist->storeAsEntry( pImpl->mxTempStorage, aTmpPersistName, aSeq, aSeq ); xPersist->saveCompleted( sal_True ); - pImpl->maTempObjectContainer[ aTmpPersistName ] = uno::Reference < embed::XEmbeddedObject >(); + pImpl->maTempObjectContainer[ aTmpPersistName ].clear(); */ if ( !pImpl->mpTempObjectContainer ) diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx index 6140d5c294e4..12101471bc97 100644 --- a/comphelper/source/eventattachermgr/eventattachermgr.cxx +++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx @@ -369,7 +369,7 @@ ImplEventAttacherManager::ImplEventAttacherManager( const Reference< XIntrospect "com.sun.star.script.EventAttacher", rContext) ); if ( xIFace.is() ) { - xAttacher = Reference< XEventAttacher2 >::query( xIFace ); + xAttacher.set( xIFace, UNO_QUERY ); } xConverter = Converter::create(rContext); } diff --git a/comphelper/source/misc/dispatchcommand.cxx b/comphelper/source/misc/dispatchcommand.cxx index 5de05542dbb4..160c08a930c7 100644 --- a/comphelper/source/misc/dispatchcommand.cxx +++ b/comphelper/source/misc/dispatchcommand.cxx @@ -38,7 +38,7 @@ bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence xFrame(xDesktop->getActiveFrame()); if (!xFrame.is()) - xFrame = uno::Reference(xDesktop, uno::UNO_QUERY); + xFrame.set(xDesktop, uno::UNO_QUERY); uno::Reference xDispatchProvider(xFrame, uno::UNO_QUERY); if (!xDispatchProvider.is()) diff --git a/comphelper/source/misc/instancelocker.cxx b/comphelper/source/misc/instancelocker.cxx index 204d1a9baca3..d43ecf606923 100644 --- a/comphelper/source/misc/instancelocker.cxx +++ b/comphelper/source/misc/instancelocker.cxx @@ -90,7 +90,7 @@ void SAL_CALL OInstanceLocker::dispose() m_pLockListener->Dispose(); m_pLockListener = NULL; } - m_xLockListener = uno::Reference< uno::XInterface >(); + m_xLockListener.clear(); } m_bDisposed = true; @@ -177,7 +177,7 @@ void SAL_CALL OInstanceLocker::initialize( const uno::Sequence< uno::Any >& aArg xInstance, nModes, xApproval ); - m_xLockListener = uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( m_pLockListener ) ); + m_xLockListener.set( static_cast< OWeakObject* >( m_pLockListener ) ); m_pLockListener->Init(); } catch( uno::Exception& ) @@ -289,7 +289,7 @@ void OLockListener::Dispose() {} } - m_xInstance = uno::Reference< uno::XInterface >(); + m_xInstance.clear(); m_bDisposed = true; } diff --git a/comphelper/source/misc/logging.cxx b/comphelper/source/misc/logging.cxx index e6cef1d74454..0790567c212a 100644 --- a/comphelper/source/misc/logging.cxx +++ b/comphelper/source/misc/logging.cxx @@ -214,7 +214,7 @@ namespace comphelper Reference< XResourceBundleLoader > xLoader( css::resource::OfficeResourceLoader::get( _rContext ) ); - _rLoggerData.xBundle = Reference< XResourceBundle >( xLoader->loadBundle_Default( _rLoggerData.sBundleBaseName ), UNO_QUERY_THROW ); + _rLoggerData.xBundle.set( xLoader->loadBundle_Default( _rLoggerData.sBundleBaseName ), UNO_QUERY_THROW ); } catch( const Exception& e ) { diff --git a/comphelper/source/misc/mimeconfighelper.cxx b/comphelper/source/misc/mimeconfighelper.cxx index d17d650a8e5c..6dc3e21d332e 100644 --- a/comphelper/source/misc/mimeconfighelper.cxx +++ b/comphelper/source/misc/mimeconfighelper.cxx @@ -132,11 +132,10 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetConfigurati aPathProp.Value <<= aPath; aArgs[0] <<= aPathProp; - xConfig = uno::Reference< container::XNameAccess >( - m_xConfigProvider->createInstanceWithArguments( - "com.sun.star.configuration.ConfigurationAccess", - aArgs ), - uno::UNO_QUERY ); + xConfig.set( m_xConfigProvider->createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationAccess", + aArgs ), + uno::UNO_QUERY ); } catch( uno::Exception& ) {} diff --git a/comphelper/source/streaming/seekableinput.cxx b/comphelper/source/streaming/seekableinput.cxx index da3b3690516f..7a39696f0497 100644 --- a/comphelper/source/streaming/seekableinput.cxx +++ b/comphelper/source/streaming/seekableinput.cxx @@ -103,7 +103,7 @@ void OSeekableInputWrapper::PrepareCopy_Impl() if ( xTempSeek.is() ) { xTempSeek->seek( 0 ); - m_xCopyInput = uno::Reference< io::XInputStream >( xTempOut, uno::UNO_QUERY ); + m_xCopyInput.set( xTempOut, uno::UNO_QUERY ); if ( m_xCopyInput.is() ) m_xCopySeek = xTempSeek; } @@ -193,15 +193,15 @@ void SAL_CALL OSeekableInputWrapper::closeInput() throw io::NotConnectedException(); m_xOriginalStream->closeInput(); - m_xOriginalStream = uno::Reference< io::XInputStream >(); + m_xOriginalStream.clear(); if ( m_xCopyInput.is() ) { m_xCopyInput->closeInput(); - m_xCopyInput = uno::Reference< io::XInputStream >(); + m_xCopyInput.clear(); } - m_xCopySeek = uno::Reference< io::XSeekable >(); + m_xCopySeek.clear(); } diff --git a/comphelper/source/streaming/seqinputstreamserv.cxx b/comphelper/source/streaming/seqinputstreamserv.cxx index c795a48b15b3..306a5e68d283 100644 --- a/comphelper/source/streaming/seqinputstreamserv.cxx +++ b/comphelper/source/streaming/seqinputstreamserv.cxx @@ -167,8 +167,8 @@ void SAL_CALL SequenceInputStreamService::closeInput() throw ( uno::RuntimeExcep throw io::NotConnectedException(); m_xInputStream->closeInput(); - m_xInputStream = uno::Reference< io::XInputStream >(); - m_xSeekable = uno::Reference< io::XSeekable >(); + m_xInputStream.clear(); + m_xSeekable.clear(); } // css::io::XSeekable: diff --git a/comphelper/source/streaming/seqoutputstreamserv.cxx b/comphelper/source/streaming/seqoutputstreamserv.cxx index 33b8c9c2602d..65f2fa75b891 100644 --- a/comphelper/source/streaming/seqoutputstreamserv.cxx +++ b/comphelper/source/streaming/seqoutputstreamserv.cxx @@ -137,7 +137,7 @@ void SAL_CALL SequenceOutputStreamService::closeOutput() throw ( uno::RuntimeExc throw io::NotConnectedException(); m_xOutputStream->closeOutput(); - m_xOutputStream = uno::Reference< io::XOutputStream >(); + m_xOutputStream.clear(); } // css::io::XSequenceOutputStream: -- cgit