From d005413c2e3d1a22a6560cea504aba6f011794e0 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sun, 22 Jun 2014 03:11:35 +0200 Subject: don't try to set property mapping if there is no value Change-Id: I422d651e303553e2ce30895b44b8d96664418c19 --- chart2/source/view/charttypes/BarChart.cxx | 9 ++++++--- chart2/source/view/charttypes/BubbleChart.cxx | 18 ++++++++++++------ chart2/source/view/charttypes/GL3DBarChart.cxx | 4 +++- chart2/source/view/charttypes/PieChart.cxx | 9 ++++++--- chart2/source/view/main/VDataSeries.cxx | 2 +- 5 files changed, 28 insertions(+), 14 deletions(-) (limited to 'chart2') diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx index aa53db07ac28..cf46db80b2bd 100644 --- a/chart2/source/view/charttypes/BarChart.cxx +++ b/chart2/source/view/charttypes/BarChart.cxx @@ -808,9 +808,12 @@ void BarChart::createShapes() if(bHasFillColorMapping) { - uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW ); - xProps->setPropertyValue("FillColor", uno::makeAny(static_cast( - pSeries->getValueByProperty(nPointIndex, "FillColor")))); + double nPropVal = pSeries->getValueByProperty(nPointIndex, "FillColor"); + if(!rtl::math::isNan(nPropVal)) + { + uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW ); + xProps->setPropertyValue("FillColor", uno::makeAny(static_cast(nPropVal))); + } } //set name/classified ObjectID (CID) ShapeFactory::setShapeName(xShape diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx index 991884467eea..0bf7e9fb9136 100644 --- a/chart2/source/view/charttypes/BubbleChart.cxx +++ b/chart2/source/view/charttypes/BubbleChart.cxx @@ -324,15 +324,21 @@ void BubbleChart::createShapes() if(bHasFillColorMapping) { - uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW ); - xProps->setPropertyValue("FillColor", uno::makeAny(static_cast( - pSeries->getValueByProperty(nIndex, "FillColor")))); + double nPropVal = pSeries->getValueByProperty(nIndex, "FillColor"); + if(!rtl::math::isNan(nPropVal)) + { + uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW ); + xProps->setPropertyValue("FillColor", uno::makeAny(static_cast(nPropVal))); + } } if(bHasBorderColorMapping) { - uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW ); - xProps->setPropertyValue("LineColor", uno::makeAny(static_cast( - pSeries->getValueByProperty(nIndex, "LineColor")))); + double nPropVal = pSeries->getValueByProperty(nIndex, "LineColor"); + if(!rtl::math::isNan(nPropVal)) + { + uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW ); + xProps->setPropertyValue("LineColor", uno::makeAny(static_cast(nPropVal))); + } } ::chart::AbstractShapeFactory::setShapeName( xShape, "MarkHandles" ); diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index d4568bdb386c..808bb90df0c1 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -169,7 +169,9 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector& rDataSer { if(bMappedFillProperty) { - nColor = static_cast(rDataSeries.getValueByProperty(nIndex, "FillColor")); + double nPropVal = rDataSeries.getValueByProperty(nIndex, "FillColor"); + if(!rtl::math::isNan(nPropVal)) + nColor = static_cast(nPropVal); } float nVal = rDataSeries.getYValue(nIndex); diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index d4636eec9879..4059c12cadce 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -436,9 +436,12 @@ void PieChart::createShapes() if(bHasFillColorMapping) { - uno::Reference< beans::XPropertySet > xProps( xPointShape, uno::UNO_QUERY_THROW ); - xProps->setPropertyValue("FillColor", uno::makeAny(static_cast( - pSeries->getValueByProperty(nPointIndex, "FillColor")))); + double nPropVal = pSeries->getValueByProperty(nPointIndex, "FillColor"); + if(!rtl::math::isNan(nPropVal)) + { + uno::Reference< beans::XPropertySet > xProps( xPointShape, uno::UNO_QUERY_THROW ); + xProps->setPropertyValue("FillColor", uno::makeAny(static_cast( nPropVal))); + } } //create label diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index bd087c70f92c..e799f2200c78 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -1065,7 +1065,7 @@ double VDataSeries::getValueByProperty( sal_Int32 nIndex, const OUString& rPropN if(itr == maPropertyMap.end()) { double fNan; - ::rtl::math::setNan( & fNan ); + ::rtl::math::setNan( &fNan ); return fNan; } -- cgit