From 5d67d70b26706ce8a08612c12a68821f984210a2 Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Wed, 8 Jul 2020 11:06:38 +0200 Subject: tdf#134563 Add UNO API for custom leader lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- 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 ++- 4 files changed, 12 insertions(+), 3 deletions(-) (limited to 'chart2') 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()) { sal_Int32 nX1 = rScreenPosition2D.X; sal_Int32 nY1 = rScreenPosition2D.Y; -- cgit