chart2/source/view/axes/VCartesianAxis.cxx         |   21 ++++++---------------
 chart2/source/view/charttypes/AreaChart.cxx        |    4 ++--
 chart2/source/view/charttypes/BarChart.cxx         |    6 +++---
 chart2/source/view/charttypes/BubbleChart.cxx      |    2 +-
 chart2/source/view/charttypes/CandleStickChart.cxx |    9 ++++-----
 chart2/source/view/charttypes/NetChart.cxx         |    4 ++--
 chart2/source/view/charttypes/PieChart.cxx         |    2 +-
 chart2/source/view/charttypes/VSeriesPlotter.cxx   |    9 ++++-----
 chart2/source/view/diagram/VDiagram.cxx            |    3 +--
 chart2/source/view/inc/VSeriesPlotter.hxx          |    2 +-
 chart2/source/view/main/ShapeFactory.cxx           |    7 +++----
 chart2/source/view/main/VLegendSymbolFactory.cxx   |    2 +-
 12 files changed, 29 insertions(+), 42 deletions(-)

New commits:
commit 5f41e5741fa3abe59dd14a50e692d425eed472d5
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sun Jan 2 14:51:28 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Jan 3 07:46:26 2022 +0100

    use more SvxShape in chart2
    
    Change-Id: I7fb23da1ad60d07ac8c3165f70dafefcfaf5ab8e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127872
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/source/view/axes/VCartesianAxis.cxx 
b/chart2/source/view/axes/VCartesianAxis.cxx
index 00020d1f0413..5910a0c73ab3 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -73,27 +73,22 @@ VCartesianAxis::~VCartesianAxis()
     m_pPosHelper = nullptr;
 }
 
-static void lcl_ResizeTextShapeToFitAvailableSpace( SvxShape& xShape2DText,
+static void lcl_ResizeTextShapeToFitAvailableSpace( SvxShapeText& rShape2DText,
                                              const AxisLabelProperties& 
rAxisLabelProperties,
                                              const OUString& rLabel,
                                              const tNameSequence& rPropNames,
                                              const tAnySequence& rPropValues,
                                              const bool bIsHorizontalAxis )
 {
-    uno::Reference< text::XTextRange > xTextRange( xShape2DText, 
uno::UNO_QUERY );
-
-    if( !xTextRange.is() )
-        return;
-
     const sal_Int32 nFullSize = bIsHorizontalAxis ? 
rAxisLabelProperties.m_aFontReferenceSize.Height : 
rAxisLabelProperties.m_aFontReferenceSize.Width;
 
     if( !nFullSize || !rLabel.getLength() )
         return;
 
     sal_Int32 nMaxLabelsSize = bIsHorizontalAxis ? 
rAxisLabelProperties.m_aMaximumSpaceForLabels.Height : 
rAxisLabelProperties.m_aMaximumSpaceForLabels.Width;
-    const sal_Int32 nAvgCharWidth = xShape2DText.getSize().Width / 
rLabel.getLength();
-    const sal_Int32 nTextSize = bIsHorizontalAxis ? 
ShapeFactory::getSizeAfterRotation(xShape2DText, 
rAxisLabelProperties.fRotationAngleDegree).Height :
-                                                    
ShapeFactory::getSizeAfterRotation(xShape2DText, 
rAxisLabelProperties.fRotationAngleDegree).Width;
+    const sal_Int32 nAvgCharWidth = rShape2DText.getSize().Width / 
rLabel.getLength();
+    const sal_Int32 nTextSize = bIsHorizontalAxis ? 
ShapeFactory::getSizeAfterRotation(rShape2DText, 
rAxisLabelProperties.fRotationAngleDegree).Height :
+                                                    
ShapeFactory::getSizeAfterRotation(rShape2DText, 
rAxisLabelProperties.fRotationAngleDegree).Width;
 
     if( !nAvgCharWidth )
         return;
@@ -112,13 +107,9 @@ static void lcl_ResizeTextShapeToFitAvailableSpace( 
SvxShape& xShape2DText,
     OUString aNewLabel = rLabel.copy( 0, nNewLen );
     if( nNewLen > sDots.getLength() )
         aNewLabel += sDots;
-    xTextRange->setString( aNewLabel );
+    rShape2DText.setString( aNewLabel );
 
-    uno::Reference< beans::XPropertySet > xProp( xTextRange, uno::UNO_QUERY );
-    if( xProp.is() )
-    {
-        PropertyMapper::setMultiProperties( rPropNames, rPropValues, xProp );
-    }
+    PropertyMapper::setMultiProperties( rPropNames, rPropValues, rShape2DText 
);
 }
 
 static rtl::Reference<SvxShapeText> createSingleLabel(
diff --git a/chart2/source/view/charttypes/AreaChart.cxx 
b/chart2/source/view/charttypes/AreaChart.cxx
index 46c271bc6e7c..d80a78d7f03f 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
+        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
+    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 f7211e857dd3..285329033931 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() );
+        setMappedProperties( *xShape, xObjectProperties, 
PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
     return xShape;
 }
 
@@ -854,7 +854,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() );
+                                setMappedProperties( *xShape, 
xDataPointProperties, 
PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
                             }
 
                             if(bHasFillColorMapping)
@@ -956,7 +956,7 @@ void BarChart::createShapes()
                         getSeriesGroupShape(pSeries.get(), xSeriesTarget) );
                     rtl::Reference<SvxShapePolyPolygon> xShape( 
ShapeFactory::createLine2D(
                         xSeriesGroupShape_Shapes, PolyToPointSequence( aPoly ) 
) );
-                    setMappedProperties( xShape, 
pSeries->getPropertiesOfSeries()
+                    setMappedProperties( *xShape, 
pSeries->getPropertiesOfSeries()
                         , 
PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
                 }
             }
diff --git a/chart2/source/view/charttypes/BubbleChart.cxx 
b/chart2/source/view/charttypes/BubbleChart.cxx
index afdd0c4c9594..9c9755154406 100644
--- a/chart2/source/view/charttypes/BubbleChart.cxx
+++ b/chart2/source/view/charttypes/BubbleChart.cxx
@@ -274,7 +274,7 @@ void BubbleChart::createShapes()
                         rtl::Reference<SvxShapeCircle> xShape = 
ShapeFactory::createCircle2D( xPointGroupShape_Shapes
                                 , aScenePosition, aSymbolSize );
 
-                        setMappedProperties( xShape
+                        setMappedProperties( *xShape
                                 , pSeries->getPropertiesOfPoint( nIndex )
                                 , 
PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
 
diff --git a/chart2/source/view/charttypes/CandleStickChart.cxx 
b/chart2/source/view/charttypes/CandleStickChart.cxx
index 8f270e3dec07..cc34aac023e7 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() );
+                        setMappedProperties( *xShape, xPointProp, 
PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
                     }
 
                     //create first-last shape
@@ -244,11 +244,10 @@ void CandleStickChart::createShapes()
                                     aAWTSize, Position3DToAWTPoint( 
aPosLeftFirst ),
                                     aNames, aValues);
 
-                        uno::Reference< beans::XPropertySet > xProp( 
static_cast<cppu::OWeakObject*>(xShape.get()), uno::UNO_QUERY_THROW );
                         if(bBlack)
-                            PropertyMapper::setMultiProperties( 
aBlackBox_Names, aBlackBox_Values, xProp );
+                            PropertyMapper::setMultiProperties( 
aBlackBox_Names, aBlackBox_Values, *xShape );
                         else
-                            PropertyMapper::setMultiProperties( 
aWhiteBox_Names, aWhiteBox_Values, xProp );
+                            PropertyMapper::setMultiProperties( 
aWhiteBox_Names, aWhiteBox_Values, *xShape );
                     }
                     else
                     {
@@ -273,7 +272,7 @@ void CandleStickChart::createShapes()
                             rtl::Reference<SvxShapePolyPolygon> xShape =
                                 ShapeFactory::createLine2D( 
xPointGroupShape_Shapes,
                                         PolyToPointSequence(aPoly) );
-                            setMappedProperties( xShape, xPointProp, 
PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
+                            setMappedProperties( *xShape, xPointProp, 
PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
                         }
                     }
 
diff --git a/chart2/source/view/charttypes/NetChart.cxx 
b/chart2/source/view/charttypes/NetChart.cxx
index aeb1e4018ac2..e721d158e17b 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
+        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
+    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 ffa7a6a20685..2a60740a75ff 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -281,7 +281,7 @@ rtl::Reference<SvxShape> PieChart::createDataPoint(
             , rParam.mfUnitCircleInnerRadius, rParam.mfUnitCircleOuterRadius
             , aOffset, B3DHomMatrixToHomogenMatrix( 
m_pPosHelper->getUnitCartesianToScene() ) );
     }
-    setMappedProperties( xShape, xObjectProperties, 
PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), 
pOverwritePropertiesMap );
+    setMappedProperties( *xShape, xObjectProperties, 
PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), 
pOverwritePropertiesMap );
     return xShape;
 }
 
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx 
b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index f4dd9990ea97..d6d71f2836d9 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -1083,7 +1083,7 @@ void VSeriesPlotter::createErrorBar(
         }
 
         rtl::Reference<SvxShapePolyPolygon> xShape = 
ShapeFactory::createLine2D( xTarget, PolyToPointSequence( aPoly) );
-        setMappedProperties( xShape, xErrorBarProperties, 
PropertyMapper::getPropertyNameMapForLineProperties() );
+        setMappedProperties( *xShape, xErrorBarProperties, 
PropertyMapper::getPropertyNameMapForLineProperties() );
     }
     catch( const uno::Exception & )
     {
@@ -1104,7 +1104,7 @@ void VSeriesPlotter::addErrorBorder(
     AddPointToPoly( aPoly, rPos1, nSequenceIndex );
     rtl::Reference<SvxShapePolyPolygon> xShape = ShapeFactory::createLine2D(
                     rTarget, PolyToPointSequence( aPoly) );
-    setMappedProperties( xShape, rErrorBorderProp,
+    setMappedProperties( *xShape, rErrorBorderProp,
                     PropertyMapper::getPropertyNameMapForLineProperties() );
 }
 
@@ -1611,13 +1611,12 @@ void 
VSeriesPlotter::createRegressionCurveEquationShapes(
 }
 
 void VSeriesPlotter::setMappedProperties(
-          const uno::Reference< drawing::XShape >& xTargetShape
+          SvxShape& rTargetShape
         , const uno::Reference< beans::XPropertySet >& xSource
         , const tPropertyNameMap& rMap
         , tPropertyNameValueMap const * pOverwriteMap )
 {
-    uno::Reference< beans::XPropertySet > xTargetProp( xTargetShape, 
uno::UNO_QUERY );
-    
PropertyMapper::setMappedProperties(xTargetProp,xSource,rMap,pOverwriteMap);
+    
PropertyMapper::setMappedProperties(rTargetShape,xSource,rMap,pOverwriteMap);
 }
 
 void VSeriesPlotter::setTimeResolutionOnXAxis( tools::Long TimeResolution, 
const Date& rNullDate )
diff --git a/chart2/source/view/diagram/VDiagram.cxx 
b/chart2/source/view/diagram/VDiagram.cxx
index cbeff2dd6586..a4296c3ff331 100644
--- a/chart2/source/view/diagram/VDiagram.cxx
+++ b/chart2/source/view/diagram/VDiagram.cxx
@@ -159,7 +159,6 @@ void VDiagram::createShapes_2d()
     {
         m_xWall2D = ShapeFactory::createRectangle( xGroupForWall );
 
-        uno::Reference< beans::XPropertySet > xProp( 
static_cast<cppu::OWeakObject*>(m_xWall2D.get()), uno::UNO_QUERY_THROW );
         try
         {
             OSL_ENSURE( m_xDiagram.is(), "Invalid Diagram model" );
@@ -167,7 +166,7 @@ void VDiagram::createShapes_2d()
             {
                 uno::Reference< beans::XPropertySet > xWallProp( 
m_xDiagram->getWall());
                 if( xWallProp.is())
-                    PropertyMapper::setMappedProperties( xProp, xWallProp, 
PropertyMapper::getPropertyNameMapForFillAndLineProperties() );
+                    PropertyMapper::setMappedProperties( *m_xWall2D, 
xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties() );
             }
             if( !bAddFloorAndWall )
             {
diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx 
b/chart2/source/view/inc/VSeriesPlotter.hxx
index 311e1d7a1813..d80d248a3c70 100644
--- a/chart2/source/view/inc/VSeriesPlotter.hxx
+++ b/chart2/source/view/inc/VSeriesPlotter.hxx
@@ -394,7 +394,7 @@ protected:
         , css::awt::Point aDefaultPos );
 
     static void setMappedProperties(
-          const css::uno::Reference< css::drawing::XShape >& xTarget
+          SvxShape& rTarget
         , const css::uno::Reference< css::beans::XPropertySet >& xSource
         , const tPropertyNameMap& rMap
         , tPropertyNameValueMap const * pOverwriteMap=nullptr );
diff --git a/chart2/source/view/main/ShapeFactory.cxx 
b/chart2/source/view/main/ShapeFactory.cxx
index 24d58da73e26..45c63c425646 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -388,7 +388,7 @@ rtl::Reference<Svx3DExtrudeObject>
     }
     rtl::Reference<Svx3DExtrudeObject> xShape = impl_createCube( xTarget, 
rPosition, rSize, nRotateZAngleHundredthDegree, bRounded );
     if( xSourceProp.is())
-        PropertyMapper::setMappedProperties( xShape, xSourceProp, 
rPropertyNameMap );
+        PropertyMapper::setMappedProperties( *xShape, xSourceProp, 
rPropertyNameMap );
     return xShape;
 }
 
@@ -1017,7 +1017,7 @@ rtl::Reference<Svx3DPolygonObject>
 
         if (xSourceProp)
         {
-            PropertyMapper::setMappedProperties(xShape, xSourceProp, 
rPropertyNameMap);
+            PropertyMapper::setMappedProperties(*xShape, xSourceProp, 
rPropertyNameMap);
         }
     }
     catch( const uno::Exception& )
@@ -2018,8 +2018,7 @@ rtl::Reference<SvxShapeRect> 
ShapeFactory::createRectangle(
 
     xShape->setPosition( rPosition );
     xShape->setSize( rSize );
-    uno::Reference< beans::XPropertySet > xPropSet( 
static_cast<cppu::OWeakObject*>(xShape.get()), uno::UNO_QUERY_THROW );
-    PropertyMapper::setMultiProperties( rPropNames, rPropValues, xPropSet );
+    PropertyMapper::setMultiProperties( rPropNames, rPropValues, *xShape );
 
     return xShape;
 }
diff --git a/chart2/source/view/main/VLegendSymbolFactory.cxx 
b/chart2/source/view/main/VLegendSymbolFactory.cxx
index 91415f66d008..d70a5e09af1d 100644
--- a/chart2/source/view/main/VLegendSymbolFactory.cxx
+++ b/chart2/source/view/main/VLegendSymbolFactory.cxx
@@ -82,7 +82,7 @@ void lcl_setPropertiesToShape(
     getPropNamesAndValues( xProp, aPropNames, aPropValues,
             ePropertyType, aMaxSymbolExtent );
 
-    ::chart::PropertyMapper::setMultiProperties( aPropNames, aPropValues, 
xShape );
+    ::chart::PropertyMapper::setMultiProperties( aPropNames, aPropValues, 
*xShape );
 }
 
 } // anonymous namespace

Reply via email to