summaryrefslogtreecommitdiff
path: root/sd/source/ui
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 /sd/source/ui
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>
Diffstat (limited to 'sd/source/ui')
-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
9 files changed, 33 insertions, 37 deletions
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);