diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-13 00:40:43 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-18 12:32:18 +0100 |
commit | a208ece66416048cdc99235a569bd8c928a07394 (patch) | |
tree | e05fd7f828564bd370d21f897cfd2da7fa8f7488 /basctl/source/dlged | |
parent | cf6b3bece7d46878302075329c72c7541c65bbd0 (diff) |
tdf#120703 PVS: V560 A part of conditional expression is always true/false
Change-Id: I60bb778a88dd5619efd4858eb74d56d28616c777
Reviewed-on: https://gerrit.libreoffice.org/63520
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basctl/source/dlged')
-rw-r--r-- | basctl/source/dlged/dlgedfunc.cxx | 62 |
1 files changed, 29 insertions, 33 deletions
diff --git a/basctl/source/dlged/dlgedfunc.cxx b/basctl/source/dlged/dlgedfunc.cxx index 665bd7c147d3..78fe1ef96966 100644 --- a/basctl/source/dlged/dlgedfunc.cxx +++ b/basctl/source/dlged/dlgedfunc.cxx @@ -256,43 +256,39 @@ bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt ) } } } - else + else if (nX || nY) { - // move the handle - if ( pHdl && ( nX || nY ) ) - { - Point aStartPoint( pHdl->GetPos() ); - Point aEndPoint( pHdl->GetPos() + Point( nX, nY ) ); - const SdrDragStat& rDragStat = rView.GetDragStat(); + Point aStartPoint(pHdl->GetPos()); + Point aEndPoint(pHdl->GetPos() + Point(nX, nY)); + const SdrDragStat& rDragStat = rView.GetDragStat(); - // start dragging - rView.BegDragObj( aStartPoint, nullptr, pHdl, 0 ); + // start dragging + rView.BegDragObj(aStartPoint, nullptr, pHdl, 0); - if ( rView.IsDragObj() ) - { - bool const bWasNoSnap = rDragStat.IsNoSnap(); - bool const bWasSnapEnabled = rView.IsSnapEnabled(); - - // switch snapping off - if ( !bWasNoSnap ) - const_cast<SdrDragStat&>(rDragStat).SetNoSnap(); - if ( bWasSnapEnabled ) - rView.SetSnapEnabled(false); - - rView.MovAction( aEndPoint ); - rView.EndDragObj(); - - // restore snap - if ( !bWasNoSnap ) - const_cast<SdrDragStat&>(rDragStat).SetNoSnap( bWasNoSnap ); - if ( bWasSnapEnabled ) - rView.SetSnapEnabled( bWasSnapEnabled ); - } - - // make moved handle visible - tools::Rectangle aVisRect( aEndPoint - Point( 100, 100 ), Size( 200, 200 ) ); - rView.MakeVisible( aVisRect, rWindow ); + if (rView.IsDragObj()) + { + bool const bWasNoSnap = rDragStat.IsNoSnap(); + bool const bWasSnapEnabled = rView.IsSnapEnabled(); + + // switch snapping off + if (!bWasNoSnap) + const_cast<SdrDragStat&>(rDragStat).SetNoSnap(); + if (bWasSnapEnabled) + rView.SetSnapEnabled(false); + + rView.MovAction(aEndPoint); + rView.EndDragObj(); + + // restore snap + if (!bWasNoSnap) + const_cast<SdrDragStat&>(rDragStat).SetNoSnap(bWasNoSnap); + if (bWasSnapEnabled) + rView.SetSnapEnabled(bWasSnapEnabled); } + + // make moved handle visible + tools::Rectangle aVisRect(aEndPoint - Point(100, 100), Size(200, 200)); + rView.MakeVisible(aVisRect, rWindow); } } else |