summaryrefslogtreecommitdiff
path: root/sc/inc/convuno.hxx
diff options
context:
space:
mode:
authorDaniel Rentz <dr@openoffice.org>2010-06-15 20:02:53 +0200
committerDaniel Rentz <dr@openoffice.org>2010-06-15 20:02:53 +0200
commit5624330c20ccbbcbbbc90631130e7d2f7a06d0bd (patch)
tree27308cb5a7f8c3eca0655d99c1fd654d8580de7a /sc/inc/convuno.hxx
parentfc1ac6254cde85bedfff1f8f78d678d4e10cc3dd (diff)
mib16: contributed bugfixes and various new symbols in VBA compatibility implementation
Diffstat (limited to 'sc/inc/convuno.hxx')
-rw-r--r--sc/inc/convuno.hxx41
1 files changed, 41 insertions, 0 deletions
diff --git a/sc/inc/convuno.hxx b/sc/inc/convuno.hxx
index 135ac055b2fe..0f93d6d6de0d 100644
--- a/sc/inc/convuno.hxx
+++ b/sc/inc/convuno.hxx
@@ -28,6 +28,7 @@
#ifndef SC_CONVUNO_HXX
#define SC_CONVUNO_HXX
+#include <algorithm>
#include <i18npool/lang.h>
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
@@ -70,6 +71,19 @@ public:
static inline void FillApiEndAddress(
::com::sun::star::table::CellAddress& rApiAddress,
const ::com::sun::star::table::CellRangeAddress& rApiRange );
+
+ /** Returns true, if the passed ranges have at least one common cell. */
+ static inline bool Intersects(
+ const ::com::sun::star::table::CellRangeAddress& rApiARange1,
+ const ::com::sun::star::table::CellRangeAddress& rApiARange2 );
+ /** Returns true, if the passed address rApiInner is inside the passed range rApiOuter. */
+ static inline bool Contains(
+ const ::com::sun::star::table::CellRangeAddress& rApiOuter,
+ const ::com::sun::star::table::CellAddress& rApiInner );
+ /** Returns true, if the passed range rApiInner is completely inside the passed range rApiOuter. */
+ static inline bool Contains(
+ const ::com::sun::star::table::CellRangeAddress& rApiOuter,
+ const ::com::sun::star::table::CellRangeAddress& rApiInner );
};
@@ -135,6 +149,33 @@ inline void ScUnoConversion::FillApiEndAddress(
rApiAddress.Sheet = rApiRange.Sheet;
}
+inline bool ScUnoConversion::Intersects(
+ const ::com::sun::star::table::CellRangeAddress& rApiRange1,
+ const ::com::sun::star::table::CellRangeAddress& rApiRange2 )
+{
+ return (rApiRange1.Sheet == rApiRange2.Sheet) &&
+ (::std::max( rApiRange1.StartColumn, rApiRange2.StartColumn ) <= ::std::min( rApiRange1.EndColumn, rApiRange2.EndColumn )) &&
+ (::std::max( rApiRange1.StartRow, rApiRange2.StartRow ) <= ::std::min( rApiRange1.EndRow, rApiRange2.EndRow ));
+}
+
+inline bool ScUnoConversion::Contains(
+ const ::com::sun::star::table::CellRangeAddress& rApiOuter,
+ const ::com::sun::star::table::CellAddress& rApiInner )
+{
+ return (rApiOuter.Sheet == rApiInner.Sheet) &&
+ (rApiOuter.StartColumn <= rApiInner.Column) && (rApiInner.Column <= rApiOuter.EndColumn) &&
+ (rApiOuter.StartRow <= rApiInner.Row) && (rApiInner.Row <= rApiOuter.EndRow);
+}
+
+inline bool ScUnoConversion::Contains(
+ const ::com::sun::star::table::CellRangeAddress& rApiOuter,
+ const ::com::sun::star::table::CellRangeAddress& rApiInner )
+{
+ return (rApiOuter.Sheet == rApiInner.Sheet) &&
+ (rApiOuter.StartColumn <= rApiInner.StartColumn) && (rApiInner.EndColumn <= rApiOuter.EndColumn) &&
+ (rApiOuter.StartRow <= rApiInner.StartRow) && (rApiInner.EndRow <= rApiOuter.EndRow);
+}
+
//___________________________________________________________________
inline sal_Bool operator==(