svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx | 33 ++++++--------- 1 file changed, 15 insertions(+), 18 deletions(-)
New commits: commit 134425eb98147d197833cb4ef7bb4d8c3d7fd2bc Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Thu Dec 16 15:16:46 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Dec 17 07:26:05 2021 +0100 simplify ViewObjectContactOfUnoControl_Impl::getUnoObject Change-Id: I7dd9758180c629fc0de4e59ffef7d33e62d43dcb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126965 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 4c0f54d93b1f..5ca5a32d2f34 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -551,7 +551,7 @@ namespace sdr::contact { @precond We're not disposed. */ - bool getUnoObject( SdrUnoObj*& _out_rpObject ) const; + SdrUnoObj* getUnoObject() const; /** ensures that we have an ->XControl @@ -904,18 +904,15 @@ namespace sdr::contact { } - bool ViewObjectContactOfUnoControl_Impl::getUnoObject( SdrUnoObj*& _out_rpObject ) const + SdrUnoObj* ViewObjectContactOfUnoControl_Impl::getUnoObject() const { OSL_PRECOND( !impl_isDisposed_nofail(), "ViewObjectContactOfUnoControl_Impl::getUnoObject: already disposed()" ); if ( impl_isDisposed_nofail() ) - _out_rpObject = nullptr; - else - { - _out_rpObject = dynamic_cast< SdrUnoObj* >( m_pAntiImpl->GetViewContact().TryToGetSdrObject() ); - DBG_ASSERT( _out_rpObject || !m_pAntiImpl->GetViewContact().TryToGetSdrObject(), - "ViewObjectContactOfUnoControl_Impl::getUnoObject: invalid SdrObject!" ); - } - return ( _out_rpObject != nullptr ); + return nullptr; + auto pRet = dynamic_cast< SdrUnoObj* >( m_pAntiImpl->GetViewContact().TryToGetSdrObject() ); + DBG_ASSERT( pRet || !m_pAntiImpl->GetViewContact().TryToGetSdrObject(), + "ViewObjectContactOfUnoControl_Impl::getUnoObject: invalid SdrObject!" ); + return pRet; } @@ -927,8 +924,8 @@ namespace sdr::contact { try { - SdrUnoObj* pUnoObject( nullptr ); - if ( getUnoObject( pUnoObject ) ) + SdrUnoObj* pUnoObject = getUnoObject(); + if ( pUnoObject ) { const tools::Rectangle aRect( pUnoObject->GetLogicRect() ); UnoControlContactHelper::adjustControlGeometry_throw( m_aControl, aRect, _rViewTransformation, m_aZoomLevelNormalization ); @@ -1033,8 +1030,8 @@ namespace sdr::contact { UnoControlContactHelper::disposeAndClearControl_nothrow( m_aControl ); } - SdrUnoObj* pUnoObject( nullptr ); - if ( !getUnoObject( pUnoObject ) ) + SdrUnoObj* pUnoObject = getUnoObject(); + if ( !pUnoObject ) return false; ControlHolder aControl; @@ -1159,8 +1156,8 @@ namespace sdr::contact { if ( !impl_getPageView_nothrow( pPageView ) ) return; - SdrUnoObj* pUnoObject( nullptr ); - if ( !getUnoObject( pUnoObject ) ) + SdrUnoObj* pUnoObject = getUnoObject(); + if ( !pUnoObject ) return; SdrPageViewAccess aPVAccess( *pPageView ); @@ -1273,8 +1270,8 @@ namespace sdr::contact { bool ViewObjectContactOfUnoControl_Impl::isPrintableControl() const { - SdrUnoObj* pUnoObject( nullptr ); - if ( !getUnoObject( pUnoObject ) ) + SdrUnoObj* pUnoObject = getUnoObject(); + if ( !pUnoObject ) return false; bool bIsPrintable = false;