summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-01-14 12:31:48 +0600
committerAndras Timar <andras.timar@collabora.com>2024-06-03 14:31:33 +0200
commitc9a79120a847f716fadfa1433e09679051714a74 (patch)
treef55188199223fa447714904874740eae3ec155aa /sw
parent6e4f4c8bea7da7cfa922e02359290374aa54d34b (diff)
Simplify a bit
And avoid a second call of pObj->GetUserCall. Change-Id: I4487ad33df594a8a96b517c5b4671512dea7116d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162042 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit 5703d3af04b8fe78fdd4dbef14b08d8446402779) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167940 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/draw/dcontact.cxx16
1 files changed, 10 insertions, 6 deletions
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 115887a368dc..a91e92569f7a 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -170,12 +170,16 @@ SwRect GetBoundRectOfAnchoredObj( const SdrObject* pObj )
/// Returns the UserCall if applicable from the group object
SwContact* GetUserCall( const SdrObject* pObj )
{
- SdrObject *pTmp;
- while ( !pObj->GetUserCall() && nullptr != (pTmp = pObj->getParentSdrObjectFromSdrObject()) )
- pObj = pTmp;
- assert((!pObj->GetUserCall() || nullptr != dynamic_cast<const SwContact*>(pObj->GetUserCall())) &&
- "<::GetUserCall(..)> - wrong type of found object user call." );
- return static_cast<SwContact*>(pObj->GetUserCall());
+ for (; pObj; pObj = pObj->getParentSdrObjectFromSdrObject())
+ {
+ if (auto pUserCall = pObj->GetUserCall())
+ {
+ assert(dynamic_cast<SwContact*>(pUserCall)
+ && "<::GetUserCall(..)> - wrong type of found object user call.");
+ return static_cast<SwContact*>(pUserCall);
+ }
+ }
+ return nullptr;
}
/// Returns true if the SrdObject is a Marquee-Object (scrolling text)