summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-11-12 17:07:22 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-11-14 08:52:21 +0000
commitaa3f954222a270d3e2fa531badd2fa7febd30338 (patch)
treef9921a240795044f00ce61718d052c26ebbc8ae0
parent90a77e9c13eb9b2aa6e83653d9d2d1409bc47f36 (diff)
coverity#703927 Unchecked return value
make these less odd and simply return the thing they selected, rather than a bool that indicates that the rpObj arg was successfully set to non-null, so there's one flag to check not two which both mean the same thing. Change-Id: If70e412f98dea8b7114fb77f26a9c59aab93be50 Reviewed-on: https://gerrit.libreoffice.org/30794 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--basctl/source/dlged/dlgedfunc.cxx4
-rw-r--r--chart2/source/controller/drawinglayer/DrawViewWrapper.cxx3
-rw-r--r--include/svx/svdmrkv.hxx4
-rw-r--r--sc/source/ui/drawfunc/drawsh.cxx4
-rw-r--r--sc/source/ui/drawfunc/fudraw.cxx10
-rw-r--r--sc/source/ui/drawfunc/fusel.cxx16
-rw-r--r--sc/source/ui/drawfunc/futext.cxx12
-rw-r--r--sc/source/ui/view/gridwin5.cxx8
-rw-r--r--sc/source/ui/view/viewfun7.cxx4
-rw-r--r--sd/source/ui/func/fuconstr.cxx4
-rw-r--r--sd/source/ui/func/fudraw.cxx8
-rw-r--r--sd/source/ui/func/fudspord.cxx7
-rw-r--r--sd/source/ui/func/fuformatpaintbrush.cxx10
-rw-r--r--sd/source/ui/func/fusel.cxx18
-rw-r--r--sd/source/ui/func/futext.cxx4
-rw-r--r--sd/source/ui/view/sdview2.cxx12
-rw-r--r--sd/source/ui/view/sdview3.cxx5
-rw-r--r--sd/source/ui/view/sdview4.cxx2
-rw-r--r--svx/source/dialog/imapwnd.cxx6
-rw-r--r--svx/source/form/fmpage.cxx4
-rw-r--r--svx/source/svdraw/svdmrkv.cxx19
-rw-r--r--svx/source/svdraw/svdview.cxx4
-rw-r--r--sw/source/core/draw/dpage.cxx8
-rw-r--r--sw/source/core/frmedt/fefly1.cxx24
-rw-r--r--sw/source/core/frmedt/feshview.cxx26
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx14
-rw-r--r--sw/source/uibase/uiview/viewdraw.cxx11
27 files changed, 120 insertions, 131 deletions
diff --git a/basctl/source/dlged/dlgedfunc.cxx b/basctl/source/dlged/dlgedfunc.cxx
index 30a95a8541f4..2ace04cf7350 100644
--- a/basctl/source/dlged/dlgedfunc.cxx
+++ b/basctl/source/dlged/dlgedfunc.cxx
@@ -464,9 +464,9 @@ void DlgEdFuncSelect::MouseButtonDown( const MouseEvent& rMEvt )
rView.UnmarkAll();
else
{
- SdrObject* pObj;
SdrPageView* pPV;
- if( rView.PickObj( aMDPos, nHitLog, pObj, pPV ) )
+ SdrObject* pObj = rView.PickObj(aMDPos, nHitLog, pPV);
+ if (pObj)
{
//if (dynamic_cast<DlgEdForm*>(pObj))
// rView.UnmarkAll();
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
index 14434150f64b..c866eb6d07d2 100644
--- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
+++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
@@ -174,11 +174,10 @@ void DrawViewWrapper::SetMarkHandles(SfxViewShell* pOtherShell)
SdrObject* DrawViewWrapper::getHitObject( const Point& rPnt ) const
{
- SdrObject* pRet = nullptr;
SdrSearchOptions nOptions = SdrSearchOptions::DEEP | SdrSearchOptions::TESTMARKABLE;
SdrPageView* pSdrPageView = this->GetPageView();
- this->SdrView::PickObj(rPnt, lcl_getHitTolerance( this->GetFirstOutputDevice() ), pRet, pSdrPageView, nOptions);
+ SdrObject* pRet = this->SdrView::PickObj(rPnt, lcl_getHitTolerance( this->GetFirstOutputDevice() ), pSdrPageView, nOptions);
if( pRet )
{
diff --git a/include/svx/svdmrkv.hxx b/include/svx/svdmrkv.hxx
index 2213699b603d..49795e6fd187 100644
--- a/include/svx/svdmrkv.hxx
+++ b/include/svx/svdmrkv.hxx
@@ -268,8 +268,8 @@ public:
// SdrSearchOptions::DEEP SdrSearchOptions::ALSOONMASTER SdrSearchOptions::TESTMARKABLE SdrSearchOptions::TESTTEXTEDIT
// SdrSearchOptions::WITHTEXT SdrSearchOptions::TESTTEXTAREA SdrSearchOptions::BACKWARD SdrSearchOptions::MARKED
// SdrSearchOptions::WHOLEPAGE
- bool PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, SdrSearchOptions nOptions, SdrObject** ppRootObj, bool* pbHitPassDirect=nullptr) const;
- bool PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, SdrSearchOptions nOptions=SdrSearchOptions::NONE) const;
+ SdrObject* PickObj(const Point& rPnt, short nTol, SdrPageView*& rpPV, SdrSearchOptions nOptions, SdrObject** ppRootObj, bool* pbHitPassDirect=nullptr) const;
+ SdrObject* PickObj(const Point& rPnt, short nTol, SdrPageView*& rpPV, SdrSearchOptions nOptions=SdrSearchOptions::NONE) const;
bool MarkObj(const Point& rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false);
// Pick: Supported options for nOptions are SdrSearchOptions::PASS2BOUND und SdrSearchOptions::PASS3NEAREST
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 756ed34a4584..3b38a264610c 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -228,8 +228,8 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
if ( pObj->IsGroupObject() )
{
SdrPageView* pPV = nullptr;
- SdrObject* pHit = nullptr;
- if ( pView->PickObj( pWin->PixelToLogic( pViewData->GetMousePosPixel() ), pView->getHitTolLog(), pHit, pPV, SdrSearchOptions::DEEP ) )
+ SdrObject* pHit = pView->PickObj(pWin->PixelToLogic(pViewData->GetMousePosPixel()), pView->getHitTolLog(), pPV, SdrSearchOptions::DEEP);
+ if (pHit)
pObj = pHit;
}
diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx
index cc4a2534f479..16cf0a6b4830 100644
--- a/sc/source/ui/drawfunc/fudraw.cxx
+++ b/sc/source/ui/drawfunc/fudraw.cxx
@@ -697,16 +697,16 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt)
bool bAlt = pMEvt && pMEvt->IsMod2();
Point aPnt = pWindow->PixelToLogic( aPosPixel );
SdrHdl* pHdl = pView->PickHandle(aPnt);
- SdrObject* pObj;
SdrPageView* pPV;
ScMacroInfo* pInfo = nullptr;
- if ( pView->PickObj(aPnt, pView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER) )
+ SdrObject* pObj = pView->PickObj(aPnt, pView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER);
+ if (pObj)
{
if ( pObj->IsGroupObject() )
{
- SdrObject* pHit = nullptr;
- if ( pView->PickObj(aMDPos, pView->getHitTolLog(), pHit, pPV, SdrSearchOptions::DEEP ) )
+ SdrObject* pHit = pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::DEEP);
+ if (pHit)
pObj = pHit;
}
pInfo = ScDrawLayer::GetMacroInfo( pObj );
@@ -731,7 +731,7 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt)
// could be suppressed with ALT
pWindow->SetPointer( Pointer( PointerStyle::RefHand ) ); // Text-URL / ImageMap
}
- else if ( !bAlt && pView->PickObj(aPnt, pView->getHitTolLog(), pObj, pPV, SdrSearchOptions::PICKMACRO) )
+ else if ( !bAlt && (pObj = pView->PickObj(aPnt, pView->getHitTolLog(), pPV, SdrSearchOptions::PICKMACRO)) )
{
// could be suppressed with ALT
SdrObjMacroHitRec aHitRec; //! something missing ????
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index aa0ff4b41bdd..445ac52c058a 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -143,10 +143,10 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
}
else
{
- SdrObject* pObj;
- SdrPageView* pPV;
+ SdrPageView* pPV = nullptr;
bool bAlt = rMEvt.IsMod2();
- if ( !bAlt && pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SdrSearchOptions::PICKMACRO) )
+ SdrObject* pObj = !bAlt ? pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::PICKMACRO) : nullptr;
+ if (pObj)
{
pView->BegMacroObj(aMDPos, pObj, pPV, pWindow);
bReturn = true;
@@ -154,7 +154,8 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
else
{
OUString sURL, sTarget;
- if ( !bAlt && pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER))
+ pObj = !bAlt ? pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER) : nullptr;
+ if (pObj)
{
// Support for imported Excel docs
// Excel is of course not consistent and allows
@@ -176,8 +177,8 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
ScMacroInfo* pTmpInfo = ScDrawLayer::GetMacroInfo( pObj );
if ( !pTmpInfo || pTmpInfo->GetMacro().isEmpty() )
{
- SdrObject* pHit = nullptr;
- if ( pView->PickObj(aMDPos, pView->getHitTolLog(), pHit, pPV, SdrSearchOptions::DEEP ) )
+ SdrObject* pHit = pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::DEEP);
+ if (pHit)
pObj = pHit;
}
}
@@ -420,7 +421,8 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
* one, he releases the mouse button immediately
**************************************************************/
SdrPageView* pPV = nullptr;
- if (pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK))
+ pObj = pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK);
+ if (pObj)
{
pView->UnmarkAllObj();
pView->MarkObj(pObj,pPV);
diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx
index b23fb0e60d6c..474871b5203b 100644
--- a/sc/source/ui/drawfunc/futext.cxx
+++ b/sc/source/ui/drawfunc/futext.cxx
@@ -196,14 +196,14 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
}
}
- SdrObject* pObj;
- SdrPageView* pPV;
+ SdrPageView* pPV = nullptr;
if ( pHdl != nullptr || pView->IsMarkedHit(aMDPos) )
{
- if (pHdl == nullptr &&
-// pView->TakeTextEditObject(aMDPos, pObj, pPV) )
- pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SdrSearchOptions::PICKTEXTEDIT) )
+ SdrObject* pObj = (pHdl == nullptr) ?
+ pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::PICKTEXTEDIT) :
+ nullptr;
+ if (pObj)
{
SdrOutliner* pO = MakeOutliner();
lcl_UpdateHyphenator( *pO, pObj );
@@ -329,7 +329,7 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
if ( bRet )
pView->GetCreateObj()->SetGridOffset( aGridOff );
}
- else if (pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK))
+ else if (SdrObject* pObj = pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK))
{
pView->UnmarkAllObj();
ScViewData& rViewData = pViewShell->GetViewData();
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index 2424bd7d54c4..8608aea834c2 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -340,15 +340,15 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
}
else
{
- SdrObject* pObj = nullptr;
SdrPageView* pPV = nullptr;
Point aMDPos = PixelToLogic( aPosPixel );
- if ( pDrView->PickObj(aMDPos, pDrView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER) )
+ SdrObject* pObj = pDrView->PickObj(aMDPos, pDrView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER);
+ if (pObj)
{
if ( pObj->IsGroupObject() )
{
- SdrObject* pHit = nullptr;
- if ( pDrView->PickObj(aMDPos, pDrView->getHitTolLog(), pHit, pPV, SdrSearchOptions::DEEP ) )
+ SdrObject* pHit = pDrView->PickObj(aMDPos, pDrView->getHitTolLog(), pPV, SdrSearchOptions::DEEP);
+ if (pHit)
pObj = pHit;
}
ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index 680fcb77e9fd..9f9fe22f25e4 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -390,8 +390,8 @@ bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic,
SdrPageView* pPageView = pScDrawView->GetSdrPageView();
if (pPageView)
{
- SdrObject* pPickObj = nullptr;
- if (pScDrawView->PickObj(rPos, pScDrawView->getHitTolLog(), pPickObj, pPageView))
+ SdrObject* pPickObj = pScDrawView->PickObj(rPos, pScDrawView->getHitTolLog(), pPageView);
+ if (pPickObj)
{
const OUString aBeginUndo(ScGlobal::GetRscString(STR_UNDO_DRAGDROP));
SdrObject* pResult = pScDrawView->ApplyGraphicToObject(
diff --git a/sd/source/ui/func/fuconstr.cxx b/sd/source/ui/func/fuconstr.cxx
index 1ead60c67fe9..f695c7afc930 100644
--- a/sd/source/ui/func/fuconstr.cxx
+++ b/sd/source/ui/func/fuconstr.cxx
@@ -163,11 +163,11 @@ bool FuConstruct::MouseButtonUp(const MouseEvent& rMEvt)
if ( !mpView->AreObjectsMarked() )
{
- SdrObject* pObj;
SdrPageView* pPV;
sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
- if (!mpView->PickObj(aPnt, mpView->getHitTolLog(), pObj, pPV))
+ SdrObject* pObj = mpView->PickObj(aPnt, mpView->getHitTolLog(), pPV);
+ if (!pObj)
{
mpView->MarkObj(aPnt, nHitLog);
}
diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx
index b8d44f126977..f593a96474d4 100644
--- a/sd/source/ui/func/fudraw.cxx
+++ b/sd/source/ui/func/fudraw.cxx
@@ -542,7 +542,7 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt)
if (eHit == SdrHitKind::NONE)
{
// found nothing -> look after at the masterpage
- mpView->PickObj(aPnt, mpView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER);
+ pObj = mpView->PickObj(aPnt, mpView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER);
}
else if (eHit == SdrHitKind::UnmarkedObject)
{
@@ -571,7 +571,8 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt)
if (bDefPointer && (dynamic_cast< const SdrObjGroup *>( pObj ) != nullptr || dynamic_cast< const E3dPolyScene* >(pObj) != nullptr))
{
// take a glance into the group
- if (mpView->PickObj(aPnt, mpView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::DEEP))
+ pObj = mpView->PickObj(aPnt, mpView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::DEEP);
+ if (pObj)
bDefPointer = !SetPointer(pObj, aPnt);
}
}
@@ -760,7 +761,8 @@ bool FuDraw::RequestHelp(const HelpEvent& rHEvt)
Point aPos(mpWindow->PixelToLogic(mpWindow->ScreenToOutputPixel(aPosPixel)));
- if (mpView->PickObj(aPos, mpView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::DEEP))
+ pObj = mpView->PickObj(aPos, mpView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::DEEP);
+ if (pObj)
bReturn = SetHelpText(pObj, aPosPixel, aVEvt);
}
}
diff --git a/sd/source/ui/func/fudspord.cxx b/sd/source/ui/func/fudspord.cxx
index fb4fb7f8eb06..1f54d7711cb8 100644
--- a/sd/source/ui/func/fudspord.cxx
+++ b/sd/source/ui/func/fudspord.cxx
@@ -69,11 +69,11 @@ bool FuDisplayOrder::MouseButtonDown(const MouseEvent& rMEvt)
bool FuDisplayOrder::MouseMove(const MouseEvent& rMEvt)
{
- SdrObject* pPickObj;
SdrPageView* pPV;
Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
- if ( mpView->PickObj(aPnt, mpView->getHitTolLog(), pPickObj, pPV) )
+ SdrObject* pPickObj = mpView->PickObj(aPnt, mpView->getHitTolLog(), pPV);
+ if (pPickObj)
{
if (mpRefObj != pPickObj)
{
@@ -104,7 +104,8 @@ bool FuDisplayOrder::MouseButtonUp(const MouseEvent& rMEvt)
SdrPageView* pPV = nullptr;
Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
- if ( mpView->PickObj(aPnt, mpView->getHitTolLog(), mpRefObj, pPV) )
+ mpRefObj = mpView->PickObj(aPnt, mpView->getHitTolLog(), pPV);
+ if (mpRefObj)
{
if (nSlotId == SID_BEFORE_OBJ)
{
diff --git a/sd/source/ui/func/fuformatpaintbrush.cxx b/sd/source/ui/func/fuformatpaintbrush.cxx
index dc70c36bbf6a..d665ce0c607c 100644
--- a/sd/source/ui/func/fuformatpaintbrush.cxx
+++ b/sd/source/ui/func/fuformatpaintbrush.cxx
@@ -99,11 +99,9 @@ bool FuFormatPaintBrush::MouseButtonDown(const MouseEvent& rMEvt)
if( (eHit == SdrHitKind::TextEdit) || (eHit == SdrHitKind::TextEditObj && ( mpViewShell->GetFrameView()->IsQuickEdit() || dynamic_cast< sdr::table::SdrTableObj* >( aVEvt.pObj ) != nullptr ) ))
{
- SdrObject* pPickObj=nullptr;
SdrPageView* pPV=nullptr;
sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
- mpView->PickObj( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ),nHitLog, pPickObj, pPV, SdrSearchOptions::PICKMARKABLE);
-
+ SdrObject* pPickObj = mpView->PickObj(mpWindow->PixelToLogic(rMEvt.GetPosPixel()),nHitLog, pPV, SdrSearchOptions::PICKMARKABLE);
if( (pPickObj != nullptr) && !pPickObj->IsEmptyPresObj() )
{
// if we text hit another shape than the one currently selected, unselect the old one now
@@ -159,11 +157,9 @@ bool FuFormatPaintBrush::MouseMove(const MouseEvent& rMEvt)
else
{
sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
- SdrObject* pObj=nullptr;
SdrPageView* pPV=nullptr;
- bool bOverMarkableObject = mpView->PickObj( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ),nHitLog, pObj, pPV, SdrSearchOptions::PICKMARKABLE);
-
- if(bOverMarkableObject && HasContentForThisType(pObj->GetObjInventor(),pObj->GetObjIdentifier()) )
+ SdrObject* pObj = mpView->PickObj(mpWindow->PixelToLogic( rMEvt.GetPosPixel() ),nHitLog, pPV, SdrSearchOptions::PICKMARKABLE);
+ if (pObj && HasContentForThisType(pObj->GetObjInventor(),pObj->GetObjIdentifier()) )
mpWindow->SetPointer(Pointer(PointerStyle::Fill));
else
mpWindow->SetPointer(Pointer(PointerStyle::Arrow));
diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx
index 90df8c954270..b84a5fc183e5 100644
--- a/sd/source/ui/func/fusel.cxx
+++ b/sd/source/ui/func/fusel.cxx
@@ -233,8 +233,8 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
}
else
{
- SdrObject* pObj;
- if (!rMEvt.IsMod2() && mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SdrSearchOptions::PICKMACRO))
+ SdrObject* pObj = !rMEvt.IsMod2() ? mpView->PickObj(aMDPos, mpView->getHitTolLog(), pPV, SdrSearchOptions::PICKMACRO) : nullptr;
+ if (pObj)
{
mpView->BegMacroObj(aMDPos, nHitLog, pObj, pPV, mpWindow);
bReturn = true;
@@ -301,7 +301,8 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
&& dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr
)
{
- if(mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER))
+ pObj = mpView->PickObj(aMDPos, mpView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER);
+ if (pObj)
{
// Animate object when not just selecting.
if ( ! bSelectionOnly)
@@ -312,7 +313,8 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
if(rMEvt.GetClicks() == 1)
{
// Look into the group
- if (mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::DEEP))
+ pObj = mpView->PickObj(aMDPos, mpView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::DEEP);
+ if (pObj)
bReturn = AnimateObj(pObj, aMDPos);
}
else if( !bReadOnly && rMEvt.GetClicks() == 2)
@@ -670,8 +672,8 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
* one, he releases the mouse button immediately
**************************************************************/
SdrPageView* pPV;
- SdrObject* pObj;
- if (mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK))
+ SdrObject* pObj = mpView->PickObj(aMDPos, mpView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK);
+ if (pObj)
{
if (pPV->IsObjMarkable(pObj))
{
@@ -1483,11 +1485,9 @@ bool FuSelection::cancel()
SdrObject* FuSelection::pickObject (const Point& rTestPoint)
{
- SdrObject* pObject = nullptr;
SdrPageView* pPageView;
sal_uInt16 nHitLog = sal_uInt16 (mpWindow->PixelToLogic(Size(HITPIX,0)).Width());
- mpView->PickObj (rTestPoint, nHitLog, pObject, pPageView, SdrSearchOptions::PICKMARKABLE);
- return pObject;
+ return mpView->PickObj(rTestPoint, nHitLog, pPageView, SdrSearchOptions::PICKMARKABLE);
}
void FuSelection::ForcePointer(const MouseEvent* pMEvt)
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
index 097f7727be4d..07bcdc858634 100644
--- a/sd/source/ui/func/futext.cxx
+++ b/sd/source/ui/func/futext.cxx
@@ -656,9 +656,9 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
/*************************************************************
* From text mode, you don't want to rotate immediately.
**************************************************************/
- SdrObject* pObj;
SdrPageView* pPV;
- if (mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK))
+ SdrObject* pObj = mpView->PickObj(aMDPos, mpView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK);
+ if (pObj)
{
if (pPV->IsObjMarkable(pObj))
{
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index 8b6c079989a7..ccdf2ada88f6 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -536,14 +536,13 @@ sal_Int8 View::AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTarge
// check object insert
if( !nRet && ( bXFillExchange || ( ( bDrawing || bGraphic || bMtf || bBitmap || bBookmark ) && ( nDropAction & DND_ACTION_LINK ) ) ) )
{
- SdrObject* pPickObj = nullptr;
SdrPageView* pPageView = nullptr;
::sd::Window* pWindow = mpViewSh->GetActiveWindow();
Point aPos( pWindow->PixelToLogic( rEvt.maPosPixel ) );
- const bool bHasPickObj = PickObj( aPos, getHitTolLog(), pPickObj, pPageView );
+ SdrObject* pPickObj = PickObj(aPos, getHitTolLog(), pPageView);
bool bIsPresTarget = false;
- if( bHasPickObj && pPickObj && ( pPickObj->IsEmptyPresObj() || pPickObj->GetUserCall() ) )
+ if (pPickObj && (pPickObj->IsEmptyPresObj() || pPickObj->GetUserCall()))
{
SdPage* pPage = static_cast<SdPage*>( pPickObj->GetPage() );
@@ -551,8 +550,7 @@ sal_Int8 View::AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTarge
bIsPresTarget = pPage->IsPresObj( pPickObj );
}
- if( bHasPickObj && !bIsPresTarget &&
- ( bGraphic || bMtf || bBitmap || bXFillExchange ) )
+ if (pPickObj && !bIsPresTarget && (bGraphic || bMtf || bBitmap || bXFillExchange))
{
if( mpDropMarkerObj != pPickObj )
{
@@ -719,10 +717,10 @@ sal_Int8 View::ExecuteDrop( const ExecuteDropEvent& rEvt,
}
else
{
- SdrObject* pPickObj = nullptr;
SdrPageView* pPageView = nullptr;
- if( PickObj( aPos, getHitTolLog(), pPickObj, pPageView ) )
+ SdrObject* pPickObj = PickObj(aPos, getHitTolLog(), pPageView);
+ if (pPickObj)
{
// insert as clip action => jump
OUString aBookmark( aINetBookmark.GetURL() );
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index ed2b16c4ed03..6490032b32c9 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -286,7 +286,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
if( bDrag )
{
SdrPageView* pPV = nullptr;
- PickObj( rPos, getHitTolLog(), pPickObj, pPV );
+ pPickObj = PickObj(rPos, getHitTolLog(), pPV);
}
if( nPage != SDRPAGE_NOTFOUND )
@@ -706,9 +706,8 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
{
// only one object
SdrObject* pObj = pModel->GetSdPage( 0, PageKind::Standard )->GetObj( 0 );
- SdrObject* pPickObj2 = nullptr;
SdrPageView* pPV = nullptr;
- PickObj( rPos, getHitTolLog(), pPickObj2, pPV );
+ SdrObject* pPickObj2 = PickObj(rPos, getHitTolLog(), pPV);
if( ( mnAction & DND_ACTION_MOVE ) && pPickObj2 && pObj )
{
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index 7782139d604e..96a2ffc5363c 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -95,7 +95,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
if( !pPickObj && pPV )
{
SdrPageView* pPageView = pPV;
- PickObj(rPos, getHitTolLog(), pPickObj, pPageView);
+ pPickObj = PickObj(rPos, getHitTolLog(), pPageView);
}
const bool bIsGraphic(dynamic_cast< const SdrGrafObj* >(pPickObj) != nullptr);
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
index 346fe9b6f217..d74fdee9d76b 100644
--- a/svx/source/dialog/imapwnd.cxx
+++ b/svx/source/dialog/imapwnd.cxx
@@ -554,9 +554,9 @@ void IMapWindow::RequestHelp( const HelpEvent& rHEvt )
if ( Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled() )
{
- SdrObject* pSdrObj = nullptr;
- SdrPageView* pPageView = nullptr;
- if ( pView->PickObj( aPos, pView->getHitTolLog(), pSdrObj, pPageView ) )
+ SdrPageView* pPageView = nullptr;
+ SdrObject* pSdrObj = pView->PickObj(aPos, pView->getHitTolLog(), pPageView);
+ if (pSdrObj)
{
const IMapObject* pIMapObj = GetIMapObj( pSdrObj );
OUString aStr;
diff --git a/svx/source/form/fmpage.cxx b/svx/source/form/fmpage.cxx
index 0c3c98d1f9fa..4efb98c7e6f3 100644
--- a/svx/source/form/fmpage.cxx
+++ b/svx/source/form/fmpage.cxx
@@ -160,9 +160,9 @@ bool FmFormPage::RequestHelp( vcl::Window* pWindow, SdrView* pView,
aPos = pWindow->ScreenToOutputPixel( aPos );
aPos = pWindow->PixelToLogic( aPos );
- SdrObject* pObj = nullptr;
SdrPageView* pPV = nullptr;
- if ( !pView->PickObj( aPos, 0, pObj, pPV, SdrSearchOptions::DEEP ) )
+ SdrObject* pObj = pView->PickObj(aPos, 0, pPV, SdrSearchOptions::DEEP);
+ if (!pObj)
return false;
FmFormObj* pFormObject = FmFormObj::GetFormObject( pObj );
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index cadb11a08c94..21895ed767e0 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -1372,17 +1372,16 @@ SdrHdl* SdrMarkView::PickHandle(const Point& rPnt) const
bool SdrMarkView::MarkObj(const Point& rPnt, short nTol, bool bToggle, bool bDeep)
{
- SdrObject* pObj;
SdrPageView* pPV;
nTol=ImpGetHitTolLogic(nTol,nullptr);
SdrSearchOptions nOptions=SdrSearchOptions::PICKMARKABLE;
if (bDeep) nOptions=nOptions|SdrSearchOptions::DEEP;
- bool bRet=PickObj(rPnt,(sal_uInt16)nTol,pObj,pPV,nOptions);
- if (bRet) {
+ SdrObject* pObj = PickObj(rPnt, (sal_uInt16)nTol, pPV, nOptions);
+ if (pObj) {
bool bUnmark=bToggle && IsObjMarked(pObj);
MarkObj(pObj,pPV,bUnmark);
}
- return bRet;
+ return pObj != nullptr;
}
bool SdrMarkView::MarkNextObj(bool bPrev)
@@ -1741,17 +1740,17 @@ SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nT
return pRet;
}
-bool SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, SdrSearchOptions nOptions) const
+SdrObject* SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrPageView*& rpPV, SdrSearchOptions nOptions) const
{
- return PickObj(rPnt,nTol,rpObj,rpPV,nOptions,nullptr);
+ return PickObj(rPnt, nTol, rpPV, nOptions, nullptr);
}
-bool SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, SdrSearchOptions nOptions, SdrObject** ppRootObj, bool* pbHitPassDirect) const
+SdrObject* SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrPageView*& rpPV, SdrSearchOptions nOptions, SdrObject** ppRootObj, bool* pbHitPassDirect) const
{ // TODO: lacks a Pass2,Pass3
SortMarkedObjects();
if (ppRootObj!=nullptr) *ppRootObj=nullptr;
if (pbHitPassDirect!=nullptr) *pbHitPassDirect=true;
- rpObj=nullptr;
+ SdrObject* pRet = nullptr;
rpPV=nullptr;
bool bWholePage(nOptions & SdrSearchOptions::WHOLEPAGE);
bool bMarked(nOptions & SdrSearchOptions::MARKED);
@@ -1856,11 +1855,11 @@ bool SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrP
}
}
if (pObj!=nullptr) {
- rpObj=pObj;
+ pRet=pObj;
rpPV=pPV;
}
}
- return rpObj!=nullptr;
+ return pRet;
}
bool SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, SdrSearchOptions nOptions) const
diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx
index 76acf83e4138..144d3497a361 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -354,7 +354,7 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co
{
eHit=SdrHitKind::Gluepoint; // deselected glue point hit
}
- else if (PickObj(aLocalLogicPosition,mnHitTolLog,pHitObj,pPV,SdrSearchOptions::DEEP|SdrSearchOptions::MARKED,&pObj,&bHitPassDirect))
+ else if ((pHitObj = PickObj(aLocalLogicPosition,mnHitTolLog,pPV,SdrSearchOptions::DEEP|SdrSearchOptions::MARKED,&pObj,&bHitPassDirect)))
{
eHit=SdrHitKind::MarkedObject;
sdr::table::SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( pObj );
@@ -374,7 +374,7 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co
}
}
}
- else if (PickObj(aLocalLogicPosition,mnHitTolLog,pHitObj,pPV,SdrSearchOptions::DEEP|SdrSearchOptions::ALSOONMASTER|SdrSearchOptions::WHOLEPAGE,&pObj,&bHitPassDirect))
+ else if ((pHitObj = PickObj(aLocalLogicPosition,mnHitTolLog,pPV,SdrSearchOptions::DEEP|SdrSearchOptions::ALSOONMASTER|SdrSearchOptions::WHOLEPAGE,&pObj,&bHitPassDirect)))
{
// MasterPages and WholePage for Macro and URL
eHit=SdrHitKind::UnmarkedObject;
diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx
index a144ea8d8eb7..3a46620eec33 100644
--- a/sw/source/core/draw/dpage.cxx
+++ b/sw/source/core/draw/dpage.cxx
@@ -183,11 +183,11 @@ bool SwDPage::RequestHelp( vcl::Window* pWindow, SdrView* pView,
aPos = pWindow->PixelToLogic( aPos );
SdrPageView* pPV;
- SdrObject* pObj;
- if( pView->PickObj( aPos, 0, pObj, pPV, SdrSearchOptions::PICKMACRO ) &&
- dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr )
+ SdrObject* pObj = pView->PickObj(aPos, 0, pPV, SdrSearchOptions::PICKMACRO);
+ SwVirtFlyDrawObj* pDrawObj = dynamic_cast<SwVirtFlyDrawObj*>(pObj);
+ if (pDrawObj)
{
- SwFlyFrame *pFly = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrame();
+ SwFlyFrame *pFly = pDrawObj->GetFlyFrame();
const SwFormatURL &rURL = pFly->GetFormat()->GetURL();
OUString sText;
if( rURL.GetMap() )
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index c78fc49a49a7..fd11278b9d89 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1453,7 +1453,6 @@ const SwFrameFormat* SwFEShell::IsURLGrfAtPos( const Point& rPt, OUString* pURL,
if( !Imp()->HasDrawView() )
return nullptr;
- SdrObject* pObj;
SdrPageView* pPV;
const SwFrameFormat* pRet = nullptr;
SwDrawView *pDView = const_cast<SwDrawView*>(Imp()->GetDrawView());
@@ -1461,11 +1460,8 @@ const SwFrameFormat* SwFEShell::IsURLGrfAtPos( const Point& rPt, OUString* pURL,
const auto nOld = pDView->GetHitTolerancePixel();
pDView->SetHitTolerancePixel( 2 );
- SwVirtFlyDrawObj* pFlyObj(nullptr);
- if (pDView->PickObj(rPt, pDView->getHitTolLog(), pObj, pPV, SdrSearchOptions::PICKMACRO))
- {
- pFlyObj = dynamic_cast<SwVirtFlyDrawObj*>(pObj);
- }
+ SdrObject* pObj = pDView->PickObj(rPt, pDView->getHitTolLog(), pPV, SdrSearchOptions::PICKMACRO);
+ SwVirtFlyDrawObj* pFlyObj = dynamic_cast<SwVirtFlyDrawObj*>(pObj);
if (pFlyObj)
{
SwFlyFrame *pFly = pFlyObj->GetFlyFrame();
@@ -1529,15 +1525,11 @@ const Graphic *SwFEShell::GetGrfAtPos( const Point &rPt,
if( !Imp()->HasDrawView() )
return nullptr;
- SdrObject* pObj;
SdrPageView* pPV;
SwDrawView *pDView = const_cast<SwDrawView*>(Imp()->GetDrawView());
- SwVirtFlyDrawObj* pFlyObj(nullptr);
- if (pDView->PickObj(rPt, pDView->getHitTolLog(), pObj, pPV))
- {
- pFlyObj = dynamic_cast<SwVirtFlyDrawObj*>(pObj);
- }
+ SdrObject* pObj = pDView->PickObj(rPt, pDView->getHitTolLog(), pPV);
+ SwVirtFlyDrawObj* pFlyObj = dynamic_cast<SwVirtFlyDrawObj*>(pObj);
if (pFlyObj)
{
SwFlyFrame *pFly = pFlyObj->GetFlyFrame();
@@ -1571,7 +1563,6 @@ const SwFrameFormat* SwFEShell::GetFormatFromObj( const Point& rPt, SwRect** pRe
if( Imp()->HasDrawView() )
{
- SdrObject* pObj;
SdrPageView* pPView;
SwDrawView *pDView = const_cast<SwDrawView*>(Imp()->GetDrawView());
@@ -1580,7 +1571,8 @@ const SwFrameFormat* SwFEShell::GetFormatFromObj( const Point& rPt, SwRect** pRe
// tolerance for Drawing-SS
pDView->SetHitTolerancePixel( pDView->GetMarkHdlSizePixel()/2 );
- if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPView, SdrSearchOptions::PICKMARKABLE ) )
+ SdrObject* pObj = pDView->PickObj(rPt, pDView->getHitTolLog(), pPView, SdrSearchOptions::PICKMARKABLE);
+ if (pObj)
{
// first check it:
if (SwVirtFlyDrawObj* pFlyObj = dynamic_cast<SwVirtFlyDrawObj*>(pObj))
@@ -1693,7 +1685,6 @@ ObjCntType SwFEShell::GetObjCntType( const Point &rPt, SdrObject *&rpObj ) const
if( Imp()->HasDrawView() )
{
- SdrObject* pObj;
SdrPageView* pPView;
SwDrawView *pDView = const_cast<SwDrawView*>(Imp()->GetDrawView());
@@ -1702,7 +1693,8 @@ ObjCntType SwFEShell::GetObjCntType( const Point &rPt, SdrObject *&rpObj ) const
// tolerance for Drawing-SS
pDView->SetHitTolerancePixel( pDView->GetMarkHdlSizePixel()/2 );
- if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPView, SdrSearchOptions::PICKMARKABLE ) )
+ SdrObject* pObj = pDView->PickObj(rPt, pDView->getHitTolLog(), pPView, SdrSearchOptions::PICKMARKABLE);
+ if (pObj)
eType = GetObjCntType( *(rpObj = pObj) );
pDView->SetHitTolerancePixel( nOld );
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 0a84b479083f..3bda5e2b1344 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1257,12 +1257,11 @@ bool SwFEShell::IsObjSelectable( const Point& rPt )
bool bRet = false;
if( pDView )
{
- SdrObject* pObj;
SdrPageView* pPV;
const auto nOld = pDView->GetHitTolerancePixel();
pDView->SetHitTolerancePixel( pDView->GetMarkHdlSizePixel()/2 );
- bRet = pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPV, SdrSearchOptions::PICKMARKABLE );
+ bRet = pDView->PickObj(rPt, pDView->getHitTolLog(), pPV, SdrSearchOptions::PICKMARKABLE) != nullptr;
pDView->SetHitTolerancePixel( nOld );
}
return bRet;
@@ -1279,7 +1278,7 @@ SdrObject* SwFEShell::GetObjAt( const Point& rPt )
const auto nOld = pDView->GetHitTolerancePixel();
pDView->SetHitTolerancePixel( pDView->GetMarkHdlSizePixel()/2 );
- pDView->PickObj( rPt, pDView->getHitTolLog(), pRet, pPV, SdrSearchOptions::PICKMARKABLE );
+ pRet = pDView->PickObj(rPt, pDView->getHitTolLog(), pPV, SdrSearchOptions::PICKMARKABLE);
pDView->SetHitTolerancePixel( nOld );
}
return pRet;
@@ -1294,16 +1293,16 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt)
if(pDrawView)
{
- SdrObject* pObj;
SdrPageView* pPV;
const auto nOld(pDrawView->GetHitTolerancePixel());
pDrawView->SetHitTolerancePixel(pDrawView->GetMarkHdlSizePixel()/2);
- bRet = pDrawView->PickObj(rPt, pDrawView->getHitTolLog(), pObj, pPV, SdrSearchOptions::PICKMARKABLE);
+ SdrObject* pObj = pDrawView->PickObj(rPt, pDrawView->getHitTolLog(), pPV, SdrSearchOptions::PICKMARKABLE);
pDrawView->SetHitTolerancePixel(nOld);
- if ( bRet && pObj )
+ if (pObj)
{
+ bRet = true;
const IDocumentDrawModelAccess& rIDDMA = getIDocumentDrawModelAccess();
// #i89920#
// Do not select object in background which is overlapping this text
@@ -1382,8 +1381,8 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt)
{
SdrObject *pCandidate = pPage->GetObj(a);
- if (dynamic_cast<const SwVirtFlyDrawObj*>( pCandidate) != nullptr &&
- static_cast<SwVirtFlyDrawObj*>(pCandidate)->GetCurrentBoundRect().IsInside(rPt) )
+ SwVirtFlyDrawObj* pDrawObj = dynamic_cast<SwVirtFlyDrawObj*>(pCandidate);
+ if (pDrawObj && pDrawObj->GetCurrentBoundRect().IsInside(rPt))
{
bRet = false;
}
@@ -2749,15 +2748,15 @@ SwChainRet SwFEShell::Chainable( SwRect &rRect, const SwFrameFormat &rSource,
SwChainRet nRet = SwChainRet::NOT_FOUND;
if( Imp()->HasDrawView() )
{
- SdrObject* pObj;
SdrPageView* pPView;
SwDrawView *pDView = const_cast<SwDrawView*>(Imp()->GetDrawView());
const auto nOld = pDView->GetHitTolerancePixel();
pDView->SetHitTolerancePixel( 0 );
- if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPView, SdrSearchOptions::PICKMARKABLE ) &&
- dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr )
+ SdrObject* pObj = pDView->PickObj(rPt, pDView->getHitTolLog(), pPView, SdrSearchOptions::PICKMARKABLE);
+ SwVirtFlyDrawObj* pDrawObj = dynamic_cast<SwVirtFlyDrawObj*>(pObj);
+ if (pDrawObj)
{
- SwFlyFrame *pFly = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrame();
+ SwFlyFrame *pFly = pDrawObj->GetFlyFrame();
rRect = pFly->Frame();
// Target and source should not be equal and the list
@@ -2782,12 +2781,11 @@ SwChainRet SwFEShell::Chain( SwFrameFormat &rSource, const Point &rPt )
if ( nErr == SwChainRet::OK )
{
StartAllAction();
- SdrObject* pObj;
SdrPageView* pPView;
SwDrawView *pDView = Imp()->GetDrawView();
const auto nOld = pDView->GetHitTolerancePixel();
pDView->SetHitTolerancePixel( 0 );
- pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPView, SdrSearchOptions::PICKMARKABLE );
+ SdrObject* pObj = pDView->PickObj(rPt, pDView->getHitTolLog(), pPView, SdrSearchOptions::PICKMARKABLE);
pDView->SetHitTolerancePixel( nOld );
SwFlyFrame *pFly = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrame();
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 68b2c69df57e..e8665d2466a7 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -466,10 +466,12 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier )
}
else
{
- SdrObject* pObj; SdrPageView* pPV;
+ SdrPageView* pPV = nullptr;
pSdrView->SetHitTolerancePixel( HIT_PIX );
- if ( bNotInSelObj && bExecHyperlinks &&
- pSdrView->PickObj( rLPt, pSdrView->getHitTolLog(), pObj, pPV, SdrSearchOptions::PICKMACRO ))
+ SdrObject* pObj = (bNotInSelObj && bExecHyperlinks) ?
+ pSdrView->PickObj(rLPt, pSdrView->getHitTolLog(), pPV, SdrSearchOptions::PICKMACRO) :
+ nullptr;
+ if (pObj)
{
SdrObjMacroHitRec aTmp;
aTmp.aPos = rLPt;
@@ -4379,9 +4381,9 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
const Point aDocPos( PixelToLogic( rMEvt.GetPosPixel() ) );
if ((PixelToLogic(m_aStartPos).Y() == (aDocPos.Y())) && (PixelToLogic(m_aStartPos).X() == (aDocPos.X())))//To make sure it was not moved
{
- SdrObject* pObj;
- SdrPageView* pPV;
- if (pSdrView && pSdrView->PickObj(aDocPos, pSdrView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER ))
+ SdrPageView* pPV = nullptr;
+ SdrObject* pObj = pSdrView ? pSdrView->PickObj(aDocPos, pSdrView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER) : nullptr;
+ if (pObj)
{
SwFrameFormat* pFormat = GetUserCall(pObj)->GetFormat();
SwFrameFormat* pShapeFormat = SwTextBoxHelper::getOtherTextBoxFormat(pFormat, RES_FLYFRMFMT);
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index dbe74d50549a..2b93959cfe86 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -457,7 +457,6 @@ static bool lcl_isTextBox(SdrObject* pObject)
bool SwView::EnterDrawTextMode(const Point& aDocPos)
{
- SdrObject* pObj;
SdrPageView* pPV;
SwWrtShell *pSh = &GetWrtShell();
SdrView *pSdrView = pSh->GetDrawView();
@@ -468,16 +467,18 @@ bool SwView::EnterDrawTextMode(const Point& aDocPos)
sal_uInt16 nOld = pSdrView->GetHitTolerancePixel();
pSdrView->SetHitTolerancePixel( 2 );
- if( pSdrView->IsMarkedHit( aDocPos ) &&
- !pSdrView->PickHandle( aDocPos ) && IsTextTool() &&
- pSdrView->PickObj( aDocPos, pSdrView->getHitTolLog(), pObj, pPV, SdrSearchOptions::PICKTEXTEDIT ) &&
+ SdrObject* pObj = (pSdrView->IsMarkedHit(aDocPos) &&
+ !pSdrView->PickHandle(aDocPos) && IsTextTool()) ?
+ pSdrView->PickObj(aDocPos, pSdrView->getHitTolLog(), pPV, SdrSearchOptions::PICKTEXTEDIT) :
+ nullptr;
+ if (pObj &&
// To allow SwDrawVirtObj text objects to be activated, allow their type, too.
( dynamic_cast< const SdrTextObj *>( pObj ) != nullptr ||
( dynamic_cast< const SwDrawVirtObj *>( pObj ) != nullptr &&
dynamic_cast< const SdrTextObj *>(&static_cast<SwDrawVirtObj*>(pObj)->GetReferencedObj() ) != nullptr ) ) &&
- m_pWrtShell->IsSelObjProtected(FlyProtectFlags::Content) == FlyProtectFlags::NONE )
+ m_pWrtShell->IsSelObjProtected(FlyProtectFlags::Content) == FlyProtectFlags::NONE)
{
// Refuse to edit editeng text of the shape if it has textbox attached.
if (!lcl_isTextBox(pObj))