[Libreoffice-commits] core.git: basctl/source chart2/source include/svx sc/source sd/source svx/source sw/source

Caolán McNamara caolanm at redhat.com
Mon Nov 14 08:52:51 UTC 2016


 basctl/source/dlged/dlgedfunc.cxx                         |    4 +-
 chart2/source/controller/drawinglayer/DrawViewWrapper.cxx |    3 -
 include/svx/svdmrkv.hxx                                   |    4 +-
 sc/source/ui/drawfunc/drawsh.cxx                          |    4 +-
 sc/source/ui/drawfunc/fudraw.cxx                          |   10 ++---
 sc/source/ui/drawfunc/fusel.cxx                           |   16 ++++----
 sc/source/ui/drawfunc/futext.cxx                          |   12 +++---
 sc/source/ui/view/gridwin5.cxx                            |    8 ++--
 sc/source/ui/view/viewfun7.cxx                            |    4 +-
 sd/source/ui/func/fuconstr.cxx                            |    4 +-
 sd/source/ui/func/fudraw.cxx                              |    8 ++--
 sd/source/ui/func/fudspord.cxx                            |    7 ++-
 sd/source/ui/func/fuformatpaintbrush.cxx                  |   10 +----
 sd/source/ui/func/fusel.cxx                               |   18 ++++-----
 sd/source/ui/func/futext.cxx                              |    4 +-
 sd/source/ui/view/sdview2.cxx                             |   12 ++----
 sd/source/ui/view/sdview3.cxx                             |    5 +-
 sd/source/ui/view/sdview4.cxx                             |    2 -
 svx/source/dialog/imapwnd.cxx                             |    6 +--
 svx/source/form/fmpage.cxx                                |    4 +-
 svx/source/svdraw/svdmrkv.cxx                             |   19 ++++------
 svx/source/svdraw/svdview.cxx                             |    4 +-
 sw/source/core/draw/dpage.cxx                             |    8 ++--
 sw/source/core/frmedt/fefly1.cxx                          |   24 ++++--------
 sw/source/core/frmedt/feshview.cxx                        |   26 ++++++--------
 sw/source/uibase/docvw/edtwin.cxx                         |   14 ++++---
 sw/source/uibase/uiview/viewdraw.cxx                      |   11 +++--
 27 files changed, 120 insertions(+), 131 deletions(-)

New commits:
commit aa3f954222a270d3e2fa531badd2fa7febd30338
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Nov 12 17:07:22 2016 +0000

    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 at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/basctl/source/dlged/dlgedfunc.cxx b/basctl/source/dlged/dlgedfunc.cxx
index 30a95a8..2ace04c 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 1443415..c866eb6 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 2213699..49795e6 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 756ed34..3b38a26 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 cc4a253..16cf0a6 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 aa0ff4b..445ac52 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 b23fb0e..474871b 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 2424bd7..8608aea 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 680fcb7..9f9fe22 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 1ead60c..f695c7a 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 b8d44f1..f593a96 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 fb4fb7f..1f54d77 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 dc70c36..d665ce0 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 90df8c9..b84a5fc 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 097f772..07bcdc8 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 8b6c079..ccdf2ad 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 ed2b16c..6490032 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 7782139..96a2ffc 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 346fe9b..d74fdee 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 0c3c98d..4efb98c 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 cadb11a..21895ed 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 76acf83..144d349 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 a144ea8..3a46620 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 c78fc49..fd11278 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 0a84b47..3bda5e2 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 68b2c69..e8665d2 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 dbe74d5..2b93959 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))


More information about the Libreoffice-commits mailing list