[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sc/qa sc/source
Tibor Nagy (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jan 14 07:36:24 UTC 2021
sc/qa/unit/data/xlsx/tdf113013.xlsx |binary
sc/qa/unit/subsequent_filters-test.cxx | 26 ++++++++++++++++++++++++++
sc/source/filter/oox/extlstcontext.cxx | 13 +++++++++----
3 files changed, 35 insertions(+), 4 deletions(-)
New commits:
commit 40cb04a088e4fcf2b76232d080b3a5aaf5f5a675
Author: Tibor Nagy <nagy.tibor2 at nisz.hu>
AuthorDate: Wed Jan 6 12:23:32 2021 +0100
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Jan 14 08:35:52 2021 +0100
tdf#113013 XLSX import: fix "Formula is" type conditional formatting
rule when the formula contains a reference to another worksheet.
Change-Id: I873fad97a88df64e885fef20d4259ef6bfeaa06b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108850
Tested-by: Jenkins
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit fcd96df8f648439ea191d8c2070e8b21ff0b1001)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109124
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sc/qa/unit/data/xlsx/tdf113013.xlsx b/sc/qa/unit/data/xlsx/tdf113013.xlsx
new file mode 100644
index 000000000000..25e6276e7fbb
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf113013.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index ce65fc6684cf..3d5621da963d 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 testCondFormatFormulaIsXLSX();
void testCondFormatBeginsAndEndsWithXLSX();
void testExtCondFormatXLSX();
void testUpdateCircleInMergedCellODS();
@@ -298,6 +299,7 @@ public:
void testDeleteCirclesInRowAndCol();
CPPUNIT_TEST_SUITE(ScFiltersTest);
+ CPPUNIT_TEST(testCondFormatFormulaIsXLSX);
CPPUNIT_TEST(testCondFormatBeginsAndEndsWithXLSX);
CPPUNIT_TEST(testExtCondFormatXLSX);
CPPUNIT_TEST(testUpdateCircleInMergedCellODS);
@@ -534,6 +536,30 @@ void testRangeNameImpl(const ScDocument& rDoc)
}
+void ScFiltersTest::testCondFormatFormulaIsXLSX()
+{
+ ScDocShellRef xDocSh = loadDoc(u"tdf113013.", FORMAT_XLSX);
+ CPPUNIT_ASSERT_MESSAGE("Failed to load tdf113013.xlsx", xDocSh.is());
+
+ ScDocument& rDoc = xDocSh->GetDocument();
+
+ // "Formula is" condition
+ ScConditionalFormat* pFormatB1 = rDoc.GetCondFormat(1, 0, 0);
+ CPPUNIT_ASSERT(pFormatB1);
+ ScConditionalFormat* pFormatA2 = rDoc.GetCondFormat(0, 1, 0);
+ CPPUNIT_ASSERT(pFormatA2);
+
+ ScRefCellValue aCellB1(rDoc, ScAddress(1, 0, 0));
+ OUString aCellStyleB1 = pFormatB1->GetCellStyle(aCellB1, ScAddress(1, 0, 0));
+ CPPUNIT_ASSERT(!aCellStyleB1.isEmpty());
+
+ ScRefCellValue aCellA2(rDoc, ScAddress(0, 1, 0));
+ OUString aCellStyleA2 = pFormatA2->GetCellStyle(aCellA2, ScAddress(0, 1, 0));
+ CPPUNIT_ASSERT(!aCellStyleA2.isEmpty());
+
+ xDocSh->DoClose();
+}
+
void ScFiltersTest::testCondFormatBeginsAndEndsWithXLSX()
{
ScDocShellRef xDocSh = loadDoc("tdf120749.", FORMAT_XLSX);
diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx
index 53cd7b385100..fda1a0449e5e 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -153,26 +153,31 @@ ContextHandlerRef ExtConditionalFormattingContext::onCreateContext(sal_Int32 nEl
eOperator = CondFormatBuffer::convertToInternalOperator(aToken);
return this;
}
- else if(aType == "containsText")
+ else if (aType == "containsText")
{
eOperator = ScConditionMode::ContainsText;
return this;
}
- else if(aType == "notContainsText")
+ else if (aType == "notContainsText")
{
eOperator = ScConditionMode::NotContainsText;
return this;
}
- else if(aType == "beginsWith")
+ else if (aType == "beginsWith")
{
eOperator = ScConditionMode::BeginsWith;
return this;
}
- else if(aType == "endsWith")
+ else if (aType == "endsWith")
{
eOperator = ScConditionMode::EndsWith;
return this;
}
+ else if (aType == "expression")
+ {
+ eOperator = ScConditionMode::Direct;
+ return this;
+ }
else
{
SAL_WARN("sc", "unhandled XLS14_TOKEN(cfRule) with type: " << aType);
More information about the Libreoffice-commits
mailing list