summaryrefslogtreecommitdiff
path: root/chart2/source/view/main/VButton.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/view/main/VButton.cxx')
-rw-r--r--chart2/source/view/main/VButton.cxx66
1 files changed, 24 insertions, 42 deletions
diff --git a/chart2/source/view/main/VButton.cxx b/chart2/source/view/main/VButton.cxx
index 088df5850416..25a770fb04bc 100644
--- a/chart2/source/view/main/VButton.cxx
+++ b/chart2/source/view/main/VButton.cxx
@@ -12,21 +12,15 @@
#include <ShapeFactory.hxx>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
-#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-#include <memory>
#include <CommonConverters.hxx>
#include <editeng/unoprnms.hxx>
namespace chart
{
-
using namespace css;
VButton::VButton()
@@ -36,22 +30,15 @@ VButton::VButton()
{
}
-void VButton::init(const uno::Reference<drawing::XShapes>& xTargetPage,
- const uno::Reference<lang::XMultiServiceFactory>& xFactory)
+void VButton::init(const rtl::Reference<SvxShapeGroupAnyD>& xTargetPage)
{
m_xTarget = 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> xProperies(xShape, uno::UNO_QUERY);
+ rtl::Reference<SvxShapePolyPolygon> xShape = new SvxShapePolyPolygon(nullptr);
+ xShape->setShapeKind(SdrObjKind::Polygon);
drawing::PolyPolygonShape3D aPolyPolygon;
aPolyPolygon.SequenceX.realloc(1);
@@ -82,30 +69,27 @@ uno::Reference<drawing::XShape> VButton::createTriangle(awt::Size aSize)
pInnerSequenceY[2] = 0.0;
pInnerSequenceZ[2] = 0.0;
- xProperies->setPropertyValue("Name", uno::makeAny(m_sCID));
- xProperies->setPropertyValue(UNO_NAME_POLYPOLYGON, uno::Any(PolyToPointSequence(aPolyPolygon)));
- xProperies->setPropertyValue("LineStyle", uno::makeAny(drawing::LineStyle_NONE));
- xProperies->setPropertyValue("FillColor", uno::makeAny(m_nArrowColor));
+ xShape->SvxShape::setPropertyValue("Name", uno::Any(m_sCID));
+ xShape->SvxShape::setPropertyValue(UNO_NAME_POLYPOLYGON,
+ uno::Any(PolyToPointSequence(aPolyPolygon)));
+ xShape->SvxShape::setPropertyValue("LineStyle", uno::Any(drawing::LineStyle_NONE));
+ xShape->SvxShape::setPropertyValue("FillColor", uno::Any(m_nArrowColor));
return xShape;
}
void VButton::createShapes(const uno::Reference<beans::XPropertySet>& xTextProp)
{
- ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(m_xShapeFactory);
+ tNameSequence aPropNames;
+ tAnySequence aPropValues;
- std::unique_ptr<tNameSequence> pPropNames(new tNameSequence);
- std::unique_ptr<tAnySequence> pPropValues(new tAnySequence);
+ PropertyMapper::getTextLabelMultiPropertyLists(xTextProp, aPropNames, aPropValues);
- PropertyMapper::getTextLabelMultiPropertyLists(xTextProp, *pPropNames, *pPropValues);
-
- m_xShape.set(pShapeFactory->createGroup2D(m_xTarget, m_sCID), uno::UNO_QUERY);
+ m_xShape = ShapeFactory::createGroup2D(m_xTarget, m_sCID);
m_xShape->setPosition(m_aPosition);
m_xShape->setSize(m_aSize);
- uno::Reference<drawing::XShapes> xContainer(m_xShape, uno::UNO_QUERY);
- if (!xContainer.is())
- return;
+ rtl::Reference<SvxShapeGroupAnyD> xContainer = m_xShape;
tPropertyNameValueMap aTextValueMap;
aTextValueMap["CharHeight"] <<= 10.0f;
@@ -123,10 +107,10 @@ void VButton::createShapes(const uno::Reference<beans::XPropertySet>& xTextProp)
aTextValueMap["Name"] <<= m_sCID; //CID OUString
- PropertyMapper::getMultiPropertyListsFromValueMap(*pPropNames, *pPropValues, aTextValueMap);
+ PropertyMapper::getMultiPropertyListsFromValueMap(aPropNames, aPropValues, aTextValueMap);
- uno::Reference<drawing::XShape> xEntry = pShapeFactory->createText(
- xContainer, m_sLabel, *pPropNames, *pPropValues, uno::Any());
+ rtl::Reference<SvxShapeText> xEntry
+ = ShapeFactory::createText(xContainer, m_sLabel, aPropNames, aPropValues, uno::Any());
if (xEntry.is())
{
@@ -137,16 +121,14 @@ void VButton::createShapes(const uno::Reference<beans::XPropertySet>& xTextProp)
if (!m_bShowArrow)
return;
- awt::Size aPolySize {280, 180};
+ 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