chart2/source/view/charttypes/PieChart.cxx | 2 - chart2/source/view/inc/ShapeFactory.hxx | 2 - chart2/source/view/main/ShapeFactory.cxx | 40 ++++++++++++----------------- 3 files changed, 19 insertions(+), 25 deletions(-)
New commits: commit 2228bda030384c8e48810d6d4fb5525084a31511 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Thu Dec 30 08:47:02 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Dec 30 13:33:22 2021 +0100 use concrete types in chart2, PieSegment2D Change-Id: I18bd576fdc3a679013f999d769089dce35e09994 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127729 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index 098628b24dac..0a9a2f1b5af8 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -276,7 +276,7 @@ uno::Reference< drawing::XShape > PieChart::createDataPoint( } else { - xShape = m_pShapeFactory->createPieSegment2D( xTarget + xShape = ShapeFactory::createPieSegment2D( xTarget , rParam.mfUnitCircleStartAngleDegree, rParam.mfUnitCircleWidthAngleDegree , rParam.mfUnitCircleInnerRadius, rParam.mfUnitCircleOuterRadius , aOffset, B3DHomMatrixToHomogenMatrix( m_pPosHelper->getUnitCartesianToScene() ) ); diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx index 4f8f6ebdfa25..d5e61cee990b 100644 --- a/chart2/source/view/inc/ShapeFactory.hxx +++ b/chart2/source/view/inc/ShapeFactory.hxx @@ -120,7 +120,7 @@ public: , const css::drawing::Direction3D& rSize , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree ); - css::uno::Reference< css::drawing::XShape > + static rtl::Reference<SvxShapePolyPolygon> createPieSegment2D( const css::uno::Reference< css::drawing::XShapes >& xTarget , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx index 695b39968621..7d73f3196364 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -851,7 +851,7 @@ static drawing::PolyPolygonBezierCoords getRingBezierCoords( return aReturn; } -uno::Reference< drawing::XShape > +rtl::Reference<SvxShapePolyPolygon> ShapeFactory::createPieSegment2D( const uno::Reference< drawing::XShapes >& xTarget , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree @@ -869,35 +869,29 @@ uno::Reference< drawing::XShape > fUnitCircleWidthAngleDegree += 360.0; //create shape - uno::Reference< drawing::XShape > xShape( - m_xShapeFactory->createInstance( - "com.sun.star.drawing.ClosedBezierShape" ), uno::UNO_QUERY ); + rtl::Reference<SvxShapePolyPolygon> xShape = new SvxShapePolyPolygon(nullptr); + xShape->setShapeKind(OBJ_PATHFILL); // aka ClosedBezierShape 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/10.0; + const double fAngleSubdivisionRadian = M_PI/10.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); - xProp->setPropertyValue( "PolyPolygonBezier", uno::Any( aCoords ) ); - } - catch( const uno::Exception& ) - { - TOOLS_WARN_EXCEPTION("chart2", "" ); - } + xShape->SvxShape::setPropertyValue( "PolyPolygonBezier", uno::Any( aCoords ) ); + } + catch( const uno::Exception& ) + { + TOOLS_WARN_EXCEPTION("chart2", "" ); } return xShape;