diff options
author | Noel Grandin <noel@peralex.com> | 2015-11-05 08:52:58 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-11-05 09:59:30 +0200 |
commit | c8782b39116eee3ddc3ef0a38c6f6dde09b6ec00 (patch) | |
tree | a37c11f8ec6436d00b36fec99027bb3b06668372 /sfx2/source/doc | |
parent | b46496c4154ff3784ecd59ed6e15b6ee07a66f22 (diff) |
use uno::Reference::set method instead of assignment
Change-Id: Id9e7621ca7170d6cc80d8ce14f155ce564691ec0
Diffstat (limited to 'sfx2/source/doc')
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/doc/doctempl.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/doc/doctemplates.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/guisaveas.cxx | 23 | ||||
-rw-r--r-- | sfx2/source/doc/objmisc.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 33 | ||||
-rw-r--r-- | sfx2/source/doc/objxtor.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 18 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 5 |
10 files changed, 50 insertions, 54 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index f6a641bd63a9..10243019863e 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -1320,8 +1320,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( bool bCreateTempIfNo ) const SfxUnoAnyItem* pxProgressItem = SfxItemSet::GetItem<SfxUnoAnyItem>(GetItemSet(), SID_PROGRESS_STATUSBAR_CONTROL, false); if( pxProgressItem && ( pxProgressItem->GetValue() >>= xStatusIndicator ) ) - xProgressHandler = Reference< css::ucb::XProgressHandler >( - new utl::ProgressHandlerWrap( xStatusIndicator ) ); + xProgressHandler.set( new utl::ProgressHandlerWrap( xStatusIndicator ) ); uno::Sequence< beans::PropertyValue > aAddProps( 2 ); aAddProps[0].Name = "RepairPackage"; @@ -1358,8 +1357,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( bool bCreateTempIfNo ) try { - pImp->xStorage = uno::Reference< embed::XStorage >( - ::comphelper::OStorageHelper::GetStorageFactory()->createInstanceWithArguments( aArgs ), + pImp->xStorage.set( ::comphelper::OStorageHelper::GetStorageFactory()->createInstanceWithArguments( aArgs ), uno::UNO_QUERY ); } catch( const uno::Exception& ) diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index 1910068932b0..056ca1c7b388 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -831,15 +831,14 @@ bool SfxDocumentTemplates::CopyFrom uno::Reference< XStorable > xStorable; try { - xStorable = uno::Reference< XStorable >( + xStorable.set( xDesktop->loadComponentFromURL( aTemplURL.GetMainURL(INetURLObject::NO_DECODE), "_blank", 0, aArgs ), UNO_QUERY ); - xDocPropsSupplier = uno::Reference< XDocumentPropertiesSupplier >( - xStorable, UNO_QUERY ); + xDocPropsSupplier.set( xStorable, UNO_QUERY ); } catch( Exception& ) { diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 3a40a3145786..8e831101957c 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -455,7 +455,7 @@ void SfxDocTplService_Impl::init_Impl() } OUString const aService = SERVICENAME_TYPEDETECTION; - mxType = uno::Reference< XTypeDetection > ( mxContext->getServiceManager()->createInstanceWithContext(aService, mxContext), UNO_QUERY ); + mxType.set( mxContext->getServiceManager()->createInstanceWithContext(aService, mxContext), UNO_QUERY ); getDirList(); readFolderList(); diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 0062a93dff97..1ba7ba072f94 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -354,9 +354,9 @@ ModelData_Impl::ModelData_Impl( SfxStoringHelper& aOwner, // because chart2 only writes the basic stream out. // In future in might make sense to implement a full scale object shell in // chart2 and make chart2 an own program. - m_xModel = uno::Reference< frame::XModel >(xCurrentComponent, uno::UNO_QUERY_THROW ); - m_xStorable = uno::Reference< frame::XStorable >(xModel, uno::UNO_QUERY_THROW ); - m_xStorable2 = uno::Reference< frame::XStorable2 >(xModel, uno::UNO_QUERY_THROW ); + m_xModel.set(xCurrentComponent, uno::UNO_QUERY_THROW ); + m_xStorable.set(xModel, uno::UNO_QUERY_THROW ); + m_xStorable2.set(xModel, uno::UNO_QUERY_THROW ); } } catch(...) @@ -397,7 +397,7 @@ uno::Reference< frame::XStorable > ModelData_Impl::GetStorable() { if ( !m_xStorable.is() ) { - m_xStorable = uno::Reference< frame::XStorable >( m_xModel, uno::UNO_QUERY ); + m_xStorable.set( m_xModel, uno::UNO_QUERY ); if ( !m_xStorable.is() ) throw uno::RuntimeException(); } @@ -410,7 +410,7 @@ uno::Reference< frame::XStorable2 > ModelData_Impl::GetStorable2() { if ( !m_xStorable2.is() ) { - m_xStorable2 = uno::Reference< frame::XStorable2 >( m_xModel, uno::UNO_QUERY ); + m_xStorable2.set( m_xModel, uno::UNO_QUERY ); if ( !m_xStorable2.is() ) throw uno::RuntimeException(); } @@ -423,7 +423,7 @@ uno::Reference< util::XModifiable > ModelData_Impl::GetModifiable() { if ( !m_xModifiable.is() ) { - m_xModifiable = uno::Reference< util::XModifiable >( m_xModel, uno::UNO_QUERY ); + m_xModifiable.set( m_xModel, uno::UNO_QUERY ); if ( !m_xModifiable.is() ) throw uno::RuntimeException(); } @@ -1181,7 +1181,7 @@ OUString ModelData_Impl::GetRecommendedExtension( const OUString& aTypeName ) if ( aTypeName.isEmpty() ) return OUString(); - uno::Reference< container::XNameAccess > xTypeDetection = uno::Reference< container::XNameAccess >( + uno::Reference< container::XNameAccess > xTypeDetection( comphelper::getProcessServiceFactory()->createInstance("com.sun.star.document.TypeDetection"), uno::UNO_QUERY ); if ( xTypeDetection.is() ) @@ -1260,7 +1260,7 @@ OUString ModelData_Impl::GetRecommendedName( const OUString& aSuggestedName, con if ( !aRecommendedName.isEmpty() && !aTypeName.isEmpty() ) { // adjust the extension to the type - uno::Reference< container::XNameAccess > xTypeDetection = uno::Reference< container::XNameAccess >( + uno::Reference< container::XNameAccess > xTypeDetection( comphelper::getProcessServiceFactory()->createInstance("com.sun.star.document.TypeDetection"), uno::UNO_QUERY ); if ( xTypeDetection.is() ) @@ -1294,9 +1294,8 @@ uno::Reference< container::XNameAccess > SfxStoringHelper::GetFilterConfiguratio { if ( !m_xFilterCFG.is() ) { - m_xFilterCFG = uno::Reference< container::XNameAccess >( - comphelper::getProcessServiceFactory()->createInstance("com.sun.star.document.FilterFactory"), - uno::UNO_QUERY ); + m_xFilterCFG.set( comphelper::getProcessServiceFactory()->createInstance("com.sun.star.document.FilterFactory"), + uno::UNO_QUERY ); if ( !m_xFilterCFG.is() ) throw uno::RuntimeException(); @@ -1310,7 +1309,7 @@ uno::Reference< container::XContainerQuery > SfxStoringHelper::GetFilterQuery() { if ( !m_xFilterQuery.is() ) { - m_xFilterQuery = uno::Reference< container::XContainerQuery >( GetFilterConfiguration(), uno::UNO_QUERY ); + m_xFilterQuery.set( GetFilterConfiguration(), uno::UNO_QUERY ); if ( !m_xFilterQuery.is() ) throw uno::RuntimeException(); } diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 96f23e61d0c9..709775c01613 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1835,10 +1835,8 @@ bool SfxObjectShell::UseInteractionToHandleError( uno::Sequence< uno::Reference< task::XInteractionContinuation > > lContinuations(2); ::comphelper::OInteractionAbort* pAbort = new ::comphelper::OInteractionAbort(); ::comphelper::OInteractionApprove* pApprove = new ::comphelper::OInteractionApprove(); - lContinuations[0] = uno::Reference< task::XInteractionContinuation >( - static_cast< task::XInteractionContinuation* >( pAbort ), uno::UNO_QUERY ); - lContinuations[1] = uno::Reference< task::XInteractionContinuation >( - static_cast< task::XInteractionContinuation* >( pApprove ), uno::UNO_QUERY ); + lContinuations[0].set( static_cast< task::XInteractionContinuation* >( pAbort ), uno::UNO_QUERY ); + lContinuations[1].set( static_cast< task::XInteractionContinuation* >( pApprove ), uno::UNO_QUERY ); task::ErrorCodeRequest aErrorCode; aErrorCode.ErrCode = nError; diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 53a318d1830d..0d7b367c5475 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -195,7 +195,7 @@ bool SfxInstanceCloseGuard_Impl::Init_Impl( const uno::Reference< util::XCloseab try { m_pPreventer = new SfxClosePreventer_Impl(); - m_xPreventer = uno::Reference< util::XCloseListener >( m_pPreventer ); + m_xPreventer.set( m_pPreventer ); xCloseable->addCloseListener( m_xPreventer ); m_xCloseable = xCloseable; bResult = true; diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 7f0a94c1c27b..2c5850e3300a 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -431,7 +431,7 @@ void SfxObjectShell::SetupStorage( const uno::Reference< embed::XStorage >& xSto void SfxObjectShell::PrepareSecondTryLoad_Impl() { // only for internal use - pImp->m_xDocStorage = uno::Reference< embed::XStorage >(); + pImp->m_xDocStorage.clear(); pImp->m_bIsInit = false; ResetError(); } @@ -891,9 +891,8 @@ sal_uInt32 SfxObjectShell::HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDo css::uno::Reference< XNameAccess > xFilterCFG; if( xServiceManager.is() ) { - xFilterCFG = css::uno::Reference< XNameAccess >( - xServiceManager->createInstance("com.sun.star.document.FilterFactory"), - UNO_QUERY ); + xFilterCFG.set( xServiceManager->createInstance("com.sun.star.document.FilterFactory"), + UNO_QUERY ); } if( xFilterCFG.is() ) @@ -2203,11 +2202,14 @@ bool SfxObjectShell::ImportFrom(SfxMedium& rMedium, uno::Reference< document::XFilter > xLoader; if ( !aFilterImplName.isEmpty() ) { - try{ - xLoader = uno::Reference< document::XFilter > - ( xFilterFact->createInstanceWithArguments( aFilterName, uno::Sequence < uno::Any >() ), uno::UNO_QUERY ); - }catch(const uno::Exception&) - { xLoader.clear(); } + try + { + xLoader.set( xFilterFact->createInstanceWithArguments( aFilterName, uno::Sequence < uno::Any >() ), uno::UNO_QUERY ); + } + catch(const uno::Exception&) + { + xLoader.clear(); + } } if ( xLoader.is() ) { @@ -2334,11 +2336,14 @@ bool SfxObjectShell::ExportTo( SfxMedium& rMedium ) if ( !aFilterImplName.isEmpty() ) { - try{ - xExporter = uno::Reference< document::XExporter > - ( xFilterFact->createInstanceWithArguments( aFilterName, uno::Sequence < uno::Any >() ), uno::UNO_QUERY ); - }catch(const uno::Exception&) - { xExporter.clear(); } + try + { + xExporter.set( xFilterFact->createInstanceWithArguments( aFilterName, uno::Sequence < uno::Any >() ), uno::UNO_QUERY ); + } + catch(const uno::Exception&) + { + xExporter.clear(); + } } } diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index f2dc2e57468c..e9c5731bee02 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -1094,10 +1094,10 @@ Reference<lang::XComponent> SfxObjectShell::CreateAndLoadComponent( const SfxIte uno::Reference < frame::XComponentLoader > xLoader; if ( pFrame ) { - xLoader = uno::Reference < frame::XComponentLoader >( pFrame->GetFrameInterface(), uno::UNO_QUERY ); + xLoader.set( pFrame->GetFrameInterface(), uno::UNO_QUERY ); } else - xLoader = uno::Reference < frame::XComponentLoader >( frame::Desktop::create(comphelper::getProcessComponentContext()), uno::UNO_QUERY ); + xLoader.set( frame::Desktop::create(comphelper::getProcessComponentContext()), uno::UNO_QUERY ); Reference <lang::XComponent> xComp; try diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 9cfb22ca805f..ee9f02a3ab86 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -433,7 +433,7 @@ void SfxOwnFramesLocker::UnlockFrames() pWindow->Enable(); - m_aLockedFrames[nInd] = Reference< frame::XFrame >(); + m_aLockedFrames[nInd].clear(); } } catch( Exception& ) @@ -784,8 +784,8 @@ void SAL_CALL SfxBaseModel::dispose() throw(RuntimeException, std::exception) EndListening( *m_pData->m_pObjectShell ); } - m_pData->m_xCurrent = Reference< frame::XController > (); - m_pData->m_seqControllers = Sequence< Reference< frame::XController > > () ; + m_pData->m_xCurrent.clear(); + m_pData->m_seqControllers.realloc(0); // m_pData member must be set to zero before 0delete is called to // force disposed exception whenever someone tries to access our @@ -1121,7 +1121,7 @@ void SAL_CALL SfxBaseModel::disconnectController( const Reference< frame::XContr m_pData->m_seqControllers = aNewSeq; if ( xController == m_pData->m_xCurrent ) - m_pData->m_xCurrent = Reference< frame::XController > (); + m_pData->m_xCurrent.clear(); } namespace @@ -3218,10 +3218,8 @@ Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData() throw // currently no frame for this document at all or View is under construction return Reference < container::XIndexAccess >(); - m_pData->m_contViewData = Reference < container::XIndexAccess >( - document::IndexedPropertyValues::create( - ::comphelper::getProcessComponentContext() ), - UNO_QUERY ); + m_pData->m_contViewData.set( document::IndexedPropertyValues::create( ::comphelper::getProcessComponentContext() ), + UNO_QUERY ); if ( !m_pData->m_contViewData.is() ) { @@ -3934,7 +3932,7 @@ Reference< frame::XTitle > SfxBaseModel::impl_getTitleHelper () Reference< frame::XModel > xThis (static_cast< frame::XModel* >(this), UNO_QUERY_THROW); ::framework::TitleHelper* pHelper = new ::framework::TitleHelper(xContext); - m_pData->m_xTitleHelper = Reference< frame::XTitle >(static_cast< ::cppu::OWeakObject* >(pHelper), UNO_QUERY_THROW); + m_pData->m_xTitleHelper.set(static_cast< ::cppu::OWeakObject* >(pHelper), UNO_QUERY_THROW); pHelper->setOwner (xThis ); pHelper->connectWithUntitledNumbers (xDesktop); } @@ -3952,7 +3950,7 @@ Reference< frame::XUntitledNumbers > SfxBaseModel::impl_getUntitledHelper () Reference< frame::XModel > xThis (static_cast< frame::XModel* >(this), UNO_QUERY_THROW); ::comphelper::NumberedCollection* pHelper = new ::comphelper::NumberedCollection(); - m_pData->m_xNumberedControllers = Reference< frame::XUntitledNumbers >(static_cast< ::cppu::OWeakObject* >(pHelper), UNO_QUERY_THROW); + m_pData->m_xNumberedControllers.set(static_cast< ::cppu::OWeakObject* >(pHelper), UNO_QUERY_THROW); pHelper->setOwner (xThis); pHelper->setUntitledPrefix (OUString(" : ")); diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index e87cc5cf5eed..aef48ecfe082 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -1131,9 +1131,8 @@ void SfxTemplateManagerDlg::OnTemplateEdit () try { - xStorable = uno::Reference< XStorable >( - mxDesktop->loadComponentFromURL(pItem->getPath(),"_default", 0, aArgs ), - uno::UNO_QUERY ); + xStorable.set( mxDesktop->loadComponentFromURL(pItem->getPath(),"_default", 0, aArgs ), + uno::UNO_QUERY ); } catch( const uno::Exception& ) { |