diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-04-13 16:39:38 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-04-13 16:42:10 +0200 |
commit | 470f16acc2a798f0ae1ebe9ce2080084ab167e80 (patch) | |
tree | c2ca3568198b5372f92eedba45a04b3c66d08bf4 | |
parent | d3f49514905fc0c4a8e30e1536340e25014cfc50 (diff) |
tdf#96996 sc: fix the data pilot
ScDPSaveData::GetInnermostDimension() should iterate in reverse (that
fixes the reported bug), and ScDataPilotFieldObj::setOrientation()
loop needs an early exit.
(regression from 37856f59d2351951b95cf5eb3a5e4f0c011a8762)
Change-Id: I7e0309385f3444bfd3ad21268cce4d25e60d7b05
-rw-r--r-- | sc/source/core/data/dpsave.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/unoobj/dapiuno.cxx | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx index b17393f975ec..22dcb6b93077 100644 --- a/sc/source/core/data/dpsave.cxx +++ b/sc/source/core/data/dpsave.cxx @@ -1041,10 +1041,10 @@ ScDPSaveDimension* ScDPSaveData::GetInnermostDimension(sal_uInt16 nOrientation) // return the innermost dimension for the given orientation, // excluding data layout dimension - for (auto const& iter : m_DimList) + for (auto iter = m_DimList.rbegin(); iter != m_DimList.rend(); ++iter) { - if (iter->GetOrientation() == nOrientation && !iter->IsDataLayout()) - return &(*iter); + if ((*iter)->GetOrientation() == nOrientation && !(*iter)->IsDataLayout()) + return iter->get(); } return nullptr; diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index 8958182dbaf6..d5881deef641 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -2071,7 +2071,10 @@ void ScDataPilotFieldObj::setOrientation(DataPilotFieldOrientation eNew) if ( !it->IsDataLayout() && (it->GetName() == maFieldId.maFieldName) ) { if ( it->GetOrientation() == DataPilotFieldOrientation_HIDDEN ) + { pNewDim = it.get(); // use this one + break; + } else ++nFound; // count existing non-hidden occurrences } |