summaryrefslogtreecommitdiff
path: root/sc/source/core/data/dpitemdata.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-03-11 17:16:54 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-04-19 00:30:10 -0400
commitac569ed4cf5064248b9952f182f6572f20dc9bcb (patch)
tree44789fb45958b6cc8ce21f1742a04a407d5f6c75 /sc/source/core/data/dpitemdata.cxx
parent687a821e3b4ac872fd7eb1010ea87c3d81e71991 (diff)
fdo#60300: Work-in-progress change to rework pivot table core.
The idea is to avoid parsing the pivot table sheet output in order to calculate GETPIVOTDATA. The table outout is configurable, and it will only be more configurable in the future. The gist of my rework is to calcualte the result of GETPIVOTDATA with the internl result tree alone. Also, the same result tree can be used for drill down too, which also currently parses the table output, therefore subject to the same limitation & fragility. Change-Id: Ib0147e2aa2b710dfd627df7f535a685301214a52
Diffstat (limited to 'sc/source/core/data/dpitemdata.cxx')
-rw-r--r--sc/source/core/data/dpitemdata.cxx31
1 files changed, 29 insertions, 2 deletions
diff --git a/sc/source/core/data/dpitemdata.cxx b/sc/source/core/data/dpitemdata.cxx
index a91476522699..c417317ff1fd 100644
--- a/sc/source/core/data/dpitemdata.cxx
+++ b/sc/source/core/data/dpitemdata.cxx
@@ -29,6 +29,33 @@
const sal_Int32 ScDPItemData::DateFirst = -1;
const sal_Int32 ScDPItemData::DateLast = 10000;
+size_t ScDPItemData::Hash::operator() (const ScDPItemData& rVal) const
+{
+ switch (rVal.GetType())
+ {
+ case GroupValue:
+ case Value:
+ case RangeStart:
+ return (size_t)(rVal.mfValue);
+ case String:
+ case Error:
+ {
+ if (!rVal.mpString)
+ return 0;
+
+ if (rVal.mbStringInterned)
+ return reinterpret_cast<size_t>(rVal.mpString);
+
+ OUStringHash aStrHasher;
+ return aStrHasher(*rVal.mpString);
+ }
+ default:
+ ;
+ }
+
+ return 0;
+}
+
sal_Int32 ScDPItemData::Compare(const ScDPItemData& rA, const ScDPItemData& rB)
{
if (rA.meType != rB.meType)
@@ -337,10 +364,10 @@ OUString ScDPItemData::GetString() const
case Error:
return *mpString;
case Value:
+ case RangeStart:
return OUString::valueOf(mfValue);
case GroupValue:
- case RangeStart:
- return OUString::createFromAscii("fail");
+ return OUString::valueOf(maGroupValue.mnValue);
case Empty:
default:
;