summaryrefslogtreecommitdiff
path: root/include
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 /include
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 'include')
-rw-r--r--include/sfx2/LokControlHandler.hxx4
-rw-r--r--include/tools/gen.hxx14
-rw-r--r--include/tools/poly.hxx2
-rw-r--r--include/vcl/region.hxx4
4 files changed, 12 insertions, 12 deletions
diff --git a/include/sfx2/LokControlHandler.hxx b/include/sfx2/LokControlHandler.hxx
index b32be1b70593..fc0b065c8834 100644
--- a/include/sfx2/LokControlHandler.hxx
+++ b/include/sfx2/LokControlHandler.hxx
@@ -35,7 +35,7 @@ public:
if (pUnoObect)
{
tools::Rectangle aControlRectHMM = pUnoObect->GetLogicRect();
- if (aControlRectHMM.IsInside(aPointHmm))
+ if (aControlRectHMM.Contains(aPointHmm))
{
css::uno::Reference<css::awt::XControl> xControl
= pUnoObect->GetUnoControl(*pDrawView, *rMainWindow.GetOutDev());
@@ -137,7 +137,7 @@ public:
// Check if we intersect with the tile rectangle and we
// need to draw the control.
- if (aObjectRectHMM.IsOver(aTileRectHMM))
+ if (aObjectRectHMM.Overlaps(aTileRectHMM))
{
drawUnoControl(pDrawView, pUnoObect, rMainWindow, rDevice, aTileRectHMM,
double(scaleX), double(scaleY));
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index f255168b3709..d016546724e2 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -336,7 +336,7 @@ public:
tools::Long& Min() { return nA; }
tools::Long& Max() { return nB; }
- bool IsInside( tools::Long nIs ) const;
+ bool Contains( tools::Long nIs ) const;
void Justify();
@@ -346,7 +346,7 @@ public:
using Pair::toString;
};
-inline bool Range::IsInside( tools::Long nIs ) const
+inline bool Range::Contains( tools::Long nIs ) const
{
return ((nA <= nIs) && (nIs <= nB ));
}
@@ -397,7 +397,7 @@ public:
tools::Long& Min() { return nA; }
tools::Long& Max() { return nB; }
- bool IsInside( tools::Long nIs ) const;
+ bool Contains( tools::Long nIs ) const;
void Justify();
@@ -413,7 +413,7 @@ public:
using Pair::toString;
};
-inline bool Selection::IsInside( tools::Long nIs ) const
+inline bool Selection::Contains( tools::Long nIs ) const
{
return ((nA <= nIs) && (nIs < nB ));
}
@@ -551,9 +551,9 @@ public:
void Justify();
- bool IsInside( const Point& rPOINT ) const;
- bool IsInside( const tools::Rectangle& rRect ) const;
- bool IsOver( const tools::Rectangle& rRect ) const;
+ bool Contains( const Point& rPOINT ) const;
+ bool Contains( const tools::Rectangle& rRect ) const;
+ bool Overlaps( const tools::Rectangle& rRect ) const;
void SetEmpty() { nRight = nBottom = RECT_EMPTY; }
void SetWidthEmpty() { nRight = RECT_EMPTY; }
diff --git a/include/tools/poly.hxx b/include/tools/poly.hxx
index 9caec8bbe210..3c39f2d6c56b 100644
--- a/include/tools/poly.hxx
+++ b/include/tools/poly.hxx
@@ -116,7 +116,7 @@ public:
void Clear();
tools::Rectangle GetBoundRect() const;
- bool IsInside( const Point& rPt ) const;
+ bool Contains( const Point& rPt ) const;
double CalcDistance( sal_uInt16 nPt1, sal_uInt16 nPt2 ) const;
void Clip( const tools::Rectangle& rRect );
void Optimize( PolyOptimizeFlags nOptimizeFlags );
diff --git a/include/vcl/region.hxx b/include/vcl/region.hxx
index cf48fbdff6e1..579d6e2c4fad 100644
--- a/include/vcl/region.hxx
+++ b/include/vcl/region.hxx
@@ -107,8 +107,8 @@ public:
bool HasPolyPolygonOrB2DPolyPolygon() const { return (getB2DPolyPolygon() || getPolyPolygon()); }
void GetRegionRectangles(RectangleVector& rTarget) const;
- bool IsInside( const Point& rPoint ) const;
- bool IsOver( const tools::Rectangle& rRect ) const;
+ bool Contains( const Point& rPoint ) const;
+ bool Overlaps( const tools::Rectangle& rRect ) const;
vcl::Region& operator=( const vcl::Region& rRegion );
vcl::Region& operator=( vcl::Region&& rRegion ) noexcept;