diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-04-13 16:39:38 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-04-18 21:08:51 +0000 |
commit | dba0cc1edc6d778805ca8ed4b77800f1e9a95408 (patch) | |
tree | b315f7e5275b38db6f2140cd3844a6736faf9324 | |
parent | f691a50a78c8f4f157fbb432efba059d723d1111 (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
(cherry picked from commit 470f16acc2a798f0ae1ebe9ce2080084ab167e80)
Reviewed-on: https://gerrit.libreoffice.org/24060
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
-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 82d810c60056..708c8b2600d0 100644 --- a/sc/source/core/data/dpsave.cxx +++ b/sc/source/core/data/dpsave.cxx @@ -1043,10 +1043,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 } |