diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-06-17 19:37:20 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-06-19 11:11:50 -0400 |
commit | 146c9e0154e1b42c5963a0e16d325d0bb131283f (patch) | |
tree | d45e5e99e7236dda04c10b321c6afbf2efa88f9d | |
parent | eb7f88bf9becf96cf2370b558e7c21ba71371af0 (diff) |
Set the number format code only when it changes.
Otherwise the chart view would keep updating itself endlessly.
Change-Id: I653ae396a48dd0fdcaa3ef308657509dac541594
-rw-r--r-- | chart2/source/tools/AxisHelper.cxx | 8 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index c6ba57038a94..acc757071ff6 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 a29c174cebc8..9142b3e6e617 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)); } |