summaryrefslogtreecommitdiff
path: root/oox/inc/oox/helper/containerhelper.hxx
diff options
context:
space:
mode:
authorDaniel Rentz [dr] <daniel.rentz@oracle.com>2011-02-25 16:43:02 +0100
committerDaniel Rentz [dr] <daniel.rentz@oracle.com>2011-02-25 16:43:02 +0100
commit4f06bfae891d1b7b80e0e17be9623536f31ae9ac (patch)
treeb4d8f7cae5ba8cd9c91269937a190225e96ad843 /oox/inc/oox/helper/containerhelper.hxx
parentf042519085109581abcdff4403e7e6d9999d4980 (diff)
dr78: #164376# use XCellRangeData to increase import performance
Diffstat (limited to 'oox/inc/oox/helper/containerhelper.hxx')
-rw-r--r--oox/inc/oox/helper/containerhelper.hxx48
1 files changed, 47 insertions, 1 deletions
diff --git a/oox/inc/oox/helper/containerhelper.hxx b/oox/inc/oox/helper/containerhelper.hxx
index d6c9721ef0a8..1f5874070a7b 100644
--- a/oox/inc/oox/helper/containerhelper.hxx
+++ b/oox/inc/oox/helper/containerhelper.hxx
@@ -28,8 +28,8 @@
#ifndef OOX_HELPER_CONTAINERHELPER_HXX
#define OOX_HELPER_CONTAINERHELPER_HXX
-#include <vector>
#include <map>
+#include <vector>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h>
@@ -47,6 +47,52 @@ namespace oox {
// ============================================================================
+/** A range of signed 32-bit integer values. */
+struct ValueRange
+{
+ sal_Int32 mnFirst;
+ sal_Int32 mnLast;
+
+ inline explicit ValueRange( sal_Int32 nValue = 0 ) : mnFirst( nValue ), mnLast( nValue ) {}
+ inline explicit ValueRange( sal_Int32 nFirst, sal_Int32 nLast ) : mnFirst( nFirst ), mnLast( nLast ) {}
+
+ inline bool operator==( const ValueRange& rRange ) const { return (mnFirst == rRange.mnFirst) && (mnLast == rRange.mnLast); }
+ inline bool operator!=( const ValueRange& rRange ) const { return !(*this == rRange); }
+ inline bool contains( sal_Int32 nValue ) const { return (mnFirst <= nValue) && (nValue <= mnLast); }
+ inline bool contains( const ValueRange& rRange ) const { return (mnFirst <= rRange.mnFirst) && (rRange.mnLast <= mnLast); }
+ inline bool intersects( const ValueRange& rRange ) const { return (mnFirst <= rRange.mnLast) && (rRange.mnFirst <= mnLast); }
+};
+
+// ----------------------------------------------------------------------------
+
+typedef ::std::vector< ValueRange > ValueRangeVector;
+
+// ----------------------------------------------------------------------------
+
+/** An ordered list of value ranges. The insertion operation will merge
+ consecutive value ranges.
+ */
+class ValueRangeSet
+{
+public:
+ inline explicit ValueRangeSet() {}
+
+ /** Inserts the passed value into the range list. */
+ inline void insert( sal_Int32 nValue ) { insert( ValueRange( nValue ) ); }
+ /** Inserts the passed value range into the range list. */
+ void insert( const ValueRange& rRange );
+
+ /** Returns the ordered list of all value ranges. */
+ inline const ValueRangeVector& getRanges() const { return maRanges; }
+ /** Returns an intersection of the range list and the passed range. */
+ ValueRangeVector getIntersection( const ValueRange& rRange ) const;
+
+private:
+ ValueRangeVector maRanges;
+};
+
+// ============================================================================
+
/** Template for a 2-dimensional array of objects.
This class template provides a similar interface to the ::std::vector