summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chart2/qa/extras/chart2import.cxx22
-rw-r--r--chart2/qa/extras/data/docx/tdf91250.docxbin0 -> 25895 bytes
-rw-r--r--oox/source/drawingml/chart/datasourcecontext.cxx3
3 files changed, 25 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index e47f1234ef60..0b70320d1e9a 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -160,6 +160,7 @@ public:
void testTdf119138MissingAutoTitleDeleted();
void testStockChartShiftedCategoryPosition();
void testTdf133376();
+ void testTdf91250();
CPPUNIT_TEST_SUITE(Chart2ImportTest);
CPPUNIT_TEST(Fdo60083);
@@ -268,6 +269,7 @@ public:
CPPUNIT_TEST(testTdf119138MissingAutoTitleDeleted);
CPPUNIT_TEST(testStockChartShiftedCategoryPosition);
CPPUNIT_TEST(testTdf133376);
+ CPPUNIT_TEST(testTdf91250);
CPPUNIT_TEST_SUITE_END();
@@ -2503,6 +2505,26 @@ void Chart2ImportTest::testTdf133376()
CPPUNIT_ASSERT_DOUBLES_EQUAL(5269, aLabelPosition.Y, 30);
}
+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
--- /dev/null
+++ b/chart2/qa/extras/data/docx/tdf91250.docx
Binary files differ
diff --git a/oox/source/drawingml/chart/datasourcecontext.cxx b/oox/source/drawingml/chart/datasourcecontext.cxx
index 7ad910af65d4..16cd509e4a63 100644
--- a/oox/source/drawingml/chart/datasourcecontext.cxx
+++ b/oox/source/drawingml/chart/datasourcecontext.cxx
@@ -127,6 +127,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;
}