[Libreoffice-commits] core.git: chart2/source

Balazs Varga (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 24 07:30:36 UTC 2020


 chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx |    1 +
 chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx |    1 +
 chart2/source/controller/main/ChartController_Tools.cxx            |    8 ++++++--
 chart2/source/tools/DataSeriesHelper.cxx                           |    2 ++
 4 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 0dce53516011f5d2d9408501714e2b1865517119
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Wed Sep 2 15:09:01 2020 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Thu Sep 24 09:29:52 2020 +0200

    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 at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

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 &)


More information about the Libreoffice-commits mailing list