summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-09-17 21:49:21 +0200
committerLuboš Luňák <l.lunak@collabora.com>2021-09-20 12:10:44 +0200
commitb22d4785310eac35696df771803dfba0871a50ac (patch)
tree56e394a3c38a2e1f17530fbc18dd8e6b3c5d5098 /sd
parent3e2370260f2b79c43b4f8a86b123861aa95d3ef2 (diff)
clean up ambiguous confusing rectangle APIs like IsInside()
Reading 'rectA.IsInside( rectB )' kind of suggests that the code checks whether 'rectA is inside rectB', but it's actually the other way around. Rename IsInside() -> Contains(), IsOver() -> Overlaps(), which should make it clear which way the logic goes. Change-Id: I9347450fe7dc34c96df6d636a4e3e660de1801ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122271 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Luboš Luňák <l.lunak@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx2
-rw-r--r--sd/source/ui/animations/motionpathtag.cxx2
-rw-r--r--sd/source/ui/annotations/annotationmanager.cxx2
-rw-r--r--sd/source/ui/docshell/sdclient.cxx2
-rw-r--r--sd/source/ui/func/fudraw.cxx2
-rw-r--r--sd/source/ui/func/fupoor.cxx4
-rw-r--r--sd/source/ui/slidesorter/controller/SlideSorterController.cxx2
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx6
-rw-r--r--sd/source/ui/slidesorter/view/SlideSorterView.cxx6
-rw-r--r--sd/source/ui/view/drviews4.cxx8
-rw-r--r--sd/source/ui/view/drviewsh.cxx2
-rw-r--r--sd/source/ui/view/sdview2.cxx4
-rw-r--r--sd/source/ui/view/sdview3.cxx6
-rw-r--r--sd/source/ui/view/sdview4.cxx4
14 files changed, 26 insertions, 26 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 1ed951437ba1..905a616bdcdf 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -412,7 +412,7 @@ void SdTiledRenderingTest::testRegisterCallback()
// Check that the top left 256x256px tile would be invalidated.
CPPUNIT_ASSERT(!m_aInvalidation.IsEmpty());
::tools::Rectangle aTopLeft(0, 0, 256*15, 256*15); // 1 px = 15 twips, assuming 96 DPI.
- CPPUNIT_ASSERT(m_aInvalidation.IsOver(aTopLeft));
+ CPPUNIT_ASSERT(m_aInvalidation.Overlaps(aTopLeft));
}
void SdTiledRenderingTest::testPostKeyEvent()
diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx
index 40d7f370ff29..360c709ac7ad 100644
--- a/sd/source/ui/animations/motionpathtag.cxx
+++ b/sd/source/ui/animations/motionpathtag.cxx
@@ -815,7 +815,7 @@ bool MotionPathTag::MarkPoints(const ::tools::Rectangle* pRect, bool bUnmark )
if( pHdl && (pHdl->getTag().get() == this) && mrView.IsPointMarkable(*pHdl) && pHdl->IsSelected() == bUnmark)
{
Point aPos(pHdl->GetPos());
- if( pRect==nullptr || pRect->IsInside(aPos))
+ if( pRect==nullptr || pRect->Contains(aPos))
{
if( mrView.MarkPointHelper(pHdl,mpMark.get(),bUnmark) )
bChgd=true;
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index b51f5973ec20..c59dc3f9eabb 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -474,7 +474,7 @@ void AnnotationManagerImpl::InsertAnnotation(const OUString& rText)
aTagRect.SetRight( aTagRect.Left() + width - 1 );
aTagRect.SetBottom( aTagRect.Top() + height - 1 );
- if( aNewRect.IsOver( aTagRect ) )
+ if( aNewRect.Overlaps( aTagRect ) )
{
bFree = false;
break;
diff --git a/sd/source/ui/docshell/sdclient.cxx b/sd/source/ui/docshell/sdclient.cxx
index de684f8c061a..02521c2575ad 100644
--- a/sd/source/ui/docshell/sdclient.cxx
+++ b/sd/source/ui/docshell/sdclient.cxx
@@ -72,7 +72,7 @@ void Client::RequestNewObjectArea( ::tools::Rectangle& aObjRect )
aObjRect.SetSize( aOldRect.GetSize() );
::tools::Rectangle aWorkArea( pView->GetWorkArea() );
- if ( aWorkArea.IsInside(aObjRect) || bPosProtect || aObjRect == aOldRect )
+ if ( aWorkArea.Contains(aObjRect) || bPosProtect || aObjRect == aOldRect )
return;
// correct position
diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx
index 8d489d81b8e2..8880b41d36dd 100644
--- a/sd/source/ui/func/fudraw.cxx
+++ b/sd/source/ui/func/fudraw.cxx
@@ -280,7 +280,7 @@ bool FuDraw::MouseButtonUp(const MouseEvent& rMEvt)
{
::tools::Rectangle aOutputArea(Point(0,0), mpWindow->GetOutputSizePixel());
- if (mpView && !aOutputArea.IsInside(rMEvt.GetPosPixel()))
+ if (mpView && !aOutputArea.Contains(rMEvt.GetPosPixel()))
mpView->GetSdrPageView()->DeleteHelpLine(nHelpLine);
mpWindow->ReleaseMouse();
diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx
index f9b9e0a61675..db84fdf5ad19 100644
--- a/sd/source/ui/func/fupoor.cxx
+++ b/sd/source/ui/func/fupoor.cxx
@@ -128,7 +128,7 @@ void FuPoor::ForceScroll(const Point& aPixPos)
if ( bNoScrollUntilInside )
{
- if ( rRect.IsInside(aPos) )
+ if ( rRect.Contains(aPos) )
bNoScrollUntilInside = false;
}
else
@@ -673,7 +673,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)
::tools::Rectangle aMarkRect(mpView->GetMarkedObjRect());
aMarkRect.Move(nX, nY);
- if(!aMarkRect.IsInside(rWorkArea))
+ if(!aMarkRect.Contains(rWorkArea))
{
if(aMarkRect.Left() < rWorkArea.Left())
{
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index a8dea819c428..f0fd9fbe9dc2 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -180,7 +180,7 @@ model::SharedPageDescriptor SlideSorterController::GetPageAt (
if ( ! mrView.GetLayouter().GetPageObjectLayouter()->GetBoundingBox(
pDescriptorAtPoint,
view::PageObjectLayouter::Part::Preview,
- view::PageObjectLayouter::WindowCoordinateSystem).IsInside(aWindowPosition))
+ view::PageObjectLayouter::WindowCoordinateSystem).Contains(aWindowPosition))
{
pDescriptorAtPoint.reset();
}
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
index 1432fc7dd57e..c710a4c1be51 100644
--- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
@@ -734,7 +734,7 @@ SelectionFunction::EventDescriptor::EventDescriptor (
// explicit test.
mbIsLeaving = rEvent.IsLeaveWindow()
|| ! ::tools::Rectangle(Point(0,0),
- rSlideSorter.GetContentWindow()->GetOutputSizePixel()).IsInside(maMousePosition);
+ rSlideSorter.GetContentWindow()->GetOutputSizePixel()).Contains(maMousePosition);
}
SelectionFunction::EventDescriptor::EventDescriptor (
@@ -762,7 +762,7 @@ SelectionFunction::EventDescriptor::EventDescriptor (
// explicit test.
mbIsLeaving = rEvent.mbLeaving
|| ! ::tools::Rectangle(Point(0,0),
- rSlideSorter.GetContentWindow()->GetOutputSizePixel()).IsInside(maMousePosition);
+ rSlideSorter.GetContentWindow()->GetOutputSizePixel()).Contains(maMousePosition);
}
sal_uInt32 SelectionFunction::EventDescriptor::EncodeMouseEvent (
@@ -1394,7 +1394,7 @@ void MultiSelectionModeHandler::UpdateSelection()
for (sal_Int32 nIndex=0; nIndex<nPageCount; ++nIndex)
{
- UpdateSelectionState(rModel.GetPageDescriptor(nIndex), aRange.IsInside(nIndex));
+ UpdateSelectionState(rModel.GetPageDescriptor(nIndex), aRange.Contains(nIndex));
}
}
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index a299f9327843..2e7d9a35137b 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -446,7 +446,7 @@ void SlideSorterView::DeterminePageObjectVisibilities()
SetState(
pDescriptor,
PageDescriptor::ST_Visible,
- aRange.IsInside(nIndex));
+ aRange.Contains(nIndex));
}
// Broadcast a change of the set of visible page objects.
@@ -485,7 +485,7 @@ void SlideSorterView::UpdatePreciousFlags()
{
pCache->SetPreciousFlag(
pDescriptor->GetPage(),
- maVisiblePageRange.IsInside(nIndex));
+ maVisiblePageRange.Contains(nIndex));
}
else
{
@@ -758,7 +758,7 @@ void SlideSorterView::UpdatePageUnderMouse ()
{
const Window::PointerState aPointerState (pWindow->GetPointerState());
const ::tools::Rectangle aWindowBox (pWindow->GetPosPixel(), pWindow->GetSizePixel());
- if (aWindowBox.IsInside(aPointerState.maPos))
+ if (aWindowBox.Contains(aPointerState.maPos))
{
UpdatePageUnderMouse(aPointerState.maPos);
return;
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index 7e4932b29856..05fca2edad19 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -273,7 +273,7 @@ void DrawViewShell::StartRulerDrag (
Point aWPos = GetActiveWindow()->PixelToLogic(GetActiveWindow()->GetPointerPosPixel());
- if ( rRuler.GetExtraRect().IsInside(rMEvt.GetPosPixel()) )
+ if ( rRuler.GetExtraRect().Contains(rMEvt.GetPosPixel()) )
{
mpDrawView->BegSetPageOrg(aWPos);
mbIsRulerDrag = true;
@@ -356,7 +356,7 @@ void DrawViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
{
::tools::Rectangle aOutputArea(Point(0,0), GetActiveWindow()->GetOutputSizePixel());
- if ( !aOutputArea.IsInside(rMEvt.GetPosPixel()) )
+ if ( !aOutputArea.Contains(rMEvt.GetPosPixel()) )
{
bool bInsideOtherWindow = false;
@@ -366,7 +366,7 @@ void DrawViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
mpContentWindow->GetOutputSizePixel());
Point aPos = mpContentWindow->GetPointerPosPixel();
- if ( aOutputArea.IsInside(aPos) )
+ if ( aOutputArea.Contains(aPos) )
bInsideOtherWindow = true;
}
@@ -467,7 +467,7 @@ void DrawViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin)
{
::tools::Rectangle aOutputArea(Point(0,0), GetActiveWindow()->GetOutputSizePixel());
- if (aOutputArea.IsInside(rMEvt.GetPosPixel()))
+ if (aOutputArea.Contains(rMEvt.GetPosPixel()))
{
mpDrawView->EndAction();
diff --git a/sd/source/ui/view/drviewsh.cxx b/sd/source/ui/view/drviewsh.cxx
index e6c3cc8e7f20..3c8738dc3f53 100644
--- a/sd/source/ui/view/drviewsh.cxx
+++ b/sd/source/ui/view/drviewsh.cxx
@@ -83,7 +83,7 @@ void DrawViewShell::MakeVisible(const ::tools::Rectangle& rRect, vcl::Window& rW
rWin.GetOutDev()->Pop();
Size aVisAreaSize(aVisArea.GetSize());
- if ( aVisArea.IsInside(rRect) )
+ if ( aVisArea.Contains(rRect) )
return;
// object is not entirely in visible area
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index 5f305228c1e3..3a40d4065d93 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -456,7 +456,7 @@ sal_Int8 View::AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTarge
aRect.Union( pObj->GetLogicRect() );
}
- if( aRect.IsInside( pOLV->GetWindow()->PixelToLogic( rEvt.maPosPixel ) ) )
+ if( aRect.Contains( pOLV->GetWindow()->PixelToLogic( rEvt.maPosPixel ) ) )
{
bIsInsideOutlinerView = true;
}
@@ -637,7 +637,7 @@ sal_Int8 View::ExecuteDrop( const ExecuteDropEvent& rEvt,
Point aPos( pOLV->GetWindow()->PixelToLogic( rEvt.maPosPixel ) );
- if( aRect.IsInside( aPos ) )
+ if( aRect.Contains( aPos ) )
{
bIsInsideOutlinerView = true;
}
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index a7204648ee4d..787c16319fcd 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -114,7 +114,7 @@ static void ImpCheckInsertPos(Point& rPos, const Size& rSize, const ::tools::Rec
::tools::Rectangle aMarkRect(Point(rPos.X() - (rSize.Width() / 2), rPos.Y() - (rSize.Height() / 2)), rSize);
- if(aMarkRect.IsInside(rWorkArea))
+ if(aMarkRect.Contains(rWorkArea))
return;
if(aMarkRect.Left() < rWorkArea.Left())
@@ -1421,7 +1421,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
::tools::Rectangle aRect( pOLV->GetOutputArea() );
Point aPos( pOLV->GetWindow()->PixelToLogic( maDropPos ) );
- if( aRect.IsInside( aPos ) || ( !bDrag && IsTextEdit() ) )
+ if( aRect.Contains( aPos ) || ( !bDrag && IsTextEdit() ) )
{
// mba: clipboard always must contain absolute URLs (could be from alien source)
pOLV->Read( *xStm, EETextFormat::Xml, mpDocSh->GetHeaderAttributes() );
@@ -1459,7 +1459,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
::tools::Rectangle aRect( pOLV->GetOutputArea() );
Point aPos( pOLV->GetWindow()->PixelToLogic( maDropPos ) );
- if( aRect.IsInside( aPos ) || ( !bDrag && IsTextEdit() ) )
+ if( aRect.Contains( aPos ) || ( !bDrag && IsTextEdit() ) )
{
// mba: clipboard always must contain absolute URLs (could be from alien source)
pOLV->Read( *xStm, EETextFormat::Rtf, mpDocSh->GetHeaderAttributes() );
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index 00e27a641c01..02febb2823be 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -85,7 +85,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
if(pPV && dynamic_cast< const ::sd::slidesorter::view::SlideSorterView* >(this) != nullptr)
{
- if(!pPV->GetPageRect().IsInside(rPos))
+ if(!pPV->GetPageRect().Contains(rPos))
pPV = nullptr;
}
@@ -313,7 +313,7 @@ SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, const OUString& rM
if(pPV && dynamic_cast<const ::sd::slidesorter::view::SlideSorterView* >(this) )
{
- if(!pPV->GetPageRect().IsInside(rPos))
+ if(!pPV->GetPageRect().Contains(rPos))
pPV = nullptr;
}