tdf#131471 sc: fix background color of conditional formatting style
The issue appears for merged cells when you trigger a change that
causes the condition to be evaluated again.
Manual test: open unit test document, put "1" in A1, and press Undo:
the green background color of the condition was removed only
partially.
Change-Id: I8bb17c77ac49a1ee897c3e2b4902723d237765d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154277
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
diff --git a/sc/qa/unit/data/ods/tdf131471.ods b/sc/qa/unit/data/ods/tdf131471.ods
new file mode 100644
index 0000000..31f0792
--- /dev/null
+++ b/sc/qa/unit/data/ods/tdf131471.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters_test3.cxx b/sc/qa/unit/subsequent_filters_test3.cxx
index 44cd702..54d5061 100644
--- a/sc/qa/unit/subsequent_filters_test3.cxx
+++ b/sc/qa/unit/subsequent_filters_test3.cxx
@@ -391,8 +391,9 @@ struct PaintListener : public SfxListener
const ScPaintHint* pPaintHint = dynamic_cast<const ScPaintHint*>(&rHint);
if (pPaintHint)
{
if (pPaintHint->GetStartCol() <= 0 && pPaintHint->GetEndCol() >= 0
&& pPaintHint->GetStartRow() <= 9 && pPaintHint->GetEndRow() >= 9)
if ((pPaintHint->GetStartCol() <= 0 && pPaintHint->GetEndCol() >= 0)
&& ((pPaintHint->GetStartRow() <= 9 && pPaintHint->GetEndRow() >= 9)
|| (pPaintHint->GetStartRow() == 2 && pPaintHint->GetEndRow() == 3)))
{
mbCalled = true;
}
@@ -420,6 +421,26 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testCondFormatFormulaListenerXLSX)
CPPUNIT_ASSERT(aListener.mbCalled);
}
CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf131471)
{
// Repaint range of conditional format in merged cell.
createScDoc("ods/tdf131471.ods");
ScDocShell* pDocSh = getScDocShell();
PaintListener aListener;
aListener.StartListening(*pDocSh);
ScDocument* pDoc = getScDoc();
ScConditionalFormatList* pList = pDoc->GetCondFormList(0);
CPPUNIT_ASSERT(pList);
CPPUNIT_ASSERT_EQUAL(size_t(1), pList->size());
ScConditionalFormat* pFormat = pList->begin()->get();
CPPUNIT_ASSERT(pFormat);
pDoc->SetDocVisible(true);
pDoc->SetValue(0, 0, 0, 1.0);
CPPUNIT_ASSERT(aListener.mbCalled);
}
CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf137091)
{
// Set the system locale to Turkish
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 33ffbd39..66c2667 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -488,7 +488,7 @@ void ScModelObj::RepaintRange( const ScRange& rRange )
void ScModelObj::RepaintRange( const ScRangeList& rRange )
{
if (pDocShell)
pDocShell->PostPaint( rRange, PaintPartFlags::Grid );
pDocShell->PostPaint(rRange, PaintPartFlags::Grid, SC_PF_TESTMERGE);
}
static ScViewData* lcl_getViewMatchingDocZoomTab(const Fraction& rZoomX,