diff options
Diffstat (limited to 'chart2/source/view')
-rw-r--r-- | chart2/source/view/diagram/VDiagram.cxx | 30 | ||||
-rw-r--r-- | chart2/source/view/inc/VDiagram.hxx | 9 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 25 |
3 files changed, 30 insertions, 34 deletions
diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx index 3e2b58458990..e5db4c77f3d0 100644 --- a/chart2/source/view/diagram/VDiagram.cxx +++ b/chart2/source/view/diagram/VDiagram.cxx @@ -19,6 +19,7 @@ #include <ShapeFactory.hxx> #include <VDiagram.hxx> +#include <Diagram.hxx> #include <PropertyMapper.hxx> #include <ViewDefines.hxx> #include <Stripe.hxx> @@ -41,7 +42,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; VDiagram::VDiagram( - const uno::Reference<XDiagram> & xDiagram, const drawing::Direction3D& rPreferredAspectRatio, + const rtl::Reference<Diagram> & xDiagram, const drawing::Direction3D& rPreferredAspectRatio, sal_Int32 nDimension ) : m_nDimensionCount(nDimension) , m_xDiagram(xDiagram) @@ -54,13 +55,12 @@ VDiagram::VDiagram( if( m_nDimensionCount != 3) return; - uno::Reference< beans::XPropertySet > xSourceProp( m_xDiagram, uno::UNO_QUERY ); - ThreeDHelper::getRotationAngleFromDiagram( xSourceProp, m_fXAnglePi, m_fYAnglePi, m_fZAnglePi ); + ThreeDHelper::getRotationAngleFromDiagram( xDiagram, m_fXAnglePi, m_fYAnglePi, m_fZAnglePi ); if( ChartTypeHelper::isSupportingRightAngledAxes( DiagramHelper::getChartTypeByIndex( m_xDiagram, 0 ) ) ) { - if(xSourceProp.is()) - xSourceProp->getPropertyValue("RightAngledAxes") >>= m_bRightAngledAxes; + if(xDiagram.is()) + xDiagram->getPropertyValue("RightAngledAxes") >>= m_bRightAngledAxes; if( m_bRightAngledAxes ) { ThreeDHelper::adaptRadAnglesForRightAngledAxes( m_fXAnglePi, m_fYAnglePi ); @@ -458,8 +458,8 @@ void VDiagram::createShapes_3d() aWallCID.clear(); rtl::Reference<Svx3DSceneObject> xWallGroup_Shapes = ShapeFactory::createGroup3D( xOuterGroup_Shapes, aWallCID ); - CuboidPlanePosition eLeftWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) ); - CuboidPlanePosition eBackWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) ); + CuboidPlanePosition eLeftWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( m_xDiagram ) ); + CuboidPlanePosition eBackWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( m_xDiagram ) ); //add left wall { @@ -521,27 +521,25 @@ void VDiagram::createShapes_3d() try { - uno::Reference< beans::XPropertySet > xSourceProp( m_xDiagram, uno::UNO_QUERY_THROW ); - //perspective { //ignore distance and focal length from file format and model completely //use vrp only to indicate the distance of the camera and thus influence the perspective m_xOuterGroupShape->setPropertyValue( UNO_NAME_3D_SCENE_DISTANCE, uno::Any( - static_cast<sal_Int32>(ThreeDHelper::getCameraDistance( xSourceProp )))); + static_cast<sal_Int32>(ThreeDHelper::getCameraDistance( m_xDiagram )))); m_xOuterGroupShape->setPropertyValue( UNO_NAME_3D_SCENE_PERSPECTIVE, - xSourceProp->getPropertyValue( UNO_NAME_3D_SCENE_PERSPECTIVE)); + m_xDiagram->getPropertyValue( UNO_NAME_3D_SCENE_PERSPECTIVE)); } //light { m_xOuterGroupShape->setPropertyValue( UNO_NAME_3D_SCENE_SHADE_MODE, - xSourceProp->getPropertyValue( UNO_NAME_3D_SCENE_SHADE_MODE)); + m_xDiagram->getPropertyValue( UNO_NAME_3D_SCENE_SHADE_MODE)); m_xOuterGroupShape->setPropertyValue( UNO_NAME_3D_SCENE_AMBIENTCOLOR, - xSourceProp->getPropertyValue( UNO_NAME_3D_SCENE_AMBIENTCOLOR)); + m_xDiagram->getPropertyValue( UNO_NAME_3D_SCENE_AMBIENTCOLOR)); m_xOuterGroupShape->setPropertyValue( UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING, - xSourceProp->getPropertyValue( UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING)); - lcl_setLightSources( xSourceProp, m_xOuterGroupShape ); + m_xDiagram->getPropertyValue( UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING)); + lcl_setLightSources( m_xDiagram, m_xOuterGroupShape ); } //rotation @@ -585,7 +583,7 @@ void VDiagram::createShapes_3d() ShapeFactory::createStripe(xOuterGroup_Shapes, aStripe , xFloorProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), bDoubleSided ); - CuboidPlanePosition eBottomPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) ); + CuboidPlanePosition eBottomPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( m_xDiagram ) ); if( !bAddFloorAndWall || (eBottomPos!=CuboidPlanePosition_Bottom) ) { //we always need this object as dummy object for correct scene dimensions diff --git a/chart2/source/view/inc/VDiagram.hxx b/chart2/source/view/inc/VDiagram.hxx index 7d8dd3069479..ab391f7bc0d3 100644 --- a/chart2/source/view/inc/VDiagram.hxx +++ b/chart2/source/view/inc/VDiagram.hxx @@ -23,6 +23,7 @@ #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/awt/Point.hpp> #include <svx/unoshape.hxx> +#include <rtl/ref.hxx> namespace com::sun::star::beans { class XPropertySet; } namespace com::sun::star::chart2 { class XDiagram; } @@ -32,7 +33,7 @@ namespace com::sun::star::drawing { class XShape; } namespace chart { - +class Diagram; class ShapeFactory; /** The VDiagram is responsible to generate the visible parts of the Diagram @@ -44,7 +45,7 @@ diagram. class VDiagram final { public: //methods - VDiagram( const css::uno::Reference<css::chart2::XDiagram>& xDiagram, + VDiagram( const rtl::Reference<::chart::Diagram>& xDiagram, const css::drawing::Direction3D& rPreferredAspectRatio, sal_Int32 nDimension ); ~VDiagram(); @@ -92,8 +93,8 @@ private: //members rtl::Reference<SvxShapeGroupAnyD> m_xCoordinateRegionShape; rtl::Reference<SvxShapeRect> m_xWall2D; - sal_Int32 m_nDimensionCount; - css::uno::Reference< css::chart2::XDiagram > m_xDiagram; + sal_Int32 m_nDimensionCount; + rtl::Reference< ::chart::Diagram > m_xDiagram; css::drawing::Direction3D m_aPreferredAspectRatio; css::uno::Reference< css::beans::XPropertySet > m_xAspectRatio3D; diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index d2a6c8ef797d..61276d2bb479 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -815,7 +815,7 @@ void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries( ChartModel& if( aVCooSysList_Y.empty() ) continue; - uno::Reference< XDiagram > xDiagram( rModel.getFirstDiagram() ); + rtl::Reference< Diagram > xDiagram( rModel.getFirstChartDiagram() ); if (!xDiagram.is()) continue; @@ -1211,7 +1211,7 @@ static ::basegfx::B3DHomMatrix createTransformationSceneToScreen( namespace { -bool lcl_IsPieOrDonut( const uno::Reference< XDiagram >& xDiagram ) +bool lcl_IsPieOrDonut( const rtl::Reference< Diagram >& xDiagram ) { //special treatment for pie charts //the size is checked after complete creation to get the datalabels into the given space @@ -1374,7 +1374,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D //return the used rectangle awt::Rectangle aUsedOuterRect(rParam.maRemainingSpace.X, rParam.maRemainingSpace.Y, 0, 0); - uno::Reference< XDiagram > xDiagram( mrChartModel.getFirstDiagram() ); + rtl::Reference< Diagram > xDiagram( mrChartModel.getFirstChartDiagram() ); if( !xDiagram.is()) return aUsedOuterRect; @@ -1399,10 +1399,9 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D VCoordinateSystem* pVCooSys = rVCooSysList[nC].get(); if(nDimensionCount==3) { - uno::Reference<beans::XPropertySet> xSceneProperties( xDiagram, uno::UNO_QUERY ); - CuboidPlanePosition eLeftWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( xSceneProperties ) ); - CuboidPlanePosition eBackWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( xSceneProperties ) ); - CuboidPlanePosition eBottomPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( xSceneProperties ) ); + CuboidPlanePosition eLeftWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( xDiagram ) ); + CuboidPlanePosition eBackWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( xDiagram ) ); + CuboidPlanePosition eBottomPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( xDiagram ) ); pVCooSys->set3DWallPositions( eLeftWallPos, eBackWallPos, eBottomPos ); } @@ -1633,8 +1632,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D awt::Size aSize(rParam.maRemainingSpace.Width, rParam.maRemainingSpace.Height); bool bPosSizeExcludeAxesProperty = true; - uno::Reference< beans::XPropertySet > xDiaProps( xDiagram, uno::UNO_QUERY_THROW ); - xDiaProps->getPropertyValue("PosSizeExcludeAxes") >>= bPosSizeExcludeAxesProperty; + xDiagram->getPropertyValue("PosSizeExcludeAxes") >>= bPosSizeExcludeAxesProperty; if (rParam.mbUseFixedInnerSize || bPosSizeExcludeAxesProperty) { aPos = awt::Point( m_aResultingDiagramRectangleExcludingAxes.X, m_aResultingDiagramRectangleExcludingAxes.Y ); @@ -2861,10 +2859,9 @@ void ChartView::createShapes2D( const awt::Size& rPageSize ) aParam.maRemainingSpace.Height = rPageSize.Height; //create the group shape for diagram and axes first to have title and legends on top of it - uno::Reference< XDiagram > xDiagram( mrChartModel.getFirstDiagram() ); - uno::Reference< beans::XPropertySet > xProp(xDiagram, uno::UNO_QUERY); + rtl::Reference< Diagram > xDiagram( mrChartModel.getFirstChartDiagram() ); bool bHasRelativeSize = false; - if( xProp.is() && xProp->getPropertyValue("RelativeSize").hasValue() ) + if( xDiagram.is() && xDiagram->getPropertyValue("RelativeSize").hasValue() ) bHasRelativeSize = true; OUString aDiagramCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, OUString::number( 0 ) ) );//todo: other index if more than one diagram is possible @@ -2932,7 +2929,7 @@ void ChartView::createShapes2D( const awt::Size& rPageSize ) bool bDummy = false; bool bIsVertical = DiagramHelper::getVertical(xDiagram, bDummy, bDummy); - if (getAvailablePosAndSizeForDiagram(aParam, rPageSize, xProp)) + if (getAvailablePosAndSizeForDiagram(aParam, rPageSize, xDiagram)) { awt::Rectangle aUsedOuterRect = impl_createDiagramAndContent(aParam, rPageSize); @@ -2991,7 +2988,7 @@ void ChartView::createShapes2D( const awt::Size& rPageSize ) bool ChartView::createAxisTitleShapes2D( CreateShapeParam2D& rParam, const css::awt::Size& rPageSize, bool bHasRelativeSize ) { - uno::Reference<XDiagram> xDiagram = mrChartModel.getFirstDiagram(); + rtl::Reference<Diagram> xDiagram = mrChartModel.getFirstChartDiagram(); rtl::Reference< ChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); sal_Int32 nDimension = DiagramHelper::getDimension( xDiagram ); |