diff options
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/address.hxx | 19 | ||||
-rw-r--r-- | sc/inc/bigrange.hxx | 8 | ||||
-rw-r--r-- | sc/inc/rangelst.hxx | 2 |
3 files changed, 19 insertions, 10 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 diff --git a/sc/inc/bigrange.hxx b/sc/inc/bigrange.hxx index a935681c58b8..979c861ba07f 100644 --- a/sc/inc/bigrange.hxx +++ b/sc/inc/bigrange.hxx @@ -137,8 +137,8 @@ public: { return ScRange( aStart.MakeAddress(), aEnd.MakeAddress() ); } - inline bool In( const ScBigAddress& ) const; ///< is Address& in range? - inline bool In( const ScBigRange& ) const; ///< is Range& in range? + inline bool Contains( const ScBigAddress& ) const; ///< is Address& in range? + inline bool Contains( const ScBigRange& ) const; ///< is Range& in range? inline bool Intersects( const ScBigRange& ) const; ///< do two ranges overlap? ScBigRange& operator=( const ScBigRange& r ) @@ -150,7 +150,7 @@ public: { return !operator==( r ); } }; -inline bool ScBigRange::In( const ScBigAddress& rAddr ) const +inline bool ScBigRange::Contains( const ScBigAddress& rAddr ) const { return aStart.Col() <= rAddr.Col() && rAddr.Col() <= aEnd.Col() && @@ -158,7 +158,7 @@ inline bool ScBigRange::In( const ScBigAddress& rAddr ) const aStart.Tab() <= rAddr.Tab() && rAddr.Tab() <= aEnd.Tab(); } -inline bool ScBigRange::In( const ScBigRange& r ) const +inline bool ScBigRange::Contains( const ScBigRange& r ) const { return aStart.Col() <= r.aStart.Col() && r.aEnd.Col() <= aEnd.Col() && diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx index 5489ab44b1b9..9052b086680f 100644 --- a/sc/inc/rangelst.hxx +++ b/sc/inc/rangelst.hxx @@ -72,7 +72,7 @@ public: bool operator==( const ScRangeList& ) const; bool operator!=( const ScRangeList& r ) const; bool Intersects( const ScRange& ) const; - bool In( const ScRange& ) const; + bool Contains( const ScRange& ) const; size_t GetCellCount() const; ScAddress GetTopLeftCorner() const; |