chart2/source/view/main/VButton.cxx | 37 +++++++++++++----------------------- chart2/source/view/main/VButton.hxx | 2 - 2 files changed, 15 insertions(+), 24 deletions(-)
New commits: commit 3a93cc176da60e80a4a8876c535f30fb11fb4373 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Mon Jan 3 09:00:43 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Jan 3 12:35:24 2022 +0100 use more SvxShape in chart2 Change-Id: I15cc7e8e0f934772ce6dc29dc89471a78f008916 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127882 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/view/main/VButton.cxx b/chart2/source/view/main/VButton.cxx index d19f3ef4fa0d..7894c5796b51 100644 --- a/chart2/source/view/main/VButton.cxx +++ b/chart2/source/view/main/VButton.cxx @@ -42,16 +42,10 @@ void VButton::init(const rtl::Reference<SvxShapeGroupAnyD>& xTargetPage, m_xShapeFactory = xFactory; } -uno::Reference<drawing::XShape> VButton::createTriangle(awt::Size aSize) +rtl::Reference<SvxShapePolyPolygon> VButton::createTriangle(awt::Size aSize) { - uno::Reference<drawing::XShape> xShape; - xShape.set(m_xShapeFactory->createInstance("com.sun.star.drawing.PolyPolygonShape"), - uno::UNO_QUERY); - - if (!xShape.is()) - return xShape; - - uno::Reference<beans::XPropertySet> xproperties(xShape, uno::UNO_QUERY); + rtl::Reference<SvxShapePolyPolygon> xShape = new SvxShapePolyPolygon(nullptr); + xShape->setShapeKind(OBJ_POLY); drawing::PolyPolygonShape3D aPolyPolygon; aPolyPolygon.SequenceX.realloc(1); @@ -82,11 +76,11 @@ uno::Reference<drawing::XShape> VButton::createTriangle(awt::Size aSize) pInnerSequenceY[2] = 0.0; pInnerSequenceZ[2] = 0.0; - xproperties->setPropertyValue("Name", uno::makeAny(m_sCID)); - xproperties->setPropertyValue(UNO_NAME_POLYPOLYGON, - uno::Any(PolyToPointSequence(aPolyPolygon))); - xproperties->setPropertyValue("LineStyle", uno::makeAny(drawing::LineStyle_NONE)); - xproperties->setPropertyValue("FillColor", uno::makeAny(m_nArrowColor)); + xShape->SvxShape::setPropertyValue("Name", uno::makeAny(m_sCID)); + xShape->SvxShape::setPropertyValue(UNO_NAME_POLYPOLYGON, + uno::Any(PolyToPointSequence(aPolyPolygon))); + xShape->SvxShape::setPropertyValue("LineStyle", uno::makeAny(drawing::LineStyle_NONE)); + xShape->SvxShape::setPropertyValue("FillColor", uno::makeAny(m_nArrowColor)); return xShape; } @@ -136,15 +130,12 @@ void VButton::createShapes(const uno::Reference<beans::XPropertySet>& xTextProp) awt::Size aPolySize{ 280, 180 }; - uno::Reference<drawing::XShape> xPoly = createTriangle(aPolySize); - if (xPoly.is()) - { - xPoly->setSize(aPolySize); - xPoly->setPosition( - { sal_Int32(m_aPosition.X + m_aSize.Width - aPolySize.Width - 100), - sal_Int32(m_aPosition.Y + (m_aSize.Height / 2.0) - (aPolySize.Height / 2.0)) }); - xContainer->add(xPoly); - } + rtl::Reference<SvxShapePolyPolygon> xPoly = createTriangle(aPolySize); + xPoly->setSize(aPolySize); + xPoly->setPosition( + { sal_Int32(m_aPosition.X + m_aSize.Width - aPolySize.Width - 100), + sal_Int32(m_aPosition.Y + (m_aSize.Height / 2.0) - (aPolySize.Height / 2.0)) }); + xContainer->add(xPoly); } } //namespace chart diff --git a/chart2/source/view/main/VButton.hxx b/chart2/source/view/main/VButton.hxx index 9d9e3f28b43e..f0c587386831 100644 --- a/chart2/source/view/main/VButton.hxx +++ b/chart2/source/view/main/VButton.hxx @@ -38,7 +38,7 @@ private: Color m_nArrowColor; Color m_nBGColor; - css::uno::Reference<css::drawing::XShape> + rtl::Reference<SvxShapePolyPolygon> createTriangle(css::awt::Size aSize); public: