chart2/source/view/axes/VCartesianAxis.cxx           |    2 
 chart2/source/view/axes/VPolarAngleAxis.cxx          |    2 
 chart2/source/view/charttypes/AreaChart.cxx          |    4 
 chart2/source/view/charttypes/BarChart.cxx           |    4 
 chart2/source/view/charttypes/BubbleChart.cxx        |    6 
 chart2/source/view/charttypes/NetChart.cxx           |    4 
 chart2/source/view/charttypes/PieChart.cxx           |   14 -
 chart2/source/view/inc/LabelPositionHelper.hxx       |    6 
 chart2/source/view/inc/PlottingPositionHelper.hxx    |    2 
 chart2/source/view/inc/PolarLabelPositionHelper.hxx  |    3 
 chart2/source/view/inc/ShapeFactory.hxx              |    8 
 chart2/source/view/main/LabelPositionHelper.cxx      |    6 
 chart2/source/view/main/PlottingPositionHelper.cxx   |    3 
 chart2/source/view/main/PolarLabelPositionHelper.cxx |    5 
 chart2/source/view/main/ShapeFactory.cxx             |  260 ++++++++-----------
 include/svx/unoshape.hxx                             |    2 
 16 files changed, 152 insertions(+), 179 deletions(-)

New commits:
commit 0ea295876797cc8677817cf5e64ce19cc36f46ea
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Dec 29 22:14:58 2021 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Dec 30 13:05:33 2021 +0100

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

diff --git a/chart2/source/view/axes/VCartesianAxis.cxx 
b/chart2/source/view/axes/VCartesianAxis.cxx
index 9df05ad36620..2aa2cbf68728 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -1135,7 +1135,7 @@ B2DVector VCartesianAxis::getScreenPosition( double 
fLogicX, double fLogicY, dou
             if (m_xLogicTarget.is() && m_pShapeFactory)
             {
                 tPropertyNameMap aDummyPropertyNameMap;
-                Reference< drawing::XShape > xShape3DAnchor = 
m_pShapeFactory->createCube( m_xLogicTarget
+                rtl::Reference<Svx3DExtrudeObject> xShape3DAnchor = 
ShapeFactory::createCube( m_xLogicTarget
                         , aScenePos,drawing::Direction3D(1,1,1), 0, nullptr, 
aDummyPropertyNameMap);
                 awt::Point a2DPos = xShape3DAnchor->getPosition(); //get 2D 
position from xShape3DAnchor
                 m_xLogicTarget->remove(xShape3DAnchor);
diff --git a/chart2/source/view/axes/VPolarAngleAxis.cxx 
b/chart2/source/view/axes/VPolarAngleAxis.cxx
index ae06bcf4d6da..de85566cd022 100644
--- a/chart2/source/view/axes/VPolarAngleAxis.cxx
+++ b/chart2/source/view/axes/VPolarAngleAxis.cxx
@@ -115,7 +115,7 @@ void VPolarAngleAxis::createTextShapes_ForAngleAxis(
             double fLogicAngle = pTickInfo->getUnscaledTickValue();
 
             LabelAlignment eLabelAlignment(LABEL_ALIGN_CENTER);
-            PolarLabelPositionHelper 
aPolarLabelPositionHelper(m_pPosHelper.get(), 2/*nDimensionCount*/, xTarget, 
pShapeFactory);
+            PolarLabelPositionHelper 
aPolarLabelPositionHelper(m_pPosHelper.get(), 2/*nDimensionCount*/, xTarget);
             sal_Int32 nScreenValueOffsetInRadiusDirection = 
m_aAxisLabelProperties.m_aMaximumSpaceForLabels.Height/15;
             awt::Point aAnchorScreenPosition2D( 
aPolarLabelPositionHelper.getLabelScreenPositionAndAlignmentForLogicValues(
                     eLabelAlignment, fLogicAngle, fLogicRadius, fLogicZ, 
nScreenValueOffsetInRadiusDirection ));
diff --git a/chart2/source/view/charttypes/AreaChart.cxx 
b/chart2/source/view/charttypes/AreaChart.cxx
index bb26c8b8bae3..a325e668f2ed 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -504,7 +504,7 @@ bool AreaChart::impl_createArea( VDataSeries* pSeries
     uno::Reference< drawing::XShape > xShape;
     if(m_nDimension==3)
     {
-        xShape = m_pShapeFactory->createArea3D( xSeriesGroupShape_Shapes
+        xShape = ShapeFactory::createArea3D( xSeriesGroupShape_Shapes
                 , aPoly, getTransformedDepth() );
     }
     else //m_nDimension!=3
@@ -953,7 +953,7 @@ void AreaChart::createShapes()
                             {
                                 if(eAlignment==LABEL_ALIGN_CENTER || 
m_nDimension == 3 )
                                     nOffset = 0;
-                                aScreenPosition2D = 
LabelPositionHelper(m_nDimension,m_xLogicTarget,m_pShapeFactory)
+                                aScreenPosition2D = 
LabelPositionHelper(m_nDimension,m_xLogicTarget)
                                         .transformSceneToScreenPosition( 
aScenePosition3D );
                             }
 
diff --git a/chart2/source/view/charttypes/BarChart.cxx 
b/chart2/source/view/charttypes/BarChart.cxx
index c092d34b691f..3099be4350cb 100644
--- a/chart2/source/view/charttypes/BarChart.cxx
+++ b/chart2/source/view/charttypes/BarChart.cxx
@@ -292,7 +292,7 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment(
 
     drawing::Position3D aScenePosition3D( pPosHelper->
             transformScaledLogicToScene( fX, fY, fZ, true ) );
-    return LabelPositionHelper(m_nDimension,m_xLogicTarget,m_pShapeFactory)
+    return LabelPositionHelper(m_nDimension,m_xLogicTarget)
         .transformSceneToScreenPosition( aScenePosition3D );
 }
 
@@ -334,7 +334,7 @@ uno::Reference< drawing::XShape > 
BarChart::createDataPoint3D_Bar(
             break;
         case DataPointGeometry3D::CUBOID:
         default:
-            xShape = m_pShapeFactory->createCube( xTarget, rPosition, rSize
+            xShape = ShapeFactory::createCube( xTarget, rPosition, rSize
                     , nRotateZAngleHundredthDegree, xObjectProperties
                     , 
PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), bRoundedEdges );
             return xShape;
diff --git a/chart2/source/view/charttypes/BubbleChart.cxx 
b/chart2/source/view/charttypes/BubbleChart.cxx
index a763458419bb..8f526f465ea6 100644
--- a/chart2/source/view/charttypes/BubbleChart.cxx
+++ b/chart2/source/view/charttypes/BubbleChart.cxx
@@ -88,8 +88,8 @@ void BubbleChart::calculateBubbleSizeScalingFactor()
     drawing::Position3D aSceneMinPos( m_pMainPosHelper->transformLogicToScene( 
m_pMainPosHelper->getLogicMinX(),m_pMainPosHelper->getLogicMinY(),fLogicZ, 
false ) );
     drawing::Position3D aSceneMaxPos( m_pMainPosHelper->transformLogicToScene( 
m_pMainPosHelper->getLogicMaxX(),m_pMainPosHelper->getLogicMaxY(),fLogicZ, 
false ) );
 
-    awt::Point aScreenMinPos( 
LabelPositionHelper(m_nDimension,m_xLogicTarget,m_pShapeFactory).transformSceneToScreenPosition(
 aSceneMinPos ) );
-    awt::Point aScreenMaxPos( 
LabelPositionHelper(m_nDimension,m_xLogicTarget,m_pShapeFactory).transformSceneToScreenPosition(
 aSceneMaxPos ) );
+    awt::Point aScreenMinPos( 
LabelPositionHelper(m_nDimension,m_xLogicTarget).transformSceneToScreenPosition(
 aSceneMinPos ) );
+    awt::Point aScreenMaxPos( 
LabelPositionHelper(m_nDimension,m_xLogicTarget).transformSceneToScreenPosition(
 aSceneMaxPos ) );
 
     sal_Int32 nWidth = abs( aScreenMaxPos.X - aScreenMinPos.X );
     sal_Int32 nHeight = abs( aScreenMaxPos.Y - aScreenMinPos.Y );
@@ -338,7 +338,7 @@ void BubbleChart::createShapes()
                                 break;
                             }
 
-                            awt::Point aScreenPosition2D( 
LabelPositionHelper(m_nDimension,m_xLogicTarget,m_pShapeFactory)
+                            awt::Point aScreenPosition2D( 
LabelPositionHelper(m_nDimension,m_xLogicTarget)
                                 .transformSceneToScreenPosition( 
aScenePosition3D ) );
                             sal_Int32 nOffset = 0;
                             if(eAlignment!=LABEL_ALIGN_CENTER)
diff --git a/chart2/source/view/charttypes/NetChart.cxx 
b/chart2/source/view/charttypes/NetChart.cxx
index ac6fff743ac5..ab82f6432dda 100644
--- a/chart2/source/view/charttypes/NetChart.cxx
+++ b/chart2/source/view/charttypes/NetChart.cxx
@@ -606,7 +606,7 @@ void NetChart::createShapes()
                                     = 
dynamic_cast<PolarPlottingPositionHelper*>(m_pPosHelper);
                                 if( pPolarPosHelper )
                                 {
-                                    PolarLabelPositionHelper 
aPolarLabelPositionHelper(pPolarPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory);
+                                    PolarLabelPositionHelper 
aPolarLabelPositionHelper(pPolarPosHelper,m_nDimension,m_xLogicTarget);
                                     aScreenPosition2D = 
aPolarLabelPositionHelper.getLabelScreenPositionAndAlignmentForLogicValues(
                                         eAlignment, fLogicX, fLogicY, fLogicZ, 
nOffset );
                                 }
@@ -615,7 +615,7 @@ void NetChart::createShapes()
                             {
                                 if(eAlignment==LABEL_ALIGN_CENTER )
                                     nOffset = 0;
-                                aScreenPosition2D = 
LabelPositionHelper(m_nDimension,m_xLogicTarget,m_pShapeFactory)
+                                aScreenPosition2D = 
LabelPositionHelper(m_nDimension,m_xLogicTarget)
                                     .transformSceneToScreenPosition( 
aScenePosition3D );
                             }
 
diff --git a/chart2/source/view/charttypes/PieChart.cxx 
b/chart2/source/view/charttypes/PieChart.cxx
index e0a7b344f498..098628b24dac 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -268,7 +268,7 @@ uno::Reference< drawing::XShape > PieChart::createDataPoint(
     uno::Reference< drawing::XShape > xShape;
     if(m_nDimension==3)
     {
-        xShape = m_pShapeFactory->createPieSegment( xTarget
+        xShape = ShapeFactory::createPieSegment( xTarget
             , rParam.mfUnitCircleStartAngleDegree, 
rParam.mfUnitCircleWidthAngleDegree
             , rParam.mfUnitCircleInnerRadius, rParam.mfUnitCircleOuterRadius
             , aOffset, B3DHomMatrixToHomogenMatrix( 
m_pPosHelper->getUnitCartesianToScene() )
@@ -338,7 +338,7 @@ void PieChart::createTextLabelShape(
     ///the scene position of the label anchor point is calculated (see notes 
for
     
///`PolarLabelPositionHelper::getLabelScreenPositionAndAlignmentForUnitCircleValues`),
     ///and immediately transformed into the screen position.
-    PolarLabelPositionHelper 
aPolarPosHelper(m_pPosHelper.get(),m_nDimension,m_xLogicTarget,m_pShapeFactory);
+    PolarLabelPositionHelper 
aPolarPosHelper(m_pPosHelper.get(),m_nDimension,m_xLogicTarget);
     awt::Point aScreenPosition2D(
         
aPolarPosHelper.getLabelScreenPositionAndAlignmentForUnitCircleValues(eAlignment,
 nLabelPlacement
         , rParam.mfUnitCircleStartAngleDegree, 
rParam.mfUnitCircleWidthAngleDegree
@@ -365,7 +365,7 @@ void PieChart::createTextLabelShape(
                     0,
                     rParam.mfUnitCircleOuterRadius,
                     0 ),
-            m_xLogicTarget, m_pShapeFactory, m_nDimension );
+            m_xLogicTarget, m_nDimension );
     basegfx::B2IVector aRadiusVector(
             aOuterCirclePoint.X - aPieLabelInfo.aOrigin.getX(),
             aOuterCirclePoint.Y - aPieLabelInfo.aOrigin.getY() );
@@ -380,7 +380,7 @@ void PieChart::createTextLabelShape(
 
     awt::Point aOuterPosition = 
PlottingPositionHelper::transformSceneToScreenPosition(
         m_pPosHelper->transformUnitCircleToScene(fAngleDegree, 
rParam.mfUnitCircleOuterRadius, 0),
-        m_xLogicTarget, m_pShapeFactory, m_nDimension);
+        m_xLogicTarget, m_nDimension);
     aPieLabelInfo.aOuterPosition = basegfx::B2IVector(aOuterPosition.X, 
aOuterPosition.Y);
 
     // set the maximum text width to be used when text wrapping is enabled
@@ -862,9 +862,9 @@ void PieChart::createShapes()
                     sal_Int32 nOffsetPercent( 
static_cast<sal_Int32>(aParam.mfExplodePercentage * 100.0) );
 
                     awt::Point aMinimumPosition( 
PlottingPositionHelper::transformSceneToScreenPosition(
-                        aOrigin, m_xLogicTarget, m_pShapeFactory, m_nDimension 
) );
+                        aOrigin, m_xLogicTarget, m_nDimension ) );
                     awt::Point aMaximumPosition( 
PlottingPositionHelper::transformSceneToScreenPosition(
-                        aNewOrigin, m_xLogicTarget, m_pShapeFactory, 
m_nDimension ) );
+                        aNewOrigin, m_xLogicTarget, m_nDimension ) );
 
                     //enable dragging of piesegments
                     OUString aPointCIDStub( 
ObjectIdentifier::createSeriesSubObjectStub( OBJECTTYPE_DATA_POINT
@@ -1402,7 +1402,7 @@ bool 
PieChart::performLabelBestFitInnerPlacement(ShapeParam& rShapeParam, PieLab
                     fBisectingRayAngleDeg,
                     rShapeParam.mfUnitCircleOuterRadius,
                     fLogicZ ),
-            m_xLogicTarget, m_pShapeFactory, m_nDimension );
+            m_xLogicTarget, m_nDimension );
 
     // compute the pie radius
     basegfx::B2IVector aPieCenter = rPieLabelInfo.aOrigin;
diff --git a/chart2/source/view/inc/LabelPositionHelper.hxx 
b/chart2/source/view/inc/LabelPositionHelper.hxx
index e90ff373bbbb..811d8c13be24 100644
--- a/chart2/source/view/inc/LabelPositionHelper.hxx
+++ b/chart2/source/view/inc/LabelPositionHelper.hxx
@@ -31,16 +31,13 @@ namespace com::sun::star::drawing { class XShape; }
 namespace chart
 {
 
-class ShapeFactory;
-
 class LabelPositionHelper
 {
 public:
     LabelPositionHelper() = delete;
     LabelPositionHelper(
           sal_Int32 nDimensionCount
-        , const css::uno::Reference< css::drawing::XShapes >& xLogicTarget
-        , ShapeFactory* pShapeFactory );
+        , const css::uno::Reference< css::drawing::XShapes >& xLogicTarget );
     virtual ~LabelPositionHelper();
 
     css::awt::Point transformSceneToScreenPosition(
@@ -60,7 +57,6 @@ protected:
 private:
     //these members are only necessary for transformation from 3D to 2D
     css::uno::Reference< css::drawing::XShapes >    m_xLogicTarget;
-    ShapeFactory* m_pShapeFactory;
 };
 
 } //namespace chart
diff --git a/chart2/source/view/inc/PlottingPositionHelper.hxx 
b/chart2/source/view/inc/PlottingPositionHelper.hxx
index 1349bd8f46a8..106eff673011 100644
--- a/chart2/source/view/inc/PlottingPositionHelper.hxx
+++ b/chart2/source/view/inc/PlottingPositionHelper.hxx
@@ -86,7 +86,7 @@ public:
     static css::awt::Point transformSceneToScreenPosition(
                   const css::drawing::Position3D& rScenePosition3D
                 , const css::uno::Reference< css::drawing::XShapes >& 
xSceneTarget
-                , ShapeFactory* pShapeFactory, sal_Int32 nDimensionCount );
+                , sal_Int32 nDimensionCount );
 
     inline double getLogicMinX() const;
     inline double getLogicMinY() const;
diff --git a/chart2/source/view/inc/PolarLabelPositionHelper.hxx 
b/chart2/source/view/inc/PolarLabelPositionHelper.hxx
index 00d8d6f96b9e..5365320358e6 100644
--- a/chart2/source/view/inc/PolarLabelPositionHelper.hxx
+++ b/chart2/source/view/inc/PolarLabelPositionHelper.hxx
@@ -33,8 +33,7 @@ public:
     PolarLabelPositionHelper(
         PolarPlottingPositionHelper* pPosHelper
         , sal_Int32 nDimensionCount
-        , const css::uno::Reference< css::drawing::XShapes >& xLogicTarget
-        , ShapeFactory* pShapeFactory );
+        , const css::uno::Reference< css::drawing::XShapes >& xLogicTarget );
     virtual ~PolarLabelPositionHelper() override;
 
     css::awt::Point getLabelScreenPositionAndAlignmentForLogicValues(
diff --git a/chart2/source/view/inc/ShapeFactory.hxx 
b/chart2/source/view/inc/ShapeFactory.hxx
index 6d747f78c633..ca94c3da1293 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -90,7 +90,7 @@ public:
             const css::uno::Reference< css::drawing::XShapes >& xTarget
           , const OUString& aName = OUString() );
 
-    css::uno::Reference< css::drawing::XShape >
+    static rtl::Reference<Svx3DExtrudeObject>
             createCube(   const css::uno::Reference< css::drawing::XShapes >& 
xTarget
                         , const css::drawing::Position3D& rPosition
                         , const css::drawing::Direction3D& rSize
@@ -127,7 +127,7 @@ public:
                     , const css::drawing::Direction3D& rOffset
                     , const css::drawing::HomogenMatrix& rUnitCircleToScene );
 
-    css::uno::Reference< css::drawing::XShape >
+    static rtl::Reference<Svx3DExtrudeObject>
         createPieSegment( const css::uno::Reference< css::drawing::XShapes >& 
xTarget
                     , double fUnitCircleStartAngleDegree, double 
fUnitCircleWidthAngleDegree
                     , double fUnitCircleInnerRadius, double 
fUnitCircleOuterRadius
@@ -144,7 +144,7 @@ public:
                     , short nRotatedTexture = 0 //0 to 7 are the different 
possibilities
                     , bool bFlatNormals=true );
 
-    css::uno::Reference< css::drawing::XShape >
+    static rtl::Reference<Svx3DExtrudeObject>
         createArea3D( const css::uno::Reference< css::drawing::XShapes >& 
xTarget
                     , const css::drawing::PolyPolygonShape3D& rPolyPolygon
                     , double fDepth);
@@ -278,7 +278,7 @@ public:
     static sal_Int32 getSymbolCount() { return Symbol_COUNT; }
 
 private:
-    css::uno::Reference< css::drawing::XShape >
+    static rtl::Reference<Svx3DExtrudeObject>
         impl_createCube( const css::uno::Reference< css::drawing::XShapes >& 
xTarget
                     , const css::drawing::Position3D& rPosition
                     , const css::drawing::Direction3D& rSize, sal_Int32 
nRotateZAngleHundredthDegree
diff --git a/chart2/source/view/main/LabelPositionHelper.cxx 
b/chart2/source/view/main/LabelPositionHelper.cxx
index 8f36943ade7a..c427e429fb44 100644
--- a/chart2/source/view/main/LabelPositionHelper.cxx
+++ b/chart2/source/view/main/LabelPositionHelper.cxx
@@ -35,11 +35,9 @@ using namespace ::com::sun::star::chart2;
 
 LabelPositionHelper::LabelPositionHelper(
                       sal_Int32 nDimensionCount
-                    , const uno::Reference< drawing::XShapes >& xLogicTarget
-                    , ShapeFactory* pShapeFactory )
+                    , const uno::Reference< drawing::XShapes >& xLogicTarget)
                     : m_nDimensionCount(nDimensionCount)
                     , m_xLogicTarget(xLogicTarget)
-                    , m_pShapeFactory(pShapeFactory)
 {
 }
 
@@ -50,7 +48,7 @@ LabelPositionHelper::~LabelPositionHelper()
 awt::Point LabelPositionHelper::transformSceneToScreenPosition( const 
drawing::Position3D& rScenePosition3D ) const
 {
     return PlottingPositionHelper::transformSceneToScreenPosition(
-                  rScenePosition3D, m_xLogicTarget, m_pShapeFactory, 
m_nDimensionCount );
+                  rScenePosition3D, m_xLogicTarget, m_nDimensionCount );
 }
 
 void LabelPositionHelper::changeTextAdjustment( tAnySequence& rPropValues, 
const tNameSequence& rPropNames, LabelAlignment eAlignment)
diff --git a/chart2/source/view/main/PlottingPositionHelper.cxx 
b/chart2/source/view/main/PlottingPositionHelper.cxx
index 00421fed86e7..e105393236d5 100644
--- a/chart2/source/view/main/PlottingPositionHelper.cxx
+++ b/chart2/source/view/main/PlottingPositionHelper.cxx
@@ -194,7 +194,6 @@ drawing::Position3D 
PlottingPositionHelper::transformScaledLogicToScene(
 
 awt::Point PlottingPositionHelper::transformSceneToScreenPosition( const 
drawing::Position3D& rScenePosition3D
                 , const uno::Reference< drawing::XShapes >& xSceneTarget
-                , ShapeFactory* pShapeFactory
                 , sal_Int32 nDimensionCount )
 {
     //@todo would like to have a cheaper method to do this transformation
@@ -205,7 +204,7 @@ awt::Point 
PlottingPositionHelper::transformSceneToScreenPosition( const drawing
     {
         //create 3D anchor shape
         tPropertyNameMap aDummyPropertyNameMap;
-        uno::Reference< drawing::XShape > xShape3DAnchor = 
pShapeFactory->createCube( xSceneTarget
+        rtl::Reference<Svx3DExtrudeObject> xShape3DAnchor = 
ShapeFactory::createCube( xSceneTarget
                 , rScenePosition3D,drawing::Direction3D(1,1,1)
                 , 0, nullptr, aDummyPropertyNameMap);
         //get 2D position from xShape3DAnchor
diff --git a/chart2/source/view/main/PolarLabelPositionHelper.cxx 
b/chart2/source/view/main/PolarLabelPositionHelper.cxx
index b64de3970196..8ca4a44ac46e 100644
--- a/chart2/source/view/main/PolarLabelPositionHelper.cxx
+++ b/chart2/source/view/main/PolarLabelPositionHelper.cxx
@@ -32,9 +32,8 @@ using namespace ::com::sun::star::chart2;
 PolarLabelPositionHelper::PolarLabelPositionHelper(
                     PolarPlottingPositionHelper* pPosHelper
                     , sal_Int32 nDimensionCount
-                    , const uno::Reference< drawing::XShapes >& xLogicTarget
-                    , ShapeFactory* pShapeFactory )
-                    : LabelPositionHelper( nDimensionCount, xLogicTarget, 
pShapeFactory )
+                    , const uno::Reference< drawing::XShapes >& xLogicTarget )
+                    : LabelPositionHelper( nDimensionCount, xLogicTarget )
                     , m_pPosHelper(pPosHelper)
 {
 }
diff --git a/chart2/source/view/main/ShapeFactory.cxx 
b/chart2/source/view/main/ShapeFactory.cxx
index ac6974a7e0fc..0e20f17cc975 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -54,6 +54,7 @@
 
 #include <basegfx/point/b2dpoint.hxx>
 #include <basegfx/matrix/b3dhommatrix.hxx>
+#include <svx/unoprov.hxx>
 #include <tools/diagnose_ex.h>
 #include <tools/helpers.hxx>
 #include <tools/UnitConversion.hxx>
@@ -358,7 +359,7 @@ static uno::Any createPolyPolygon_Cone( double fHeight, 
double fRadius, double f
 
 //  methods for 3D shape creation
 
-uno::Reference<drawing::XShape>
+rtl::Reference<Svx3DExtrudeObject>
         ShapeFactory::createCube(
             const uno::Reference<drawing::XShapes>& xTarget
             , const drawing::Position3D& rPosition, const 
drawing::Direction3D& rSize
@@ -386,14 +387,13 @@ uno::Reference<drawing::XShape>
             TOOLS_WARN_EXCEPTION("chart2", "" );
         }
     }
-    uno::Reference<drawing::XShape> xShape = impl_createCube( xTarget, 
rPosition, rSize, nRotateZAngleHundredthDegree, bRounded );
-    uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+    rtl::Reference<Svx3DExtrudeObject> xShape = impl_createCube( xTarget, 
rPosition, rSize, nRotateZAngleHundredthDegree, bRounded );
     if( xSourceProp.is())
-        PropertyMapper::setMappedProperties( xProp, xSourceProp, 
rPropertyNameMap );
+        PropertyMapper::setMappedProperties( xShape, xSourceProp, 
rPropertyNameMap );
     return xShape;
 }
 
-uno::Reference<drawing::XShape>
+rtl::Reference<Svx3DExtrudeObject>
         ShapeFactory::impl_createCube(
               const uno::Reference<drawing::XShapes>& xTarget
             , const drawing::Position3D& rPosition, const 
drawing::Direction3D& rSize
@@ -404,53 +404,47 @@ uno::Reference<drawing::XShape>
         return nullptr;
 
     //create shape
-    uno::Reference< drawing::XShape > xShape(
-        m_xShapeFactory->createInstance(
-            "com.sun.star.drawing.Shape3DExtrudeObject" ), uno::UNO_QUERY );
+    rtl::Reference<Svx3DExtrudeObject> xShape = new 
Svx3DExtrudeObject(nullptr);
+    xShape->setShapeKind(E3D_EXTRUDEOBJ_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
-        {
-            //depth
-            double fDepth = rSize.DirectionZ;
-            if (fDepth<0)
-                fDepth*=-1.0;
-
-            //PercentDiagonal
-            sal_Int16 nPercentDiagonal = bRounded ? 3 : 0;
-
-            //Matrix for position
-            basegfx::B3DHomMatrix aHomMatrix;
-            if (nRotateZAngleHundredthDegree != 0)
-                aHomMatrix.rotate(0.0, 0.0, 
-basegfx::deg2rad<100>(nRotateZAngleHundredthDegree));
-            aHomMatrix.translate(rPosition.PositionX, rPosition.PositionY,
-                                 rPosition.PositionZ - (fDepth / 2.0));
-
-            uno::Sequence<OUString> aPropertyNames {
-                UNO_NAME_3D_EXTRUDE_DEPTH,
-                UNO_NAME_3D_PERCENT_DIAGONAL,
-                UNO_NAME_3D_POLYPOLYGON3D,
-                UNO_NAME_3D_TRANSFORM_MATRIX,
-            };
-
-            uno::Sequence<uno::Any> aPropertyValues {
-                uno::Any(sal_Int32(fDepth)), // Depth
-                uno::Any(nPercentDiagonal),  // PercentDiagonal
-                createPolyPolygon_Cube(rSize, double(nPercentDiagonal) / 
200.0, bRounded),
-                uno::Any(B3DHomMatrixToHomogenMatrix(aHomMatrix))
-            };
-
-            xMultiPropertySet->setPropertyValues(aPropertyNames, 
aPropertyValues);
-        }
-        catch( const uno::Exception& )
-        {
-            TOOLS_WARN_EXCEPTION("chart2", "" );
-        }
+        //depth
+        double fDepth = rSize.DirectionZ;
+        if (fDepth<0)
+            fDepth*=-1.0;
+
+        //PercentDiagonal
+        sal_Int16 nPercentDiagonal = bRounded ? 3 : 0;
+
+        //Matrix for position
+        basegfx::B3DHomMatrix aHomMatrix;
+        if (nRotateZAngleHundredthDegree != 0)
+            aHomMatrix.rotate(0.0, 0.0, 
-basegfx::deg2rad<100>(nRotateZAngleHundredthDegree));
+        aHomMatrix.translate(rPosition.PositionX, rPosition.PositionY,
+                             rPosition.PositionZ - (fDepth / 2.0));
+
+        uno::Sequence<OUString> aPropertyNames {
+            UNO_NAME_3D_EXTRUDE_DEPTH,
+            UNO_NAME_3D_PERCENT_DIAGONAL,
+            UNO_NAME_3D_POLYPOLYGON3D,
+            UNO_NAME_3D_TRANSFORM_MATRIX,
+        };
+
+        uno::Sequence<uno::Any> aPropertyValues {
+            uno::Any(sal_Int32(fDepth)), // Depth
+            uno::Any(nPercentDiagonal),  // PercentDiagonal
+            createPolyPolygon_Cube(rSize, double(nPercentDiagonal) / 200.0, 
bRounded),
+            uno::Any(B3DHomMatrixToHomogenMatrix(aHomMatrix))
+        };
+
+        xShape->setPropertyValues(aPropertyNames, aPropertyValues);
+    }
+    catch( const uno::Exception& )
+    {
+        TOOLS_WARN_EXCEPTION("chart2", "" );
     }
     return xShape;
 }
@@ -915,7 +909,7 @@ uno::Reference< drawing::XShape >
     return xShape;
 }
 
-uno::Reference< drawing::XShape >
+rtl::Reference<Svx3DExtrudeObject>
         ShapeFactory::createPieSegment(
                     const uno::Reference< drawing::XShapes >& xTarget
                     , double fUnitCircleStartAngleDegree, double 
fUnitCircleWidthAngleDegree
@@ -934,65 +928,59 @@ uno::Reference< drawing::XShape >
         fUnitCircleWidthAngleDegree += 360.0;
 
     //create shape
-    uno::Reference< drawing::XShape > xShape(
-        m_xShapeFactory->createInstance(
-            "com.sun.star.drawing.Shape3DExtrudeObject" ), uno::UNO_QUERY );
+    rtl::Reference<Svx3DExtrudeObject> xShape = new 
Svx3DExtrudeObject(nullptr);
+    xShape->setShapeKind(E3D_EXTRUDEOBJ_ID | E3D_INVENTOR_FLAG);
     xTarget->add(xShape); //need to add the shape before setting of properties
 
     //set properties
-    uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
-    OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
-    if( xProp.is())
+    try
     {
-        try
-        {
-            ::basegfx::B2DHomMatrix aTransformationFromUnitCircle( IgnoreZ( 
HomogenMatrixToB3DHomMatrix(rUnitCircleToScene) ) );
-            
aTransformationFromUnitCircle.translate(rOffset.DirectionX,rOffset.DirectionY);
+        ::basegfx::B2DHomMatrix aTransformationFromUnitCircle( IgnoreZ( 
HomogenMatrixToB3DHomMatrix(rUnitCircleToScene) ) );
+        
aTransformationFromUnitCircle.translate(rOffset.DirectionX,rOffset.DirectionY);
 
-            const double fAngleSubdivisionRadian = M_PI/32.0;
+        const double fAngleSubdivisionRadian = M_PI/32.0;
 
-            drawing::PolyPolygonBezierCoords aCoords
-                = getRingBezierCoords(fUnitCircleInnerRadius, 
fUnitCircleOuterRadius,
-                                      
basegfx::deg2rad(fUnitCircleStartAngleDegree),
-                                      
basegfx::deg2rad(fUnitCircleWidthAngleDegree),
-                                      aTransformationFromUnitCircle, 
fAngleSubdivisionRadian);
+        drawing::PolyPolygonBezierCoords aCoords
+            = getRingBezierCoords(fUnitCircleInnerRadius, 
fUnitCircleOuterRadius,
+                                  
basegfx::deg2rad(fUnitCircleStartAngleDegree),
+                                  
basegfx::deg2rad(fUnitCircleWidthAngleDegree),
+                                  aTransformationFromUnitCircle, 
fAngleSubdivisionRadian);
 
-            //depth
-            xProp->setPropertyValue( UNO_NAME_3D_EXTRUDE_DEPTH
-                , uno::Any(static_cast<sal_Int32>(fDepth)) );
+        //depth
+        xShape->setPropertyValue( UNO_NAME_3D_EXTRUDE_DEPTH
+            , uno::Any(static_cast<sal_Int32>(fDepth)) );
 
-            //PercentDiagonal
-            xProp->setPropertyValue( UNO_NAME_3D_PERCENT_DIAGONAL
-                , uno::Any( sal_Int16(0) ) );
+        //PercentDiagonal
+        xShape->setPropertyValue( UNO_NAME_3D_PERCENT_DIAGONAL
+            , uno::Any( sal_Int16(0) ) );
 
-            //Polygon
-            drawing::PolyPolygonShape3D aPoly( BezierToPoly(aCoords) );
-            ShapeFactory::closePolygon( aPoly );
-            xProp->setPropertyValue( UNO_NAME_3D_POLYPOLYGON3D
-                , uno::Any( aPoly ) );
-
-            //DoubleSided
-            xProp->setPropertyValue( UNO_NAME_3D_DOUBLE_SIDED
-                , uno::Any( true ) );
-
-            //Reduced lines
-            xProp->setPropertyValue( UNO_NAME_3D_REDUCED_LINE_GEOMETRY
-                , uno::Any( true ) );
-
-            //TextureProjectionMode
-            xProp->setPropertyValue( UNO_NAME_3D_TEXTURE_PROJ_Y
-                , uno::Any( drawing::TextureProjectionMode_OBJECTSPECIFIC ) );
-
-            //TextureProjectionMode
-            xProp->setPropertyValue( UNO_NAME_3D_TEXTURE_PROJ_X
-                , uno::Any( drawing::TextureProjectionMode_PARALLEL ) );
-            xProp->setPropertyValue( UNO_NAME_3D_TEXTURE_PROJ_Y
-                , uno::Any( drawing::TextureProjectionMode_OBJECTSPECIFIC ) );
-        }
-        catch( const uno::Exception& )
-        {
-            TOOLS_WARN_EXCEPTION("chart2", "" );
-        }
+        //Polygon
+        drawing::PolyPolygonShape3D aPoly( BezierToPoly(aCoords) );
+        ShapeFactory::closePolygon( aPoly );
+        xShape->setPropertyValue( UNO_NAME_3D_POLYPOLYGON3D
+            , uno::Any( aPoly ) );
+
+        //DoubleSided
+        xShape->setPropertyValue( UNO_NAME_3D_DOUBLE_SIDED
+            , uno::Any( true ) );
+
+        //Reduced lines
+        xShape->setPropertyValue( UNO_NAME_3D_REDUCED_LINE_GEOMETRY
+            , uno::Any( true ) );
+
+        //TextureProjectionMode
+        xShape->setPropertyValue( UNO_NAME_3D_TEXTURE_PROJ_Y
+            , uno::Any( drawing::TextureProjectionMode_OBJECTSPECIFIC ) );
+
+        //TextureProjectionMode
+        xShape->setPropertyValue( UNO_NAME_3D_TEXTURE_PROJ_X
+            , uno::Any( drawing::TextureProjectionMode_PARALLEL ) );
+        xShape->setPropertyValue( UNO_NAME_3D_TEXTURE_PROJ_Y
+            , uno::Any( drawing::TextureProjectionMode_OBJECTSPECIFIC ) );
+    }
+    catch( const uno::Exception& )
+    {
+        TOOLS_WARN_EXCEPTION("chart2", "" );
     }
     return xShape;
 }
@@ -1059,7 +1047,7 @@ uno::Reference< drawing::XShape >
     return xShape;
 }
 
-uno::Reference< drawing::XShape >
+rtl::Reference<Svx3DExtrudeObject>
         ShapeFactory::createArea3D( const uno::Reference< drawing::XShapes >& 
xTarget
                     , const drawing::PolyPolygonShape3D& rPolyPolygon
                     , double fDepth )
@@ -1071,49 +1059,43 @@ uno::Reference< drawing::XShape >
         return nullptr;
 
     //create shape
-    uno::Reference< drawing::XShape > xShape(
-        m_xShapeFactory->createInstance(
-            "com.sun.star.drawing.Shape3DExtrudeObject" ), uno::UNO_QUERY );
+    rtl::Reference<Svx3DExtrudeObject> xShape = new 
Svx3DExtrudeObject(nullptr);
+    xShape->setShapeKind(E3D_EXTRUDEOBJ_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_EXTRUDE_DEPTH,
-                UNO_NAME_3D_PERCENT_DIAGONAL,
-                UNO_NAME_3D_POLYPOLYGON3D,
-                UNO_NAME_3D_DOUBLE_SIDED,
-            };
-
-            uno::Sequence<uno::Any> aPropertyValues {
-                uno::Any(sal_Int32(fDepth)), // depth
-                uno::Any(sal_Int16(0)),      // PercentDiagonal
-                uno::Any(rPolyPolygon),      // Polygon
-                uno::Any(true)               // DoubleSided
-            };
-
-            //the z component of the polygon is now ignored by the drawing 
layer,
-            //so we need to translate the object via transformation matrix
-
-            //Matrix for position
-            if (rPolyPolygon.SequenceZ.hasElements()&& 
rPolyPolygon.SequenceZ[0].hasElements())
-            {
-                basegfx::B3DHomMatrix aM;
-                aM.translate(0, 0, rPolyPolygon.SequenceZ[0][0]);
-                drawing::HomogenMatrix aHM = B3DHomMatrixToHomogenMatrix(aM);
-                lcl_addProperty(aPropertyNames, aPropertyValues, 
UNO_NAME_3D_TRANSFORM_MATRIX, uno::Any(aHM));
-            }
-            xMultiPropertySet->setPropertyValues(aPropertyNames, 
aPropertyValues);
-        }
-        catch( const uno::Exception& )
-        {
-            TOOLS_WARN_EXCEPTION("chart2", "" );
-        }
+        uno::Sequence<OUString> aPropertyNames{
+            UNO_NAME_3D_EXTRUDE_DEPTH,
+            UNO_NAME_3D_PERCENT_DIAGONAL,
+            UNO_NAME_3D_POLYPOLYGON3D,
+            UNO_NAME_3D_DOUBLE_SIDED,
+        };
+
+        uno::Sequence<uno::Any> aPropertyValues {
+            uno::Any(sal_Int32(fDepth)), // depth
+            uno::Any(sal_Int16(0)),      // PercentDiagonal
+            uno::Any(rPolyPolygon),      // Polygon
+            uno::Any(true)               // DoubleSided
+        };
+
+        //the z component of the polygon is now ignored by the drawing layer,
+        //so we need to translate the object via transformation matrix
+
+        //Matrix for position
+        if (rPolyPolygon.SequenceZ.hasElements()&& 
rPolyPolygon.SequenceZ[0].hasElements())
+        {
+            basegfx::B3DHomMatrix aM;
+            aM.translate(0, 0, rPolyPolygon.SequenceZ[0][0]);
+            drawing::HomogenMatrix aHM = B3DHomMatrixToHomogenMatrix(aM);
+            lcl_addProperty(aPropertyNames, aPropertyValues, 
UNO_NAME_3D_TRANSFORM_MATRIX, uno::Any(aHM));
+        }
+        xShape->setPropertyValues(aPropertyNames, aPropertyValues);
+    }
+    catch( const uno::Exception& )
+    {
+        TOOLS_WARN_EXCEPTION("chart2", "" );
     }
     return xShape;
 }
diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx
index fdf1f5de1b61..68430160871a 100644
--- a/include/svx/unoshape.hxx
+++ b/include/svx/unoshape.hxx
@@ -757,7 +757,7 @@ public:
 class Svx3DExtrudeObject final : public SvxShape
 {
 public:
-    Svx3DExtrudeObject(SdrObject* pObj);
+    SVXCORE_DLLPUBLIC Svx3DExtrudeObject(SdrObject* pObj);
 private:
     // override these for special property handling in subcasses. Return true 
if property is handled
     virtual bool setPropertyValueImpl( const OUString& rName, const 
SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;

Reply via email to