diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-20 09:25:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-21 11:32:43 +0100 |
commit | a60ffa6985dec32cc73032a7774f58694a6ee9a7 (patch) | |
tree | e94b9c586e6db1dde0a69aeddbe067bf8be2a47d /sw/source/core/unocore/unodraw.cxx | |
parent | 466c3564058aae4946cdd21eab9dfef529554d90 (diff) |
loplugin:flatten in sw
Change-Id: I64176f48d90303f078e326c8838da9eb2daf8126
Reviewed-on: https://gerrit.libreoffice.org/44937
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/unocore/unodraw.cxx')
-rw-r--r-- | sw/source/core/unocore/unodraw.cxx | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index cdaff02db50a..3d080b56391a 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -906,44 +906,45 @@ SwXShape::SwXShape(uno::Reference< uno::XInterface > & xShape) : pImpl(new SwShapeDescriptor_Impl()), m_bDescriptor(true) { - if(xShape.is()) // default Ctor + if(!xShape.is()) // default Ctor + return; + + const uno::Type& rAggType = cppu::UnoType<uno::XAggregation>::get(); + //aAgg contains a reference of the SvxShape! { - const uno::Type& rAggType = cppu::UnoType<uno::XAggregation>::get(); - //aAgg contains a reference of the SvxShape! + uno::Any aAgg = xShape->queryInterface(rAggType); + aAgg >>= xShapeAgg; + // #i31698# + if ( xShapeAgg.is() ) { - uno::Any aAgg = xShape->queryInterface(rAggType); - aAgg >>= xShapeAgg; - // #i31698# - if ( xShapeAgg.is() ) - { - xShapeAgg->queryAggregation( cppu::UnoType<drawing::XShape>::get()) >>= mxShape; - OSL_ENSURE( mxShape.is(), - "<SwXShape::SwXShape(..)> - no XShape found at <xShapeAgg>" ); - } + xShapeAgg->queryAggregation( cppu::UnoType<drawing::XShape>::get()) >>= mxShape; + OSL_ENSURE( mxShape.is(), + "<SwXShape::SwXShape(..)> - no XShape found at <xShapeAgg>" ); } - xShape = nullptr; - m_refCount++; - if( xShapeAgg.is() ) - xShapeAgg->setDelegator( static_cast<cppu::OWeakObject*>(this) ); - m_refCount--; + } + xShape = nullptr; + m_refCount++; + if( xShapeAgg.is() ) + xShapeAgg->setDelegator( static_cast<cppu::OWeakObject*>(this) ); + m_refCount--; - uno::Reference< lang::XUnoTunnel > xShapeTunnel(xShapeAgg, uno::UNO_QUERY); - SvxShape* pShape = nullptr; - if(xShapeTunnel.is()) - pShape = reinterpret_cast< SvxShape * >( - sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething(SvxShape::getUnoTunnelId()) )); + uno::Reference< lang::XUnoTunnel > xShapeTunnel(xShapeAgg, uno::UNO_QUERY); + SvxShape* pShape = nullptr; + if(xShapeTunnel.is()) + pShape = reinterpret_cast< SvxShape * >( + sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething(SvxShape::getUnoTunnelId()) )); - SdrObject* pObj = pShape ? pShape->GetSdrObject() : nullptr; - if(pObj) - { - SwFrameFormat* pFormat = ::FindFrameFormat( pObj ); - if(pFormat) - pFormat->Add(this); + SdrObject* pObj = pShape ? pShape->GetSdrObject() : nullptr; + if(pObj) + { + SwFrameFormat* pFormat = ::FindFrameFormat( pObj ); + if(pFormat) + pFormat->Add(this); - lcl_addShapePropertyEventFactories( *pObj, *this ); - pImpl->bInitializedPropertyNotifier = true; - } + lcl_addShapePropertyEventFactories( *pObj, *this ); + pImpl->bInitializedPropertyNotifier = true; } + } void SwXShape::AddExistingShapeToFormat( SdrObject const & _rObj ) |