summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2020-09-02 15:09:01 +0200
committerLászló Németh <nemeth@numbertext.org>2020-09-24 09:29:52 +0200
commit0dce53516011f5d2d9408501714e2b1865517119 (patch)
tree4594ea7569839eda7606cbaca5540b15cefe0091 /chart2
parent0f99330f33868594ad253656805918115823f59d (diff)
tdf#136402 Chart View: remove custom label text
Now Delete Data Labels and Insert Data Labels local menu options remove custom label text instead of keeping it. See with unit test document custom_data_label.xlsx of commit bcda268cde1f8408c2066ce985acedfce3e3bc2e (tdf#134977 Chart OOXML: fix import of custom data label). Change-Id: Ifc7afd0f2ece9da528e6206a6bd393b394b36f9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101929 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/source/controller/itemsetwrapper/DataPointItemConverter.cxx1
-rw-r--r--chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx1
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx8
-rw-r--r--chart2/source/tools/DataSeriesHelper.cxx2
4 files changed, 10 insertions, 2 deletions
diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
index 6328a222b622..302c56280fa0 100644
--- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
@@ -338,6 +338,7 @@ bool DataPointItemConverter::ApplySpecialItem(
DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, CHART_UNONAME_LABEL , aOldValue ) )
{
DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, CHART_UNONAME_LABEL , uno::Any( aLabel ) );
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, CHART_UNONAME_CUSTOM_LABEL_FIELDS, uno::Any() );
bChanged = true;
}
}
diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
index bdeffbf6cf3c..5fe31b1bcd5f 100644
--- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
@@ -287,6 +287,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte
DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries, CHART_UNONAME_LABEL, aOldValue))
{
DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries, CHART_UNONAME_LABEL, uno::Any(aLabel));
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries, CHART_UNONAME_CUSTOM_LABEL_FIELDS, uno::Any());
bChanged = true;
}
}
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 3668321589db..d72a629757a1 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -765,10 +765,14 @@ bool ChartController::executeDispatch_Delete()
if( aObjectType == OBJECTTYPE_DATA_LABELS )
{
uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( aCID, getModel() ));
- ::chart::DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, CHART_UNONAME_LABEL, uno::Any(aLabel) );
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, CHART_UNONAME_LABEL, uno::Any(aLabel) );
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, CHART_UNONAME_CUSTOM_LABEL_FIELDS, uno::Any() );
}
else
- xObjectProperties->setPropertyValue( CHART_UNONAME_LABEL, uno::Any(aLabel) );
+ {
+ xObjectProperties->setPropertyValue(CHART_UNONAME_LABEL, uno::Any(aLabel));
+ xObjectProperties->setPropertyValue(CHART_UNONAME_CUSTOM_LABEL_FIELDS, uno::Any());
+ }
bReturn = true;
aUndoGuard.commit();
}
diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx
index 809ba67a931e..c7dabaf1d4da 100644
--- a/chart2/source/tools/DataSeriesHelper.cxx
+++ b/chart2/source/tools/DataSeriesHelper.cxx
@@ -173,6 +173,7 @@ void lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( const Reference< chart2::
aLabel.ShowCustomLabel = false;
}
xPointProp->setPropertyValue(CHART_UNONAME_LABEL, uno::Any(aLabel));
+ xPointProp->setPropertyValue(CHART_UNONAME_CUSTOM_LABEL_FIELDS, uno::Any());
}
}
}
@@ -837,6 +838,7 @@ void deleteDataLabelsFromPoint( const Reference< beans::XPropertySet >& xPointPr
aLabel.ShowCategoryName = false;
aLabel.ShowCustomLabel = false;
xPointProp->setPropertyValue(CHART_UNONAME_LABEL, uno::Any(aLabel));
+ xPointProp->setPropertyValue(CHART_UNONAME_CUSTOM_LABEL_FIELDS, uno::Any());
}
}
catch(const uno::Exception &)