diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-01-04 12:54:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-04 14:41:28 +0100 |
commit | 3e9786b4dcbf342aab469940710e8a01be62d694 (patch) | |
tree | 1f7c397bd556e1ab8fef501cbf2c51849e97025c | |
parent | 971b029308c527737d4085559e91fa8495b93d9c (diff) |
drop the OverwriteMap stuff in chart2
as a step towards setting properties directly on SdrObject
Change-Id: Ia05487408eeb97598742e7ceb94834095e7dff1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127936
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | chart2/source/view/charttypes/AreaChart.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/charttypes/BarChart.cxx | 6 | ||||
-rw-r--r-- | chart2/source/view/charttypes/BubbleChart.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/CandleStickChart.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/charttypes/NetChart.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/charttypes/PieChart.cxx | 20 | ||||
-rw-r--r-- | chart2/source/view/charttypes/PieChart.hxx | 1 | ||||
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 13 | ||||
-rw-r--r-- | chart2/source/view/inc/PropertyMapper.hxx | 6 | ||||
-rw-r--r-- | chart2/source/view/inc/VSeriesPlotter.hxx | 6 | ||||
-rw-r--r-- | chart2/source/view/main/PropertyMapper.cxx | 38 |
11 files changed, 25 insertions, 79 deletions
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index a07d175f9c52..3972aba068fd 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -436,7 +436,7 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries { xShape = ShapeFactory::createLine2D( xSeriesGroupShape_Shapes , PolyToPointSequence( aPoly ) ); - setMappedProperties( *xShape + PropertyMapper::setMappedProperties( *xShape , pSeries->getPropertiesOfSeries() , PropertyMapper::getPropertyNameMapForLineSeriesProperties() ); //because of this name this line will be used for marking @@ -512,7 +512,7 @@ bool AreaChart::impl_createArea( VDataSeries* pSeries xShape = ShapeFactory::createArea2D( xSeriesGroupShape_Shapes , aPoly ); } - setMappedProperties( *xShape + PropertyMapper::setMappedProperties( *xShape , pSeries->getPropertiesOfSeries() , PropertyMapper::getPropertyNameMapForFilledSeriesProperties() ); //because of this name this line will be used for marking diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx index 314149f21bcf..5fcd1bfc4203 100644 --- a/chart2/source/view/charttypes/BarChart.cxx +++ b/chart2/source/view/charttypes/BarChart.cxx @@ -340,7 +340,7 @@ rtl::Reference< SvxShape > BarChart::createDataPoint3D_Bar( return xShape; } if( nGeometry3D != DataPointGeometry3D::PYRAMID ) - setMappedProperties( *xShape, xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() ); + PropertyMapper::setMappedProperties( *xShape, xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() ); return xShape; } @@ -845,7 +845,7 @@ void BarChart::createShapes() AddPointToPoly( aPoly, drawing::Position3D( fLogicX-fLogicBarWidth/2.0,fLowerYValue,fLogicZ) ); pPosHelper->transformScaledLogicToScene( aPoly ); xShape = ShapeFactory::createArea2D( xSeriesGroupShape_Shapes, aPoly ); - setMappedProperties( *xShape, xDataPointProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() ); + PropertyMapper::setMappedProperties( *xShape, xDataPointProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() ); } if(bHasFillColorMapping) @@ -947,7 +947,7 @@ void BarChart::createShapes() getSeriesGroupShape(pSeries.get(), xSeriesTarget) ); rtl::Reference<SvxShapePolyPolygon> xShape( ShapeFactory::createLine2D( xSeriesGroupShape_Shapes, PolyToPointSequence( aPoly ) ) ); - setMappedProperties( *xShape, pSeries->getPropertiesOfSeries() + PropertyMapper::setMappedProperties( *xShape, pSeries->getPropertiesOfSeries() , PropertyMapper::getPropertyNameMapForFilledSeriesProperties() ); } } diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx index c65010db0404..9505e091e8b8 100644 --- a/chart2/source/view/charttypes/BubbleChart.cxx +++ b/chart2/source/view/charttypes/BubbleChart.cxx @@ -273,7 +273,7 @@ void BubbleChart::createShapes() rtl::Reference<SvxShapeCircle> xShape = ShapeFactory::createCircle2D( xPointGroupShape_Shapes , aScenePosition, aSymbolSize ); - setMappedProperties( *xShape + PropertyMapper::setMappedProperties( *xShape , pSeries->getPropertiesOfPoint( nIndex ) , PropertyMapper::getPropertyNameMapForFilledSeriesProperties() ); diff --git a/chart2/source/view/charttypes/CandleStickChart.cxx b/chart2/source/view/charttypes/CandleStickChart.cxx index 6aed1d7ca3c2..3138c5611c5d 100644 --- a/chart2/source/view/charttypes/CandleStickChart.cxx +++ b/chart2/source/view/charttypes/CandleStickChart.cxx @@ -224,7 +224,7 @@ void CandleStickChart::createShapes() rtl::Reference<SvxShapePolyPolygon> xShape = ShapeFactory::createLine2D( xPointGroupShape_Shapes, PolyToPointSequence(aPoly)); - setMappedProperties( *xShape, xPointProp, PropertyMapper::getPropertyNameMapForLineSeriesProperties() ); + PropertyMapper::setMappedProperties( *xShape, xPointProp, PropertyMapper::getPropertyNameMapForLineSeriesProperties() ); } //create first-last shape @@ -272,7 +272,7 @@ void CandleStickChart::createShapes() rtl::Reference<SvxShapePolyPolygon> xShape = ShapeFactory::createLine2D( xPointGroupShape_Shapes, PolyToPointSequence(aPoly) ); - setMappedProperties( *xShape, xPointProp, PropertyMapper::getPropertyNameMapForLineSeriesProperties() ); + PropertyMapper::setMappedProperties( *xShape, xPointProp, PropertyMapper::getPropertyNameMapForLineSeriesProperties() ); } } diff --git a/chart2/source/view/charttypes/NetChart.cxx b/chart2/source/view/charttypes/NetChart.cxx index a1553a18e344..cf99d3ab0dae 100644 --- a/chart2/source/view/charttypes/NetChart.cxx +++ b/chart2/source/view/charttypes/NetChart.cxx @@ -154,7 +154,7 @@ bool NetChart::impl_createLine( VDataSeries* pSeries { xShape = ShapeFactory::createLine2D( xSeriesGroupShape_Shapes , PolyToPointSequence( aPoly ) ); - setMappedProperties( *xShape + PropertyMapper::setMappedProperties( *xShape , pSeries->getPropertiesOfSeries() , PropertyMapper::getPropertyNameMapForLineSeriesProperties() ); //because of this name this line will be used for marking @@ -225,7 +225,7 @@ bool NetChart::impl_createArea( VDataSeries* pSeries rtl::Reference<SvxShapePolyPolygon> xShape = ShapeFactory::createArea2D( xSeriesGroupShape_Shapes , aPoly ); - setMappedProperties( *xShape + PropertyMapper::setMappedProperties( *xShape , pSeries->getPropertiesOfSeries() , PropertyMapper::getPropertyNameMapForFilledSeriesProperties() ); //because of this name this line will be used for marking diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index d2d13c4a7564..2fd709500d29 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -250,7 +250,6 @@ bool PieChart::shouldSnapRectToUsedArea() rtl::Reference<SvxShape> PieChart::createDataPoint( const rtl::Reference<SvxShapeGroupAnyD>& xTarget, const uno::Reference<beans::XPropertySet>& xObjectProperties, - tPropertyNameValueMap const * pOverwritePropertiesMap, const ShapeParam& rParam ) { //transform position: @@ -281,7 +280,7 @@ rtl::Reference<SvxShape> PieChart::createDataPoint( , rParam.mfUnitCircleInnerRadius, rParam.mfUnitCircleOuterRadius , aOffset, B3DHomMatrixToHomogenMatrix( m_pPosHelper->getUnitCartesianToScene() ) ); } - setMappedProperties( *xShape, xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), pOverwritePropertiesMap ); + PropertyMapper::setMappedProperties( *xShape, xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() ); return xShape; } @@ -816,20 +815,19 @@ void PieChart::createShapes() aParam.mfUnitCircleInnerRadius = m_pPosHelper->transformToRadius( fLogicInnerRadius ); aParam.mfUnitCircleOuterRadius = m_pPosHelper->transformToRadius( fLogicOuterRadius ); + ///create data point + aParam.mfLogicZ = -1.0; // For 3D pie chart label position + rtl::Reference<SvxShape> xPointShape = + createDataPoint( + xSeriesGroupShape_Shapes, xPointProperties, aParam); + ///point color: - std::unique_ptr< tPropertyNameValueMap > apOverwritePropertiesMap; if (!pSeries->hasPointOwnColor(nPointIndex) && m_xColorScheme.is()) { - apOverwritePropertiesMap.reset( new tPropertyNameValueMap ); - (*apOverwritePropertiesMap)["FillColor"] <<= - m_xColorScheme->getColorByIndex( nPointIndex ); + xPointShape->setPropertyValue("FillColor", + uno::Any(m_xColorScheme->getColorByIndex( nPointIndex ))); } - ///create data point - aParam.mfLogicZ = -1.0; // For 3D pie chart label position - rtl::Reference<SvxShape> xPointShape = - createDataPoint( - xSeriesGroupShape_Shapes, xPointProperties, apOverwritePropertiesMap.get(), aParam); if(bHasFillColorMapping) { diff --git a/chart2/source/view/charttypes/PieChart.hxx b/chart2/source/view/charttypes/PieChart.hxx index 2f57b118b089..5bd25eed53e6 100644 --- a/chart2/source/view/charttypes/PieChart.hxx +++ b/chart2/source/view/charttypes/PieChart.hxx @@ -67,7 +67,6 @@ private: //methods createDataPoint( const rtl::Reference<SvxShapeGroupAnyD>& xTarget, const css::uno::Reference<css::beans::XPropertySet>& xObjectProperties, - tPropertyNameValueMap const * pOverWritePropertiesMap, const ShapeParam& rParam ); /** This method creates a text shape for a label of a data point. diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 3605a6829493..bb3ecd8037eb 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -1073,7 +1073,7 @@ void VSeriesPlotter::createErrorBar( } rtl::Reference<SvxShapePolyPolygon> xShape = ShapeFactory::createLine2D( xTarget, PolyToPointSequence( aPoly) ); - setMappedProperties( *xShape, xErrorBarProperties, PropertyMapper::getPropertyNameMapForLineProperties() ); + PropertyMapper::setMappedProperties( *xShape, xErrorBarProperties, PropertyMapper::getPropertyNameMapForLineProperties() ); } catch( const uno::Exception & ) { @@ -1094,7 +1094,7 @@ void VSeriesPlotter::addErrorBorder( AddPointToPoly( aPoly, rPos1, nSequenceIndex ); rtl::Reference<SvxShapePolyPolygon> xShape = ShapeFactory::createLine2D( rTarget, PolyToPointSequence( aPoly) ); - setMappedProperties( *xShape, rErrorBorderProp, + PropertyMapper::setMappedProperties( *xShape, rErrorBorderProp, PropertyMapper::getPropertyNameMapForLineProperties() ); } @@ -1600,15 +1600,6 @@ void VSeriesPlotter::createRegressionCurveEquationShapes( } } -void VSeriesPlotter::setMappedProperties( - SvxShape& rTargetShape - , const uno::Reference< beans::XPropertySet >& xSource - , const tPropertyNameMap& rMap - , tPropertyNameValueMap const * pOverwriteMap ) -{ - PropertyMapper::setMappedProperties(rTargetShape,xSource,rMap,pOverwriteMap); -} - void VSeriesPlotter::setTimeResolutionOnXAxis( tools::Long TimeResolution, const Date& rNullDate ) { m_nTimeResolution = TimeResolution; diff --git a/chart2/source/view/inc/PropertyMapper.hxx b/chart2/source/view/inc/PropertyMapper.hxx index 73e50fab1769..0d208094ee8e 100644 --- a/chart2/source/view/inc/PropertyMapper.hxx +++ b/chart2/source/view/inc/PropertyMapper.hxx @@ -48,14 +48,12 @@ public: static void setMappedProperties( const css::uno::Reference< css::beans::XPropertySet >& xTarget , const css::uno::Reference< css::beans::XPropertySet >& xSource - , const tPropertyNameMap& rMap - , tPropertyNameValueMap const * pOverwriteMap=nullptr ); + , const tPropertyNameMap& rMap ); static void setMappedProperties( SvxShape& xTarget , const css::uno::Reference< css::beans::XPropertySet >& xSource - , const tPropertyNameMap& rMap - , tPropertyNameValueMap const * pOverwriteMap=nullptr ); + , const tPropertyNameMap& rMap ); /** * Fetch property values from the source object and map it to the diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index a19050a5540a..cc92aa969dda 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -389,12 +389,6 @@ protected: , const css::uno::Reference< css::chart2::XRegressionCurveCalculator > & xRegressionCurveCalculator , css::awt::Point aDefaultPos ); - static void setMappedProperties( - SvxShape& rTarget - , const css::uno::Reference< css::beans::XPropertySet >& xSource - , const tPropertyNameMap& rMap - , tPropertyNameValueMap const * pOverwriteMap=nullptr ); - virtual PlottingPositionHelper& getPlottingPositionHelper( sal_Int32 nAxisIndex ) const;//nAxisIndex indicates whether the position belongs to the main axis ( nAxisIndex==0 ) or secondary axis ( nAxisIndex==1 ) VDataSeries* getFirstSeries() const; diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx index 6d6df42303c0..6f78cad7815a 100644 --- a/chart2/source/view/main/PropertyMapper.cxx +++ b/chart2/source/view/main/PropertyMapper.cxx @@ -34,23 +34,10 @@ namespace chart { using namespace ::com::sun::star; -namespace -{ - -void lcl_overwriteOrAppendValues( - tPropertyNameValueMap &rMap, const tPropertyNameValueMap& rOverwriteMap ) -{ - for (auto const& elem : rOverwriteMap) - rMap[ elem.first ] = elem.second; -} - -} // anonymous namespace - void PropertyMapper::setMappedProperties( SvxShape& xTarget , const uno::Reference< beans::XPropertySet >& xSource - , const tPropertyNameMap& rMap - , tPropertyNameValueMap const * pOverwriteMap ) + , const tPropertyNameMap& rMap ) { if( !xSource.is() ) return; @@ -58,24 +45,13 @@ void PropertyMapper::setMappedProperties( tNameSequence aNames; tAnySequence aValues; getMultiPropertyLists(aNames, aValues, xSource, rMap ); - if(pOverwriteMap && (aNames.getLength() == aValues.getLength())) - { - tPropertyNameValueMap aNewMap; - for( sal_Int32 nI=0; nI<aNames.getLength(); ++nI ) - aNewMap[ aNames[nI] ] = aValues[nI]; - lcl_overwriteOrAppendValues( aNewMap, *pOverwriteMap ); - aNames = comphelper::mapKeysToSequence( aNewMap ); - aValues = comphelper::mapValuesToSequence( aNewMap ); - } - PropertyMapper::setMultiProperties( aNames, aValues, xTarget ); } void PropertyMapper::setMappedProperties( const uno::Reference< beans::XPropertySet >& xTarget , const uno::Reference< beans::XPropertySet >& xSource - , const tPropertyNameMap& rMap - , tPropertyNameValueMap const * pOverwriteMap ) + , const tPropertyNameMap& rMap ) { if( !xTarget.is() || !xSource.is() ) return; @@ -83,16 +59,6 @@ void PropertyMapper::setMappedProperties( tNameSequence aNames; tAnySequence aValues; getMultiPropertyLists(aNames, aValues, xSource, rMap ); - if(pOverwriteMap && (aNames.getLength() == aValues.getLength())) - { - tPropertyNameValueMap aNewMap; - for( sal_Int32 nI=0; nI<aNames.getLength(); ++nI ) - aNewMap[ aNames[nI] ] = aValues[nI]; - lcl_overwriteOrAppendValues( aNewMap, *pOverwriteMap ); - aNames = comphelper::mapKeysToSequence( aNewMap ); - aValues = comphelper::mapValuesToSequence( aNewMap ); - } - PropertyMapper::setMultiProperties( aNames, aValues, xTarget ); } |