sc/source/core/data/dpobject.cxx |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit dd670d89951876c32fdfdcb26a93ced1c6d42998
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu May 2 08:54:40 2019 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Thu May 2 10:43:49 2019 +0200

    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.kagan...@collabora.com>

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;
+                }
             }
         }
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to