From 3c971162b57bb042dc001f775b8e20ec37ecbef8 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 30 Oct 2015 14:22:53 +0200 Subject: use uno::Reference::set method instead of assignment Change-Id: I150f213ab033f5fc1b50abe4e1529292206c9feb Reviewed-on: https://gerrit.libreoffice.org/19689 Tested-by: Jenkins Reviewed-by: Noel Grandin --- dtrans/source/test/test_dtrans.cxx | 2 +- dtrans/source/win32/dnd/sourcecontext.cxx | 4 ++-- dtrans/source/win32/dnd/target.cxx | 6 ++--- dtrans/test/win32/dnd/atlwindow.cxx | 4 ++-- editeng/source/items/numitem.cxx | 2 +- editeng/source/misc/unolingu.cxx | 13 +++++----- editeng/source/xml/xmltxtimp.cxx | 2 +- embeddedobj/source/commonembedding/miscobj.cxx | 2 +- embeddedobj/source/commonembedding/persistence.cxx | 8 +++---- embeddedobj/source/commonembedding/xfactory.cxx | 25 ++++++++----------- embeddedobj/source/general/docholder.cxx | 20 ++++++++-------- embeddedobj/source/general/dummyobject.cxx | 4 ++-- embeddedobj/source/msole/olecomponent.cxx | 2 +- embeddedobj/source/msole/oleembed.cxx | 4 ++-- embeddedobj/source/msole/olemisc.cxx | 4 ++-- embeddedobj/source/msole/olepersist.cxx | 21 ++++++++-------- embeddedobj/source/msole/ownview.cxx | 8 +++---- embeddedobj/source/msole/xdialogcreator.cxx | 10 ++++---- embedserv/source/embed/docholder.cxx | 28 +++++++++++----------- embedserv/source/embed/ed_ipersiststr.cxx | 2 +- 20 files changed, 81 insertions(+), 90 deletions(-) diff --git a/dtrans/source/test/test_dtrans.cxx b/dtrans/source/test/test_dtrans.cxx index 2787f93feb2a..b81b3b6c8272 100644 --- a/dtrans/source/test/test_dtrans.cxx +++ b/dtrans/source/test/test_dtrans.cxx @@ -137,7 +137,7 @@ void SAL_CALL ClipboardListener::changedContents( const ClipboardEvent& event ) throw(RuntimeException) { m_nReceivedChangedContentsEvents++; - m_xClipboard = Reference< XClipboard > (event.Source, UNO_QUERY); + m_xClipboard.set(event.Source, UNO_QUERY); m_xTransferable = event.Contents; } diff --git a/dtrans/source/win32/dnd/sourcecontext.cxx b/dtrans/source/win32/dnd/sourcecontext.cxx index cee6c98bb4c2..84e54da21cfc 100644 --- a/dtrans/source/win32/dnd/sourcecontext.cxx +++ b/dtrans/source/win32/dnd/sourcecontext.cxx @@ -92,7 +92,7 @@ void SourceContext::fire_dragDropEnd( sal_Bool success, sal_Int8 effect) } e.DragSource= m_dragSource; e.DragSourceContext= static_cast( this); - e.Source= Reference( static_cast( this), UNO_QUERY); + e.Source.set( static_cast( this), UNO_QUERY); OInterfaceContainerHelper* pContainer= rBHelper.getContainer( cppu::UnoType::get()); @@ -119,7 +119,7 @@ void SourceContext::fire_dropActionChanged( sal_Int8 dropAction, sal_Int8 userAc e.UserAction= userAction; e.DragSource= m_dragSource; e.DragSourceContext= static_cast( this); - e.Source= Reference( static_cast( this), UNO_QUERY); + e.Source.set( static_cast( this), UNO_QUERY); OInterfaceContainerHelper* pContainer= rBHelper.getContainer( cppu::UnoType::get()); diff --git a/dtrans/source/win32/dnd/target.cxx b/dtrans/source/win32/dnd/target.cxx index bc5b6490eee7..d7247f9fc297 100644 --- a/dtrans/source/win32/dnd/target.cxx +++ b/dtrans/source/win32/dnd/target.cxx @@ -334,7 +334,7 @@ HRESULT DropTarget::DragEnter( IDataObject *pDataObj, DropTargetDragEnterEvent e; e.SupportedDataFlavors= m_currentData->getTransferDataFlavors(); e.DropAction= m_nCurrentDropAction; - e.Source= Reference( static_cast(this),UNO_QUERY); + e.Source.set( static_cast(this),UNO_QUERY); e.Context= m_currentDragContext; POINT point={ pt.x, pt.y}; ScreenToClient( m_hWnd, &point); @@ -373,7 +373,7 @@ HRESULT DropTarget::DragOver( DWORD grfKeyState, { DropTargetDragEvent e; e.DropAction= m_nCurrentDropAction; - e.Source= Reference(static_cast(this),UNO_QUERY); + e.Source.set(static_cast(this),UNO_QUERY); e.Context= m_currentDragContext; POINT point={ pt.x, pt.y}; ScreenToClient( m_hWnd, &point); @@ -456,7 +456,7 @@ HRESULT DropTarget::Drop( IDataObject * /*pDataObj*/, { DropTargetDropEvent e; e.DropAction= m_nCurrentDropAction; - e.Source= Reference( static_cast(this), UNO_QUERY); + e.Source.set( static_cast(this), UNO_QUERY); e.Context= m_currentDropContext; POINT point={ pt.x, pt.y}; ScreenToClient( m_hWnd, &point); diff --git a/dtrans/test/win32/dnd/atlwindow.cxx b/dtrans/test/win32/dnd/atlwindow.cxx index 4981e0aacf47..1f8f74843397 100644 --- a/dtrans/test/win32/dnd/atlwindow.cxx +++ b/dtrans/test/win32/dnd/atlwindow.cxx @@ -97,7 +97,7 @@ LRESULT AWindow::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandle // create the DragSource Reference< XInterface> xint= MultiServiceFactory->createInstance("com.sun.star.datatransfer.dnd.OleDragSource"); - m_xDragSource= Reference( xint, UNO_QUERY); + m_xDragSource.set( xint, UNO_QUERY ); Reference xInit( xint, UNO_QUERY); Any ar[2]; @@ -106,7 +106,7 @@ LRESULT AWindow::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandle //create the DropTarget Reference< XInterface> xintTarget= MultiServiceFactory->createInstance("com.sun.star.datatransfer.dnd.OleDropTarget"); - m_xDropTarget= Reference( xintTarget, UNO_QUERY); + m_xDropTarget.set( xintTarget, UNO_QUERY ); Reference xInitTarget( xintTarget, UNO_QUERY); Any any; diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index 834d5f44e26d..e38e0cd75e38 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -69,7 +69,7 @@ static void lcl_getFormatter(css::uno::Reference { Reference xContext( ::comphelper::getProcessComponentContext() ); Reference xRet = text::DefaultNumberingProvider::create(xContext); - _xFormatter = Reference (xRet, UNO_QUERY); + _xFormatter.set(xRet, UNO_QUERY); } catch(const Exception&) { diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx index 6eff02562de0..6adfbe9144cc 100644 --- a/editeng/source/misc/unolingu.cxx +++ b/editeng/source/misc/unolingu.cxx @@ -237,7 +237,7 @@ void SpellDummy_Impl::GetSpell_Impl() if (!xSpell.is()) { uno::Reference< XLinguServiceManager2 > xLngSvcMgr( GetLngSvcMgr_Impl() ); - xSpell = uno::Reference< XSpellChecker1 >( xLngSvcMgr->getSpellChecker(), UNO_QUERY ); + xSpell.set( xLngSvcMgr->getSpellChecker(), UNO_QUERY ); } } @@ -640,8 +640,7 @@ uno::Reference< XDictionary > LinguMgr::GetIgnoreAll() uno::Reference< XSearchableDictionaryList > xTmpDicList( GetDictionaryList() ); if (xTmpDicList.is()) { - xIgnoreAll = uno::Reference< XDictionary > ( xTmpDicList->getDictionaryByName( - "IgnoreAllList" ), UNO_QUERY ); + xIgnoreAll.set( xTmpDicList->getDictionaryByName( "IgnoreAllList" ), UNO_QUERY ); } return xIgnoreAll; } @@ -657,11 +656,11 @@ uno::Reference< XDictionary > LinguMgr::GetChangeAll() uno::Reference< XSearchableDictionaryList > _xDicList( GetDictionaryList() , UNO_QUERY ); if (_xDicList.is()) { - xChangeAll = uno::Reference< XDictionary > ( - _xDicList->createDictionary( + xChangeAll.set( _xDicList->createDictionary( "ChangeAllList", LanguageTag::convertToLocale( LANGUAGE_NONE ), - DictionaryType_NEGATIVE, OUString() ), UNO_QUERY ); + DictionaryType_NEGATIVE, OUString() ), + UNO_QUERY ); } return xChangeAll; } @@ -702,7 +701,7 @@ uno::Reference< XDictionary > LinguMgr::GetStandard() xTmpDicList->addDictionary( xTmp ); xTmp->setActive( sal_True ); } - xDic = uno::Reference< XDictionary > ( xTmp, UNO_QUERY ); + xDic.set( xTmp, UNO_QUERY ); } #if OSL_DEBUG_LEVEL > 1 uno::Reference< XStorable > xStor( xDic, UNO_QUERY ); diff --git a/editeng/source/xml/xmltxtimp.cxx b/editeng/source/xml/xmltxtimp.cxx index 321a817e2221..b3c1042e1f39 100644 --- a/editeng/source/xml/xmltxtimp.cxx +++ b/editeng/source/xml/xmltxtimp.cxx @@ -182,7 +182,7 @@ void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& r xSource->setOutputStream( uno::Reference< io::XOutputStream >::query( xPipe ) ); xml::sax::InputSource aParserInput; - aParserInput.aInputStream = uno::Reference< io::XInputStream >::query( xPipe ); + aParserInput.aInputStream.set( xPipe, UNO_QUERY ); aParserInput.sSystemId = aMedium.GetName(); diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx index f5e4de65b54d..0601c03188c2 100644 --- a/embeddedobj/source/commonembedding/miscobj.cxx +++ b/embeddedobj/source/commonembedding/miscobj.cxx @@ -326,7 +326,7 @@ void OCommonEmbeddedObject::PostEvent_Impl( const OUString& aEventName ) { document::EventObject aEvent; aEvent.EventName = aEventName; - aEvent.Source = uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ); + aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) ); // For now all the events are sent as object events // aEvent.Source = ( xSource.is() ? xSource // : uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ) ); diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 5b84c98d9941..5d1d7e223459 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -582,7 +582,7 @@ uno::Reference< io::XInputStream > OCommonEmbeddedObject::StoreDocumentToTempStr { osl::MutexGuard aGuard( m_aMutex ); if ( m_pDocHolder ) - xStorable = uno::Reference< frame::XStorable > ( m_pDocHolder->GetComponent(), uno::UNO_QUERY ); + xStorable.set( m_pDocHolder->GetComponent(), uno::UNO_QUERY ); } if( !xStorable.is() ) @@ -763,7 +763,7 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl( { osl::MutexGuard aGuard( m_aMutex ); if ( m_pDocHolder ) - xDoc = uno::Reference< document::XStorageBasedDocument >( m_pDocHolder->GetComponent(), uno::UNO_QUERY ); + xDoc.set( m_pDocHolder->GetComponent(), uno::UNO_QUERY ); } OUString aBaseURL = GetBaseURLFrom_Impl(rMediaArgs, rObjArgs); @@ -1493,8 +1493,8 @@ void SAL_CALL OCommonEmbeddedObject::saveCompleted( sal_Bool bUseNew ) } } - m_xNewObjectStorage = uno::Reference< embed::XStorage >(); - m_xNewParentStorage = uno::Reference< embed::XStorage >(); + m_xNewObjectStorage.clear(); + m_xNewParentStorage.clear(); m_aNewEntryName.clear(); m_aNewDocMediaDescriptor.realloc( 0 ); m_bWaitSaveCompleted = false; diff --git a/embeddedobj/source/commonembedding/xfactory.cxx b/embeddedobj/source/commonembedding/xfactory.cxx index 8e09b9b4f88e..4aba8073a379 100644 --- a/embeddedobj/source/commonembedding/xfactory.cxx +++ b/embeddedobj/source/commonembedding/xfactory.cxx @@ -112,7 +112,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta catch ( const uno::Exception& ) { } - xSubStorage = uno::Reference< embed::XStorage >(); + xSubStorage.clear(); uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByMediaType( aMediaType ); @@ -123,8 +123,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta if ( !aObject.getLength() ) throw io::IOException(); // unexpected mimetype of the storage - xResult = uno::Reference< uno::XInterface >( - static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject( + xResult.set(static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject( m_xContext, aObject ) ), uno::UNO_QUERY ); @@ -184,8 +183,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta throw io::IOException(); // unexpected mimetype of the storage - xResult = uno::Reference< uno::XInterface >( - static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject( + xResult.set(static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject( m_xContext, aObject ) ), uno::UNO_QUERY ); @@ -237,11 +235,10 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta if ( !aObject.getLength() ) throw io::IOException(); // unexpected mimetype of the storage - xResult = uno::Reference< uno::XInterface >( - static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject( - m_xContext, - aObject ) ), - uno::UNO_QUERY ); + xResult.set( static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject( + m_xContext, + aObject ) ), + uno::UNO_QUERY ); uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY ); @@ -295,7 +292,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta throw io::IOException(); // TODO: } - uno::Reference< uno::XInterface > xResult = uno::Reference< uno::XInterface > ( + uno::Reference< uno::XInterface > xResult( static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject( m_xContext, aObject ) ), @@ -351,8 +348,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta throw io::IOException(); // unexpected mimetype of the storage - xResult = uno::Reference< uno::XInterface >( - static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject( + xResult.set(static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject( m_xContext, aObject, aTempMedDescr, @@ -415,8 +411,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta if ( !aFilterName.isEmpty() ) { - xResult = uno::Reference< uno::XInterface >( - static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject( + xResult.set(static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject( m_xContext, aObject, aTempMedDescr, diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx index 9e78fa2e55e4..6c8f7b0ed038 100644 --- a/embeddedobj/source/general/docholder.cxx +++ b/embeddedobj/source/general/docholder.cxx @@ -235,9 +235,9 @@ void DocumentHolder::CloseFrame() if ( xComp.is() ) xComp->dispose(); - m_xHatchWindow = uno::Reference< awt::XWindow >(); - m_xOwnWindow = uno::Reference< awt::XWindow >(); - m_xFrame = uno::Reference< frame::XFrame >(); + m_xHatchWindow.clear(); + m_xOwnWindow.clear(); + m_xFrame.clear(); } @@ -415,7 +415,7 @@ bool DocumentHolder::ShowInplace( const uno::Reference< awt::XWindowPeer >& xPar awt::Size( HATCH_BORDER_WIDTH, HATCH_BORDER_WIDTH ) ); uno::Reference< awt::XWindowPeer > xHatchWinPeer( xHatchWindow, uno::UNO_QUERY ); - xHWindow = uno::Reference< awt::XWindow >( xHatchWinPeer, uno::UNO_QUERY ); + xHWindow.set( xHatchWinPeer, uno::UNO_QUERY ); if ( !xHWindow.is() ) throw uno::RuntimeException(); // TODO: can not create own window @@ -1107,9 +1107,9 @@ void SAL_CALL DocumentHolder::disposing( const css::lang::EventObject& aSource ) if( m_xFrame.is() && m_xFrame == aSource.Source ) { - m_xHatchWindow = uno::Reference< awt::XWindow >(); - m_xOwnWindow = uno::Reference< awt::XWindow >(); - m_xFrame = uno::Reference< frame::XFrame >(); + m_xHatchWindow.clear(); + m_xOwnWindow.clear(); + m_xFrame.clear(); } } @@ -1138,9 +1138,9 @@ void SAL_CALL DocumentHolder::notifyClosing( const lang::EventObject& aSource ) if( m_xFrame.is() && m_xFrame == aSource.Source ) { - m_xHatchWindow = uno::Reference< awt::XWindow >(); - m_xOwnWindow = uno::Reference< awt::XWindow >(); - m_xFrame = uno::Reference< frame::XFrame >(); + m_xHatchWindow.clear(); + m_xOwnWindow.clear(); + m_xFrame.clear(); } } diff --git a/embeddedobj/source/general/dummyobject.cxx b/embeddedobj/source/general/dummyobject.cxx index 3f6c4167eca3..592820e51855 100644 --- a/embeddedobj/source/general/dummyobject.cxx +++ b/embeddedobj/source/general/dummyobject.cxx @@ -67,7 +67,7 @@ void ODummyEmbeddedObject::PostEvent_Impl( const OUString& aEventName ) { document::EventObject aEvent; aEvent.EventName = aEventName; - aEvent.Source = uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ); + aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) ); // For now all the events are sent as object events // aEvent.Source = ( xSource.is() ? xSource // : uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ) ); @@ -446,7 +446,7 @@ void SAL_CALL ODummyEmbeddedObject::saveCompleted( sal_Bool bUseNew ) PostEvent_Impl( OUString( "OnSaveAsDone" ) ); } - m_xNewParentStorage = uno::Reference< embed::XStorage >(); + m_xNewParentStorage.clear(); m_aNewEntryName.clear(); m_bWaitSaveCompleted = false; } diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx index b7f016824dd3..6a7b9e471131 100644 --- a/embeddedobj/source/msole/olecomponent.cxx +++ b/embeddedobj/source/msole/olecomponent.cxx @@ -1594,7 +1594,7 @@ uno::Any SAL_CALL OleComponent::getTransferData( const datatransfer::DataFlavor& m_pUnoOleObject->StoreObjectToStream( xTempOutStream ); xTempOutStream->closeOutput(); - xTempOutStream = uno::Reference< io::XOutputStream >(); + xTempOutStream.clear(); } else throw io::IOException(); // TODO: diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx index 2e19372f1060..83647109296e 100644 --- a/embeddedobj/source/msole/oleembed.cxx +++ b/embeddedobj/source/msole/oleembed.cxx @@ -344,7 +344,7 @@ bool OleEmbeddedObject::TryToConvertToOOo() nStep = 1; uno::Reference< lang::XComponent > xComp( m_xObjectStream, uno::UNO_QUERY_THROW ); xComp->dispose(); - m_xObjectStream = uno::Reference< io::XStream >(); + m_xObjectStream.clear(); m_nObjectState = -1; nStep = 2; @@ -738,7 +738,7 @@ namespace uno::Any aUrl = xNativeTempFile->getPropertyValue("Uri"); aUrl >>= sUrl; - xNativeTempFile = uno::Reference(); + xNativeTempFile.clear(); uno::Reference < ucb::XSimpleFileAccess3 > xSimpleFileAccess( ucb::SimpleFileAccess::create( comphelper::getComponentContext(xFactory) ) ); diff --git a/embeddedobj/source/msole/olemisc.cxx b/embeddedobj/source/msole/olemisc.cxx index e0ad671b8ca3..24b3b73f8de8 100644 --- a/embeddedobj/source/msole/olemisc.cxx +++ b/embeddedobj/source/msole/olemisc.cxx @@ -294,10 +294,10 @@ void OleEmbeddedObject::Dispose() xComp->dispose(); } catch( const uno::Exception& ) {} } - m_xObjectStream = uno::Reference< io::XStream >(); + m_xObjectStream.clear(); } - m_xParentStorage = uno::Reference< embed::XStorage >(); + m_xParentStorage.clear(); m_bDisposed = true; } diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx index 3a9429c28c05..f98745135850 100644 --- a/embeddedobj/source/msole/olepersist.cxx +++ b/embeddedobj/source/msole/olepersist.cxx @@ -125,7 +125,7 @@ OUString GetNewFilledTempFile_Impl( const uno::Reference< io::XInputStream >& xI // copy stream contents to the file ::comphelper::OStorageHelper::CopyInputToOutput( xInStream, xTempOutStream ); xTempOutStream->closeOutput(); - xTempOutStream = uno::Reference< io::XOutputStream >(); + xTempOutStream.clear(); } else throw io::IOException(); // TODO: @@ -643,7 +643,7 @@ uno::Reference< io::XStream > OleEmbeddedObject::TryToRetrieveCachedVisualRepres aArgs[1] <<= true; // do not create copy try { - xNameContainer = uno::Reference< container::XNameContainer >( + xNameContainer.set( m_xFactory->createInstanceWithArguments( "com.sun.star.embed.OLESimpleStorage", aArgs ), @@ -897,7 +897,7 @@ void OleEmbeddedObject::OnViewChanged_Impl() ) { // The view is changed while the object is in running state, save the new object - m_xCachedVisualRepresentation = uno::Reference< io::XStream >(); + m_xCachedVisualRepresentation.clear(); SaveObject_Impl(); MakeEventListenerNotification_Impl( OUString( "OnVisAreaChanged" ) ); } @@ -963,9 +963,8 @@ void OleEmbeddedObject::CreateOleComponent_Impl( OleComponent* pOleComponent ) m_pOleComponent->acquire(); // TODO: needs holder? if ( !m_xClosePreventer.is() ) - m_xClosePreventer = uno::Reference< util::XCloseListener >( - static_cast< ::cppu::OWeakObject* >( new OClosePreventer ), - uno::UNO_QUERY ); + m_xClosePreventer.set( static_cast< ::cppu::OWeakObject* >( new OClosePreventer ), + uno::UNO_QUERY ); m_pOleComponent->addCloseListener( m_xClosePreventer ); } @@ -1108,7 +1107,7 @@ void OleEmbeddedObject::StoreToLocation_Impl( // ignore visual representation provided from outside if it should not be stored if ( !bStoreVis ) - xCachedVisualRepresentation = uno::Reference< io::XStream >(); + xCachedVisualRepresentation.clear(); if ( bStoreVis && !HasVisReplInStream() && !xCachedVisualRepresentation.is() ) throw io::IOException(); // TODO: there is no cached visual representation and nothing is provided from outside @@ -1612,12 +1611,12 @@ void SAL_CALL OleEmbeddedObject::saveCompleted( sal_Bool bUseNew ) bool bStoreLoaded = m_bStoreLoaded; - m_xNewObjectStream = uno::Reference< io::XStream >(); - m_xNewParentStorage = uno::Reference< embed::XStorage >(); + m_xNewObjectStream.clear(); + m_xNewParentStorage.clear(); m_aNewEntryName.clear(); m_bWaitSaveCompleted = false; m_bNewVisReplInStream = false; - m_xNewCachedVisRepl = uno::Reference< io::XStream >(); + m_xNewCachedVisRepl.clear(); m_bStoreLoaded = false; if ( bUseNew && m_pOleComponent && m_nUpdateMode == embed::EmbedUpdateModes::ALWAYS_UPDATE && !bStoreLoaded @@ -1778,7 +1777,7 @@ void SAL_CALL OleEmbeddedObject::storeOwn() // the replacement is changed probably, and it must be in the object stream if ( !m_pOleComponent->IsWorkaroundActive() ) - m_xCachedVisualRepresentation = uno::Reference< io::XStream >(); + m_xCachedVisualRepresentation.clear(); SetVisReplInStream( sal_True ); } #endif diff --git a/embeddedobj/source/msole/ownview.cxx b/embeddedobj/source/msole/ownview.cxx index 9d9946103203..b880d220b8a3 100644 --- a/embeddedobj/source/msole/ownview.cxx +++ b/embeddedobj/source/msole/ownview.cxx @@ -541,7 +541,7 @@ void OwnView_Impl::Close() if ( !m_xModel.is() ) return; xModel = m_xModel; - m_xModel = uno::Reference< frame::XModel >(); + m_xModel.clear(); if ( m_bBusy ) return; @@ -584,7 +584,7 @@ void SAL_CALL OwnView_Impl::notifyEvent( const document::EventObject& aEvent ) { // SaveAs operation took place, so just forget the model and deregister listeners xModel = m_xModel; - m_xModel = uno::Reference< frame::XModel >(); + m_xModel.clear(); } } @@ -621,7 +621,7 @@ void SAL_CALL OwnView_Impl::notifyClosing( const lang::EventObject& Source ) { ::osl::MutexGuard aGuard( m_aMutex ); if ( Source.Source == m_xModel ) - m_xModel = uno::Reference< frame::XModel >(); + m_xModel.clear(); } @@ -630,7 +630,7 @@ void SAL_CALL OwnView_Impl::disposing( const lang::EventObject& Source ) { ::osl::MutexGuard aGuard( m_aMutex ); if ( Source.Source == m_xModel ) - m_xModel = uno::Reference< frame::XModel >(); + m_xModel.clear(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embeddedobj/source/msole/xdialogcreator.cxx b/embeddedobj/source/msole/xdialogcreator.cxx index ced6113a6cd1..833bc6f6fbfa 100644 --- a/embeddedobj/source/msole/xdialogcreator.cxx +++ b/embeddedobj/source/msole/xdialogcreator.cxx @@ -201,9 +201,8 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceByDia //TODO: retrieve ClassName OUString aClassName; - aObjectInfo.Object = uno::Reference< embed::XEmbeddedObject >( - xEmbCreator->createInstanceInitNew( aClassID, aClassName, xStorage, sEntName, aObjArgs ), - uno::UNO_QUERY ); + aObjectInfo.Object.set( xEmbCreator->createInstanceInitNew( aClassID, aClassName, xStorage, sEntName, aObjArgs ), + uno::UNO_QUERY ); } else { @@ -228,9 +227,8 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceByDia if ( !xEmbCreator.is() ) throw uno::RuntimeException(); - aObjectInfo.Object = uno::Reference< embed::XEmbeddedObject >( - xEmbCreator->createInstanceInitFromMediaDescriptor( xStorage, sEntName, aMediaDescr, aObjArgs ), - uno::UNO_QUERY ); + aObjectInfo.Object.set( xEmbCreator->createInstanceInitFromMediaDescriptor( xStorage, sEntName, aMediaDescr, aObjArgs ), + uno::UNO_QUERY ); } if ( ( io.dwFlags & IOF_CHECKDISPLAYASICON) && io.hMetaPict != NULL ) diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx index 31956a75edd4..7ee882506a59 100644 --- a/embedserv/source/embed/docholder.cxx +++ b/embedserv/source/embed/docholder.cxx @@ -293,7 +293,7 @@ HRESULT DocumentHolder::InPlaceActivate( } aAny <<= sal_Int32(hWndxWinParent); - xWin = uno::Reference( + xWin.set( xToolkit->createSystemChild( aAny, aProcessIdent, @@ -646,9 +646,9 @@ void DocumentHolder::DisconnectFrameDocument( sal_Bool bComplete ) if ( bComplete ) { - m_xFrame = uno::Reference(); + m_xFrame.clear(); m_pIDispatch = NULL; - m_xDocument = uno::Reference< frame::XModel >(); + m_xDocument.clear(); } } @@ -670,7 +670,7 @@ void DocumentHolder::CloseDocument() } m_pIDispatch = NULL; - m_xDocument = uno::Reference< frame::XModel >(); + m_xDocument.clear(); } @@ -699,7 +699,7 @@ void DocumentHolder::CloseFrame() xComp->dispose(); } - m_xFrame = uno::Reference< frame::XFrame2 >(); + m_xFrame.clear(); } void DocumentHolder::SetDocument( const uno::Reference< frame::XModel >& xDoc, sal_Bool bLink ) @@ -760,7 +760,7 @@ sal_Bool DocumentHolder::ExecuteSuspendCloseFrame() { } - m_xFrame = uno::Reference< frame::XFrame2 >(); + m_xFrame.clear(); } return sal_True; @@ -818,14 +818,14 @@ void DocumentHolder::ClearInterceptorInternally() if ( xInterceptor.is() && m_pInterceptor ) m_pInterceptor->DisconnectDocHolder(); - m_xInterceptorLocker = uno::Reference< frame::XDispatchProviderInterceptor >(); + m_xInterceptorLocker.clear(); m_pInterceptor = 0; } void DocumentHolder::ClearInterceptor() { ::osl::MutexGuard aGuard( m_aMutex ); - m_xInterceptorLocker = uno::Reference< frame::XDispatchProviderInterceptor >(); + m_xInterceptorLocker.clear(); m_pInterceptor = 0; } @@ -1236,7 +1236,7 @@ css::uno::Reference< css::awt::XWindow> SAL_CALL DocumentHolder::getContainerWin uno::Any aAny; aAny <<= sal_Int32(hWnd); - xWin = uno::Reference( + xWin.set( xToolkit->createSystemChild( aAny, aProcessIdent, @@ -1331,11 +1331,11 @@ void SAL_CALL DocumentHolder::disposing( const css::lang::EventObject& aSource ) if ( m_xDocument.is() && m_xDocument == aSource.Source ) { m_pIDispatch = NULL; - m_xDocument = uno::Reference< frame::XModel >(); + m_xDocument.clear(); } if( m_xFrame.is() && m_xFrame == aSource.Source ) - m_xFrame = uno::Reference< frame::XFrame2 >(); + m_xFrame.clear(); } @@ -1372,15 +1372,15 @@ DocumentHolder::notifyClosing( { // can happen only in case of links m_pIDispatch = NULL; - m_xDocument = uno::Reference< frame::XModel >(); - m_xFrame = uno::Reference< frame::XFrame2 >(); + m_xDocument.clear(); + m_xFrame.clear(); LockedEmbedDocument_Impl aDocLock = m_xOleAccess->GetEmbedDocument(); if ( aDocLock.GetEmbedDocument() ) aDocLock.GetEmbedDocument()->OLENotifyClosing(); } else if( m_xFrame.is() && m_xFrame == aSource.Source ) - m_xFrame = uno::Reference< frame::XFrame2 >(); + m_xFrame.clear(); } void SAL_CALL diff --git a/embedserv/source/embed/ed_ipersiststr.cxx b/embedserv/source/embed/ed_ipersiststr.cxx index 34de2efb783f..64513b4f8c52 100644 --- a/embedserv/source/embed/ed_ipersiststr.cxx +++ b/embedserv/source/embed/ed_ipersiststr.cxx @@ -104,7 +104,7 @@ uno::Reference< io::XInputStream > createTempXInStreamFromIStream( if ( xTempSeek.is() ) { xTempSeek->seek ( 0 ); - xResult = uno::Reference< io::XInputStream >( xTempOut, uno::UNO_QUERY ); + xResult.set( xTempOut, uno::UNO_QUERY ); } } } -- cgit