summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/document.hxx2
-rw-r--r--sc/inc/hints.hxx2
-rw-r--r--sc/qa/unit/data/xlsx/cond_format_formula_listener.xlsxbin0 -> 8545 bytes
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx44
4 files changed, 46 insertions, 2 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index a2e661a76dd0..08fa0849ff09 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1455,7 +1455,7 @@ public:
void SetClipArea( const ScRange& rArea, bool bCut = false );
SC_DLLPUBLIC bool IsDocVisible() const { return bIsVisible; }
- void SetDocVisible( bool bSet );
+ SC_DLLPUBLIC void SetDocVisible( bool bSet );
bool HasOLEObjectsInArea( const ScRange& rRange, const ScMarkData* pTabMark = nullptr );
diff --git a/sc/inc/hints.hxx b/sc/inc/hints.hxx
index 7dc6dbfa3a56..cd3817120530 100644
--- a/sc/inc/hints.hxx
+++ b/sc/inc/hints.hxx
@@ -24,7 +24,7 @@
#include "address.hxx"
#include <svl/hint.hxx>
-class ScPaintHint : public SfxHint
+class SC_DLLPUBLIC ScPaintHint : public SfxHint
{
ScRange aRange;
PaintPartFlags nParts;
diff --git a/sc/qa/unit/data/xlsx/cond_format_formula_listener.xlsx b/sc/qa/unit/data/xlsx/cond_format_formula_listener.xlsx
new file mode 100644
index 000000000000..97d7845c3511
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/cond_format_formula_listener.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 4f72dddadf44..6a8c051cf15e 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -64,6 +64,7 @@
#include <formula/errorcodes.hxx>
#include <externalrefmgr.hxx>
#include <stlpool.hxx>
+#include <hints.hxx>
#include <orcusfiltersimpl.hxx>
#include <orcusfilters.hxx>
@@ -234,6 +235,7 @@ public:
#ifdef UNX
void testUnicodeFileNameGnumeric();
#endif
+ void testCondFormatFormulaListenerXLSX();
void testMergedCellsXLSXML();
void testBackgroundColorStandardXLSXML();
@@ -365,6 +367,7 @@ public:
CPPUNIT_TEST(testBackgroundColorStandardXLSXML);
CPPUNIT_TEST(testNamedExpressionsXLSXML);
CPPUNIT_TEST(testEmptyRowsXLSXML);
+ CPPUNIT_TEST(testCondFormatFormulaListenerXLSX);
CPPUNIT_TEST_SUITE_END();
@@ -3749,6 +3752,47 @@ void ScFiltersTest::testActiveXCheckboxXLSX()
xDocSh->DoClose();
}
+namespace {
+
+struct PaintListener : public SfxListener
+{
+ bool mbCalled = false;
+ virtual void Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) override
+ {
+ const ScPaintHint* pPaintHint = dynamic_cast<const ScPaintHint*>(&rHint);
+ if (pPaintHint)
+ {
+ if (pPaintHint->GetStartCol() <= 0 && pPaintHint->GetEndCol() >= 0
+ && pPaintHint->GetStartRow() <= 9 && pPaintHint->GetEndRow() >= 9)
+ {
+ mbCalled = true;
+ }
+ }
+ }
+};
+
+}
+
+void ScFiltersTest::testCondFormatFormulaListenerXLSX()
+{
+ ScDocShellRef xDocSh = loadDoc("cond_format_formula_listener.", FORMAT_XLSX);
+ PaintListener aListener;
+ aListener.StartListening(*xDocSh);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ ScConditionalFormatList* pList = rDoc.GetCondFormList(0);
+ CPPUNIT_ASSERT(pList);
+
+ CPPUNIT_ASSERT_EQUAL(size_t(1), pList->size());
+ ScConditionalFormat* pFormat = pList->begin()->get();
+ CPPUNIT_ASSERT(pFormat);
+ rDoc.SetDocVisible(true);
+ rDoc.SetValue(0, 0, 0, 2.0);
+
+ CPPUNIT_ASSERT(aListener.mbCalled);
+
+ xDocSh->DoClose();
+}
+
ScFiltersTest::ScFiltersTest()
: ScBootstrapFixture( "sc/qa/unit/data" )
{