summaryrefslogtreecommitdiff
path: root/svx/source/svdraw/svdmrkv.cxx
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2017-12-27 13:00:39 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2017-12-27 16:34:14 +0100
commitfed40ef827f2ee8db583a13bcb439fe625c7527f (patch)
tree5caa7931dcf01e55aee6f570091fa6d84dce789f /svx/source/svdraw/svdmrkv.cxx
parentb30499e288b923483c3d00edce6af72cb5eef5b9 (diff)
Return early
Change-Id: I2b420141b5986b1d23460d5432c1b7051b11663e
Diffstat (limited to 'svx/source/svdraw/svdmrkv.cxx')
-rw-r--r--svx/source/svdraw/svdmrkv.cxx22
1 files changed, 11 insertions, 11 deletions
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index f0043d4aa824..cb5f4fe0f972 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -1913,24 +1913,23 @@ bool SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageVie
bool bCheckNearestOn3rdPass(nOptions & SdrSearchOptions::PASS3NEAREST);
rpObj=nullptr;
rpPV=nullptr;
- bool bFnd=false;
const size_t nMarkCount=GetMarkedObjectCount();
- for (size_t nMarkNum=nMarkCount; nMarkNum>0 && !bFnd;) {
+ for (size_t nMarkNum=nMarkCount; nMarkNum>0;) {
--nMarkNum;
SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
SdrPageView* pPV=pM->GetPageView();
SdrObject* pObj=pM->GetMarkedSdrObj();
- bFnd = nullptr != CheckSingleSdrObjectHit(rPnt,mnHitTolLog,pObj,pPV,SdrSearchOptions::TESTMARKABLE,nullptr);
- if (bFnd) {
+ if (CheckSingleSdrObjectHit(rPnt,mnHitTolLog,pObj,pPV,SdrSearchOptions::TESTMARKABLE,nullptr)) {
rpObj=pObj;
rpPV=pPV;
+ return true;
}
}
- if ((bBoundCheckOn2ndPass || bCheckNearestOn3rdPass) && !bFnd) {
+ if (bBoundCheckOn2ndPass || bCheckNearestOn3rdPass) {
SdrObject* pBestObj=nullptr;
SdrPageView* pBestPV=nullptr;
sal_uIntPtr nBestDist=ULONG_MAX;
- for (size_t nMarkNum=nMarkCount; nMarkNum>0 && !bFnd;) {
+ for (size_t nMarkNum=nMarkCount; nMarkNum>0;) {
--nMarkNum;
SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
SdrPageView* pPV=pM->GetPageView();
@@ -1941,10 +1940,11 @@ bool SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageVie
aRect.Right ()+=mnHitTolLog;
aRect.Bottom()+=mnHitTolLog;
if (aRect.IsInside(rPnt)) {
- bFnd=true;
rpObj=pObj;
rpPV=pPV;
- } else if (bCheckNearestOn3rdPass) {
+ return true;
+ }
+ if (bCheckNearestOn3rdPass) {
sal_uIntPtr nDist=0;
if (rPnt.X()<aRect.Left()) nDist+=aRect.Left()-rPnt.X();
if (rPnt.X()>aRect.Right()) nDist+=rPnt.X()-aRect.Right();
@@ -1957,13 +1957,13 @@ bool SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageVie
}
}
}
- if (bCheckNearestOn3rdPass && !bFnd) {
+ if (bCheckNearestOn3rdPass) {
rpObj=pBestObj;
rpPV=pBestPV;
- bFnd=pBestObj!=nullptr;
+ return pBestObj!=nullptr;
}
}
- return bFnd;
+ return false;
}