summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-07-19 15:12:15 +0200
committerEike Rathke <erack@redhat.com>2018-08-31 13:53:10 +0200
commite56eb9cb7ee80215c05d06f25349d7ab7ad06640 (patch)
tree1026dd288078eac0bfc08777aaeb7f2081be0f13 /sc
parentb0d94ba8efe46c3ff7e90fa98f9a8708f48c5e66 (diff)
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@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/attarray.cxx12
-rw-r--r--sc/source/core/data/table2.cxx3
2 files changed, 9 insertions, 6 deletions
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 2dd227f0e5cc..b9ecb05568ef 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -299,11 +299,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 8362c319d2ce..05b9a76e89f3 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -572,14 +572,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;
}