chart2/source/view/axes/VCartesianGrid.cxx |    2 
 chart2/source/view/inc/ShapeFactory.hxx    |    2 
 chart2/source/view/main/ShapeFactory.cxx   |   92 +++++++++++++----------------
 3 files changed, 45 insertions(+), 51 deletions(-)

New commits:
commit a6bc44821c9da9b2e8664de391a9f2869709b88f
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Dec 30 13:12:16 2021 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Fri Dec 31 08:04:56 2021 +0100

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

diff --git a/chart2/source/view/axes/VCartesianGrid.cxx 
b/chart2/source/view/axes/VCartesianGrid.cxx
index 2201904a5307..277ad26fd625 100644
--- a/chart2/source/view/axes/VCartesianGrid.cxx
+++ b/chart2/source/view/axes/VCartesianGrid.cxx
@@ -304,7 +304,7 @@ void VCartesianGrid::createShapes()
             aPoints.SequenceX.realloc(nRealPointCount);
             aPoints.SequenceY.realloc(nRealPointCount);
             aPoints.SequenceZ.realloc(nRealPointCount);
-            m_pShapeFactory->createLine3D( xTarget, aPoints, 
aLinePropertiesList[nDepth] );
+            ShapeFactory::createLine3D( xTarget, aPoints, 
aLinePropertiesList[nDepth] );
         }
     }
 }
diff --git a/chart2/source/view/inc/ShapeFactory.hxx 
b/chart2/source/view/inc/ShapeFactory.hxx
index 7f9bde623afa..a2b91b3e83f1 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -176,7 +176,7 @@ public:
         createLine ( const css::uno::Reference< css::drawing::XShapes >& 
xTarget,
                 const css::awt::Size& rSize, const css::awt::Point& rPosition 
);
 
-    css::uno::Reference< css::drawing::XShape >
+    static rtl::Reference<Svx3DPolygonObject>
         createLine3D( const css::uno::Reference< css::drawing::XShapes >& 
xTarget
                     , const css::drawing::PolyPolygonShape3D& rPoints
                     , const VLineProperties& rLineProperties );
diff --git a/chart2/source/view/main/ShapeFactory.cxx 
b/chart2/source/view/main/ShapeFactory.cxx
index 4ee4bf704973..90019cc51de0 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -1836,7 +1836,7 @@ uno::Reference< drawing::XShape >
     return xShape;
 }
 
-uno::Reference< drawing::XShape >
+rtl::Reference<Svx3DPolygonObject>
         ShapeFactory::createLine3D( const uno::Reference< drawing::XShapes >& 
xTarget
                     , const drawing::PolyPolygonShape3D& rPoints
                     , const VLineProperties& rLineProperties )
@@ -1848,65 +1848,59 @@ uno::Reference< drawing::XShape >
         return nullptr;
 
     //create shape
-    uno::Reference< drawing::XShape > xShape(
-        m_xShapeFactory->createInstance(
-            "com.sun.star.drawing.Shape3DPolygonObject" ), uno::UNO_QUERY );
+    rtl::Reference<Svx3DPolygonObject> xShape = new 
Svx3DPolygonObject(nullptr);
+    xShape->setShapeKind(E3D_POLYGONOBJ_ID | E3D_INVENTOR_FLAG);
     xTarget->add(xShape);
 
     //set properties
-    uno::Reference<beans::XMultiPropertySet> xMultiPropertySet(xShape, 
uno::UNO_QUERY);
-    OSL_ENSURE(xMultiPropertySet.is(), "created shape offers no 
XMultiPropertySet");
-    if (xMultiPropertySet.is())
+    try
     {
-        try
-        {
-            uno::Sequence<OUString> aPropertyNames {
-                UNO_NAME_3D_POLYPOLYGON3D,
-                UNO_NAME_3D_LINEONLY
-            };
-
-            uno::Sequence<uno::Any> aPropertyValues {
-                uno::Any(rPoints),  // Polygon
-                uno::Any(true)      // LineOnly
-            };
+        uno::Sequence<OUString> aPropertyNames {
+            UNO_NAME_3D_POLYPOLYGON3D,
+            UNO_NAME_3D_LINEONLY
+        };
 
-            //Transparency
-            if(rLineProperties.Transparence.hasValue())
-            {
-                lcl_addProperty(aPropertyNames, aPropertyValues,
-                                UNO_NAME_LINETRANSPARENCE,
-                                rLineProperties.Transparence);
-            }
+        uno::Sequence<uno::Any> aPropertyValues {
+            uno::Any(rPoints),  // Polygon
+            uno::Any(true)      // LineOnly
+        };
 
-            //LineStyle
-            if(rLineProperties.LineStyle.hasValue())
-            {
-                lcl_addProperty(aPropertyNames, aPropertyValues,
-                                UNO_NAME_LINESTYLE,
-                                rLineProperties.LineStyle);
-            }
+        //Transparency
+        if(rLineProperties.Transparence.hasValue())
+        {
+            lcl_addProperty(aPropertyNames, aPropertyValues,
+                            UNO_NAME_LINETRANSPARENCE,
+                            rLineProperties.Transparence);
+        }
 
-            //LineWidth
-            if(rLineProperties.Width.hasValue())
-            {
-                lcl_addProperty(aPropertyNames, aPropertyValues,
-                                UNO_NAME_LINEWIDTH,
-                                rLineProperties.Width);
-            }
+        //LineStyle
+        if(rLineProperties.LineStyle.hasValue())
+        {
+            lcl_addProperty(aPropertyNames, aPropertyValues,
+                            UNO_NAME_LINESTYLE,
+                            rLineProperties.LineStyle);
+        }
 
-            //LineColor
-            if(rLineProperties.Color.hasValue())
-            {
-                lcl_addProperty(aPropertyNames, aPropertyValues,
-                                UNO_NAME_LINECOLOR,
-                                rLineProperties.Color);
-            }
-            xMultiPropertySet->setPropertyValues(aPropertyNames, 
aPropertyValues);
+        //LineWidth
+        if(rLineProperties.Width.hasValue())
+        {
+            lcl_addProperty(aPropertyNames, aPropertyValues,
+                            UNO_NAME_LINEWIDTH,
+                            rLineProperties.Width);
         }
-        catch( const uno::Exception& )
+
+        //LineColor
+        if(rLineProperties.Color.hasValue())
         {
-            TOOLS_WARN_EXCEPTION("chart2", "" );
+            lcl_addProperty(aPropertyNames, aPropertyValues,
+                            UNO_NAME_LINECOLOR,
+                            rLineProperties.Color);
         }
+        xShape->setPropertyValues(aPropertyNames, aPropertyValues);
+    }
+    catch( const uno::Exception& )
+    {
+        TOOLS_WARN_EXCEPTION("chart2", "" );
     }
     return xShape;
 }

Reply via email to