summaryrefslogtreecommitdiff
path: root/starmath
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 /starmath
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 'starmath')
-rw-r--r--starmath/source/ElementsDockingWindow.cxx20
-rw-r--r--starmath/source/accessibility.cxx2
-rw-r--r--starmath/source/dialog.cxx2
3 files changed, 12 insertions, 12 deletions
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index 278b2287b40b..c627980440e5 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -561,13 +561,13 @@ bool SmElementsControl::MouseMove( const MouseEvent& rMouseEvent )
return false;
}
- if (tools::Rectangle(Point(0, 0), GetOutputSizePixel()).IsInside(rMouseEvent.GetPosPixel()))
+ if (tools::Rectangle(Point(0, 0), GetOutputSizePixel()).Contains(rMouseEvent.GetPosPixel()))
{
const SmElement* pPrevElement = current();
if (pPrevElement)
{
const tools::Rectangle rect(pPrevElement->mBoxLocation, pPrevElement->mBoxSize);
- if (rect.IsInside(rMouseEvent.GetPosPixel()))
+ if (rect.Contains(rMouseEvent.GetPosPixel()))
return true;
}
@@ -579,7 +579,7 @@ bool SmElementsControl::MouseMove( const MouseEvent& rMouseEvent )
continue;
const tools::Rectangle rect(element->mBoxLocation, element->mBoxSize);
- if (rect.IsInside(rMouseEvent.GetPosPixel()))
+ if (rect.Contains(rMouseEvent.GetPosPixel()))
{
m_nCurrentRolloverElement = n;
Invalidate();
@@ -613,13 +613,13 @@ bool SmElementsControl::MouseButtonDown(const MouseEvent& rMouseEvent)
{
GrabFocus();
- if (rMouseEvent.IsLeft() && tools::Rectangle(Point(0, 0), GetOutputSizePixel()).IsInside(rMouseEvent.GetPosPixel()) && maSelectHdlLink.IsSet())
+ if (rMouseEvent.IsLeft() && tools::Rectangle(Point(0, 0), GetOutputSizePixel()).Contains(rMouseEvent.GetPosPixel()) && maSelectHdlLink.IsSet())
{
const SmElement* pPrevElement = hasRollover() ? current() : nullptr;
if (pPrevElement)
{
tools::Rectangle rect(pPrevElement->mBoxLocation, pPrevElement->mBoxSize);
- if (rect.IsInside(rMouseEvent.GetPosPixel()))
+ if (rect.Contains(rMouseEvent.GetPosPixel()))
{
setCurrentElement(m_nCurrentRolloverElement);
maSelectHdlLink.Call(*const_cast<SmElement*>(pPrevElement));
@@ -633,7 +633,7 @@ bool SmElementsControl::MouseButtonDown(const MouseEvent& rMouseEvent)
{
SmElement* element = maElementList[n].get();
tools::Rectangle rect(element->mBoxLocation, element->mBoxSize);
- if (rect.IsInside(rMouseEvent.GetPosPixel()))
+ if (rect.Contains(rMouseEvent.GetPosPixel()))
{
setCurrentElement(n);
maSelectHdlLink.Call(*element);
@@ -726,7 +726,7 @@ void SmElementsControl::stepFocus(const bool bBackward)
const tools::Rectangle outputRect(Point(0,0), GetOutputSizePixel());
const SmElement *pCur = maElementList[nPos].get();
tools::Rectangle elementRect(pCur->mBoxLocation, pCur->mBoxSize);
- if (!outputRect.IsInside(elementRect))
+ if (!outputRect.Contains(elementRect))
scrollToElement(bBackward, pCur);
Invalidate();
}
@@ -753,7 +753,7 @@ void SmElementsControl::pageFocus(const bool bBackward)
SmElement *pCur = maElementList[nPos].get();
tools::Rectangle elementRect(pCur->mBoxLocation, pCur->mBoxSize);
- if (!outputRect.IsInside(elementRect))
+ if (!outputRect.Contains(elementRect))
{
if (nPrevPos != nStartPos)
{
@@ -1134,7 +1134,7 @@ bool SmElementsControl::itemIsVisible(sal_uInt16 nPos) const
return false;
tools::Rectangle outputRect(Point(0, 0), GetOutputSizePixel());
- return outputRect.IsInside(elementRect);
+ return outputRect.Contains(elementRect);
}
sal_uInt16 SmElementsControl::itemCount() const { return maElementList.size(); }
@@ -1185,7 +1185,7 @@ sal_uInt16 SmElementsControl::itemAtPos(const Point& rPoint) const
{
const SmElement* pItem = maElementList[n].get();
tools::Rectangle elementRect(pItem->mBoxLocation, pItem->mBoxSize);
- if (elementRect.IsInside(rPoint))
+ if (elementRect.Contains(rPoint))
return n;
}
return SAL_MAX_UINT16;
diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index 3bb9d1196482..6eb9da06a5f2 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -549,7 +549,7 @@ sal_Int32 SAL_CALL SmGraphicAccessible::getIndexAtPoint( const awt::Point& aPoin
Size aSize( pNode->GetSize() );
tools::Rectangle aRect( aTLPos, aSize );
- if (aRect.IsInside( aPos ))
+ if (aRect.Contains( aPos ))
{
OSL_ENSURE( pNode->IsVisible(), "node is not a leaf" );
OUStringBuffer aBuf;
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index ff1d001578de..a67273dc32ef 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -1030,7 +1030,7 @@ bool SmShowSymbolSet::MouseButtonDown(const MouseEvent& rMEvt)
aPoint.AdjustX( -nXOffset );
aPoint.AdjustY( -nYOffset );
- if (rMEvt.IsLeft() && tools::Rectangle(Point(0, 0), aOutputSize).IsInside(rMEvt.GetPosPixel()))
+ if (rMEvt.IsLeft() && tools::Rectangle(Point(0, 0), aOutputSize).Contains(rMEvt.GetPosPixel()))
{
tools::Long nPos = (aPoint.Y() / nLen) * nColumns + (aPoint.X() / nLen) +
m_xScrolledWindow->vadjustment_get_value() * nColumns;