diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-09-29 21:26:16 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-09-29 22:02:24 +0100 |
commit | 2434e019252cbc8b6a567eafe89ccfdf4749b838 (patch) | |
tree | 34266abc748b07e650c0e3dd441d561cce1864c6 | |
parent | a15db9dbb306031c9a4903a6875de94473c740da (diff) |
reorg FillItemData
Change-Id: Ia70bf1c7fb4bf524b92c3f97103cd74bccf46822
-rw-r--r-- | sc/inc/dptabres.hxx | 2 | ||||
-rw-r--r-- | sc/inc/dptabsrc.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dptabres.cxx | 24 | ||||
-rw-r--r-- | sc/source/core/data/dptabsrc.cxx | 13 |
4 files changed, 16 insertions, 25 deletions
diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx index 4528c406d0da..a462ade90d8f 100644 --- a/sc/inc/dptabres.hxx +++ b/sc/inc/dptabres.hxx @@ -368,7 +368,7 @@ public: OUString GetName() const; OUString GetDisplayName( bool bLocaleIndependent ) const; - void FillItemData( ScDPItemData& rData ) const; + ScDPItemData FillItemData() const; bool IsValid() const; bool IsVisible() const; long GetSize(long nMeasure) const; diff --git a/sc/inc/dptabsrc.hxx b/sc/inc/dptabsrc.hxx index 998f77491cec..035aa1b85b01 100644 --- a/sc/inc/dptabsrc.hxx +++ b/sc/inc/dptabsrc.hxx @@ -741,7 +741,7 @@ public: ScDPMember& operator=(const ScDPMember&) = delete; OUString GetNameStr( bool bLocaleIndependent ) const; - void FillItemData( ScDPItemData& rData ) const; + ScDPItemData FillItemData() const; const ScDPItemData* GetItemData() const; SCROW GetItemDataId() const { return mnDataId; } bool IsNamedItem(SCROW nIndex) const; diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index 12a40ccef9a7..2d5e72d4c9f6 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -965,8 +965,7 @@ OUString ScDPResultMember::GetDisplayName( bool bLocaleIndependent ) const if (!pDPMember) return OUString(); - ScDPItemData aItem; - pDPMember->FillItemData(aItem); + ScDPItemData aItem(pDPMember->FillItemData()); if (aParentDimData.mpParentDim) { long nDim = aParentDimData.mpParentDim->GetDimension(); @@ -976,13 +975,12 @@ OUString ScDPResultMember::GetDisplayName( bool bLocaleIndependent ) const return aItem.GetString(); } -void ScDPResultMember::FillItemData( ScDPItemData& rData ) const +ScDPItemData ScDPResultMember::FillItemData() const { - const ScDPMember* pMemberDesc = GetDPMember(); + const ScDPMember* pMemberDesc = GetDPMember(); if (pMemberDesc) - pMemberDesc->FillItemData( rData ); - else - rData.SetString( ScGlobal::GetRscString(STR_PIVOT_TOTAL) ); // root member + return pMemberDesc->FillItemData(); + return ScDPItemData(ScGlobal::GetRscString(STR_PIVOT_TOTAL)); // root member } bool ScDPResultMember::IsNamedItem( SCROW nIndex ) const @@ -1322,8 +1320,7 @@ void ScDPResultMember::FillMemberResults( } else { - ScDPItemData aItemData; - FillItemData( aItemData ); + ScDPItemData aItemData(FillItemData()); if (aParentDimData.mpParentDim) { long nDim = aParentDimData.mpParentDim->GetDimension(); @@ -2694,8 +2691,7 @@ bool ScDPGroupCompare::TestIncluded( const ScDPMember& rMember ) { // need to check all previous groups //TODO: get array of groups (or indexes) before loop? - ScDPItemData aMemberData; - rMember.FillItemData( aMemberData ); + ScDPItemData aMemberData(rMember.FillItemData()); const std::vector<ScDPInitState::Member>& rMemStates = rInitState.GetMembers(); std::vector<ScDPInitState::Member>::const_iterator it = rMemStates.begin(), itEnd = rMemStates.end(); @@ -2714,8 +2710,7 @@ bool ScDPGroupCompare::TestIncluded( const ScDPMember& rMember ) // -> look for other groups using the same base //TODO: get array of groups (or indexes) before loop? - ScDPItemData aMemberData; - rMember.FillItemData( aMemberData ); + ScDPItemData aMemberData(rMember.FillItemData()); const std::vector<ScDPInitState::Member>& rMemStates = rInitState.GetMembers(); std::vector<ScDPInitState::Member>::const_iterator it = rMemStates.begin(), itEnd = rMemStates.end(); for (; it != itEnd && bInclude; ++it) @@ -3510,8 +3505,7 @@ void ScDPResultDimension::FillVisibilityData(ScDPResultVisibilityData& rData) co ScDPResultMember* pMember = *itr; if (pMember->IsValid()) { - ScDPItemData aItem; - pMember->FillItemData(aItem); + ScDPItemData aItem(pMember->FillItemData()); rData.addVisibleMember(GetName(), aItem); pMember->FillVisibilityData(rData); } diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index 859b0caa929f..390bc0e89c1c 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -463,8 +463,7 @@ Sequence< Sequence<Any> > SAL_CALL ScDPSource::getDrillDownData(const Sequence<s sal_Int32 nIndex = pMembers->GetIndexFromName( rFilter.MatchValueName ); if ( nIndex >= 0 ) { - ScDPItemData aItem; - pMembers->getByIndex(nIndex)->FillItemData( aItem ); + ScDPItemData aItem(pMembers->getByIndex(nIndex)->FillItemData()); aFilterCriteria.push_back( ScDPFilteredCache::Criterion() ); aFilterCriteria.back().mnFieldIndex = nCol; aFilterCriteria.back().mpFilter.reset( @@ -737,8 +736,7 @@ void ScDPSource::FilterCacheByPageDimensions() ScDPMember* pMem = pMems->getByIndex(j); if (pMem->isVisible()) { - ScDPItemData aData; - pMem->FillItemData(aData); + ScDPItemData aData(pMem->FillItemData()); pGrpFilter->addMatchItem(aData); } } @@ -1450,8 +1448,7 @@ const ScDPItemData& ScDPDimension::GetSelectedData() ScDPMember* pMember = pMembers->getByIndex(i); if (aSelectedPage.equals(pMember->GetNameStr( false))) { - pSelectedData = new ScDPItemData(); - pMember->FillItemData( *pSelectedData ); + pSelectedData = new ScDPItemData(pMember->FillItemData()); } } } @@ -2582,12 +2579,12 @@ sal_Int32 ScDPMember::Compare( const ScDPMember& rOther ) const return pSource->GetData()->Compare( pSource->GetSourceDim(nDim),mnDataId,rOther.GetItemDataId()); } -void ScDPMember::FillItemData( ScDPItemData& rData ) const +ScDPItemData ScDPMember::FillItemData() const { //TODO: handle date hierarchy... const ScDPItemData* pData = GetItemData(); - rData = (pData ? *pData : ScDPItemData()); + return (pData ? *pData : ScDPItemData()); } const OUString* ScDPMember::GetLayoutName() const |