diff options
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 8 | ||||
-rw-r--r-- | sw/qa/extras/layout/data/tdf134866.docx | bin | 0 -> 27169 bytes | |||
-rw-r--r-- | sw/qa/extras/layout/layout.cxx | 16 |
3 files changed, 23 insertions, 1 deletions
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 5acd2d587914..e0b25ba74811 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -530,7 +530,13 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re } case DataPointCustomLabelFieldType_PERCENTAGE: { - aTextList[i] = getLabelTextForValue( rDataSeries, nPointIndex, fValue, true ); + if(fSumValue == 0.0) + fSumValue = 1.0; + fValue /= fSumValue; + if(fValue < 0) + fValue *= -1.0; + + aTextList[i] = getLabelTextForValue(rDataSeries, nPointIndex, fValue, true); break; } case DataPointCustomLabelFieldType_CELLREF: diff --git a/sw/qa/extras/layout/data/tdf134866.docx b/sw/qa/extras/layout/data/tdf134866.docx Binary files differnew file mode 100644 index 000000000000..3358b527133c --- /dev/null +++ b/sw/qa/extras/layout/data/tdf134866.docx diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index adb19aee2646..ade9607847de 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2687,6 +2687,22 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf129173) pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/textarray[22]/text", "56"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134866) +{ + SwDoc* pDoc = createDoc("tdf134866.docx"); + SwDocShell* pShell = pDoc->GetDocShell(); + + // Dump the rendering of the first page as an XML file. + std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); + MetafileXmlDump dumper; + xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + CPPUNIT_ASSERT(pXmlDoc); + + // Check the data label of pie chart. + assertXPathContent( + pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/textarray[2]/text", "100%"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf129095) { SwDoc* pDoc = createDoc("tdf129095.docx"); |