summaryrefslogtreecommitdiff
path: root/sc/source/core/data/dpobject.cxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-05-02 08:54:40 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2019-05-02 10:43:49 +0200
commitdd670d89951876c32fdfdcb26a93ced1c6d42998 (patch)
treec04ff69f58e741f5cdd26360f62d0867feb12ab3 /sc/source/core/data/dpobject.cxx
parented67b443d1db273818737ef7996330a8f475361b (diff)
Use range-based for here instead of ScNameToIndexAccess
Change-Id: Ida1351dda42f2dc0ddb50dbcbd55564d64280c15 Reviewed-on: https://gerrit.libreoffice.org/71655 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc/source/core/data/dpobject.cxx')
-rw-r--r--sc/source/core/data/dpobject.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 8357f5961f94..57c1b7723c71 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -262,23 +262,23 @@ static sheet::DataPilotFieldOrientation lcl_GetDataGetOrientation( const uno::Re
sheet::DataPilotFieldOrientation nRet = sheet::DataPilotFieldOrientation_HIDDEN;
if ( xSource.is() )
{
- uno::Reference<container::XNameAccess> xDimsName = xSource->getDimensions();
- uno::Reference<container::XIndexAccess> xIntDims = new ScNameToIndexAccess( xDimsName );
- long nIntCount = xIntDims->getCount();
- bool bFound = false;
- for (long nIntDim=0; nIntDim<nIntCount && !bFound; nIntDim++)
+ uno::Reference<container::XNameAccess> xDimNames = xSource->getDimensions();
+ for (const OUString& rDimName: xDimNames->getElementNames())
{
- uno::Reference<beans::XPropertySet> xDimProp(xIntDims->getByIndex(nIntDim),
+ uno::Reference<beans::XPropertySet> xDimProp(xDimNames->getByName(rDimName),
uno::UNO_QUERY);
if ( xDimProp.is() )
{
- bFound = ScUnoHelpFunctions::GetBoolProperty( xDimProp,
+ const bool bFound = ScUnoHelpFunctions::GetBoolProperty( xDimProp,
SC_UNO_DP_ISDATALAYOUT );
//TODO: error checking -- is "IsDataLayoutDimension" property required??
if (bFound)
+ {
nRet = ScUnoHelpFunctions::GetEnumProperty(
xDimProp, SC_UNO_DP_ORIENTATION,
sheet::DataPilotFieldOrientation_HIDDEN );
+ break;
+ }
}
}
}