summaryrefslogtreecommitdiff
path: root/sc/inc/address.hxx
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-12-06 01:03:50 +0100
committerLuboš Luňák <l.lunak@collabora.com>2021-12-06 12:21:00 +0100
commit9809441f05e4dbac8e12b042fd4391f1a7580643 (patch)
tree2303963c415716775cff0fa0d004938c7c9beaa2 /sc/inc/address.hxx
parent5bd9ded5f01c39f201d21a90541aecb6dba80fad (diff)
rename In() to Contains()
Similarly to b22d4785310eac35696d, 'A.In(B)' makes it unclear whether the check is for A in B or B in A, as it's actually the latter. Change-Id: Iaccc41d40f4bb105a44c1bb8d9211c06d1a3c127 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126392 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sc/inc/address.hxx')
-rw-r--r--sc/inc/address.hxx19
1 files changed, 14 insertions, 5 deletions
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index dca071604627..725e696059db 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -547,8 +547,9 @@ public:
{
return aStart.IsValid() && aEnd.IsValid();
}
- inline bool In( const ScAddress& ) const; ///< is Address& in Range?
- inline bool In( const ScRange& ) const; ///< is Range& in Range?
+ inline bool Contains( const ScAddress& ) const; ///< is Address& fully in Range?
+ inline bool Contains( const ScRange& ) const; ///< is Range& fully in Range?
+ inline bool Intersects( const ScRange& rRange ) const; // do two ranges intersect?
ScRefFlags Parse( const OUString&, const ScDocument&,
const ScAddress::Details& rDetails = ScAddress::detailsOOOa1,
@@ -640,7 +641,6 @@ public:
void IncRowIfNotLessThan(const ScDocument& rDoc, SCROW nStartRow, SCROW nOffset);
void ExtendTo( const ScRange& rRange );
- bool Intersects( const ScRange& rRange ) const; // do two ranges intersect?
ScRange Intersection( const ScRange& rOther ) const;
@@ -729,7 +729,7 @@ inline bool ScRange::operator<=( const ScRange& rRange ) const
return operator<( rRange ) || operator==( rRange );
}
-inline bool ScRange::In( const ScAddress& rAddress ) const
+inline bool ScRange::Contains( const ScAddress& rAddress ) const
{
return
aStart.Col() <= rAddress.Col() && rAddress.Col() <= aEnd.Col() &&
@@ -737,7 +737,7 @@ inline bool ScRange::In( const ScAddress& rAddress ) const
aStart.Tab() <= rAddress.Tab() && rAddress.Tab() <= aEnd.Tab();
}
-inline bool ScRange::In( const ScRange& rRange ) const
+inline bool ScRange::Contains( const ScRange& rRange ) const
{
return
aStart.Col() <= rRange.aStart.Col() && rRange.aEnd.Col() <= aEnd.Col() &&
@@ -745,6 +745,15 @@ inline bool ScRange::In( const ScRange& rRange ) const
aStart.Tab() <= rRange.aStart.Tab() && rRange.aEnd.Tab() <= aEnd.Tab();
}
+inline bool ScRange::Intersects( const ScRange& rRange ) const
+{
+ return !(
+ std::min( aEnd.Col(), rRange.aEnd.Col() ) < std::max( aStart.Col(), rRange.aStart.Col() )
+ || std::min( aEnd.Row(), rRange.aEnd.Row() ) < std::max( aStart.Row(), rRange.aStart.Row() )
+ || std::min( aEnd.Tab(), rRange.aEnd.Tab() ) < std::max( aStart.Tab(), rRange.aStart.Tab() )
+ );
+}
+
inline size_t ScRange::hashArea() const
{
#if SAL_TYPES_SIZEOFPOINTER == 8