summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2021-10-22 21:11:59 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2022-02-23 18:20:20 +0100
commitd9d7b17adf91c90a21a59250934e2e52e1133d81 (patch)
tree969032e6d8b2739b292601867a672cf8cfe7e37c
parent0635bbb035940dcedb17713a958f81265d69e67e (diff)
tdf#131025 ODF import: recognize SV_COUNTRY_LANGUAGE_OFFSET
File import was making an exception for "float value 0" if the accompanying text had no resemblance to the value 0, but that only applied to GENERAL number format. It should apply to any language's default number format. REGRESSION warning: as we can see, this has been handled inconsistently in the past. But from the coding exception to overcome losing text to a zero (and the huge number of duplicate bugs) the best choice seems to be ignore the spec that says that a number value overrides the text value - at least in the case where the number value is zero. Change-Id: I701e72c6a5dad42c7799ab501255a4859adf61d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124080 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 3e1d316734354c6b49696c8904e0fc431cfb5143) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124014 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit d3b4ef0f7726ef1619717d9e3327963ceb4c065a)
-rw-r--r--sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odtbin0 -> 11544 bytes
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx10
-rw-r--r--sw/source/filter/xml/xmltbli.cxx2
3 files changed, 11 insertions, 1 deletions
diff --git a/sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt b/sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt
new file mode 100644
index 000000000000..f2bffb050ac4
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt
Binary files differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 321ce301fb9c..6a216a1b5e92 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -219,6 +219,16 @@ DECLARE_ODFEXPORT_TEST(testTdf43569, "tdf43569_conditionalfield.doc")
CPPUNIT_ASSERT(xFields->hasMoreElements());
}
+DECLARE_ODFEXPORT_TEST(testTdf131025_noZerosInTable, "tdf131025_noZerosInTable.odt")
+{
+ uno::Reference<text::XTextTablesSupplier> xSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xTables = xSupplier->getTextTables();
+ uno::Reference<text::XTextTable> xTable(xTables->getByName("Table1"), uno::UNO_QUERY);
+
+ uno::Reference<text::XTextRange> xCell(xTable->getCellByName("C3"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("5 gp"), xCell->getString());
+}
+
DECLARE_ODFEXPORT_TEST(testTdf103567, "tdf103567.odt")
{
uno::Reference<drawing::XShape> const xShape(getShape(1));
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 0fde4d3c509d..07ea1355b8fb 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -2021,7 +2021,7 @@ SwTableBox *SwXMLTableContext::MakeTableBox(
{
const SwTableBoxNumFormat* pNumFormat =
static_cast<const SwTableBoxNumFormat*>( pItem );
- if( ( pNumFormat != nullptr ) && ( pNumFormat->GetValue() == 0 ) )
+ if (pNumFormat && (pNumFormat->GetValue() % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
{
// only one text node?
SwNodeIndex aNodeIndex( *(pCell->GetStartNode()), 1 );