chart2/source/view/charttypes/AreaChart.cxx      |    2 -
 chart2/source/view/charttypes/NetChart.cxx       |    2 -
 chart2/source/view/inc/ShapeFactory.hxx          |    2 -
 chart2/source/view/main/ShapeFactory.cxx         |   24 ++++++++---------------
 chart2/source/view/main/VLegendSymbolFactory.cxx |    3 --
 include/svx/unoshape.hxx                         |    2 -
 6 files changed, 14 insertions(+), 21 deletions(-)

New commits:
commit 72af8f8e8f11a74ced2dfb6c2457026550814129
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Dec 30 09:28:32 2021 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Dec 30 17:07:03 2021 +0100

    use concrete types in chart2, SvxGraphicObject
    
    Change-Id: Ia01be1d6cdb1b9a1c2af32a8873575227fe32b03
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127731
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/chart2/source/view/charttypes/AreaChart.cxx 
b/chart2/source/view/charttypes/AreaChart.cxx
index f5b39f833673..d6e97b1bdabb 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -870,7 +870,7 @@ void AreaChart::createShapes()
                                 }
                                 else if (pSymbolProperties->Style == 
SymbolStyle_GRAPHIC)
                                 {
-                                    
m_pShapeFactory->createGraphic2D(xPointGroupShape_Shapes,
+                                    
ShapeFactory::createGraphic2D(xPointGroupShape_Shapes,
                                                                      
aScenePosition, aSymbolSize,
                                                                      
pSymbolProperties->Graphic);
                                 }
diff --git a/chart2/source/view/charttypes/NetChart.cxx 
b/chart2/source/view/charttypes/NetChart.cxx
index ab82f6432dda..129ccc8feffc 100644
--- a/chart2/source/view/charttypes/NetChart.cxx
+++ b/chart2/source/view/charttypes/NetChart.cxx
@@ -551,7 +551,7 @@ void NetChart::createShapes()
                             }
                             else if (pSymbolProperties->Style == 
SymbolStyle_GRAPHIC)
                             {
-                                
m_pShapeFactory->createGraphic2D(xPointGroupShape_Shapes,
+                                
ShapeFactory::createGraphic2D(xPointGroupShape_Shapes,
                                                                  
aScenePosition, aSymbolSize,
                                                                  
pSymbolProperties->Graphic);
                             }
diff --git a/chart2/source/view/inc/ShapeFactory.hxx 
b/chart2/source/view/inc/ShapeFactory.hxx
index 0c39000b828c..698847350b3d 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -161,7 +161,7 @@ public:
                     , sal_Int32 nBorderColor
                     , sal_Int32 nFillColor );
 
-    css::uno::Reference< css::drawing::XShape >
+    static rtl::Reference<SvxGraphicObject>
         createGraphic2D( const css::uno::Reference< css::drawing::XShapes >& 
xTarget
                     , const css::drawing::Position3D& rPos
                     , const css::drawing::Direction3D& rSize
diff --git a/chart2/source/view/main/ShapeFactory.cxx 
b/chart2/source/view/main/ShapeFactory.cxx
index b1f5147875b3..fadf4edac3ab 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -1659,7 +1659,7 @@ rtl::Reference<SvxShapePolyPolygon>
     return xShape;
 }
 
-uno::Reference< drawing::XShape >
+rtl::Reference<SvxGraphicObject>
         ShapeFactory::createGraphic2D(
                       const uno::Reference< drawing::XShapes >& xTarget
                     , const drawing::Position3D& rPosition
@@ -1673,9 +1673,8 @@ uno::Reference< drawing::XShape >
     // performance reasons (ask AW, said CL)
 
     //create shape
-    uno::Reference< drawing::XShape > xShape(
-        m_xShapeFactory->createInstance(
-            "com.sun.star.drawing.GraphicObjectShape" ), uno::UNO_QUERY );
+    rtl::Reference<SvxGraphicObject> xShape = new SvxGraphicObject(nullptr);
+    xShape->setShapeKind(OBJ_GRAF);
     xTarget->add(xShape);
 
     try
@@ -1692,18 +1691,13 @@ uno::Reference< drawing::XShape >
     {
         TOOLS_WARN_EXCEPTION("chart2", "" );
     }
-    uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
-    OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
-    if( xProp.is())
+    try
     {
-        try
-        {
-            xProp->setPropertyValue( "Graphic", uno::Any( xGraphic ));
-        }
-        catch( const uno::Exception& )
-        {
-            TOOLS_WARN_EXCEPTION("chart2", "" );
-        }
+        xShape->SvxShape::setPropertyValue( "Graphic", uno::Any( xGraphic ));
+    }
+    catch( const uno::Exception& )
+    {
+        TOOLS_WARN_EXCEPTION("chart2", "" );
     }
     return xShape;
 }
diff --git a/chart2/source/view/main/VLegendSymbolFactory.cxx 
b/chart2/source/view/main/VLegendSymbolFactory.cxx
index 54bc3da664fc..b2abd2183430 100644
--- a/chart2/source/view/main/VLegendSymbolFactory.cxx
+++ b/chart2/source/view/main/VLegendSymbolFactory.cxx
@@ -134,7 +134,6 @@ rtl::Reference< SvxShapeGroup > 
VLegendSymbolFactory::createSymbol(
             {
                 drawing::Direction3D aSymbolSize( nSize, nSize, 0 );
                 drawing::Position3D aPos( rEntryKeyAspectRatio.Width/2.0, 
rEntryKeyAspectRatio.Height/2.0, 0 );
-                ShapeFactory* pFactory = 
ShapeFactory::getOrCreateShapeFactory( xShapeFactory );
                 if( aSymbol.Style == chart2::SymbolStyle_STANDARD )
                 {
                     // take series color as fill color
@@ -152,7 +151,7 @@ rtl::Reference< SvxShapeGroup > 
VLegendSymbolFactory::createSymbol(
                 }
                 else if( aSymbol.Style == chart2::SymbolStyle_GRAPHIC )
                 {
-                    xSymbol.set( pFactory->createGraphic2D(
+                    xSymbol.set( ShapeFactory::createGraphic2D(
                                      xResultGroup,
                                      aPos,
                                      aSymbolSize,
diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx
index 210885bfac28..cbc26fd98333 100644
--- a/include/svx/unoshape.hxx
+++ b/include/svx/unoshape.hxx
@@ -645,7 +645,7 @@ class SvxGraphicObject final : public SvxShapeText
     virtual bool getPropertyValueImpl( const OUString& rName, const 
SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
 
 public:
-    SvxGraphicObject(SdrObject* pObj);
+    SVXCORE_DLLPUBLIC SvxGraphicObject(SdrObject* pObj);
     virtual ~SvxGraphicObject() noexcept override;
 };
 

Reply via email to