summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2020-07-08 11:06:38 +0200
committerLászló Németh <nemeth@numbertext.org>2020-08-18 19:01:21 +0200
commit5d67d70b26706ce8a08612c12a68821f984210a2 (patch)
tree7e857813c19bb75a6d0751fc31a7bec6101dc213 /chart2
parent73f9d308337ce54d724f46e96e6505c45f445f26 (diff)
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 <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/qa/extras/chart2export.cxx2
-rw-r--r--chart2/source/model/main/DataSeriesProperties.cxx7
-rw-r--r--chart2/source/model/main/DataSeriesProperties.hxx3
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx3
4 files changed, 12 insertions, 3 deletions
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<sal_Bool>::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_Bool>())
{
sal_Int32 nX1 = rScreenPosition2D.X;
sal_Int32 nY1 = rScreenPosition2D.Y;