chart2/source/tools/AxisHelper.cxx    |    8 ++++++--
 chart2/source/view/main/ChartView.cxx |    6 ++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 5761232368093e6b0a9a9b2860647be6470733cb
Author: Kohei Yoshida <kohei.yosh...@collabora.com>
Date:   Tue Jun 17 19:37:20 2014 -0400

    Set the number format code only when it changes.
    
    Otherwise the chart view would keep updating itself endlessly.
    
    Change-Id: I653ae396a48dd0fdcaa3ef308657509dac541594

diff --git a/chart2/source/tools/AxisHelper.cxx 
b/chart2/source/tools/AxisHelper.cxx
index c6ba570..acc7570 100644
--- a/chart2/source/tools/AxisHelper.cxx
+++ b/chart2/source/tools/AxisHelper.cxx
@@ -148,8 +148,11 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
 
     bool bLinkToSource = true;
     xProp->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= 
bLinkToSource;
+    xProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormatKey;
 
-    if (bLinkToSource || !(xProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= 
nNumberFormatKey))
+    sal_Int32 nOldNumberFormat = nNumberFormatKey;
+
+    if (bLinkToSource)
     {
         bool bFormatSet = false;
         //check whether we have a percent scale -> use percent format
@@ -323,7 +326,8 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
             }
         }
 
-        xProp->setPropertyValue(CHART_UNONAME_NUMFMT, 
uno::makeAny(nNumberFormatKey));
+        if (nOldNumberFormat != nNumberFormatKey)
+            xProp->setPropertyValue(CHART_UNONAME_NUMFMT, 
uno::makeAny(nNumberFormatKey));
     }
 
     return nNumberFormatKey;
diff --git a/chart2/source/view/main/ChartView.cxx 
b/chart2/source/view/main/ChartView.cxx
index a29c174..9142b3e 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1877,7 +1877,9 @@ sal_Int32 
ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
     }
     catch ( const beans::UnknownPropertyException& ) {}
 
-    if (bLinkToSource || 
!(xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nFormat))
+    xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nFormat;
+    sal_Int32 nOldFormat = nFormat;
+    if (bLinkToSource)
     {
         uno::Reference< chart2::XChartType > xChartType( 
DataSeriesHelper::getChartTypeOfSeries( xSeries, xDiagram ) );
 
@@ -1903,7 +1905,7 @@ sal_Int32 
ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
             }
         }
 
-        if (nFormat >= 0)
+        if (nFormat >= 0 && nOldFormat != nFormat)
             xSeriesOrPointProp->setPropertyValue(CHART_UNONAME_NUMFMT, 
uno::makeAny(nFormat));
     }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to