[Libreoffice-commits] core.git: chart2/qa oox/source
Balazs Varga (via logerrit)
logerrit at kemper.freedesktop.org
Fri Mar 20 10:45:21 UTC 2020
chart2/qa/extras/chart2import.cxx | 14 ++++++++++++++
chart2/qa/extras/data/xlsx/tdfPieNumFormat.xlsx |binary
oox/source/drawingml/chart/seriesconverter.cxx | 7 -------
3 files changed, 14 insertions(+), 7 deletions(-)
New commits:
commit 9f3623ce21a89e026128f85b4a09a40757754090
Author: Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Mon Mar 16 15:44:06 2020 +0100
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Fri Mar 20 11:44:46 2020 +0100
tdf#131398 OOXML chart import: fix number format of pie chart labels
Remove percentage format detection heuristics, which converted the
plain number format with percentage style to percentage format based
on the formatted string, resulting bad pie chart labels.
Change-Id: I642394d04fd6e6a5439bd53207e08e75de5b3029
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90570
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 68a142090805..4a7ccb373685 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -61,6 +61,7 @@ public:
*/
void testPPTXHiddenDataSeries();
void testPPTXPercentageNumberFormats();
+ void testPieChartLabelsNumFormat();
void testPPTXStackedNonStackedYAxis();
void testPPTChartSeries();
void testODPChartSeries();
@@ -175,6 +176,7 @@ public:
CPPUNIT_TEST(testPPTXSparseChartSeries);
CPPUNIT_TEST(testPPTXHiddenDataSeries);
CPPUNIT_TEST(testPPTXPercentageNumberFormats);
+ CPPUNIT_TEST(testPieChartLabelsNumFormat);
CPPUNIT_TEST(testPPTXStackedNonStackedYAxis);
CPPUNIT_TEST(testODPChartSeries);
CPPUNIT_TEST(testBnc864396);
@@ -710,6 +712,18 @@ void Chart2ImportTest::testPPTXPercentageNumberFormats()
CPPUNIT_ASSERT_MESSAGE("Y axis should be a percent format.", (nType & util::NumberFormat::PERCENT));
}
+void Chart2ImportTest::testPieChartLabelsNumFormat()
+{
+ load("/chart2/qa/extras/data/xlsx/", "tdfPieNumFormat.xlsx");
+ uno::Reference< chart::XChartDocument > xChartDoc(getChartCompFromSheet(0, mxComponent), UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xChartDoc.is());
+ // test data point labels format
+ Reference<beans::XPropertySet> xDataPointPropSet(xChartDoc->getDiagram()->getDataPointProperties(0, 0), uno::UNO_SET_THROW);
+ chart2::DataPointLabel aLabel;
+ xDataPointPropSet->getPropertyValue("Label") >>= aLabel;
+ CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumber);
+}
+
void Chart2ImportTest::testPPTXStackedNonStackedYAxis()
{
load("/chart2/qa/extras/data/pptx/", "stacked-non-stacked-mix-y-axis.pptx");
diff --git a/chart2/qa/extras/data/xlsx/tdfPieNumFormat.xlsx b/chart2/qa/extras/data/xlsx/tdfPieNumFormat.xlsx
new file mode 100644
index 000000000000..0835cb33325b
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdfPieNumFormat.xlsx differ
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx
index 6ade0b4cfd07..f063019b8327 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -124,13 +124,6 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt
bool bShowValue = !rDataLabel.mbDeleted && rDataLabel.mobShowVal.get( !bMSO2007Doc );
bool bShowPercent = !rDataLabel.mbDeleted && rDataLabel.mobShowPercent.get( !bMSO2007Doc ) && (rTypeInfo.meTypeCategory == TYPECATEGORY_PIE);
- if( bShowValue &&
- !bShowPercent && rTypeInfo.meTypeCategory == TYPECATEGORY_PIE &&
- rDataLabel.maNumberFormat.maFormatCode.indexOf('%') >= 0 )
- {
- bShowValue = false;
- bShowPercent = true;
- }
bool bShowCateg = !rDataLabel.mbDeleted && rDataLabel.mobShowCatName.get( !bMSO2007Doc );
bool bShowSymbol = !rDataLabel.mbDeleted && rDataLabel.mobShowLegendKey.get( !bMSO2007Doc );
More information about the Libreoffice-commits
mailing list