diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2021-09-17 21:49:21 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2021-09-20 12:10:44 +0200 |
commit | b22d4785310eac35696df771803dfba0871a50ac (patch) | |
tree | 56e394a3c38a2e1f17530fbc18dd8e6b3c5d5098 /editeng | |
parent | 3e2370260f2b79c43b4f8a86b123861aa95d3ef2 (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 'editeng')
-rw-r--r-- | editeng/source/accessibility/AccessibleEditableTextPara.cxx | 6 | ||||
-rw-r--r-- | editeng/source/accessibility/AccessibleImageBullet.cxx | 2 | ||||
-rw-r--r-- | editeng/source/accessibility/AccessibleStringWrap.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 12 | ||||
-rw-r--r-- | editeng/source/outliner/outlin2.cxx | 2 | ||||
-rw-r--r-- | editeng/source/outliner/outlvw.cxx | 8 | ||||
-rw-r--r-- | editeng/source/uno/unoedprx.cxx | 2 |
7 files changed, 17 insertions, 17 deletions
diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index 5f86bf041433..70d7ed49b6bd 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -1003,7 +1003,7 @@ namespace accessibility tools::Rectangle aRect( Point(aTmpRect.X, aTmpRect.Y), Size(aTmpRect.Width, aTmpRect.Height) ); Point aPoint( aTmpPoint.X, aTmpPoint.Y ); - return aRect.IsInside( aPoint ); + return aRect.Contains( aPoint ); } uno::Reference< XAccessible > SAL_CALL AccessibleEditableTextPara::getAccessibleAtPoint( const awt::Point& _aPoint ) @@ -1030,7 +1030,7 @@ namespace accessibility { tools::Rectangle aRect = aBulletInfo.aBounds; - if( aRect.IsInside( aLogPoint ) ) + if( aRect.Contains( aLogPoint ) ) return getAccessibleChild(0); } } @@ -1361,7 +1361,7 @@ namespace accessibility awt::Rectangle aRect1( getCharacterBounds(nIndex) ); tools::Rectangle aRect2( aRect1.X, aRect1.Y, aRect1.Width + aRect1.X, aRect1.Height + aRect1.Y ); - if( aRect2.IsInside( Point( rPoint.X, rPoint.Y ) ) ) + if( aRect2.Contains( Point( rPoint.X, rPoint.Y ) ) ) return nIndex; else return -1; diff --git a/editeng/source/accessibility/AccessibleImageBullet.cxx b/editeng/source/accessibility/AccessibleImageBullet.cxx index a5dc2b66bd92..a83f427bfeba 100644 --- a/editeng/source/accessibility/AccessibleImageBullet.cxx +++ b/editeng/source/accessibility/AccessibleImageBullet.cxx @@ -218,7 +218,7 @@ namespace accessibility tools::Rectangle aRect( Point(aTmpRect.X, aTmpRect.Y), Size(aTmpRect.Width, aTmpRect.Height) ); Point aPoint( rPoint.X, rPoint.Y ); - return aRect.IsInside( aPoint ); + return aRect.Contains( aPoint ); } uno::Reference< XAccessible > SAL_CALL AccessibleImageBullet::getAccessibleAtPoint( const awt::Point& /*aPoint*/ ) diff --git a/editeng/source/accessibility/AccessibleStringWrap.cxx b/editeng/source/accessibility/AccessibleStringWrap.cxx index 77149d1df70d..29ed20295760 100644 --- a/editeng/source/accessibility/AccessibleStringWrap.cxx +++ b/editeng/source/accessibility/AccessibleStringWrap.cxx @@ -80,7 +80,7 @@ sal_Int32 AccessibleStringWrap::GetIndexAtPoint( const Point& rPoint ) for( i=0; i<nLen; ++i ) { GetCharacterBounds(i, aRect); - if( aRect.IsInside(rPoint) ) + if( aRect.Contains(rPoint) ) return i; } diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 19bd96ccde71..3ad33fa5525d 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -1603,7 +1603,7 @@ Pair ImpEditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck nRa if ( bVisCursor ) { tools::Rectangle aCursorRect( pCrsr->GetPos(), pCrsr->GetSize() ); - if ( aOutArea.IsInside( aCursorRect ) ) + if ( aOutArea.Contains( aCursorRect ) ) pCrsr->Show(); } @@ -1818,7 +1818,7 @@ void ImpEditView::DeleteSelected() const SvxFieldItem* ImpEditView::GetField( const Point& rPos, sal_Int32* pPara, sal_Int32* pPos ) const { - if( !GetOutputArea().IsInside( rPos ) ) + if( !GetOutputArea().Contains( rPos ) ) return nullptr; Point aDocPos( GetDocPos( rPos ) ); @@ -1858,7 +1858,7 @@ bool ImpEditView::IsBulletArea( const Point& rPos, sal_Int32* pPara ) if ( pPara ) *pPara = EE_PARA_NOT_FOUND; - if( !GetOutputArea().IsInside( rPos ) ) + if( !GetOutputArea().Contains( rPos ) ) return false; Point aDocPos( GetDocPos( rPos ) ); @@ -2063,7 +2063,7 @@ bool ImpEditView::IsSelectionAtPoint( const Point& rPosPixel ) const OutputDevice& rOutDev = GetOutputDevice(); Point aMousePos = rOutDev.PixelToLogic(rPosPixel); - if ( ( !GetOutputArea().IsInside( aMousePos ) ) && !pEditEngine->pImpEditEngine->IsInSelectionMode() ) + if ( ( !GetOutputArea().Contains( aMousePos ) ) && !pEditEngine->pImpEditEngine->IsInSelectionMode() ) { return false; } @@ -2083,7 +2083,7 @@ bool ImpEditView::SetCursorAtPoint( const Point& rPointPixel ) const OutputDevice& rOutDev = GetOutputDevice(); aMousePos = rOutDev.PixelToLogic( aMousePos ); - if ( ( !GetOutputArea().IsInside( aMousePos ) ) && !pEditEngine->pImpEditEngine->IsInSelectionMode() ) + if ( ( !GetOutputArea().Contains( aMousePos ) ) && !pEditEngine->pImpEditEngine->IsInSelectionMode() ) { return false; } @@ -2486,7 +2486,7 @@ void ImpEditView::dragOver(const css::datatransfer::dnd::DropTargetDragEvent& rD bool bAccept = false; - if ( GetOutputArea().IsInside( aMousePos ) && !bReadOnly ) + if ( GetOutputArea().Contains( aMousePos ) && !bReadOnly ) { if ( pDragAndDropInfo && pDragAndDropInfo->bHasValidData ) { diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx index 67dd5b0bb768..3d4061a82cde 100644 --- a/editeng/source/outliner/outlin2.cxx +++ b/editeng/source/outliner/outlin2.cxx @@ -436,7 +436,7 @@ bool Outliner::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, bool* pbBu if ( ( nPara != EE_PARA_NOT_FOUND ) && ImplHasNumberFormat( nPara ) ) { tools::Rectangle aBulArea = ImpCalcBulletArea( nPara, true, true ); - if ( aBulArea.IsInside( rPaperPos ) ) + if ( aBulArea.Contains( rPaperPos ) ) { bTextPos = true; if ( pbBullet) diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 83ab8aca2a5f..3e910db125aa 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -244,7 +244,7 @@ sal_Int32 OutlinerView::ImpCheckMousePos(const Point& rPosPix, MouseTarget& reTa sal_Int32 nPara = EE_PARA_NOT_FOUND; Point aMousePosWin = pEditView->GetOutputDevice().PixelToLogic( rPosPix ); - if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) ) + if( !pEditView->GetOutputArea().Contains( aMousePosWin ) ) { reTarget = MouseTarget::Outside; } @@ -288,7 +288,7 @@ bool OutlinerView::MouseMove( const MouseEvent& rMEvt ) return pEditView->MouseMove( rMEvt ); Point aMousePosWin( pEditView->GetOutputDevice().PixelToLogic( rMEvt.GetPosPixel() ) ); - if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) ) + if( !pEditView->GetOutputArea().Contains( aMousePosWin ) ) return false; PointerStyle aPointer = GetPointer( rMEvt.GetPosPixel() ); @@ -303,7 +303,7 @@ bool OutlinerView::MouseButtonDown( const MouseEvent& rMEvt ) return pEditView->MouseButtonDown( rMEvt ); Point aMousePosWin( pEditView->GetOutputDevice().PixelToLogic( rMEvt.GetPosPixel() ) ); - if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) ) + if( !pEditView->GetOutputArea().Contains( aMousePosWin ) ) return false; PointerStyle aPointer = GetPointer( rMEvt.GetPosPixel() ); @@ -351,7 +351,7 @@ bool OutlinerView::MouseButtonUp( const MouseEvent& rMEvt ) return pEditView->MouseButtonUp( rMEvt ); Point aMousePosWin( pEditView->GetOutputDevice().PixelToLogic( rMEvt.GetPosPixel() ) ); - if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) ) + if( !pEditView->GetOutputArea().Contains( aMousePosWin ) ) return false; PointerStyle aPointer = GetPointer( rMEvt.GetPosPixel() ); diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index 161633a137a2..0eeaa796c0bb 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -793,7 +793,7 @@ bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, sal_Int32& aBulletInfo.bVisible && aBulletInfo.nType != SVX_NUM_BITMAP ) { - if( aBulletInfo.aBounds.IsInside( rPoint) ) + if( aBulletInfo.aBounds.Contains( rPoint) ) { OutputDevice* pOutDev = GetRefDevice(); |