diff options
-rw-r--r-- | sc/qa/unit/data/xlsx/tdf122102.xlsx | bin | 0 -> 10609 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 38 | ||||
-rw-r--r-- | sc/source/filter/oox/extlstcontext.cxx | 13 |
3 files changed, 50 insertions, 1 deletions
diff --git a/sc/qa/unit/data/xlsx/tdf122102.xlsx b/sc/qa/unit/data/xlsx/tdf122102.xlsx Binary files differnew file mode 100644 index 000000000000..bc1db82d78a7 --- /dev/null +++ b/sc/qa/unit/data/xlsx/tdf122102.xlsx diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 593c12c3e27a..b2b6247a7b3c 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -104,6 +104,7 @@ public: virtual void tearDown() override; //ods, xls, xlsx filter tests + void testExtCondFormatXLSX(); void testUpdateCircleInMergedCellODS(); void testDeleteCircleInMergedCellODS(); void testBooleanFormatXLSX(); @@ -295,6 +296,7 @@ public: void testDeleteCirclesInRowAndCol(); CPPUNIT_TEST_SUITE(ScFiltersTest); + CPPUNIT_TEST(testExtCondFormatXLSX); CPPUNIT_TEST(testUpdateCircleInMergedCellODS); CPPUNIT_TEST(testDeleteCircleInMergedCellODS); CPPUNIT_TEST(testBooleanFormatXLSX); @@ -530,6 +532,42 @@ void testRangeNameImpl(const ScDocument& rDoc) } +void ScFiltersTest::testExtCondFormatXLSX() +{ + ScDocShellRef xDocSh = loadDoc("tdf122102.", FORMAT_XLSX); + CPPUNIT_ASSERT_MESSAGE("Failed to load tdf122102.xlsx", xDocSh.is()); + + ScDocument& rDoc = xDocSh->GetDocument(); + + // contains text and not contains text conditions + ScConditionalFormat* pFormatA1 = rDoc.GetCondFormat(0, 0, 0); + CPPUNIT_ASSERT(pFormatA1); + ScConditionalFormat* pFormatA2 = rDoc.GetCondFormat(0, 1, 0); + CPPUNIT_ASSERT(pFormatA2); + ScConditionalFormat* pFormatA3 = rDoc.GetCondFormat(0, 2, 0); + CPPUNIT_ASSERT(pFormatA3); + ScConditionalFormat* pFormatA4 = rDoc.GetCondFormat(0, 3, 0); + CPPUNIT_ASSERT(pFormatA4); + + ScRefCellValue aCellA1(rDoc, ScAddress(0, 0, 0)); + OUString aCellStyleA1 = pFormatA1->GetCellStyle(aCellA1, ScAddress(0, 0, 0)); + CPPUNIT_ASSERT(!aCellStyleA1.isEmpty()); + + ScRefCellValue aCellA2(rDoc, ScAddress(0, 1, 0)); + OUString aCellStyleA2 = pFormatA2->GetCellStyle(aCellA2, ScAddress(0, 1, 0)); + CPPUNIT_ASSERT(!aCellStyleA2.isEmpty()); + + ScRefCellValue aCellA3(rDoc, ScAddress(0, 2, 0)); + OUString aCellStyleA3 = pFormatA3->GetCellStyle(aCellA3, ScAddress(0, 2, 0)); + CPPUNIT_ASSERT(!aCellStyleA3.isEmpty()); + + ScRefCellValue aCellA4(rDoc, ScAddress(0, 3, 0)); + OUString aCellStyleA4 = pFormatA4->GetCellStyle(aCellA4, ScAddress(0, 3, 0)); + CPPUNIT_ASSERT(!aCellStyleA4.isEmpty()); + + xDocSh->DoClose(); +} + void ScFiltersTest::testUpdateCircleInMergedCellODS() { ScDocShellRef xDocSh = loadDoc("updateCircleInMergedCell.", FORMAT_ODS); diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx index fadb4365265b..b413e9e58029 100644 --- a/sc/source/filter/oox/extlstcontext.cxx +++ b/sc/source/filter/oox/extlstcontext.cxx @@ -135,6 +135,16 @@ ContextHandlerRef ExtConditionalFormattingContext::onCreateContext(sal_Int32 nEl eOperator = CondFormatBuffer::convertToInternalOperator(aToken); return this; } + else if(aType == "containsText") + { + eOperator = ScConditionMode::ContainsText; + return this; + } + else if(aType == "notContainsText") + { + eOperator = ScConditionMode::NotContainsText; + return this; + } else { SAL_WARN("sc", "unhandled XLS14_TOKEN(cfRule) with type: " << aType); @@ -181,7 +191,8 @@ void ExtConditionalFormattingContext::onEndElement() { case XM_TOKEN(f): { - rFormulas.push_back(aChars); + if(!aChars.startsWith("ISERROR(SEARCH(") && !aChars.startsWith("NOT(ISERROR(SEARCH(")) + rFormulas.push_back(aChars); } break; case XLS14_TOKEN( cfRule ): |