chart2/source/view/charttypes/AreaChart.cxx      |    4 +--
 chart2/source/view/charttypes/BarChart.cxx       |    9 +++----
 chart2/source/view/charttypes/BarChart.hxx       |    2 -
 chart2/source/view/charttypes/NetChart.cxx       |    2 -
 chart2/source/view/charttypes/PieChart.cxx       |    5 +--
 chart2/source/view/charttypes/VSeriesPlotter.cxx |    6 ++--
 chart2/source/view/inc/ShapeFactory.hxx          |    3 --
 chart2/source/view/main/ShapeFactory.cxx         |   29 +++--------------------
 8 files changed, 19 insertions(+), 41 deletions(-)

New commits:
commit 5f567b9aec84283546c3084f015d01a70bd76c86
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sun Jan 2 11:29:35 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Jan 2 17:58:44 2022 +0100

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

diff --git a/chart2/source/view/charttypes/AreaChart.cxx 
b/chart2/source/view/charttypes/AreaChart.cxx
index 4d06dc41bc27..46c271bc6e7c 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -407,7 +407,7 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries
     pPosHelper->transformScaledLogicToScene( aPoly );
 
     //create line:
-    uno::Reference< drawing::XShape > xShape;
+    rtl::Reference< SvxShape > xShape;
     if(m_nDimension==3)
     {
         double fDepth = getTransformedDepth();
@@ -501,7 +501,7 @@ bool AreaChart::impl_createArea( VDataSeries* pSeries
     pPosHelper->transformScaledLogicToScene( aPoly );
 
     //create area:
-    uno::Reference< drawing::XShape > xShape;
+    rtl::Reference< SvxShape > xShape;
     if(m_nDimension==3)
     {
         xShape = ShapeFactory::createArea3D( xSeriesGroupShape_Shapes
diff --git a/chart2/source/view/charttypes/BarChart.cxx 
b/chart2/source/view/charttypes/BarChart.cxx
index f41770fb67dc..f7211e857dd3 100644
--- a/chart2/source/view/charttypes/BarChart.cxx
+++ b/chart2/source/view/charttypes/BarChart.cxx
@@ -296,7 +296,7 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment(
         .transformSceneToScreenPosition( aScenePosition3D );
 }
 
-uno::Reference< drawing::XShape > BarChart::createDataPoint3D_Bar(
+rtl::Reference< SvxShape > BarChart::createDataPoint3D_Bar(
           const uno::Reference< drawing::XShapes >& xTarget
         , const drawing::Position3D& rPosition, const drawing::Direction3D& 
rSize
         , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree
@@ -319,7 +319,7 @@ uno::Reference< drawing::XShape > 
BarChart::createDataPoint3D_Bar(
         TOOLS_WARN_EXCEPTION("chart2", "" );
     }
 
-    uno::Reference< drawing::XShape > xShape;
+    rtl::Reference< SvxShape > xShape;
     switch( nGeometry3D )
     {
         case DataPointGeometry3D::CYLINDER:
@@ -797,7 +797,7 @@ void BarChart::createShapes()
                         //create partial point
                         if( !approxEqual(fLowerYValue,fUpperYValue) )
                         {
-                            uno::Reference< drawing::XShape >  xShape;
+                            rtl::Reference< SvxShape >  xShape;
                             if( m_nDimension==3 )
                             {
                                 drawing::Position3D aLogicBottom            
(fLogicX,fLogicYStart,fLogicZ);
@@ -862,8 +862,7 @@ void BarChart::createShapes()
                                 double nPropVal = 
pSeries->getValueByProperty(nPointIndex, "FillColor");
                                 if(!std::isnan(nPropVal))
                                 {
-                                    uno::Reference< beans::XPropertySet > 
xProps( xShape, uno::UNO_QUERY_THROW );
-                                    xProps->setPropertyValue("FillColor", 
uno::Any(static_cast<sal_Int32>(nPropVal)));
+                                    xShape->setPropertyValue("FillColor", 
uno::Any(static_cast<sal_Int32>(nPropVal)));
                                 }
                             }
                             //set name/classified ObjectID (CID)
diff --git a/chart2/source/view/charttypes/BarChart.hxx 
b/chart2/source/view/charttypes/BarChart.hxx
index f5d918e7f74b..5e1ebee666d1 100644
--- a/chart2/source/view/charttypes/BarChart.hxx
+++ b/chart2/source/view/charttypes/BarChart.hxx
@@ -42,7 +42,7 @@ public:
     virtual css::drawing::Direction3D  getPreferredDiagramAspectRatio() const 
override;
 
 private: //methods
-    static css::uno::Reference< css::drawing::XShape >
+    static rtl::Reference< SvxShape >
         createDataPoint3D_Bar(
                           const css::uno::Reference< css::drawing::XShapes >& 
xTarget
                         , const css::drawing::Position3D& rPosition
diff --git a/chart2/source/view/charttypes/NetChart.cxx 
b/chart2/source/view/charttypes/NetChart.cxx
index 425898514ac7..aeb1e4018ac2 100644
--- a/chart2/source/view/charttypes/NetChart.cxx
+++ b/chart2/source/view/charttypes/NetChart.cxx
@@ -222,7 +222,7 @@ bool NetChart::impl_createArea( VDataSeries* pSeries
     pPosHelper->transformScaledLogicToScene( aPoly );
 
     //create area:
-    uno::Reference< drawing::XShape >
+    rtl::Reference<SvxShapePolyPolygon>
         xShape = ShapeFactory::createArea2D( xSeriesGroupShape_Shapes
                 , aPoly );
     setMappedProperties( xShape
diff --git a/chart2/source/view/charttypes/PieChart.cxx 
b/chart2/source/view/charttypes/PieChart.cxx
index 61ba53079ccc..ffa7a6a20685 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -828,7 +828,7 @@ void PieChart::createShapes()
 
                 ///create data point
                 aParam.mfLogicZ = -1.0; // For 3D pie chart label position
-                uno::Reference<drawing::XShape> xPointShape =
+                rtl::Reference<SvxShape> xPointShape =
                     createDataPoint(
                         xSeriesGroupShape_Shapes, xPointProperties, 
apOverwritePropertiesMap.get(), aParam);
 
@@ -837,8 +837,7 @@ void PieChart::createShapes()
                     double nPropVal = pSeries->getValueByProperty(nPointIndex, 
"FillColor");
                     if(!std::isnan(nPropVal))
                     {
-                        uno::Reference< beans::XPropertySet > xProps( 
xPointShape, uno::UNO_QUERY_THROW );
-                        xProps->setPropertyValue("FillColor", 
uno::Any(static_cast<sal_Int32>( nPropVal)));
+                        xPointShape->setPropertyValue("FillColor", 
uno::Any(static_cast<sal_Int32>( nPropVal)));
                     }
                 }
 
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx 
b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 48094a6d63b7..f4dd9990ea97 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -2724,7 +2724,7 @@ std::vector< ViewLegendEntry > 
VSeriesPlotter::createLegendEntriesForSeries(
                     OUString aChildParticle( 
ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_DATA_POINT, nIdx ) );
                     aChildParticle = ObjectIdentifier::addChildParticle( 
aChildParticle, ObjectIdentifier::createChildParticleWithIndex( 
OBJECTTYPE_LEGEND_ENTRY, 0 ) );
                     OUString aCID = 
ObjectIdentifier::createClassifiedIdentifierForParticles( 
rSeries.getSeriesParticle(), aChildParticle );
-                    ShapeFactory::setShapeName( *xShape, aCID );
+                    ShapeFactory::setShapeName( xShape, aCID );
                 }
 
                 // label
@@ -2752,7 +2752,7 @@ std::vector< ViewLegendEntry > 
VSeriesPlotter::createLegendEntriesForSeries(
 
                 OUString aChildParticle( 
ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_LEGEND_ENTRY, 0 ) );
                 OUString aCID = 
ObjectIdentifier::createClassifiedIdentifierForParticles( 
rSeries.getSeriesParticle(), aChildParticle );
-                ShapeFactory::setShapeName( *xShape, aCID );
+                ShapeFactory::setShapeName( xShape, aCID );
             }
 
             // label
@@ -2800,7 +2800,7 @@ std::vector< ViewLegendEntry > 
VSeriesPlotter::createLegendEntriesForSeries(
                         OUString aChildParticle( 
ObjectIdentifier::createChildParticleWithIndex( eObjectType, i ) );
                         aChildParticle = ObjectIdentifier::addChildParticle( 
aChildParticle, ObjectIdentifier::createChildParticleWithIndex( 
OBJECTTYPE_LEGEND_ENTRY, 0 ) );
                         OUString aCID = 
ObjectIdentifier::createClassifiedIdentifierForParticles( 
rSeries.getSeriesParticle(), aChildParticle );
-                        ShapeFactory::setShapeName( *xShape, aCID );
+                        ShapeFactory::setShapeName( xShape, aCID );
                     }
 
                     aResult.push_back(aEntry);
diff --git a/chart2/source/view/inc/ShapeFactory.hxx 
b/chart2/source/view/inc/ShapeFactory.hxx
index c61e6801a5ff..e42655284d65 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -243,9 +243,8 @@ public:
 
     static void makeShapeInvisible( const rtl::Reference< SvxShape >& rShape );
 
-    static void setShapeName( const css::uno::Reference< css::drawing::XShape 
>& xShape
+    static void setShapeName( const rtl::Reference< SvxShape >& xShape
             , const OUString& rName );
-    static void setShapeName( SvxShape& rShape, const OUString& rName );
 
     static OUString getShapeName( const css::uno::Reference< 
css::drawing::XShape >& xShape );
 
diff --git a/chart2/source/view/main/ShapeFactory.cxx 
b/chart2/source/view/main/ShapeFactory.cxx
index 457045a25ac5..24d58da73e26 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -97,7 +97,7 @@ uno::Reference< drawing::XShapes > 
ShapeFactory::getOrCreateChartRootShape(
     uno::Reference<drawing::XShape> 
xShape(static_cast<cppu::OWeakObject*>(xShapeGroup.get()), uno::UNO_QUERY);
     xDrawPage->addBottom(xShape);
 
-    setShapeName(xShape, "com.sun.star.chart2.shapes");
+    setShapeName(xShapeGroup, "com.sun.star.chart2.shapes");
     xShape->setSize(awt::Size(0,0));
 
     xRet.set(xShape, uno::UNO_QUERY);
@@ -1717,7 +1717,7 @@ rtl::Reference< SvxShapeGroup >
 
         //set name
         if(!aName.isEmpty())
-            setShapeName( xShape, aName );
+            setShapeName( xShapeGroup, aName );
 
         {//workaround
             //need this null size as otherwise empty group shapes where 
painted with a gray border
@@ -2350,34 +2350,15 @@ void ShapeFactory::makeShapeInvisible( const 
rtl::Reference< SvxShape >& xShape
 
 // set a name/CID at a shape (is used for selection handling)
 
-void ShapeFactory::setShapeName( const uno::Reference< drawing::XShape >& 
xShape
+void ShapeFactory::setShapeName( const rtl::Reference< SvxShape >& xShape
                                , const OUString& rName )
 {
     if(!xShape.is())
         return;
-    uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
-    OSL_ENSURE(xProp.is(), "shape offers no XPropertySet");
-    if( xProp.is())
-    {
-        try
-        {
-            xProp->setPropertyValue( UNO_NAME_MISC_OBJ_NAME
-                , uno::Any( rName ) );
-        }
-        catch( const uno::Exception& )
-        {
-            TOOLS_WARN_EXCEPTION("chart2", "" );
-        }
-    }
-}
-
-// set a name/CID at a shape (is used for selection handling)
-
-void ShapeFactory::setShapeName( SvxShape& rShape, const OUString& rName )
-{
     try
     {
-        rShape.setPropertyValue( UNO_NAME_MISC_OBJ_NAME, uno::Any( rName ) );
+        xShape->setPropertyValue( UNO_NAME_MISC_OBJ_NAME
+            , uno::Any( rName ) );
     }
     catch( const uno::Exception& )
     {

Reply via email to