summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-08-25 21:03:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-08-26 09:07:00 +0200
commit5f891974bfb27bacd5fc3d623463204e872fffad (patch)
tree13543dbb3bd3b632004622b926ffcf8b2904b285 /svx/source
parent9a6293bec8d1902b1f2ff2028c95c6b5bb950a35 (diff)
simplify SvxShape::Notify a little
(*) the logic at the bottom was very hard to read (*) by the time we hit the bottom of the method, we know pSdrObject cannot be nullptr Change-Id: I718d655f4e477bb3edaaa3f41412fb16c7336017 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138846 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/unodraw/unoshape.cxx45
1 files changed, 12 insertions, 33 deletions
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index cb27ab065886..9eb3edfd5ab8 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -989,48 +989,27 @@ void SvxShape::Notify( SfxBroadcaster&, const SfxHint& rHint ) noexcept
return;
}
- bool bClearMe = false;
-
- switch( pSdrHint->GetKind() )
+ if (pSdrHint->GetKind() == SdrHintKind::ObjectChange)
{
- case SdrHintKind::ObjectChange:
- {
- updateShapeKind();
- break;
- }
- case SdrHintKind::ModelCleared:
- {
- bClearMe = true;
- break;
- }
- default:
- break;
- };
-
- if( !bClearMe )
- return;
-
- if(!HasSdrObjectOwnership())
+ updateShapeKind();
+ }
+ else // (pSdrHint->GetKind() == SdrHintKind::ModelCleared)
{
- if(nullptr != pSdrObject)
+ if(!HasSdrObjectOwnership())
{
EndListening(pSdrObject->getSdrModelFromSdrObject());
pSdrObject->setUnoShape(nullptr);
- }
- mpSdrObjectWeakReference.reset(nullptr);
+ mpSdrObjectWeakReference.reset(nullptr);
- // SdrModel *is* going down, try to Free SdrObject even
- // when !HasSdrObjectOwnership
- if(nullptr != pSdrObject && !pSdrObject->IsInserted())
- {
- SdrObject::Free(pSdrObject);
+ // SdrModel *is* going down, try to Free SdrObject even
+ // when !HasSdrObjectOwnership
+ if(!pSdrObject->IsInserted())
+ SdrObject::Free(pSdrObject);
}
- }
- if(!mpImpl->mbDisposing)
- {
- dispose();
+ if(!mpImpl->mbDisposing)
+ dispose();
}
}