diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-01-02 20:49:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-03 07:46:45 +0100 |
commit | 7c36f46a1ea35633d64c44a2ee1e834b1f88cc8d (patch) | |
tree | 9cd0edfd08b67053ed5ff64e6d523166478baf34 /chart2/source/view/main | |
parent | 5f41e5741fa3abe59dd14a50e692d425eed472d5 (diff) |
add new SvxShape hierarchy class
to serve as a shared/common base class, so I can plumb
SvxShape types through chart2.
Change-Id: I8758fff1599c92a214b334ee44cf7b4e582c1915
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127873
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/view/main')
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 22 | ||||
-rw-r--r-- | chart2/source/view/main/DataPointSymbolSupplier.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/main/LabelPositionHelper.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/main/PlotterBase.cxx | 8 | ||||
-rw-r--r-- | chart2/source/view/main/PlottingPositionHelper.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/main/PolarLabelPositionHelper.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/main/ShapeFactory.cxx | 106 | ||||
-rw-r--r-- | chart2/source/view/main/VButton.cxx | 5 | ||||
-rw-r--r-- | chart2/source/view/main/VButton.hxx | 4 | ||||
-rw-r--r-- | chart2/source/view/main/VLegend.cxx | 10 | ||||
-rw-r--r-- | chart2/source/view/main/VLegend.hxx | 4 | ||||
-rw-r--r-- | chart2/source/view/main/VLegendSymbolFactory.cxx | 7 | ||||
-rw-r--r-- | chart2/source/view/main/VTitle.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/main/VTitle.hxx | 5 |
14 files changed, 104 insertions, 77 deletions
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 85e4e5fcb7f1..97fd3ab42dab 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1440,8 +1440,8 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D drawing::Direction3D aPreferredAspectRatio = rParam.mpSeriesPlotterContainer->getPreferredAspectRatio(); - uno::Reference< drawing::XShapes > xSeriesTargetInFrontOfAxis; - uno::Reference< drawing::XShapes > xSeriesTargetBehindAxis; + rtl::Reference<SvxShapeGroupAnyD> xSeriesTargetInFrontOfAxis; + rtl::Reference<SvxShapeGroupAnyD> xSeriesTargetBehindAxis; VDiagram aVDiagram(xDiagram, aPreferredAspectRatio, nDimensionCount); {//create diagram aVDiagram.init(rParam.mxDiagramWithAxesShapes, m_xShapeFactory); @@ -1536,7 +1536,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D for( const std::unique_ptr<VSeriesPlotter>& aPlotter : rSeriesPlotterList ) { VSeriesPlotter* pSeriesPlotter = aPlotter.get(); - uno::Reference< drawing::XShapes > xSeriesTarget; + rtl::Reference<SvxShapeGroupAnyD> xSeriesTarget; if( pSeriesPlotter->WantToPlotInFrontOfAxisLine() ) xSeriesTarget = xSeriesTargetInFrontOfAxis; else @@ -2066,7 +2066,7 @@ void changePositionOfAxisTitle( VTitle* pVTitle, TitleAlignment eAlignment } std::shared_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType - , const uno::Reference< drawing::XShapes>& xPageShapes + , const rtl::Reference<SvxShapeGroupAnyD>& xPageShapes , const uno::Reference< lang::XMultiServiceFactory>& xShapeFactory , ChartModel& rModel , awt::Rectangle& rRemainingSpace @@ -2200,7 +2200,7 @@ std::shared_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType } bool lcl_createLegend( const uno::Reference< XLegend > & xLegend - , const uno::Reference< drawing::XShapes>& xPageShapes + , const rtl::Reference<SvxShapeGroupAnyD>& xPageShapes , const uno::Reference< lang::XMultiServiceFactory>& xShapeFactory , const uno::Reference< uno::XComponentContext > & xContext , awt::Rectangle & rRemainingSpace @@ -2222,7 +2222,7 @@ bool lcl_createLegend( const uno::Reference< XLegend > & xLegend return true; } -void lcl_createButtons(const uno::Reference<drawing::XShapes>& xPageShapes, +void lcl_createButtons(const rtl::Reference<SvxShapeGroupAnyD>& xPageShapes, const uno::Reference<lang::XMultiServiceFactory>& xShapeFactory, ChartModel& rModel, awt::Rectangle& rRemainingSpace) @@ -2296,8 +2296,7 @@ void lcl_createButtons(const uno::Reference<drawing::XShapes>& xPageShapes, void formatPage( ChartModel& rChartModel , const awt::Size& rPageSize - , const uno::Reference< drawing::XShapes >& xTarget - , const uno::Reference< lang::XMultiServiceFactory>& xShapeFactory + , const rtl::Reference<SvxShapeGroupAnyD>& xTarget ) { try @@ -2306,9 +2305,6 @@ void formatPage( if( ! xModelPage.is()) return; - if( !xShapeFactory.is() ) - return; - //format page tPropertyNameValueMap aNameValueMap; PropertyMapper::getValueMap( aNameValueMap, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), xModelPage ); @@ -2836,7 +2832,7 @@ OUString ChartView::dump() uno::Reference< drawing::XShapes > xShape(m_xDrawPage->getByIndex(i), uno::UNO_QUERY); if(xShape.is()) { - OUString aString = XShapeDumper::dump(mxRootShape); + OUString aString = XShapeDumper::dump(uno::Reference<drawing::XShapes>(mxRootShape)); aBuffer.append(aString); } else @@ -2885,7 +2881,7 @@ void ChartView::createShapes2D( const awt::Size& rPageSize ) { // todo: it would be nicer to just pass the page m_xDrawPage and format it, // but the draw page does not support XPropertySet - formatPage( mrChartModel, rPageSize, mxRootShape, m_xShapeFactory ); + formatPage( mrChartModel, rPageSize, mxRootShape ); CreateShapeParam2D aParam; aParam.maRemainingSpace.X = 0; diff --git a/chart2/source/view/main/DataPointSymbolSupplier.cxx b/chart2/source/view/main/DataPointSymbolSupplier.cxx index ba112e082b33..ff7f8370ac32 100644 --- a/chart2/source/view/main/DataPointSymbolSupplier.cxx +++ b/chart2/source/view/main/DataPointSymbolSupplier.cxx @@ -26,7 +26,7 @@ namespace chart using namespace ::com::sun::star; rtl::Reference< SvxShapeGroup > DataPointSymbolSupplier::create2DSymbolList( - const uno::Reference< drawing::XShapes >& xTarget + const rtl::Reference<SvxDrawPage>& xTarget , const drawing::Direction3D& rSize ) { rtl::Reference< SvxShapeGroup > xGroupShapes = ShapeFactory::createGroup2D( xTarget ); diff --git a/chart2/source/view/main/LabelPositionHelper.cxx b/chart2/source/view/main/LabelPositionHelper.cxx index c427e429fb44..a632947758c9 100644 --- a/chart2/source/view/main/LabelPositionHelper.cxx +++ b/chart2/source/view/main/LabelPositionHelper.cxx @@ -35,7 +35,7 @@ using namespace ::com::sun::star::chart2; LabelPositionHelper::LabelPositionHelper( sal_Int32 nDimensionCount - , const uno::Reference< drawing::XShapes >& xLogicTarget) + , const rtl::Reference<SvxShapeGroupAnyD>& xLogicTarget) : m_nDimensionCount(nDimensionCount) , m_xLogicTarget(xLogicTarget) { diff --git a/chart2/source/view/main/PlotterBase.cxx b/chart2/source/view/main/PlotterBase.cxx index 382d3fa7a18a..93c80ca1574e 100644 --- a/chart2/source/view/main/PlotterBase.cxx +++ b/chart2/source/view/main/PlotterBase.cxx @@ -34,8 +34,8 @@ PlotterBase::PlotterBase( sal_Int32 nDimensionCount ) { } -void PlotterBase::initPlotter( const uno::Reference< drawing::XShapes >& xLogicTarget - , const uno::Reference< drawing::XShapes >& xFinalTarget +void PlotterBase::initPlotter( const rtl::Reference<SvxShapeGroupAnyD>& xLogicTarget + , const rtl::Reference<SvxShapeGroupAnyD>& xFinalTarget , const uno::Reference< lang::XMultiServiceFactory >& xShapeFactory , const OUString& rCID ) { @@ -72,8 +72,8 @@ void PlotterBase::setTransformationSceneToScreen( const drawing::HomogenMatrix& m_pPosHelper->setTransformationSceneToScreen( rMatrix ); } -uno::Reference< drawing::XShapes > PlotterBase::createGroupShape( - const uno::Reference< drawing::XShapes >& xTarget +rtl::Reference<SvxShapeGroupAnyD> PlotterBase::createGroupShape( + const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const OUString& rName ) { if(!m_xShapeFactory.is()) diff --git a/chart2/source/view/main/PlottingPositionHelper.cxx b/chart2/source/view/main/PlottingPositionHelper.cxx index e105393236d5..350c0942ae78 100644 --- a/chart2/source/view/main/PlottingPositionHelper.cxx +++ b/chart2/source/view/main/PlottingPositionHelper.cxx @@ -193,7 +193,7 @@ drawing::Position3D PlottingPositionHelper::transformScaledLogicToScene( } awt::Point PlottingPositionHelper::transformSceneToScreenPosition( const drawing::Position3D& rScenePosition3D - , const uno::Reference< drawing::XShapes >& xSceneTarget + , const rtl::Reference<SvxShapeGroupAnyD>& xSceneTarget , sal_Int32 nDimensionCount ) { //@todo would like to have a cheaper method to do this transformation diff --git a/chart2/source/view/main/PolarLabelPositionHelper.cxx b/chart2/source/view/main/PolarLabelPositionHelper.cxx index 8ca4a44ac46e..d5c819954a91 100644 --- a/chart2/source/view/main/PolarLabelPositionHelper.cxx +++ b/chart2/source/view/main/PolarLabelPositionHelper.cxx @@ -32,7 +32,7 @@ using namespace ::com::sun::star::chart2; PolarLabelPositionHelper::PolarLabelPositionHelper( PolarPlottingPositionHelper* pPosHelper , sal_Int32 nDimensionCount - , const uno::Reference< drawing::XShapes >& xLogicTarget ) + , const rtl::Reference<SvxShapeGroupAnyD>& xLogicTarget ) : LabelPositionHelper( nDimensionCount, xLogicTarget ) , m_pPosHelper(pPosHelper) { diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx index 45c63c425646..afcea1802274 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -83,10 +83,10 @@ void lcl_addProperty(uno::Sequence<OUString> & rPropertyNames, uno::Sequence<uno } // end anonymous namespace -uno::Reference< drawing::XShapes > ShapeFactory::getOrCreateChartRootShape( +rtl::Reference<SvxShapeGroupAnyD> ShapeFactory::getOrCreateChartRootShape( const rtl::Reference<SvxDrawPage>& xDrawPage ) { - uno::Reference<drawing::XShapes> xRet = ShapeFactory::getChartRootShape(xDrawPage); + rtl::Reference<SvxShapeGroupAnyD> xRet = ShapeFactory::getChartRootShape(xDrawPage); if (xRet.is()) return xRet; @@ -98,13 +98,12 @@ uno::Reference< drawing::XShapes > ShapeFactory::getOrCreateChartRootShape( xDrawPage->addBottom(xShape); setShapeName(xShapeGroup, "com.sun.star.chart2.shapes"); - xShape->setSize(awt::Size(0,0)); + xShapeGroup->setSize(awt::Size(0,0)); - xRet.set(xShape, uno::UNO_QUERY); - return xRet; + return xShapeGroup; } -void ShapeFactory::setPageSize(const uno::Reference<drawing::XShapes>&, const awt::Size&) {} +void ShapeFactory::setPageSize(const rtl::Reference<SvxShapeGroupAnyD>&, const awt::Size&) {} // diverse tools::PolyPolygon create methods @@ -360,7 +359,7 @@ static uno::Any createPolyPolygon_Cone( double fHeight, double fRadius, double f rtl::Reference<Svx3DExtrudeObject> ShapeFactory::createCube( - const uno::Reference<drawing::XShapes>& xTarget + const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize , sal_Int32 nRotateZAngleHundredthDegree , const uno::Reference< beans::XPropertySet >& xSourceProp @@ -394,7 +393,7 @@ rtl::Reference<Svx3DExtrudeObject> rtl::Reference<Svx3DExtrudeObject> ShapeFactory::impl_createCube( - const uno::Reference<drawing::XShapes>& xTarget + const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize , sal_Int32 nRotateZAngleHundredthDegree , bool bRounded ) @@ -450,7 +449,7 @@ rtl::Reference<Svx3DExtrudeObject> rtl::Reference<Svx3DLatheObject> ShapeFactory::createCylinder( - const uno::Reference<drawing::XShapes>& xTarget + const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize , sal_Int32 nRotateZAngleHundredthDegree ) { @@ -460,7 +459,7 @@ rtl::Reference<Svx3DLatheObject> rtl::Reference<Svx3DSceneObject> ShapeFactory::createPyramid( - const uno::Reference<drawing::XShapes>& xTarget + const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize , double fTopHeight, bool bRotateZ , const uno::Reference< beans::XPropertySet >& xSourceProp @@ -620,7 +619,7 @@ rtl::Reference<Svx3DSceneObject> rtl::Reference<Svx3DLatheObject> ShapeFactory::createCone( - const uno::Reference<drawing::XShapes>& xTarget + const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree ) { @@ -629,7 +628,7 @@ rtl::Reference<Svx3DLatheObject> rtl::Reference<Svx3DLatheObject> ShapeFactory::impl_createConeOrCylinder( - const uno::Reference<drawing::XShapes>& xTarget + const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree , bool bCylinder ) @@ -852,7 +851,7 @@ static drawing::PolyPolygonBezierCoords getRingBezierCoords( rtl::Reference<SvxShapePolyPolygon> ShapeFactory::createPieSegment2D( - const uno::Reference< drawing::XShapes >& xTarget + const rtl::Reference<SvxShapeGroupAnyD>& xTarget , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius , const drawing::Direction3D& rOffset @@ -898,7 +897,7 @@ rtl::Reference<SvxShapePolyPolygon> rtl::Reference<Svx3DExtrudeObject> ShapeFactory::createPieSegment( - const uno::Reference< drawing::XShapes >& xTarget + const rtl::Reference<SvxShapeGroupAnyD>& xTarget , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius , const drawing::Direction3D& rOffset @@ -973,7 +972,7 @@ rtl::Reference<Svx3DExtrudeObject> } rtl::Reference<Svx3DPolygonObject> - ShapeFactory::createStripe( const uno::Reference< drawing::XShapes >& xTarget + ShapeFactory::createStripe( const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const Stripe& rStripe , const uno::Reference< beans::XPropertySet >& xSourceProp , const tPropertyNameMap& rPropertyNameMap @@ -1028,7 +1027,7 @@ rtl::Reference<Svx3DPolygonObject> } rtl::Reference<Svx3DExtrudeObject> - ShapeFactory::createArea3D( const uno::Reference< drawing::XShapes >& xTarget + ShapeFactory::createArea3D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const drawing::PolyPolygonShape3D& rPolyPolygon , double fDepth ) { @@ -1082,7 +1081,7 @@ rtl::Reference<Svx3DExtrudeObject> rtl::Reference<SvxShapePolyPolygon> - ShapeFactory::createArea2D( const uno::Reference< drawing::XShapes >& xTarget + ShapeFactory::createArea2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const drawing::PolyPolygonShape3D& rPolyPolygon ) { if( !xTarget.is() ) @@ -1618,7 +1617,7 @@ static drawing::PolyPolygonShape3D createPolyPolygon_Symbol( const drawing::Posi rtl::Reference<SvxShapePolyPolygon> ShapeFactory::createSymbol2D( - const uno::Reference< drawing::XShapes >& xTarget + const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const drawing::Position3D& rPosition , const drawing::Direction3D& rSize , sal_Int32 nStandardSymbol @@ -1660,7 +1659,7 @@ rtl::Reference<SvxShapePolyPolygon> rtl::Reference<SvxGraphicObject> ShapeFactory::createGraphic2D( - const uno::Reference< drawing::XShapes >& xTarget + const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const drawing::Position3D& rPosition , const drawing::Direction3D& rSize , const uno::Reference< graphic::XGraphic >& xGraphic ) @@ -1702,7 +1701,39 @@ rtl::Reference<SvxGraphicObject> } rtl::Reference< SvxShapeGroup > - ShapeFactory::createGroup2D( const uno::Reference< drawing::XShapes >& xTarget + ShapeFactory::createGroup2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget + , const OUString& aName ) +{ + if( !xTarget.is() ) + return nullptr; + try + { + //create and add to target + rtl::Reference<SvxShapeGroup> xShapeGroup = new SvxShapeGroup(nullptr, nullptr); + xShapeGroup->setShapeKind(OBJ_GRUP); + uno::Reference< drawing::XShape > xShape(static_cast<cppu::OWeakObject*>(xShapeGroup.get()), uno::UNO_QUERY_THROW); + xTarget->add(xShape); + + //set name + if(!aName.isEmpty()) + setShapeName( xShapeGroup, aName ); + + {//workaround + //need this null size as otherwise empty group shapes where painted with a gray border + xShapeGroup->setSize(awt::Size(0,0)); + } + + return xShapeGroup; + } + catch( const uno::Exception& ) + { + TOOLS_WARN_EXCEPTION("chart2", "" ); + } + return nullptr; +} + +rtl::Reference< SvxShapeGroup > + ShapeFactory::createGroup2D( const rtl::Reference<SvxDrawPage>& xTarget , const OUString& aName ) { if( !xTarget.is() ) @@ -1734,7 +1765,7 @@ rtl::Reference< SvxShapeGroup > } rtl::Reference<Svx3DSceneObject> - ShapeFactory::createGroup3D( const uno::Reference< drawing::XShapes >& xTarget + ShapeFactory::createGroup3D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const OUString& aName ) { if( !xTarget.is() ) @@ -1776,7 +1807,7 @@ rtl::Reference<Svx3DSceneObject> } rtl::Reference<SvxShapeCircle> - ShapeFactory::createCircle2D( const uno::Reference< drawing::XShapes >& xTarget + ShapeFactory::createCircle2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const drawing::Position3D& rPosition , const drawing::Direction3D& rSize ) { @@ -1815,7 +1846,7 @@ rtl::Reference<SvxShapeCircle> } rtl::Reference<SvxShapeCircle> - ShapeFactory::createCircle( const uno::Reference< drawing::XShapes >& xTarget + ShapeFactory::createCircle( const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const awt::Size& rSize , const awt::Point& rPosition ) { @@ -1829,7 +1860,7 @@ rtl::Reference<SvxShapeCircle> } rtl::Reference<Svx3DPolygonObject> - ShapeFactory::createLine3D( const uno::Reference< drawing::XShapes >& xTarget + ShapeFactory::createLine3D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const drawing::PolyPolygonShape3D& rPoints , const VLineProperties& rLineProperties ) { @@ -1898,7 +1929,7 @@ rtl::Reference<Svx3DPolygonObject> } rtl::Reference<SvxShapePolyPolygon> - ShapeFactory::createLine2D( const uno::Reference< drawing::XShapes >& xTarget + ShapeFactory::createLine2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const drawing::PointSequenceSequence& rPoints , const VLineProperties* pLineProperties ) { @@ -1961,7 +1992,7 @@ rtl::Reference<SvxShapePolyPolygon> } rtl::Reference<SvxShapePolyPolygon> - ShapeFactory::createLine ( const uno::Reference< drawing::XShapes >& xTarget, + ShapeFactory::createLine ( const rtl::Reference<SvxShapeGroupAnyD>& xTarget, const awt::Size& rSize, const awt::Point& rPosition ) { //create shape @@ -1975,7 +2006,7 @@ rtl::Reference<SvxShapePolyPolygon> } rtl::Reference<SvxShapeRect> ShapeFactory::createInvisibleRectangle( - const uno::Reference< drawing::XShapes >& xTarget + const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const awt::Size& rSize ) { try @@ -1998,7 +2029,7 @@ rtl::Reference<SvxShapeRect> ShapeFactory::createInvisibleRectangle( } rtl::Reference<SvxShapeRect> ShapeFactory::createRectangle( - const uno::Reference< drawing::XShapes >& xTarget, + const rtl::Reference<SvxShapeGroupAnyD>& xTarget, const awt::Size& rSize, const awt::Point& rPosition, const tNameSequence& rPropNames, @@ -2009,7 +2040,7 @@ rtl::Reference<SvxShapeRect> ShapeFactory::createRectangle( xShape->setShapeKind(OBJ_RECT); if (ePos == StackPosition::Bottom) { - uno::Reference<drawing::XShapes2> xTarget2(xTarget, uno::UNO_QUERY); + uno::Reference<drawing::XShapes2> xTarget2(static_cast<cppu::OWeakObject*>(xTarget.get()), uno::UNO_QUERY); if (xTarget2.is()) xTarget2->addBottom(xShape); } @@ -2025,7 +2056,7 @@ rtl::Reference<SvxShapeRect> ShapeFactory::createRectangle( rtl::Reference<SvxShapeRect> ShapeFactory::createRectangle( - const uno::Reference< drawing::XShapes >& xTarget ) + const rtl::Reference<SvxShapeGroupAnyD>& xTarget ) { rtl::Reference<SvxShapeRect> xShape = new SvxShapeRect(nullptr); xShape->setShapeKind(OBJ_RECT); @@ -2035,7 +2066,7 @@ rtl::Reference<SvxShapeRect> } rtl::Reference<SvxShapeText> - ShapeFactory::createText( const uno::Reference< drawing::XShapes >& xTarget + ShapeFactory::createText( const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const OUString& rText , const tNameSequence& rPropNames , const tAnySequence& rPropValues @@ -2076,7 +2107,7 @@ rtl::Reference<SvxShapeText> } rtl::Reference<SvxShapeText> - ShapeFactory::createText( const uno::Reference< drawing::XShapes >& xTarget + ShapeFactory::createText( const rtl::Reference<SvxShapeGroupAnyD>& xTarget , uno::Sequence< uno::Reference< chart2::XFormattedString > >& xFormattedString , const tNameSequence& rPropNames , const tAnySequence& rPropValues @@ -2161,7 +2192,7 @@ rtl::Reference<SvxShapeText> } rtl::Reference<SvxShapeText> - ShapeFactory::createText( const uno::Reference< drawing::XShapes >& xTarget, + ShapeFactory::createText( const rtl::Reference<SvxShapeGroupAnyD>& xTarget, const awt::Size& rSize, const awt::Point& rPos, uno::Sequence< uno::Reference< chart2::XFormattedString > >& xFormattedString, @@ -2310,10 +2341,10 @@ ShapeFactory* ShapeFactory::getOrCreateShapeFactory(const uno::Reference< lang:: return pShapeFactory; } -uno::Reference< drawing::XShapes > ShapeFactory::getChartRootShape( +rtl::Reference<SvxShapeGroupAnyD> ShapeFactory::getChartRootShape( const rtl::Reference<SvxDrawPage>& xDrawPage ) { - uno::Reference< drawing::XShapes > xRet; + rtl::Reference<SvxShapeGroupAnyD> xRet; const uno::Reference< drawing::XShapes > xShapes = xDrawPage; if( xShapes.is() ) { @@ -2325,7 +2356,8 @@ uno::Reference< drawing::XShapes > ShapeFactory::getChartRootShape( { if( ShapeFactory::getShapeName( xShape ) == "com.sun.star.chart2.shapes" ) { - xRet.set( xShape, uno::UNO_QUERY ); + xRet = dynamic_cast<SvxShapeGroupAnyD*>(xShape.get()); + assert(xRet); break; } } @@ -2510,7 +2542,7 @@ awt::Size ShapeFactory::getSizeAfterRotation( return aRet; } -void ShapeFactory::removeSubShapes( const uno::Reference< drawing::XShapes >& xShapes ) +void ShapeFactory::removeSubShapes( const rtl::Reference<SvxShapeGroupAnyD>& xShapes ) { if( xShapes.is() ) { diff --git a/chart2/source/view/main/VButton.cxx b/chart2/source/view/main/VButton.cxx index b28f42d6f52f..d19f3ef4fa0d 100644 --- a/chart2/source/view/main/VButton.cxx +++ b/chart2/source/view/main/VButton.cxx @@ -35,7 +35,7 @@ VButton::VButton() { } -void VButton::init(const uno::Reference<drawing::XShapes>& xTargetPage, +void VButton::init(const rtl::Reference<SvxShapeGroupAnyD>& xTargetPage, const uno::Reference<lang::XMultiServiceFactory>& xFactory) { m_xTarget = xTargetPage; @@ -102,8 +102,7 @@ void VButton::createShapes(const uno::Reference<beans::XPropertySet>& xTextProp) m_xShape->setPosition(m_aPosition); m_xShape->setSize(m_aSize); - uno::Reference<drawing::XShapes> xContainer(static_cast<cppu::OWeakObject*>(m_xShape.get()), - uno::UNO_QUERY_THROW); + rtl::Reference<SvxShapeGroupAnyD> xContainer = m_xShape; tPropertyNameValueMap aTextValueMap; aTextValueMap["CharHeight"] <<= 10.0f; diff --git a/chart2/source/view/main/VButton.hxx b/chart2/source/view/main/VButton.hxx index 35761e349991..9d9e3f28b43e 100644 --- a/chart2/source/view/main/VButton.hxx +++ b/chart2/source/view/main/VButton.hxx @@ -28,7 +28,7 @@ class VButton final { private: css::uno::Reference<css::lang::XMultiServiceFactory> m_xShapeFactory; - css::uno::Reference<css::drawing::XShapes> m_xTarget; + rtl::Reference<SvxShapeGroupAnyD> m_xTarget; rtl::Reference<SvxShapeGroup> m_xShape; OUString m_sLabel; OUString m_sCID; @@ -44,7 +44,7 @@ private: public: VButton(); - void init(const css::uno::Reference<css::drawing::XShapes>& xTargetPage, + void init(const rtl::Reference<SvxShapeGroupAnyD>& xTargetPage, const css::uno::Reference<css::lang::XMultiServiceFactory>& xFactory); void createShapes(const css::uno::Reference<css::beans::XPropertySet>& xTextProp); diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index 370093d636e7..9ed83a77b086 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -149,7 +149,7 @@ void lcl_getProperties( awt::Size lcl_createTextShapes( const std::vector<ViewLegendEntry> & rEntries, - const Reference< drawing::XShapes > & xTarget, + const rtl::Reference<SvxShapeGroupAnyD> & xTarget, std::vector< rtl::Reference<SvxShapeText> > & rOutTextShapes, const tPropertyValues & rTextProperties ) { @@ -265,7 +265,7 @@ awt::Size lcl_placeLegendEntries( double fViewFontSize, const awt::Size& rMaxSymbolExtent, tPropertyValues & rTextProperties, - const Reference< drawing::XShapes > & xTarget, + const rtl::Reference<SvxShapeGroupAnyD> & xTarget, const awt::Size& rRemainingSpace, sal_Int32 nYStartPosition, const awt::Size& rPageSize, @@ -820,7 +820,7 @@ bool lcl_shouldSymbolsBePlacedOnTheLeftSide( const Reference< beans::XPropertySe } std::vector<std::shared_ptr<VButton>> lcl_createButtons( - uno::Reference<drawing::XShapes> const & xLegendContainer, + rtl::Reference<SvxShapeGroupAnyD> const & xLegendContainer, uno::Reference<lang::XMultiServiceFactory> const & xShapeFactory, ChartModel& rModel, bool bPlaceButtonsVertically, tools::Long & nUsedHeight) { @@ -875,7 +875,7 @@ VLegend::VLegend( const Reference< XLegend > & xLegend, const Reference< uno::XComponentContext > & xContext, std::vector< LegendEntryProvider* >&& rLegendEntryProviderList, - const Reference< drawing::XShapes >& xTargetPage, + const rtl::Reference<SvxShapeGroupAnyD>& xTargetPage, const Reference< lang::XMultiServiceFactory >& xFactory, ChartModel& rModel ) : m_xTarget(xTargetPage) @@ -930,7 +930,7 @@ void VLegend::createShapes( ObjectIdentifier::createClassifiedIdentifierForParticle( aLegendParticle ) ); // create and insert sub-shapes - Reference< drawing::XShapes > xLegendContainer = m_xShape; + rtl::Reference<SvxShapeGroupAnyD> xLegendContainer = m_xShape; if( xLegendContainer.is() ) { // for quickly setting properties diff --git a/chart2/source/view/main/VLegend.hxx b/chart2/source/view/main/VLegend.hxx index d4963cd69671..6750cc780465 100644 --- a/chart2/source/view/main/VLegend.hxx +++ b/chart2/source/view/main/VLegend.hxx @@ -43,7 +43,7 @@ public: VLegend( const css::uno::Reference< css::chart2::XLegend > & xLegend, const css::uno::Reference< css::uno::XComponentContext > & xContext, std::vector< LegendEntryProvider* >&& rLegendEntryProviderList, - const css::uno::Reference< css::drawing::XShapes >& xTargetPage, + const rtl::Reference<SvxShapeGroupAnyD>& xTargetPage, const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory, ChartModel& rModel ); @@ -71,7 +71,7 @@ public: const css::uno::Reference< css::chart2::XLegend > & xLegend ); private: - css::uno::Reference< css::drawing::XShapes > m_xTarget; + rtl::Reference<SvxShapeGroupAnyD> m_xTarget; css::uno::Reference< css::lang::XMultiServiceFactory> m_xShapeFactory; css::uno::Reference< css::chart2::XLegend > m_xLegend; rtl::Reference< SvxShapeGroup > m_xShape; diff --git a/chart2/source/view/main/VLegendSymbolFactory.cxx b/chart2/source/view/main/VLegendSymbolFactory.cxx index d70a5e09af1d..f4bec2397d89 100644 --- a/chart2/source/view/main/VLegendSymbolFactory.cxx +++ b/chart2/source/view/main/VLegendSymbolFactory.cxx @@ -92,22 +92,21 @@ namespace chart rtl::Reference< SvxShapeGroup > VLegendSymbolFactory::createSymbol( const awt::Size& rEntryKeyAspectRatio, - const Reference< drawing::XShapes >& rSymbolContainer, + const rtl::Reference<SvxShapeGroupAnyD>& rSymbolContainer, LegendSymbolStyle eStyle, - const Reference< lang::XMultiServiceFactory > & xShapeFactory, const Reference< beans::XPropertySet > & xLegendEntryProperties, PropertyType ePropertyType, const uno::Any& rExplicitSymbol ) { rtl::Reference< SvxShapeGroup > xResult; - if( ! (rSymbolContainer.is() && xShapeFactory.is())) + if( !rSymbolContainer) return xResult; xResult = ShapeFactory::createGroup2D( rSymbolContainer ); if( ! xResult) return xResult; - Reference< drawing::XShapes > xResultGroup( static_cast<cppu::OWeakObject*>(xResult.get()), uno::UNO_QUERY_THROW ); + rtl::Reference<SvxShapeGroupAnyD> xResultGroup = xResult; // add an invisible square box to maintain aspect ratio ShapeFactory::createInvisibleRectangle( xResultGroup, rEntryKeyAspectRatio ); diff --git a/chart2/source/view/main/VTitle.cxx b/chart2/source/view/main/VTitle.cxx index d50d11f10a69..16c09cc08bd8 100644 --- a/chart2/source/view/main/VTitle.cxx +++ b/chart2/source/view/main/VTitle.cxx @@ -43,7 +43,7 @@ VTitle::~VTitle() } void VTitle::init( - const uno::Reference< drawing::XShapes >& xTargetPage + const rtl::Reference<SvxShapeGroupAnyD>& xTargetPage , const uno::Reference< lang::XMultiServiceFactory >& xFactory , const OUString& rCID ) { diff --git a/chart2/source/view/main/VTitle.hxx b/chart2/source/view/main/VTitle.hxx index ad3d1d815b88..69b7edd0cfb4 100644 --- a/chart2/source/view/main/VTitle.hxx +++ b/chart2/source/view/main/VTitle.hxx @@ -23,6 +23,7 @@ #include <rtl/ustring.hxx> #include <rtl/ref.hxx> #include <sal/types.h> +#include <svx/unoshape.hxx> namespace com::sun::star::awt { struct Point; } namespace com::sun::star::chart2 { class XTitle; } @@ -40,7 +41,7 @@ public: explicit VTitle( const css::uno::Reference< css::chart2::XTitle > & xTitle ); ~VTitle(); - void init( const css::uno::Reference< css::drawing::XShapes >& xTargetPage + void init( const rtl::Reference<SvxShapeGroupAnyD>& xTargetPage , const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , const OUString& rCID ); @@ -57,7 +58,7 @@ public: const css::uno::Reference< css::chart2::XTitle > & xTitle); private: - css::uno::Reference< css::drawing::XShapes > m_xTarget; + rtl::Reference<SvxShapeGroupAnyD> m_xTarget; css::uno::Reference< css::lang::XMultiServiceFactory> m_xShapeFactory; css::uno::Reference< css::chart2::XTitle > m_xTitle; rtl::Reference<SvxShapeText> m_xShape; |