[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Aug 31 15:47:56 UTC 2018


 sc/source/core/data/attarray.cxx |   12 ++++++++----
 sc/source/core/data/table2.cxx   |    3 +--
 2 files changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 2fffe4a50b6f541c1e43cf13a3a475caf94d203b
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Jul 19 15:12:15 2018 +0200
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Fri Aug 31 17:47:31 2018 +0200

    tdf#117781: don't remove already applied conditional format data
    
    
    ... when deduplicating; only add new range. Check not to add the
    same conditional format to a range more than once.
    
    Change-Id: I0702b8e1462784cc71666ddfa6442a2827f00af5
    Reviewed-on: https://gerrit.libreoffice.org/57725
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit e56eb9cb7ee80215c05d06f25349d7ab7ad06640)
    Reviewed-on: https://gerrit.libreoffice.org/59866

diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index d058b7e70b4f..3330cf14c10e 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -298,11 +298,15 @@ void ScAttrArray::AddCondFormat( SCROW nStartRow, SCROW nEndRow, sal_uInt32 nInd
             std::vector< sal_uInt32 > aCondFormatData;
             if(pItem)
                 aCondFormatData = static_cast<const ScCondFormatItem*>(pItem)->GetCondFormatData();
-            aCondFormatData.push_back(nIndex);
+            if (std::find(aCondFormatData.begin(), aCondFormatData.end(), nIndex)
+                == aCondFormatData.end())
+            {
+                aCondFormatData.push_back(nIndex);
 
-            ScCondFormatItem aItem;
-            aItem.SetCondFormatData( aCondFormatData );
-            pNewPattern->GetItemSet().Put( aItem );
+                ScCondFormatItem aItem;
+                aItem.SetCondFormatData( aCondFormatData );
+                pNewPattern->GetItemSet().Put( aItem );
+            }
         }
         else
         {
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index b7f95afebfed..e640b31622f4 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -569,14 +569,13 @@ bool CheckAndDeduplicateCondFormat(ScDocument* pDocument, ScConditionalFormat* p
 
     if (pOldFormat->EqualEntries(*pNewFormat, true))
     {
-        pDocument->RemoveCondFormatData(pOldFormat->GetRange(), nTab, pOldFormat->GetKey());
         const ScRangeList& rNewRangeList = pNewFormat->GetRange();
         ScRangeList& rDstRangeList = pOldFormat->GetRangeList();
         for (size_t i = 0; i < rNewRangeList.size(); ++i)
         {
             rDstRangeList.Join(rNewRangeList[i]);
         }
-        pDocument->AddCondFormatData(pOldFormat->GetRange(), nTab, pOldFormat->GetKey());
+        pDocument->AddCondFormatData(rNewRangeList, nTab, pOldFormat->GetKey());
         return true;
     }
 


More information about the Libreoffice-commits mailing list