chart2/source/model/template/ChartTypeTemplate.cxx | 10 ++++------ chart2/source/tools/AxisHelper.cxx | 11 ++++++++++- chart2/source/view/main/ChartView.cxx | 13 ++++++++++++- 3 files changed, 26 insertions(+), 8 deletions(-)
New commits: commit c4f46b2816320f415b970b182cad1f0bbb017be3 Author: Kohei Yoshida <[email protected]> Date: Tue Jun 17 18:43:48 2014 -0400 Get the linked number format feature to work again... Now we have to query the linked number format property flag explicitly rather than just relying on whether or not the number format is set. Change-Id: Ic9a35a252f3b8a4e9a2eaeb7459419a927c1b52f diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index 95bbb4b..3b742be 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -458,9 +458,8 @@ void SAL_CALL ChartTypeTemplate::resetStyles( const Reference< chart2::XDiagram if( xAxisProp.is()) { // set number format to source format - uno::Any aValue = xAxisProp->getPropertyValue(CHART_UNONAME_NUMFMT); - if( aValue.hasValue()) - xAxisProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any()); + xAxisProp->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, uno::makeAny(true)); + xAxisProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any()); } } } @@ -758,9 +757,8 @@ void ChartTypeTemplate::adaptAxes( if( xAxisProp.is()) { // set number format to source format - uno::Any aValue = xAxisProp->getPropertyValue(CHART_UNONAME_NUMFMT); - if( aValue.hasValue()) - xAxisProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any()); + xAxisProp->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, uno::makeAny(true)); + xAxisProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any()); } } } diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 48a3a72..c6ba570 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -143,7 +143,13 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( Reference< chart2::XChartDocument > xChartDoc( xNumberFormatsSupplier, uno::UNO_QUERY ); Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY ); - if( xProp.is() && !( xProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormatKey ) ) + if (!xProp.is()) + return 0; + + bool bLinkToSource = true; + xProp->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkToSource; + + if (bLinkToSource || !(xProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormatKey)) { bool bFormatSet = false; //check whether we have a percent scale -> use percent format @@ -316,7 +322,10 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( } } } + + 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 4d4c3c8..a29c174 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1870,7 +1870,14 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( if( !xSeriesOrPointProp.is() ) return nFormat; - if (!(xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nFormat)) + bool bLinkToSource = true; + try + { + xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkToSource; + } + catch ( const beans::UnknownPropertyException& ) {} + + if (bLinkToSource || !(xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nFormat)) { uno::Reference< chart2::XChartType > xChartType( DataSeriesHelper::getChartTypeOfSeries( xSeries, xDiagram ) ); @@ -1895,7 +1902,11 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( nFormat = xValues->getNumberFormatKeyByIndex( nPointIndex ); } } + + if (nFormat >= 0) + xSeriesOrPointProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::makeAny(nFormat)); } + if(nFormat<0) nFormat=0; return nFormat; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
