[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
Tibor Nagy (via logerrit)
logerrit at kemper.freedesktop.org
Tue Mar 2 16:14:34 UTC 2021
sc/qa/unit/data/xlsx/tdf122102.xlsx |binary
sc/qa/unit/subsequent_filters-test.cxx | 38 +++++++++++++++++++++++++++++++++
sc/source/filter/oox/extlstcontext.cxx | 13 ++++++++++-
3 files changed, 50 insertions(+), 1 deletion(-)
New commits:
commit 2dcf05d75624f0d1a4cfb6c4ab724a53dbeab316
Author: Tibor Nagy <nagy.tibor2 at nisz.hu>
AuthorDate: Tue Dec 15 18:58:33 2020 +0100
Commit: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Tue Mar 2 17:13:56 2021 +0100
tdf#122102 XLSX import: fix "contains" conditional formatting
when using "Given text" type and cell reference
with "contains text" or "not contains text" conditions.
Co-authored-by: Attila Szűcs (NISZ)
Change-Id: Ifbd34ef9f7ee948b6ac42a890bd52f3fb8486aec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107791
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit 0101975f8eac650bb87c4af81157cb33a6309e0e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107810
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
(cherry picked from commit 4bca4f507c064c18880bd8283aaba567865d2462)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111789
Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
diff --git a/sc/qa/unit/data/xlsx/tdf122102.xlsx b/sc/qa/unit/data/xlsx/tdf122102.xlsx
new file mode 100644
index 000000000000..bc1db82d78a7
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf122102.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 31fce53b67bd..66c092276e3d 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -106,6 +106,7 @@ public:
virtual void tearDown() override;
//ods, xls, xlsx filter tests
+ void testExtCondFormatXLSX();
void testUpdateCircleInMergedCellODS();
void testDeleteCircleInMergedCellODS();
void testBooleanFormatXLSX();
@@ -275,6 +276,7 @@ public:
void testDeleteCirclesInRowAndCol();
CPPUNIT_TEST_SUITE(ScFiltersTest);
+ CPPUNIT_TEST(testExtCondFormatXLSX);
CPPUNIT_TEST(testUpdateCircleInMergedCellODS);
CPPUNIT_TEST(testDeleteCircleInMergedCellODS);
CPPUNIT_TEST(testBooleanFormatXLSX);
@@ -488,6 +490,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 06aa3d836120..0a694e00fd2d 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 ):
More information about the Libreoffice-commits
mailing list