summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-12-29 21:51:30 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-12-30 13:04:54 +0100
commit3f3e011c9bbf5c51df983c2a28b348dcdff3dd3f (patch)
tree6a182b4fc203fb10db2d1a18a077e4007d220e22
parentUpdate git submodules (diff)
downloadcore-3f3e011c9bbf5c51df983c2a28b348dcdff3dd3f.tar.gz
core-3f3e011c9bbf5c51df983c2a28b348dcdff3dd3f.zip
use concrete types in chart2, SvxShapePolyPolygon
Change-Id: Ica53484d44e6992278b8d188ffb536e238aeb195 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127725 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--chart2/source/controller/drawinglayer/ViewElementListProvider.cxx6
-rw-r--r--chart2/source/inc/chartview/DataPointSymbolSupplier.hxx8
-rw-r--r--chart2/source/view/charttypes/AreaChart.cxx2
-rw-r--r--chart2/source/view/charttypes/NetChart.cxx2
-rw-r--r--chart2/source/view/inc/ShapeFactory.hxx2
-rw-r--r--chart2/source/view/main/DataPointSymbolSupplier.cxx11
-rw-r--r--chart2/source/view/main/ShapeFactory.cxx46
-rw-r--r--chart2/source/view/main/VLegendSymbolFactory.cxx2
8 files changed, 35 insertions, 44 deletions
diff --git a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
index 2f037e767f18..c5a63bf19161 100644
--- a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
+++ b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
@@ -119,11 +119,11 @@ SdrObjList* ViewElementListProvider::GetSymbolList() const
//create symbols via uno and convert to native sdr objects
drawing::Direction3D aSymbolSize(220, 220, 0); // should be 250, but 250 -> 280 ??
- uno::Reference<drawing::XShapes> xSymbols
- = DataPointSymbolSupplier::create2DSymbolList(xShapeFactory, xTarget, aSymbolSize);
+ rtl::Reference< SvxShapeGroup > xSymbols
+ = DataPointSymbolSupplier::create2DSymbolList(xTarget, aSymbolSize);
SdrObject* pSdrObject = DrawViewWrapper::getSdrObject(
- uno::Reference<drawing::XShape>(xSymbols, uno::UNO_QUERY));
+ uno::Reference<drawing::XShape>(static_cast<cppu::OWeakObject*>(xSymbols.get()), uno::UNO_QUERY));
if (pSdrObject)
pSymbolList = pSdrObject->GetSubList();
}
diff --git a/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx b/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx
index e028de7957fa..9b236cfb06d5 100644
--- a/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx
+++ b/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx
@@ -21,10 +21,11 @@
#include <chartview/chartviewdllapi.hxx>
#include <com/sun/star/uno/Reference.h>
+#include <rtl/ref.hxx>
+#include <svx/unoshape.hxx>
namespace com::sun::star::drawing { class XShapes; }
namespace com::sun::star::drawing { struct Direction3D; }
-namespace com::sun::star::lang { class XMultiServiceFactory; }
namespace chart
{
@@ -32,9 +33,8 @@ namespace chart
class OOO_DLLPUBLIC_CHARTVIEW DataPointSymbolSupplier
{
public:
- static css::uno::Reference< css::drawing::XShapes >
- create2DSymbolList( const css::uno::Reference< css::lang::XMultiServiceFactory >& xShapeFactory
- , const css::uno::Reference< css::drawing::XShapes >& xTarget
+ static rtl::Reference< SvxShapeGroup >
+ create2DSymbolList( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::drawing::Direction3D& rSize );
};
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index 63e7555b1402..bb26c8b8bae3 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -863,7 +863,7 @@ void AreaChart::createShapes()
if (pSymbolProperties->Style == SymbolStyle_STANDARD)
{
sal_Int32 nSymbol = pSymbolProperties->StandardSymbol;
- m_pShapeFactory->createSymbol2D(
+ ShapeFactory::createSymbol2D(
xPointGroupShape_Shapes, aScenePosition, aSymbolSize,
nSymbol, pSymbolProperties->BorderColor,
pSymbolProperties->FillColor);
diff --git a/chart2/source/view/charttypes/NetChart.cxx b/chart2/source/view/charttypes/NetChart.cxx
index 1f33285344e7..ac6fff743ac5 100644
--- a/chart2/source/view/charttypes/NetChart.cxx
+++ b/chart2/source/view/charttypes/NetChart.cxx
@@ -545,7 +545,7 @@ void NetChart::createShapes()
if (pSymbolProperties->Style == SymbolStyle_STANDARD)
{
sal_Int32 nSymbol = pSymbolProperties->StandardSymbol;
- m_pShapeFactory->createSymbol2D(
+ ShapeFactory::createSymbol2D(
xPointGroupShape_Shapes, aScenePosition, aSymbolSize, nSymbol,
pSymbolProperties->BorderColor, pSymbolProperties->FillColor);
}
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index cba783dd8886..6d747f78c633 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -153,7 +153,7 @@ public:
createArea2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::drawing::PolyPolygonShape3D& rPolyPolygon);
- css::uno::Reference< css::drawing::XShape >
+ static rtl::Reference<SvxShapePolyPolygon>
createSymbol2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::drawing::Position3D& rPos
, const css::drawing::Direction3D& rSize
diff --git a/chart2/source/view/main/DataPointSymbolSupplier.cxx b/chart2/source/view/main/DataPointSymbolSupplier.cxx
index 740776475cf6..ba112e082b33 100644
--- a/chart2/source/view/main/DataPointSymbolSupplier.cxx
+++ b/chart2/source/view/main/DataPointSymbolSupplier.cxx
@@ -25,19 +25,16 @@ namespace chart
{
using namespace ::com::sun::star;
-uno::Reference< drawing::XShapes > DataPointSymbolSupplier::create2DSymbolList(
- const uno::Reference< lang::XMultiServiceFactory >& xShapeFactory
- , const uno::Reference< drawing::XShapes >& xTarget
+rtl::Reference< SvxShapeGroup > DataPointSymbolSupplier::create2DSymbolList(
+ const uno::Reference< drawing::XShapes >& xTarget
, const drawing::Direction3D& rSize )
{
- ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(xShapeFactory);
- uno::Reference< drawing::XShapes > xGroupShapes =
- ShapeFactory::createGroup2D( xTarget );
+ rtl::Reference< SvxShapeGroup > xGroupShapes = ShapeFactory::createGroup2D( xTarget );
drawing::Position3D aPos(0,0,0);
for(sal_Int32 nS=0;nS<ShapeFactory::getSymbolCount();nS++)
{
- pShapeFactory->createSymbol2D( xGroupShapes, aPos, rSize, nS, 0, 0 );
+ ShapeFactory::createSymbol2D( xGroupShapes, aPos, rSize, nS, 0, 0 );
}
return xGroupShapes;
}
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index 310907405cda..ac6974a7e0fc 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -1654,7 +1654,7 @@ static drawing::PolyPolygonShape3D createPolyPolygon_Symbol( const drawing::Posi
return aPP;
}
-uno::Reference< drawing::XShape >
+rtl::Reference<SvxShapePolyPolygon>
ShapeFactory::createSymbol2D(
const uno::Reference< drawing::XShapes >& xTarget
, const drawing::Position3D& rPosition
@@ -1667,37 +1667,31 @@ uno::Reference< drawing::XShape >
return nullptr;
//create shape
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.PolyPolygonShape" ), uno::UNO_QUERY );
- xTarget->add(xShape);
+ rtl::Reference<SvxShapePolyPolygon> xShape = new SvxShapePolyPolygon(nullptr);
+ xShape->setShapeKind(OBJ_POLY);
+ xTarget->add(uno::Reference<drawing::XShape>(xShape));
//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
- {
- drawing::PointSequenceSequence aPoints( PolyToPointSequence(
- createPolyPolygon_Symbol( rPosition, rSize, nStandardSymbol ) ));
+ drawing::PointSequenceSequence aPoints( PolyToPointSequence(
+ createPolyPolygon_Symbol( rPosition, rSize, nStandardSymbol ) ));
- //Polygon
- xProp->setPropertyValue( UNO_NAME_POLYPOLYGON
- , uno::Any( aPoints ) );
+ //Polygon
+ xShape->SvxShape::setPropertyValue( UNO_NAME_POLYPOLYGON
+ , uno::Any( aPoints ) );
- //LineColor
- xProp->setPropertyValue( UNO_NAME_LINECOLOR
- , uno::Any( nBorderColor ) );
+ //LineColor
+ xShape->SvxShape::setPropertyValue( UNO_NAME_LINECOLOR
+ , uno::Any( nBorderColor ) );
- //FillColor
- xProp->setPropertyValue( UNO_NAME_FILLCOLOR
- , uno::Any( nFillColor ) );
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ //FillColor
+ xShape->SvxShape::setPropertyValue( UNO_NAME_FILLCOLOR
+ , uno::Any( nFillColor ) );
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
return xShape;
}
diff --git a/chart2/source/view/main/VLegendSymbolFactory.cxx b/chart2/source/view/main/VLegendSymbolFactory.cxx
index 70931e9ff7fd..54bc3da664fc 100644
--- a/chart2/source/view/main/VLegendSymbolFactory.cxx
+++ b/chart2/source/view/main/VLegendSymbolFactory.cxx
@@ -142,7 +142,7 @@ rtl::Reference< SvxShapeGroup > VLegendSymbolFactory::createSymbol(
// border of symbols always same as fill color
aSymbol.BorderColor = aSymbol.FillColor;
- xSymbol.set( pFactory->createSymbol2D(
+ xSymbol.set( ShapeFactory::createSymbol2D(
xResultGroup,
aPos,
aSymbolSize,