[Libreoffice-commits] core.git: sc/source

Arkadiy Illarionov (via logerrit) logerrit at kemper.freedesktop.org
Sat Aug 3 19:02:05 UTC 2019


 sc/source/core/data/dptabsrc.cxx |   16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

New commits:
commit 3ab2df3cf755ecd0e3e31ad06872426d24222c31
Author:     Arkadiy Illarionov <qarkai at gmail.com>
AuthorDate: Sat Aug 3 21:15:57 2019 +0300
Commit:     Arkadiy Illarionov <qarkai at gmail.com>
CommitDate: Sat Aug 3 21:00:59 2019 +0200

    tdf#39593 Drop lcl_GetIndexFromName
    
    Use comphelper::findValue instead
    
    Change-Id: Id8490034b0f957084680fef18ba07974b5373fb2
    Reviewed-on: https://gerrit.libreoffice.org/76896
    Tested-by: Jenkins
    Reviewed-by: Arkadiy Illarionov <qarkai at gmail.com>

diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index 0b3f79e35a0d..c72f34a559cc 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -24,6 +24,7 @@
 #include <unordered_set>
 #include <vector>
 
+#include <comphelper/sequence.hxx>
 #include <o3tl/any.hxx>
 #include <osl/diagnose.h>
 #include <rtl/math.hxx>
@@ -589,17 +590,6 @@ static long lcl_CountMinMembers(const vector<ScDPDimension*>& ppDim, const vecto
     return nTotal;
 }
 
-static long lcl_GetIndexFromName( const OUString& rName, const uno::Sequence<OUString>& rElements )
-{
-    long nCount = rElements.getLength();
-    const OUString* pArray = rElements.getConstArray();
-    for (long nPos=0; nPos<nCount; nPos++)
-        if (pArray[nPos] == rName)
-            return nPos;
-
-    return -1;  // not found
-}
-
 void ScDPSource::FillCalcInfo(bool bIsRow, ScDPTableData::CalcInfo& rInfo, bool &rHasAutoShow)
 {
     const std::vector<long>& rDims = bIsRow ? maRowDims : maColDims;
@@ -796,8 +786,8 @@ void ScDPSource::CreateRes_Impl()
              eRefType == sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE_DIFFERENCE ||
              eRefType == sheet::DataPilotFieldReferenceType::RUNNING_TOTAL )
         {
-            long nColumn = lcl_GetIndexFromName(
-                aDataRefValues.back().ReferenceField, GetDimensionsObject()->getElementNames());
+            long nColumn = comphelper::findValue(
+                GetDimensionsObject()->getElementNames(), aDataRefValues.back().ReferenceField);
             if ( nColumn >= 0 )
             {
                 nDataRefOrient = GetOrientation(nColumn);


More information about the Libreoffice-commits mailing list