chart2/source/view/charttypes/AreaChart.cxx | 2 chart2/source/view/charttypes/BarChart.cxx | 2 chart2/source/view/charttypes/BarChart.hxx | 2 chart2/source/view/diagram/VDiagram.cxx | 12 ++--- chart2/source/view/inc/ShapeFactory.hxx | 4 - chart2/source/view/main/ShapeFactory.cxx | 65 ++++++++++++---------------- include/svx/unoshape.hxx | 2 7 files changed, 41 insertions(+), 48 deletions(-)
New commits: commit 206c52d1248cc474fc7c3bbb6812688c97eb2ca0 Author: Noel Grandin <[email protected]> AuthorDate: Thu Dec 30 09:22:15 2021 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Thu Dec 30 13:33:39 2021 +0100 use concrete types in chart2, Stripe Change-Id: I8814616024345206a69b7e33ade42c74656e9213 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127730 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 a325e668f2ed..f5b39f833673 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -426,7 +426,7 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries aPoint2.PositionY = aPoly.SequenceY[nPoly][nPoint]; aPoint2.PositionZ = aPoly.SequenceZ[nPoly][nPoint]; - m_pShapeFactory->createStripe(xSeriesGroupShape_Shapes + ShapeFactory::createStripe(xSeriesGroupShape_Shapes , Stripe( aPoint1, aPoint2, fDepth ) , pSeries->getPropertiesOfSeries(), PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), true, 1 ); } diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx index 0af39bafc348..9b2beb354689 100644 --- a/chart2/source/view/charttypes/BarChart.cxx +++ b/chart2/source/view/charttypes/BarChart.cxx @@ -329,7 +329,7 @@ uno::Reference< drawing::XShape > BarChart::createDataPoint3D_Bar( xShape = ShapeFactory::createCone( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree ); break; case DataPointGeometry3D::PYRAMID: - xShape = m_pShapeFactory->createPyramid( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree>0 + xShape = ShapeFactory::createPyramid( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree>0 , xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() ); break; case DataPointGeometry3D::CUBOID: diff --git a/chart2/source/view/charttypes/BarChart.hxx b/chart2/source/view/charttypes/BarChart.hxx index 20534f9d4759..f5d918e7f74b 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 - css::uno::Reference< css::drawing::XShape > + static css::uno::Reference< css::drawing::XShape > createDataPoint3D_Bar( const css::uno::Reference< css::drawing::XShapes >& xTarget , const css::drawing::Position3D& rPosition diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx index d229ffefcd80..cbeff2dd6586 100644 --- a/chart2/source/view/diagram/VDiagram.cxx +++ b/chart2/source/view/diagram/VDiagram.cxx @@ -495,8 +495,8 @@ void VDiagram::createShapes_3d() } aStripe.InvertNormal(true); - uno::Reference< drawing::XShape > xShape = - m_pShapeFactory->createStripe( xWallGroup_Shapes, aStripe + rtl::Reference<Svx3DPolygonObject> xShape = + ShapeFactory::createStripe( xWallGroup_Shapes, aStripe , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), bDoubleSided, nRotatedTexture ); if( !bAddFloorAndWall ) { @@ -523,8 +523,8 @@ void VDiagram::createShapes_3d() } aStripe.InvertNormal(true); - uno::Reference< drawing::XShape > xShape = - m_pShapeFactory->createStripe(xWallGroup_Shapes, aStripe + rtl::Reference<Svx3DPolygonObject> xShape = + ShapeFactory::createStripe(xWallGroup_Shapes, aStripe , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), bDoubleSided, nRotatedTexture ); if( !bAddFloorAndWall ) { @@ -598,8 +598,8 @@ void VDiagram::createShapes_3d() , drawing::Direction3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,0,0) ); aStripe.InvertNormal(true); - uno::Reference< drawing::XShape > xShape = - m_pShapeFactory->createStripe(xOuterGroup_Shapes, aStripe + rtl::Reference<Svx3DPolygonObject> xShape = + ShapeFactory::createStripe(xOuterGroup_Shapes, aStripe , xFloorProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), bDoubleSided ); CuboidPlanePosition eBottomPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) ); diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx index d5e61cee990b..0c39000b828c 100644 --- a/chart2/source/view/inc/ShapeFactory.hxx +++ b/chart2/source/view/inc/ShapeFactory.hxx @@ -105,7 +105,7 @@ public: , const css::drawing::Direction3D& rSize , sal_Int32 nRotateZAngleHundredthDegree ); - rtl::Reference<Svx3DSceneObject> + static rtl::Reference<Svx3DSceneObject> createPyramid( const css::uno::Reference< css::drawing::XShapes >& xTarget , const css::drawing::Position3D& rPosition , const css::drawing::Direction3D& rSize @@ -135,7 +135,7 @@ public: , const css::drawing::HomogenMatrix& rUnitCircleToScene , double fDepth ); - css::uno::Reference< css::drawing::XShape > + static rtl::Reference<Svx3DPolygonObject> createStripe( const css::uno::Reference< css::drawing::XShapes >& xTarget , const Stripe& rStripe , const css::uno::Reference< css::beans::XPropertySet >& xSourceProp diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx index 7d73f3196364..b1f5147875b3 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -973,7 +973,7 @@ rtl::Reference<Svx3DExtrudeObject> return xShape; } -uno::Reference< drawing::XShape > +rtl::Reference<Svx3DPolygonObject> ShapeFactory::createStripe( const uno::Reference< drawing::XShapes >& xTarget , const Stripe& rStripe , const uno::Reference< beans::XPropertySet >& xSourceProp @@ -986,52 +986,45 @@ 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_TEXTUREPOLYGON3D, - UNO_NAME_3D_NORMALSPOLYGON3D, - UNO_NAME_3D_LINEONLY, - UNO_NAME_3D_DOUBLE_SIDED - }; + uno::Sequence<OUString> aPropertyNames{ + UNO_NAME_3D_POLYPOLYGON3D, + UNO_NAME_3D_TEXTUREPOLYGON3D, + UNO_NAME_3D_NORMALSPOLYGON3D, + UNO_NAME_3D_LINEONLY, + UNO_NAME_3D_DOUBLE_SIDED + }; - uno::Sequence<uno::Any> aPropertyValues { - rStripe.getPolyPolygonShape3D(), // Polygon - Stripe::getTexturePolygon(nRotatedTexture), // TexturePolygon - rStripe.getNormalsPolygon(), // Normals Polygon - uno::Any(false), // LineOnly - uno::Any(bDoubleSided) // DoubleSided - }; + uno::Sequence<uno::Any> aPropertyValues { + rStripe.getPolyPolygonShape3D(), // Polygon + Stripe::getTexturePolygon(nRotatedTexture), // TexturePolygon + rStripe.getNormalsPolygon(), // Normals Polygon + uno::Any(false), // LineOnly + uno::Any(bDoubleSided) // DoubleSided + }; - //NormalsKind - if (bFlatNormals) - lcl_addProperty(aPropertyNames, aPropertyValues, - UNO_NAME_3D_NORMALS_KIND, uno::Any(drawing::NormalsKind_FLAT)); + //NormalsKind + if (bFlatNormals) + lcl_addProperty(aPropertyNames, aPropertyValues, + UNO_NAME_3D_NORMALS_KIND, uno::Any(drawing::NormalsKind_FLAT)); - xMultiPropertySet->setPropertyValues(aPropertyNames, aPropertyValues); + xShape->setPropertyValues(aPropertyNames, aPropertyValues); - uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); - if (xSourceProp.is() && xPropertySet.is()) - { - PropertyMapper::setMappedProperties(xPropertySet, xSourceProp, rPropertyNameMap); - } - } - catch( const uno::Exception& ) + if (xSourceProp) { - TOOLS_WARN_EXCEPTION("chart2", "" ); + PropertyMapper::setMappedProperties(xShape, xSourceProp, rPropertyNameMap); } } + catch( const uno::Exception& ) + { + TOOLS_WARN_EXCEPTION("chart2", "" ); + } return xShape; } diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx index 13df4873fc40..210885bfac28 100644 --- a/include/svx/unoshape.hxx +++ b/include/svx/unoshape.hxx @@ -779,7 +779,7 @@ class Svx3DPolygonObject final : public SvxShape virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override; public: - Svx3DPolygonObject(SdrObject* pObj); + SVXCORE_DLLPUBLIC Svx3DPolygonObject(SdrObject* pObj); virtual ~Svx3DPolygonObject() noexcept override; // XServiceInfo
