diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-03-23 22:05:03 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-03-23 22:27:42 -0400 |
commit | 16168d7d589d22b1efd2a666d08d96233783457f (patch) | |
tree | cc616aa28df72cf054fc30969ab78d5999a7919f | |
parent | 83a7d544b2d2f6969bdca52b18d99f8a64ed5afa (diff) |
We don't need date helper in FillGroupValues().
-rw-r--r-- | sc/inc/dpgroup.hxx | 8 | ||||
-rw-r--r-- | sc/source/core/data/dpgroup.cxx | 23 |
2 files changed, 23 insertions, 8 deletions
diff --git a/sc/inc/dpgroup.hxx b/sc/inc/dpgroup.hxx index b9271fdf0463..eb4668542f81 100644 --- a/sc/inc/dpgroup.hxx +++ b/sc/inc/dpgroup.hxx @@ -89,7 +89,7 @@ class ScDPGroupDimension { long nSourceDim; long nGroupDim; - String aGroupName; + rtl::OUString aGroupName; ScDPDateGroupHelper* pDateHelper; ScDPGroupItemVec aItems; mutable ::std::vector< SCROW > maMemberEntries; @@ -105,7 +105,7 @@ public: long GetSourceDim() const { return nSourceDim; } long GetGroupDim() const { return nGroupDim; } - const String& GetName() const { return aGroupName; } + const rtl::OUString& GetName() const { return aGroupName; } const std::vector< SCROW >& GetColumnEntries( const ScDPCacheTable& rCacheTable ) const; const ScDPGroupItem* GetGroupForData( const ScDPItemData& rData ) const; // rData = entry in original dim. @@ -119,6 +119,8 @@ public: void DisposeData(); size_t GetItemCount() const { return aItems.size(); } + + bool IsDateDimension() const; }; typedef ::std::vector<ScDPGroupDimension> ScDPGroupDimensionVec; @@ -146,6 +148,8 @@ public: void MakeDateHelper( const ScDPNumGroupInfo& rInfo, long nDim, sal_Int32 nPart ); void DisposeData(); + + bool IsDateDimension() const; }; // diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx index b2006a4494a0..872ddfcb145c 100644 --- a/sc/source/core/data/dpgroup.cxx +++ b/sc/source/core/data/dpgroup.cxx @@ -465,6 +465,11 @@ void ScDPGroupDimension::DisposeData() maMemberEntries.clear(); } +bool ScDPGroupDimension::IsDateDimension() const +{ + return pDateHelper != NULL; +} + // ----------------------------------------------------------------------- ScDPNumGroupDimension::ScDPNumGroupDimension() : @@ -500,6 +505,11 @@ void ScDPNumGroupDimension::DisposeData() maMemberEntries.clear(); } +bool ScDPNumGroupDimension::IsDateDimension() const +{ + return pDateHelper != NULL; +} + ScDPNumGroupDimension::~ScDPNumGroupDimension() { delete pDateHelper; @@ -857,15 +867,15 @@ void ScDPGroupTableData::FillGroupValues(vector<SCROW>& rItems, const vector<lon for (size_t i = 0; it != itEnd; ++it, ++i) { long nColumn = *it; - const ScDPDateGroupHelper* pDateHelper = NULL; + bool bDateDim = false; long nSourceDim = nColumn; if ( nColumn >= nSourceCount && nColumn < nSourceCount + nGroupedColumns ) { const ScDPGroupDimension& rGroupDim = aGroups[nColumn - nSourceCount]; nSourceDim= rGroupDim.GetSourceDim(); - pDateHelper = rGroupDim.GetDateHelper(); - if (!pDateHelper) // date is handled below + bDateDim = rGroupDim.IsDateDimension(); + if (!bDateDim) // date is handled below { const ScDPItemData& rItem = *GetMemberById(nSourceDim, rItems[i]); const ScDPGroupItem* pGroupItem = rGroupDim.GetGroupForData(rItem); @@ -880,8 +890,8 @@ void ScDPGroupTableData::FillGroupValues(vector<SCROW>& rItems, const vector<lon } else if ( IsNumGroupDimension( nColumn ) ) { - pDateHelper = pNumGroups[nColumn].GetDateHelper(); - if (!pDateHelper) // date is handled below + bDateDim = pNumGroups[nColumn].IsDateDimension(); + if (!bDateDim) // date is handled below { const ScDPItemData* pData = pCache->GetItemDataById(nSourceDim, rItems[i]); if (pData->GetType() == ScDPItemData::Value) @@ -899,8 +909,9 @@ void ScDPGroupTableData::FillGroupValues(vector<SCROW>& rItems, const vector<lon const ScDPNumGroupInfo* pNumInfo = pCache->GetNumGroupInfo(nColumn); - if (pDateHelper && pNumInfo) + if (bDateDim && pNumInfo) { + // This is a date group dimension. sal_Int32 nDatePart = pCache->GetGroupType(nColumn); const ScDPItemData* pData = pCache->GetItemDataById(nSourceDim, rItems[i]); if (pData->GetType() == ScDPItemData::Value) |