chart2/qa/extras/chart2import.cxx | 22 ++++++++++++++++++++++ chart2/qa/extras/data/docx/tdf91250.docx |binary oox/source/drawingml/chart/datasourcecontext.cxx | 3 +++ 3 files changed, 25 insertions(+)
New commits: commit 8a6985e301e5f4a98ef5306739529efdcdf13049 Author: Balazs Varga <balazs.varga...@gmail.com> AuthorDate: Mon Jun 8 14:26:33 2020 +0200 Commit: Gabor Kelemen <kelemen.gab...@nisz.hu> CommitDate: Sun Jul 26 20:31:09 2020 +0200 tdf#91250 Chart DOCX Import: Fix decimal place formatting issue Use UNLIMITED_PRECISION in case of GENERAL number format of CATEGORY axis labels in embedded charts, just like Calc does. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95802 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit f2a7f1bb080d882fd23b63a4f7a4833d6691b6e7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95985 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit 8cde18843c155531c3a735e1e825f54aa671a47e) Change-Id: I30cb50955c67824bd1aa88fb139618ce0f0974fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99397 Tested-by: Gabor Kelemen <kelemen.gab...@nisz.hu> Reviewed-by: Gabor Kelemen <kelemen.gab...@nisz.hu> diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index d81a1cacd3d1..b60540fb3dda 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -156,6 +156,7 @@ public: void testTdf125444PercentageCustomLabel(); void testTdf123206CustomLabelField(); void testStockChartShiftedCategoryPosition(); + void testTdf91250(); CPPUNIT_TEST_SUITE(Chart2ImportTest); CPPUNIT_TEST(Fdo60083); @@ -261,6 +262,7 @@ public: CPPUNIT_TEST(testTdf125444PercentageCustomLabel); CPPUNIT_TEST(testTdf123206CustomLabelField); CPPUNIT_TEST(testStockChartShiftedCategoryPosition); + CPPUNIT_TEST(testTdf91250); CPPUNIT_TEST_SUITE_END(); @@ -2444,6 +2446,26 @@ void Chart2ImportTest::testStockChartShiftedCategoryPosition() CPPUNIT_ASSERT(aScaleData.ShiftedCategoryPosition); } +void Chart2ImportTest::testTdf91250() +{ + load("/chart2/qa/extras/data/docx/", "tdf91250.docx"); + uno::Reference< chart2::XChartDocument > xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); + CPPUNIT_ASSERT(xChartDoc.is()); + Reference<chart2::XInternalDataProvider> xInternalProvider(xChartDoc->getDataProvider(), uno::UNO_QUERY); + CPPUNIT_ASSERT(xInternalProvider.is()); + + Reference<chart::XComplexDescriptionAccess> xDescAccess(xInternalProvider, uno::UNO_QUERY); + CPPUNIT_ASSERT(xDescAccess.is()); + + // Get the category labels. + Sequence<OUString> aCategories = xDescAccess->getRowDescriptions(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aCategories.getLength()); + CPPUNIT_ASSERT_EQUAL(OUString("12.3254"), aCategories[0]); + CPPUNIT_ASSERT_EQUAL(OUString("11.62315"), aCategories[1]); + CPPUNIT_ASSERT_EQUAL(OUString("9.26"), aCategories[2]); + CPPUNIT_ASSERT_EQUAL(OUString("8.657"), aCategories[3]); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/docx/tdf91250.docx b/chart2/qa/extras/data/docx/tdf91250.docx new file mode 100644 index 000000000000..4cb199b45795 Binary files /dev/null and b/chart2/qa/extras/data/docx/tdf91250.docx differ diff --git a/oox/source/drawingml/chart/datasourcecontext.cxx b/oox/source/drawingml/chart/datasourcecontext.cxx index 7fa7b12852a7..63a2762feeb6 100644 --- a/oox/source/drawingml/chart/datasourcecontext.cxx +++ b/oox/source/drawingml/chart/datasourcecontext.cxx @@ -130,6 +130,9 @@ void DoubleSequenceContext::onCharacters( const OUString& rChars ) double fValue = rChars.toDouble(); ::Color* pColor = nullptr; OUString aFormattedValue; + // tdf#91250: use UNLIMITED_PRECISION in case of GENERAL Number Format of category axis labels + if( pNumFrmt->GetStandardPrec() != SvNumberFormatter::UNLIMITED_PRECISION ) + pNumFrmt->ChangeStandardPrec(SvNumberFormatter::UNLIMITED_PRECISION); pNumFrmt->GetOutputString( fValue, nKey, aFormattedValue, &pColor ); mrModel.maData[ mnPtIndex ] <<= aFormattedValue; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits