core.git: chart2/qa chart2/source offapi/com oox/source
chart2/qa/extras/chart2import.cxx | 22 + chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx |1 chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx |1 chart2/source/model/main/DataPointProperties.cxx |6 + chart2/source/model/main/DataPointProperties.hxx |3 chart2/source/tools/DataSeriesHelper.cxx |3 chart2/source/view/charttypes/PieChart.cxx | 38 ++ chart2/source/view/inc/VDataSeries.hxx |1 chart2/source/view/main/VDataSeries.cxx| 21 + offapi/com/sun/star/chart2/DataPointProperties.idl |6 + oox/source/drawingml/chart/seriesconverter.cxx |3 oox/source/token/properties.txt|1 12 files changed, 92 insertions(+), 14 deletions(-) New commits: commit a77403d11a60ebe6aeb33d9b6ae611412d9ab1cc Author: Justin Luth AuthorDate: Thu Jan 25 11:57:40 2024 -0500 Commit: Miklos Vajna CommitDate: Tue Jan 30 10:40:43 2024 +0100 tdf#146756 pie chart2 import: use manualLayout Width for pie chart labels ... and use a compatible 1/5 width if not specified. This patch depends on the previous oox patch (commit 301e27cbebf7d6e4c9b82290d7cd555c43f0c999) which actually reads the width into the model. Fixes a 7.2 regression from commit b0068342398786ca50304260434a18880dddf74d author Tünde Tóth on Wed Dec 16 18:26:26 2020 +0100 tdf#138777 pie chart: improve long data label width and is basically a re-write of 7.1's commit 20da1a5dd37c7edac620566c992d5a53b23a5f12 author Tünde Tóth on Fri Oct 09 09:24:18 2020 +0200 tdf#134978 Chart OOXML Import: fix pie chart label custom position This is very risky, but then ANYTHING changing chart2 is risky. There were a lot of changes made in 7.1, and they all invited regressions. However, our chart implementation is not in a good state, and certainly is not very interoperable, so it is worth taking the risk. Anything dealing with manualLayout at this point should have originated as a pptx, so forcing a compatible max width should be fairly safe. It probably isn't actually all that risky after all. largely copied code from commit 4223ff2be69f03e571464b0b09ad0d278918631b Author: Balazs Varga on Wed Jan 15 16:31:35 2020 +0100 tdf#48436 Chart: add CustomLabelPosition UNO API property Fortunately this all goes away after a round-trip since custom label placement is lost on export to OOXML, and that really helps to reduce the risk. make CppunitTest_chart2_import CPPUNIT_TEST_NAME=testTdf146487 Change-Id: I9722fc6c759c15ac3924780e6fc124f02fba07e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162590 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index fc8042a38393..b23e048c6949 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -37,6 +38,8 @@ #include #include +namespace +{ class Chart2ImportTest : public ChartTest { public: @@ -46,6 +49,11 @@ protected: void testTransparentBackground(std::u16string_view filename); }; +OUString getShapeDump(css::uno::Reference const& doc) +{ +return css::uno::Reference(doc, css::uno::UNO_QUERY_THROW)->dump("shapes"); +} + // error bar import // split method up into smaller chunks for more detailed tests CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testFdo60083) @@ -187,7 +195,7 @@ CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testSteppedLines) } } -static uno::Sequence < OUString > getChartColumnDescriptions( uno::Reference< chart::XChartDocument > const & xChart1Doc) +uno::Sequence < OUString > getChartColumnDescriptions( uno::Reference< chart::XChartDocument > const & xChart1Doc) { CPPUNIT_ASSERT(xChart1Doc.is()); uno::Reference< chart::XChartDataArray > xChartData ( xChart1Doc->getData(), UNO_QUERY_THROW); @@ -1988,6 +1996,17 @@ CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testTdf146487) Reference xTitled(xChartDoc, uno::UNO_QUERY_THROW); uno::Reference xTitle = xTitled->getTitleObject(); CPPUNIT_ASSERT_MESSAGE("chart doc should not have a title", !xTitle.is()); + +// tdf#146756 use manualLayout Width that was provided (so Green; $7,654,321 is not wrapped +if (!IsDefaultDPI()) +return; +uno::Reference xDoc = getChartDocFromDrawImpress(0, 0); +OString aXmlDump = OUStringToOString(getShapeDump(xDoc), RTL_TEXTENCODING_UTF8); +xmlDocUniquePtr
[Libreoffice-commits] core.git: chart2/qa chart2/source offapi/com oox/source
chart2/qa/extras/chart2export.cxx| 27 +++ chart2/qa/extras/data/xlsx/tdf138204.xlsx|binary chart2/source/view/charttypes/VSeriesPlotter.cxx |1 offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl |3 - oox/source/drawingml/chart/seriesconverter.cxx |2 oox/source/export/chartexport.cxx|3 + 6 files changed, 35 insertions(+), 1 deletion(-) New commits: commit 4930749294475cc28afd06cd11fdf56a157ad9ce Author: Balazs Varga AuthorDate: Mon Nov 16 14:44:45 2020 +0100 Commit: László Németh CommitDate: Tue Nov 17 11:10:09 2020 +0100 tdf#138204 Chart OOXML Import: doesn't show placeholder for CELLRANGE data label field type. Add CELLRANGE to enum com::sun::star::chart2::DataPointCustomLabelFieldType, like we do at CELLREF, while both of them are not implemented, see commit 790f9abeb1a1167ad5ab84c5fb855b36669c125b (tdf#114821 import complex data labels in bar chart). Regression from commit: 0d2340998415fb4b2f794054c62ef61c83e32155 (tdf#136061 Chart ODF/OOXML: fix missing custom labels) Change-Id: I8e0f4ca9db6e613a190cbda31504a7542fc13a86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105934 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 73f9166d176c..9637aebd4e53 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -182,6 +182,7 @@ public: void testTdf136267(); void testDataLabelPlacementPieChart(); void testTdf137917(); +void testTdf138204(); CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(testErrorBarXLSX); @@ -326,6 +327,7 @@ public: CPPUNIT_TEST(testTdf136267); CPPUNIT_TEST(testDataLabelPlacementPieChart); CPPUNIT_TEST(testTdf137917); +CPPUNIT_TEST(testTdf138204); CPPUNIT_TEST_SUITE_END(); @@ -2984,6 +2986,31 @@ void Chart2ExportTest::testTdf137917() assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:minorTimeUnit", "val", "days"); } +void Chart2ExportTest::testTdf138204() +{ +load("/chart2/qa/extras/data/xlsx/", "tdf138204.xlsx"); +xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); +CPPUNIT_ASSERT(pXmlDoc); + +// Check the first data label field type +assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:dLbls/c:dLbl/c:tx/c:rich/a:p/a:fld", "type", "CELLRANGE"); + +Reference< chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent); +CPPUNIT_ASSERT(xChartDoc.is()); + +uno::Reference xDataSeries(getDataSeriesFromDoc(xChartDoc, 1)); +CPPUNIT_ASSERT(xDataSeries.is()); + +uno::Reference xPropertySet; +uno::Sequence> aFields; +xPropertySet.set(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW); +xPropertySet->getPropertyValue("CustomLabelFields") >>= aFields; +CPPUNIT_ASSERT_EQUAL(static_cast(1), aFields.getLength()); + + CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CELLRANGE, aFields[0]->getFieldType()); +//CPPUNIT_ASSERT_EQUAL(OUString("67.5%"), aFields[0]->getString()); TODO: Not implemented yet +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/xlsx/tdf138204.xlsx b/chart2/qa/extras/data/xlsx/tdf138204.xlsx new file mode 100644 index ..04c2e50d799c Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf138204.xlsx differ diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index b502efd83fe5..132903ba4d30 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -542,6 +542,7 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re break; } case DataPointCustomLabelFieldType_CELLREF: +case DataPointCustomLabelFieldType_CELLRANGE: { // TODO: for now doesn't show placeholder aTextList[i] = OUString(); diff --git a/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl b/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl index 05c26a738684..f5ea79ca68d5 100644 --- a/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl +++ b/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl @@ -24,7 +24,8 @@ enum DataPointCustomLabelFieldType CATEGORYNAME, CELLREF, NEWLINE, -PERCENTAGE +PERCENTAGE, +CELLRANGE }; }; }; }; }; diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index
[Libreoffice-commits] core.git: chart2/qa chart2/source offapi/com oox/source
chart2/qa/extras/chart2export.cxx |2 +- chart2/source/model/main/DataSeriesProperties.cxx |7 +++ chart2/source/model/main/DataSeriesProperties.hxx |3 ++- chart2/source/view/charttypes/VSeriesPlotter.cxx |3 ++- offapi/com/sun/star/chart2/DataSeries.idl |7 +++ oox/source/drawingml/chart/seriescontext.cxx |6 +- oox/source/drawingml/chart/seriesconverter.cxx|2 +- oox/source/export/chartexport.cxx |6 -- oox/source/token/properties.txt |2 +- 9 files changed, 30 insertions(+), 8 deletions(-) New commits: commit 5d67d70b26706ce8a08612c12a68821f984210a2 Author: Balazs Varga AuthorDate: Wed Jul 8 11:06:38 2020 +0200 Commit: László Németh CommitDate: Tue Aug 18 19:01:21 2020 +0200 tdf#134563 Add UNO API for custom leader lines If its ShowCustomLeaderLines=true, data series uses leader lines for labels with custom alignment. Add also OOXML import/export of custom data series setting. Change-Id: I8e6f7cb457c38b84aa40c917e69704862262a96e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98323 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index f9b2651a922c..754768880054 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -2373,7 +2373,7 @@ void Chart2ExportTest::testLeaderLines() xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser[1]/c:dLbls/c:extLst/c:ext/c15:showLeaderLines", "val", "1"); -assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser[2]/c:dLbls/c:extLst/c:ext/c15:showLeaderLines", "val", "1"); +assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser[2]/c:dLbls/c:extLst/c:ext/c15:showLeaderLines", "val", "0"); } void Chart2ExportTest::testNumberFormatExportPPTX() diff --git a/chart2/source/model/main/DataSeriesProperties.cxx b/chart2/source/model/main/DataSeriesProperties.cxx index 5d0cb777e151..d85d264753c1 100644 --- a/chart2/source/model/main/DataSeriesProperties.cxx +++ b/chart2/source/model/main/DataSeriesProperties.cxx @@ -69,6 +69,12 @@ void DataSeriesProperties::AddPropertiesToVector( beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEVOID ); +rOutProperties.emplace_back( "ShowCustomLeaderLines", + PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES, + cppu::UnoType::get(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT ); + // add properties of service DataPointProperties DataPointProperties::AddPropertiesToVector( rOutProperties ); } @@ -80,6 +86,7 @@ void DataSeriesProperties::AddDefaultsToMap( PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATASERIES_VARY_COLORS_BY_POINT, false ); PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DATASERIES_ATTACHED_AXIS_INDEX, 0 ); PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATASERIES_SHOW_LEGEND_ENTRY, true ); +PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES, true ); // PROP_DATASERIES_ATTRIBUTED_DATA_POINTS has no default diff --git a/chart2/source/model/main/DataSeriesProperties.hxx b/chart2/source/model/main/DataSeriesProperties.hxx index e20602baf45f..6bc058201466 100644 --- a/chart2/source/model/main/DataSeriesProperties.hxx +++ b/chart2/source/model/main/DataSeriesProperties.hxx @@ -35,7 +35,8 @@ namespace chart::DataSeriesProperties PROP_DATASERIES_VARY_COLORS_BY_POINT, PROP_DATASERIES_ATTACHED_AXIS_INDEX, PROP_DATASERIES_SHOW_LEGEND_ENTRY, -PROP_DATASERIES_DELETED_LEGEND_ENTRIES +PROP_DATASERIES_DELETED_LEGEND_ENTRIES, +PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES }; void AddPropertiesToVector( diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 14b322e8f587..8f7dcbb59a1d 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -702,7 +702,8 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re if( aRelPos.X != -1 ) { xTextShape->setPosition(aRelPos); -if( !m_xChartTypeModel->getChartType().equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) +if( !m_xChartTypeModel->getChartType().equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE) && +rDataSeries.getPropertiesOfSeries()->getPropertyValue( "ShowCustomLeaderLines" ).get()) {
[Libreoffice-commits] core.git: chart2/qa chart2/source offapi/com oox/source
chart2/qa/extras/chart2import.cxx | 25 + chart2/qa/extras/data/xlsx/testTdf130032.xlsx |binary chart2/source/view/main/VDataSeries.cxx| 12 +++- offapi/com/sun/star/chart/DataLabelPlacement.idl |2 offapi/com/sun/star/chart2/DataPointProperties.idl |2 oox/source/drawingml/chart/seriesconverter.cxx | 53 + oox/source/drawingml/chart/typegroupconverter.cxx |4 - 7 files changed, 40 insertions(+), 58 deletions(-) New commits: commit dff7a46fb46d1fa2a3ad674ee493ae2d59150fe3 Author: Balazs Varga AuthorDate: Thu Jan 30 23:58:57 2020 +0100 Commit: László Németh CommitDate: Fri Jan 31 10:43:22 2020 +0100 tdf#130032 Chart OOXML Import: fix data label custom position in case of all chart types except pie chart. Clean up commit 4223ff2be69f03e571464b0b09ad0d278918631b (tdf#48436 Chart: add CustomLabelPosition UNO API property). Note: use the correct default OOXML label placement in case of radar charts. Change-Id: I9a8f509304b3c70d879c8c6a95bc91d15ac28521 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87759 Reviewed-by: László Németh Tested-by: László Németh diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 47b2e0354d51..054b04209db2 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -153,6 +153,7 @@ public: void testTdf123206CustomLabelField(); void testTdf125444PercentageCustomLabel(); void testDataPointLabelCustomPos(); +void testTdf130032(); CPPUNIT_TEST_SUITE(Chart2ImportTest); CPPUNIT_TEST(Fdo60083); @@ -254,6 +255,7 @@ public: CPPUNIT_TEST(testTdf123206CustomLabelField); CPPUNIT_TEST(testTdf125444PercentageCustomLabel); CPPUNIT_TEST(testDataPointLabelCustomPos); +CPPUNIT_TEST(testTdf130032); CPPUNIT_TEST_SUITE_END(); @@ -2353,6 +2355,7 @@ void Chart2ImportTest::testTdf125444PercentageCustomLabel() void Chart2ImportTest::testDataPointLabelCustomPos() { +// test CustomLabelPosition on Bar chart load("/chart2/qa/extras/data/xlsx/", "testDataPointLabelCustomPos.xlsx"); uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet(0, mxComponent); CPPUNIT_ASSERT(xChartDoc.is()); @@ -2372,6 +2375,28 @@ void Chart2ImportTest::testDataPointLabelCustomPos() CPPUNIT_ASSERT_EQUAL(chart::DataLabelPlacement::OUTSIDE, aPlacement); } +void Chart2ImportTest::testTdf130032() +{ +// test CustomLabelPosition on Line chart +load("/chart2/qa/extras/data/xlsx/", "testTdf130032.xlsx"); +uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet(0, mxComponent); +CPPUNIT_ASSERT(xChartDoc.is()); +uno::Reference xDataSeries(getDataSeriesFromDoc(xChartDoc, 0)); +CPPUNIT_ASSERT(xDataSeries.is()); + +uno::Reference xPropertySet(xDataSeries->getDataPointByIndex(1), uno::UNO_SET_THROW); +CPPUNIT_ASSERT(xPropertySet.is()); + +chart2::RelativePosition aCustomLabelPosition; +xPropertySet->getPropertyValue("CustomLabelPosition") >>= aCustomLabelPosition; +CPPUNIT_ASSERT_DOUBLES_EQUAL(aCustomLabelPosition.Primary, -0.04383334, 1e-7); +CPPUNIT_ASSERT_DOUBLES_EQUAL(aCustomLabelPosition.Secondary, 0.086794050743657, 1e-7); + +sal_Int32 aPlacement; +xPropertySet->getPropertyValue("LabelPlacement") >>= aPlacement; +CPPUNIT_ASSERT_EQUAL(chart::DataLabelPlacement::RIGHT, aPlacement); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/xlsx/testTdf130032.xlsx b/chart2/qa/extras/data/xlsx/testTdf130032.xlsx new file mode 100644 index ..03a3dbf403c3 Binary files /dev/null and b/chart2/qa/extras/data/xlsx/testTdf130032.xlsx differ diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index 33bf9bee481d..f64cb151a2d8 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -641,8 +641,10 @@ awt::Point VDataSeries::getLabelPosition( awt::Point aTextShapePos, sal_Int32 nP aPos.Y = static_cast(aCustomLabelPosition.Secondary * m_aReferenceSize.Height) + aTextShapePos.Y; } } -catch (const uno::Exception&) {} - +catch (const uno::Exception&) +{ +TOOLS_WARN_EXCEPTION("chart2", ""); +} return aPos; } @@ -659,8 +661,10 @@ bool VDataSeries::isLabelCustomPos(sal_Int32 nPointIndex) const bCustom = true; } } -catch (const uno::Exception&) {} - +catch (const uno::Exception&) +{ +TOOLS_WARN_EXCEPTION("chart2", ""); +} return bCustom; } diff --git a/offapi/com/sun/star/chart/DataLabelPlacement.idl b/offapi/com/sun/star/chart/DataLabelPlacement.idl index fbdc19fcce8f..f8e50effeaea 100644 --- a/offapi/com/sun/star/chart/DataLabelPlacement.idl
[Libreoffice-commits] core.git: chart2/qa chart2/source offapi/com oox/source
chart2/qa/extras/chart2import.cxx | 24 +++ chart2/qa/extras/data/xlsx/deleted_legend_entry2.xlsx |binary chart2/source/model/main/DataSeriesProperties.cxx |6 + chart2/source/model/main/DataSeriesProperties.hxx |3 chart2/source/view/charttypes/VSeriesPlotter.cxx | 21 +- offapi/com/sun/star/chart2/DataSeries.idl |7 ++ oox/source/drawingml/chart/titleconverter.cxx | 61 +++--- oox/source/token/properties.txt |1 8 files changed, 114 insertions(+), 9 deletions(-) New commits: commit 6e847aa817999ab18acd534f9e6a86685bb268fc Author: Tünde Tóth AuthorDate: Wed Dec 18 09:49:26 2019 +0100 Commit: László Németh CommitDate: Fri Jan 10 14:21:35 2020 +0100 tdf#129859 XLSX import: don't show deleted legend entries by adding a new feature to disable selected data points in pie charts. Fixing also tdf#129858 by deleting the correct legend entry in bar charts. Change-Id: Iaaf3a864e9404b8b6d3e2affbb366e18d0f4b43e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86160 Reviewed-by: László Németh Tested-by: László Németh diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index e44efe636eed..5fcf205df813 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -151,6 +151,7 @@ public: void testTdf121991(); void testTdf123206CustomLabelField(); void testTdf125444PercentageCustomLabel(); +void testDeletedLegendEntries(); CPPUNIT_TEST_SUITE(Chart2ImportTest); CPPUNIT_TEST(Fdo60083); @@ -251,6 +252,8 @@ public: CPPUNIT_TEST(testTdf121991); CPPUNIT_TEST(testTdf123206CustomLabelField); CPPUNIT_TEST(testTdf125444PercentageCustomLabel); +CPPUNIT_TEST(testDeletedLegendEntries); + CPPUNIT_TEST_SUITE_END(); private: @@ -2334,7 +2337,28 @@ void Chart2ImportTest::testTdf125444PercentageCustomLabel() // to assert the latter. CPPUNIT_ASSERT_EQUAL(static_cast(3), aLabelFields.getLength()); CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType_PERCENTAGE, aLabelFields[2]->getFieldType()); +} + +void Chart2ImportTest::testDeletedLegendEntries() +{ +load("/chart2/qa/extras/data/xlsx/", "deleted_legend_entry2.xlsx"); +Reference xChartDoc = getChartDocFromSheet(0, mxComponent); +CPPUNIT_ASSERT(xChartDoc.is()); +Reference xDataSeries(getDataSeriesFromDoc(xChartDoc, 0)); +CPPUNIT_ASSERT(xDataSeries.is()); +Reference xPropertySet(xDataSeries, uno::UNO_QUERY_THROW); +bool bShowLegendEntry = true; +CPPUNIT_ASSERT(xPropertySet->getPropertyValue("ShowLegendEntry") >>= bShowLegendEntry); +CPPUNIT_ASSERT(!bShowLegendEntry); +Reference xChartDoc2 = getChartDocFromSheet(1, mxComponent); +CPPUNIT_ASSERT(xChartDoc.is()); +Reference xDataSeries2(getDataSeriesFromDoc(xChartDoc2, 0)); +CPPUNIT_ASSERT(xDataSeries2.is()); +Reference xPropertySet2(xDataSeries2, uno::UNO_QUERY_THROW); +Sequence deletedLegendEntriesSeq; +CPPUNIT_ASSERT(xPropertySet2->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), deletedLegendEntriesSeq[0]); } CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest); diff --git a/chart2/qa/extras/data/xlsx/deleted_legend_entry2.xlsx b/chart2/qa/extras/data/xlsx/deleted_legend_entry2.xlsx new file mode 100644 index ..ea02464b1c46 Binary files /dev/null and b/chart2/qa/extras/data/xlsx/deleted_legend_entry2.xlsx differ diff --git a/chart2/source/model/main/DataSeriesProperties.cxx b/chart2/source/model/main/DataSeriesProperties.cxx index c43ced71f40c..5d0cb777e151 100644 --- a/chart2/source/model/main/DataSeriesProperties.cxx +++ b/chart2/source/model/main/DataSeriesProperties.cxx @@ -63,6 +63,12 @@ void DataSeriesProperties::AddPropertiesToVector( beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT ); +rOutProperties.emplace_back( "DeletedLegendEntries", + PROP_DATASERIES_DELETED_LEGEND_ENTRIES, + cppu::UnoType>::get(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEVOID ); + // add properties of service DataPointProperties DataPointProperties::AddPropertiesToVector( rOutProperties ); } diff --git a/chart2/source/model/main/DataSeriesProperties.hxx b/chart2/source/model/main/DataSeriesProperties.hxx index 6791078d5678..b0f6283db54c 100644 --- a/chart2/source/model/main/DataSeriesProperties.hxx +++ b/chart2/source/model/main/DataSeriesProperties.hxx @@ -37,7 +37,8 @@ namespace DataSeriesProperties PROP_DATASERIES_STACKING_DIRECTION, PROP_DATASERIES_VARY_COLORS_BY_POINT, PROP_DATASERIES_ATTACHED_AXIS_INDEX, -PROP_DATASERIES_SHOW_LEGEND_ENTRY +