chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx | 2 chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx | 5 chart2/source/controller/dialogs/DataBrowserModel.cxx | 2 chart2/source/controller/dialogs/DialogModel.cxx | 14 chart2/source/controller/dialogs/dlg_DataSource.cxx | 3 chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx | 24 - chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx | 6 chart2/source/controller/inc/ObjectHierarchy.hxx | 6 chart2/source/controller/main/ObjectHierarchy.cxx | 7 chart2/source/controller/sidebar/ChartSeriesPanel.cxx | 2 chart2/source/inc/AxisHelper.hxx | 7 chart2/source/inc/ChartTypeTemplate.hxx | 2 chart2/source/inc/DataSourceHelper.hxx | 3 chart2/source/inc/DiagramHelper.hxx | 55 +-- chart2/source/inc/RegressionCurveHelper.hxx | 3 chart2/source/inc/ThreeDHelper.hxx | 34 +- chart2/source/model/template/BarChartTypeTemplate.cxx | 5 chart2/source/model/template/BarChartTypeTemplate.hxx | 2 chart2/source/model/template/ChartTypeTemplate.cxx | 10 chart2/source/tools/AxisHelper.cxx | 8 chart2/source/tools/DataSourceHelper.cxx | 8 chart2/source/tools/DiagramHelper.cxx | 150 +++------ chart2/source/tools/RangeHighlighter.cxx | 15 chart2/source/tools/ReferenceSizeProvider.cxx | 9 chart2/source/tools/RegressionCurveHelper.cxx | 2 chart2/source/tools/ThreeDHelper.cxx | 164 ++++------ chart2/source/tools/TitleHelper.cxx | 14 chart2/source/view/diagram/VDiagram.cxx | 30 - chart2/source/view/inc/VDiagram.hxx | 9 chart2/source/view/main/ChartView.cxx | 25 - 30 files changed, 283 insertions(+), 343 deletions(-)
New commits: commit 39f452953e12e24350e7a3740129fa4930aedfca Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Jan 25 20:17:29 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jan 25 20:23:08 2022 +0100 use more concrete types in chart2, Diagram Change-Id: I40cd39d0878dc56e4e86e05149c9744cb563d745 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128942 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx index 3b0a56818e77..3afac39a2ce8 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx @@ -647,7 +647,7 @@ void ChartDataWrapper::applyData( lcl_Operator& rDataOperator ) return; uno::Reference< chart2::data::XDataSource > xSource( xDataProvider->createDataSource( aArguments ) ); - uno::Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram() ); + rtl::Reference< Diagram > xDia( xChartDoc->getFirstChartDiagram() ); if( xDia.is() ) xDia->setDiagramData( xSource, aArguments ); diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index 1054d20b3088..b3263d45c090 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -25,6 +25,7 @@ #include "WallFloorWrapper.hxx" #include "MinMaxLineWrapper.hxx" #include "UpDownBarWrapper.hxx" +#include <Diagram.hxx> #include <DiagramHelper.hxx> #include <DataSourceHelper.hxx> #include <ChartModelHelper.hxx> @@ -438,7 +439,7 @@ struct StaticDiagramWrapperPropertyArray : public rtl::StaticAggregate< Sequence { }; -bool lcl_isXYChart( const Reference< chart2::XDiagram >& rDiagram ) +bool lcl_isXYChart( const rtl::Reference< ::chart::Diagram >& rDiagram ) { bool bRet = false; rtl::Reference< ::chart::ChartType > xChartType( ::chart::DiagramHelper::getChartTypeByIndex( rDiagram, 0 ) ); @@ -453,7 +454,7 @@ bool lcl_isXYChart( const Reference< chart2::XDiagram >& rDiagram ) sal_Int32 lcl_getNewAPIIndexForOldAPIIndex( sal_Int32 nOldAPIIndex - , const Reference< chart2::XDiagram >& xDiagram ) + , const rtl::Reference< ::chart::Diagram >& xDiagram ) { sal_Int32 nNewAPIIndex = nOldAPIIndex; diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx index 6171c1c87242..c7f91e490dcf 100644 --- a/chart2/source/controller/dialogs/DataBrowserModel.cxx +++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx @@ -205,7 +205,7 @@ private: OUString m_aRole; }; -bool lcl_ShowCategoriesAsDataLabel( const Reference< chart2::XDiagram > & xDiagram ) +bool lcl_ShowCategoriesAsDataLabel( const rtl::Reference< ::chart::Diagram > & xDiagram ) { return !DiagramHelper::isCategoryDiagram(xDiagram); } diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx index 165c4f39a654..a68f75d077b6 100644 --- a/chart2/source/controller/dialogs/DialogModel.cxx +++ b/chart2/source/controller/dialogs/DialogModel.cxx @@ -233,7 +233,7 @@ Reference< XDataSeries > lcl_CreateNewSeries( const uno::Reference< XChartType > & xChartType, sal_Int32 nNewSeriesIndex, sal_Int32 nTotalNumberOfSeriesInCTGroup, - const Reference< XDiagram > & xDiagram, + const rtl::Reference< ::chart::Diagram > & xDiagram, const rtl::Reference< ::chart::ChartTypeTemplate > & xTemplate, bool bCreateDataCachedSequences ) { @@ -548,7 +548,7 @@ void DialogModel::moveSeries( m_aTimerTriggeredControllerLock.startTimer(); ControllerLockGuardUNO aLockedControllers( m_xChartDocument ); - Reference< XDiagram > xDiagram( m_xChartDocument->getFirstDiagram()); + rtl::Reference< Diagram > xDiagram( m_xChartDocument->getFirstChartDiagram()); DiagramHelper::moveSeries( xDiagram, xSeries, eDirection==MoveDirection::Down ); } @@ -563,7 +563,7 @@ Reference< chart2::XDataSeries > DialogModel::insertSeriesAfter( try { - Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram() ); + rtl::Reference< Diagram > xDiagram( m_xChartDocument->getFirstChartDiagram() ); ThreeDLookScheme e3DScheme = ThreeDHelper::detectScheme( xDiagram ); sal_Int32 nSeriesInChartType = 0; @@ -614,7 +614,7 @@ Reference< data::XLabeledDataSequence > DialogModel::getCategories() const { if( m_xChartDocument.is()) { - Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram()); + rtl::Reference< Diagram > xDiagram( m_xChartDocument->getFirstChartDiagram()); xResult.set( DiagramHelper::getCategoriesFromDiagram( xDiagram )); } } @@ -630,7 +630,7 @@ void DialogModel::setCategories( const Reference< chart2::data::XLabeledDataSequ if( !m_xChartDocument.is()) return; - Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram()); + rtl::Reference< Diagram > xDiagram( m_xChartDocument->getFirstChartDiagram()); if( !xDiagram.is()) return; @@ -663,7 +663,7 @@ bool DialogModel::isCategoryDiagram() const { bool bRet = false; if( m_xChartDocument.is()) - bRet = DiagramHelper::isCategoryDiagram( m_xChartDocument->getFirstDiagram() ); + bRet = DiagramHelper::isCategoryDiagram( m_xChartDocument->getFirstChartDiagram() ); return bRet; } @@ -724,7 +724,7 @@ void DialogModel::setData( m_xTemplate->getDataInterpreter()); if( xInterpreter.is()) { - Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram() ); + rtl::Reference< Diagram > xDiagram( m_xChartDocument->getFirstChartDiagram() ); ThreeDLookScheme e3DScheme = ThreeDHelper::detectScheme( xDiagram ); std::vector< Reference< XDataSeries > > aSeriesToReUse( diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx index 7c804ba8a235..b67044705213 100644 --- a/chart2/source/controller/dialogs/dlg_DataSource.cxx +++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx @@ -24,6 +24,7 @@ #include <ChartTypeTemplateProvider.hxx> #include <ChartTypeManager.hxx> #include <ChartTypeTemplate.hxx> +#include <Diagram.hxx> #include <DiagramHelper.hxx> #include "DialogModel.hxx" #include <ChartModel.hxx> @@ -63,7 +64,7 @@ DocumentChartTypeTemplateProvider::DocumentChartTypeTemplateProvider( if( !xDoc.is()) return; - Reference< chart2::XDiagram > xDia( xDoc->getFirstDiagram()); + rtl::Reference< Diagram > xDia( xDoc->getFirstChartDiagram()); if( xDia.is()) { DiagramHelper::tTemplateWithServiceName aResult( diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx index 3135a2b0db2d..a47cebe9c8a4 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx @@ -19,6 +19,7 @@ #include "tp_3D_SceneGeometry.hxx" +#include <Diagram.hxx> #include <DiagramHelper.hxx> #include <ChartType.hxx> #include <ChartTypeHelper.hxx> @@ -47,9 +48,9 @@ void lcl_SetMetricFieldLimits(weld::MetricSpinButton& rField, sal_Int64 nLimit) } ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage(weld::Container* pParent, - const uno::Reference< beans::XPropertySet > & xSceneProperties, + const rtl::Reference< ::chart::Diagram > & xDiagram, ControllerLockHelper & rControllerLockHelper) - : m_xSceneProperties( xSceneProperties ) + : m_xDiagram( xDiagram ) , m_aAngleTimer("chart2 ThreeD_SceneGeometry_TabPage m_aAngleTimer") , m_aPerspectiveTimer("chart2 ThreeD_SceneGeometry_TabPage m_aPerspectiveTimer") , m_nXRotation(0) @@ -69,7 +70,7 @@ ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage(weld::Container* pPar , m_xMFPerspective(m_xBuilder->weld_metric_spin_button("MTR_FLD_PERSPECTIVE", FieldUnit::PERCENT)) { double fXAngle, fYAngle, fZAngle; - ThreeDHelper::getRotationAngleFromDiagram( m_xSceneProperties, fXAngle, fYAngle, fZAngle ); + ThreeDHelper::getRotationAngleFromDiagram( m_xDiagram, fXAngle, fYAngle, fZAngle ); fXAngle = basegfx::rad2deg(fXAngle); fYAngle = basegfx::rad2deg(fYAngle); @@ -100,12 +101,12 @@ ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage(weld::Container* pPar m_xMFZRotation->connect_value_changed( aAngleEditedLink ); drawing::ProjectionMode aProjectionMode = drawing::ProjectionMode_PERSPECTIVE; - m_xSceneProperties->getPropertyValue( "D3DScenePerspective" ) >>= aProjectionMode; + m_xDiagram->getPropertyValue( "D3DScenePerspective" ) >>= aProjectionMode; m_xCbxPerspective->set_active( aProjectionMode == drawing::ProjectionMode_PERSPECTIVE ); m_xCbxPerspective->connect_toggled( LINK( this, ThreeD_SceneGeometry_TabPage, PerspectiveToggled )); sal_Int32 nPerspectivePercentage = 20; - m_xSceneProperties->getPropertyValue( "Perspective" ) >>= nPerspectivePercentage; + m_xDiagram->getPropertyValue( "Perspective" ) >>= nPerspectivePercentage; m_xMFPerspective->set_value(nPerspectivePercentage, FieldUnit::PERCENT); m_aPerspectiveTimer.SetTimeout(nTimeout); @@ -114,11 +115,10 @@ ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage(weld::Container* pPar m_xMFPerspective->set_sensitive( m_xCbxPerspective->get_active() ); //RightAngledAxes - uno::Reference< chart2::XDiagram > xDiagram( m_xSceneProperties, uno::UNO_QUERY ); - if (ChartTypeHelper::isSupportingRightAngledAxes(DiagramHelper::getChartTypeByIndex(xDiagram, 0))) + if (ChartTypeHelper::isSupportingRightAngledAxes(DiagramHelper::getChartTypeByIndex(m_xDiagram, 0))) { bool bRightAngledAxes = false; - m_xSceneProperties->getPropertyValue( "RightAngledAxes" ) >>= bRightAngledAxes; + m_xDiagram->getPropertyValue( "RightAngledAxes" ) >>= bRightAngledAxes; m_xCbxRightAngledAxes->connect_toggled( LINK( this, ThreeD_SceneGeometry_TabPage, RightAngledAxesToggled )); m_xCbxRightAngledAxes->set_active( bRightAngledAxes ); RightAngledAxesToggled(*m_xCbxRightAngledAxes); @@ -160,7 +160,7 @@ void ThreeD_SceneGeometry_TabPage::applyAnglesToModel() fYAngle = basegfx::deg2rad(fYAngle); fZAngle = basegfx::deg2rad(fZAngle); - ThreeDHelper::setRotationAngleToDiagram( m_xSceneProperties, fXAngle, fYAngle, fZAngle ); + ThreeDHelper::setRotationAngleToDiagram( m_xDiagram, fXAngle, fYAngle, fZAngle ); m_bAngleChangePending = false; m_aAngleTimer.Stop(); @@ -191,8 +191,8 @@ void ThreeD_SceneGeometry_TabPage::applyPerspectiveToModel() try { - m_xSceneProperties->setPropertyValue( "D3DScenePerspective" , uno::Any( aMode )); - m_xSceneProperties->setPropertyValue( "Perspective" , uno::Any( static_cast<sal_Int32>(m_xMFPerspective->get_value(FieldUnit::PERCENT)) )); + m_xDiagram->setPropertyValue( "D3DScenePerspective" , uno::Any( aMode )); + m_xDiagram->setPropertyValue( "Perspective" , uno::Any( static_cast<sal_Int32>(m_xMFPerspective->get_value(FieldUnit::PERCENT)) )); } catch( const uno::Exception & ) { @@ -250,7 +250,7 @@ IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, RightAngledAxesToggled, weld::Togg m_xMFZRotation->set_value(m_nZRotation, FieldUnit::DEGREE); } - ThreeDHelper::switchRightAngledAxes( m_xSceneProperties, m_xCbxRightAngledAxes->get_active() ); + ThreeDHelper::switchRightAngledAxes( m_xDiagram, m_xCbxRightAngledAxes->get_active() ); } } //namespace chart diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx index ca7f75ebea0d..4bcdd8ca6237 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx @@ -20,18 +20,20 @@ #include <vcl/timer.hxx> #include <vcl/weld.hxx> +#include <rtl/ref.hxx> namespace com::sun::star::beans { class XPropertySet; } namespace chart { class ControllerLockHelper; } namespace chart { +class Diagram; class ThreeD_SceneGeometry_TabPage { public: ThreeD_SceneGeometry_TabPage(weld::Container* pWindow, - const css::uno::Reference< css::beans::XPropertySet > & xSceneProperties, + const rtl::Reference< ::chart::Diagram > & xDiagram, ControllerLockHelper & rControllerLockHelper); ~ThreeD_SceneGeometry_TabPage(); @@ -54,7 +56,7 @@ private: void applyAnglesToModel(); void applyPerspectiveToModel(); - css::uno::Reference< css::beans::XPropertySet > m_xSceneProperties; + rtl::Reference< ::chart::Diagram > m_xDiagram; Timer m_aAngleTimer; Timer m_aPerspectiveTimer; diff --git a/chart2/source/controller/inc/ObjectHierarchy.hxx b/chart2/source/controller/inc/ObjectHierarchy.hxx index d8f7747e8bc6..014210c1c839 100644 --- a/chart2/source/controller/inc/ObjectHierarchy.hxx +++ b/chart2/source/controller/inc/ObjectHierarchy.hxx @@ -67,17 +67,17 @@ private: void createAxesTree( ObjectHierarchy::tChildContainer & rContainer, const rtl::Reference<::chart::ChartModel> & xChartDoc, - const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + const rtl::Reference< ::chart::Diagram > & xDiagram ); void createDiagramTree( ObjectHierarchy::tChildContainer& rContainer, const rtl::Reference<::chart::ChartModel>& xChartDoc, - const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + const rtl::Reference< ::chart::Diagram >& xDiagram ); void createDataSeriesTree( ObjectHierarchy::tChildContainer & rOutDiagramSubContainer, const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); static void createWallAndFloor( ObjectHierarchy::tChildContainer & rContainer, - const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + const rtl::Reference< ::chart::Diagram > & xDiagram ); void createLegendTree( ObjectHierarchy::tChildContainer & rContainer, const rtl::Reference<::chart::ChartModel> & xChartDoc, diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx index b15a90d79b4a..5a8853278f07 100644 --- a/chart2/source/controller/main/ObjectHierarchy.cxx +++ b/chart2/source/controller/main/ObjectHierarchy.cxx @@ -214,9 +214,8 @@ void ObjectHierarchy::createLegendTree( void ObjectHierarchy::createAxesTree( ObjectHierarchy::tChildContainer & rContainer, const rtl::Reference<::chart::ChartModel> & xChartDoc, - const Reference< XDiagram > & xDiagram ) + const rtl::Reference< Diagram > & xDiagram ) { - Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW ); sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); rtl::Reference< ChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); bool bSupportsAxesGrids = ChartTypeHelper::isSupportingMainAxis( xChartType, nDimensionCount, 0 ); @@ -278,7 +277,7 @@ void ObjectHierarchy::createAxesTree( void ObjectHierarchy::createWallAndFloor( ObjectHierarchy::tChildContainer & rContainer, - const Reference< XDiagram > & xDiagram ) + const rtl::Reference< Diagram > & xDiagram ) { sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); bool bIsThreeD = ( nDimensionCount == 3 ); @@ -297,7 +296,7 @@ void ObjectHierarchy::createWallAndFloor( void ObjectHierarchy::createDiagramTree( ObjectHierarchy::tChildContainer & rContainer, const rtl::Reference<::chart::ChartModel> & xChartDoc, - const Reference< XDiagram > & xDiagram ) + const rtl::Reference< Diagram > & xDiagram ) { if( !m_bOrderingForElementSelector ) { diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx index 27878f8926cc..a9a77652d11e 100644 --- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx +++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx @@ -222,7 +222,7 @@ void setAttachedAxisType(const rtl::Reference<::chart::ChartModel>& if (!xDataSeries.is()) return; - uno::Reference<chart2::XDiagram> xDiagram = xModel->getFirstDiagram(); + rtl::Reference<Diagram> xDiagram = xModel->getFirstChartDiagram(); DiagramHelper::attachSeriesToAxis(bPrimary, xDataSeries, xDiagram, comphelper::getProcessComponentContext()); } diff --git a/chart2/source/inc/AxisHelper.hxx b/chart2/source/inc/AxisHelper.hxx index df3da4c4de5b..61610b5c4b9d 100644 --- a/chart2/source/inc/AxisHelper.hxx +++ b/chart2/source/inc/AxisHelper.hxx @@ -40,6 +40,7 @@ namespace chart { class BaseCoordinateSystem; class ChartType; +class Diagram; class OOO_DLLPUBLIC_CHARTTOOLS AxisHelper { @@ -102,7 +103,7 @@ public: static void makeGridInvisible( const css::uno::Reference< css::beans::XPropertySet >& xGridProperties ); static void hideAxisIfNoDataIsAttached( const css::uno::Reference< css::chart2::XAxis >& xAxis - , const css::uno::Reference< css::chart2::XDiagram >& xDiagram); + , const rtl::Reference< ::chart::Diagram >& xDiagram); SAL_DLLPRIVATE static bool areAxisLabelsVisible( const css::uno::Reference< css::beans::XPropertySet >& xAxisProperties ); static bool isAxisVisible( const css::uno::Reference< css::chart2::XAxis >& xAxis ); @@ -172,7 +173,7 @@ public: getAllGrids( const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); static void getAxisOrGridPossibilities( css::uno::Sequence< sal_Bool >& rPossibilityList - , const css::uno::Reference< css::chart2::XDiagram>& xDiagram, bool bAxis=true ); + , const rtl::Reference< ::chart::Diagram>& xDiagram, bool bAxis=true ); static void getAxisOrGridExistence( css::uno::Sequence< sal_Bool >& rExistenceList , const css::uno::Reference< css::chart2::XDiagram>& xDiagram, bool bAxis=true ); @@ -199,7 +200,7 @@ public: static void setRTLAxisLayout( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys ); static rtl::Reference< ::chart::ChartType > - getFirstChartTypeWithSeriesAttachedToAxisIndex( const css::uno::Reference< css::chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex ); + getFirstChartTypeWithSeriesAttachedToAxisIndex( const rtl::Reference< ::chart::Diagram >& xDiagram, const sal_Int32 nAttachedAxisIndex ); static bool isAxisPositioningEnabled(); }; diff --git a/chart2/source/inc/ChartTypeTemplate.hxx b/chart2/source/inc/ChartTypeTemplate.hxx index e5594c43bdc3..af70bb84ccb3 100644 --- a/chart2/source/inc/ChartTypeTemplate.hxx +++ b/chart2/source/inc/ChartTypeTemplate.hxx @@ -159,7 +159,7 @@ public: <p>The dimension depends on the value returned by getDimension().</p> */ virtual void createCoordinateSystems( - const css::uno::Reference< css::chart2::XCoordinateSystemContainer > & xOutCooSysCnt ); + const rtl::Reference< ::chart::Diagram > & xDiagram ); /** Sets categories at the scales of dimension 0 and the percent stacking at the scales of dimension 1 of all given coordinate systems. diff --git a/chart2/source/inc/DataSourceHelper.hxx b/chart2/source/inc/DataSourceHelper.hxx index 950f66e54927..892412cc8d63 100644 --- a/chart2/source/inc/DataSourceHelper.hxx +++ b/chart2/source/inc/DataSourceHelper.hxx @@ -35,6 +35,7 @@ namespace com::sun::star::frame { class XModel; } namespace chart { +class Diagram; class OOO_DLLPUBLIC_CHARTTOOLS DataSourceHelper { @@ -79,7 +80,7 @@ public: pressUsedDataIntoRectangularFormat( const css::uno::Reference< css::chart2::XChartDocument >& xChartDoc ); SAL_DLLPRIVATE static css::uno::Sequence< OUString > getUsedDataRanges( - const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + const rtl::Reference< ::chart::Diagram > & xDiagram ); static css::uno::Sequence< OUString > getUsedDataRanges( const rtl::Reference<::chart::ChartModel> & xChartModel ); diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx index a05de767d38d..9f40c536e241 100644 --- a/chart2/source/inc/DiagramHelper.hxx +++ b/chart2/source/inc/DiagramHelper.hxx @@ -45,6 +45,7 @@ namespace chart class ChartType; class ChartTypeManager; class ChartTypeTemplate; +class Diagram; enum DiagramPositioningMode { @@ -71,7 +72,7 @@ public: */ static tTemplateWithServiceName getTemplateForDiagram( - const css::uno::Reference< css::chart2::XDiagram > & xDiagram, + const rtl::Reference< ::chart::Diagram > & xDiagram, const rtl::Reference< ::chart::ChartTypeManager > & xChartTypeManager); /** Sets the "SwapXAndYAxis" property at all coordinate systems found in the @@ -79,7 +80,7 @@ public: "vertical==true" for bar charts, "vertical==false" for column charts */ - static void setVertical( const css::uno::Reference< css::chart2::XDiagram > & xDiagram, + static void setVertical( const rtl::Reference< ::chart::Diagram > & xDiagram, bool bVertical ); /** Gets the "SwapXAndYAxis" property at all coordinate systems found in the @@ -87,11 +88,11 @@ public: "vertical==true" for bar charts, "vertical==false" for column charts */ - static bool getVertical( const css::uno::Reference< css::chart2::XDiagram > & xDiagram, + static bool getVertical( const rtl::Reference< ::chart::Diagram > & xDiagram, bool& rbOutFoundResult, bool& rbOutAmbiguousResult ); static StackMode getStackMode( - const css::uno::Reference< css::chart2::XDiagram > & xDiagram, + const rtl::Reference< ::chart::Diagram > & xDiagram, bool& rbFound, bool& rbAmbiguous ); @@ -102,7 +103,7 @@ public: applies to the first chart type/the bars) */ static void setStackMode( - const css::uno::Reference< css::chart2::XDiagram > & xDiagram, + const rtl::Reference< ::chart::Diagram > & xDiagram, StackMode eStackMode ); @@ -125,7 +126,7 @@ public: dimension is not unique, 0 is returned. */ static sal_Int32 getDimension( - const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + const rtl::Reference< ::chart::Diagram > & xDiagram ); /** Sets the dimension of the diagram given. @@ -135,14 +136,14 @@ public: XCoordinateSystemContainer of the diagram. */ static void setDimension( - const css::uno::Reference< css::chart2::XDiagram > & xDiagram, + const rtl::Reference< ::chart::Diagram > & xDiagram, sal_Int32 nNewDimensionCount ); /** Replaces all occurrences of xCooSysToReplace in the tree with xReplacement in the diagram's tree */ SAL_DLLPRIVATE static void replaceCoordinateSystem( - const css::uno::Reference< css::chart2::XDiagram > & xDiagram, + const rtl::Reference< ::chart::Diagram > & xDiagram, const css::uno::Reference< css::chart2::XCoordinateSystem > & xCooSysToReplace, const css::uno::Reference< css::chart2::XCoordinateSystem > & xReplacement ); @@ -151,22 +152,22 @@ public: static bool attachSeriesToAxis( bool bMainAxis, const css::uno::Reference< css::chart2::XDataSeries >& xSeries, - const css::uno::Reference< css::chart2::XDiagram >& xDiagram, + const rtl::Reference< ::chart::Diagram >& xDiagram, const css::uno::Reference< css::uno::XComponentContext > & xContext, bool bAdaptAxes=true ); static css::uno::Reference< css::chart2::XAxis > getAttachedAxis( const css::uno::Reference< css::chart2::XDataSeries >& xSeries, - const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + const rtl::Reference< ::chart::Diagram >& xDiagram ); static rtl::Reference< ChartType > getChartTypeOfSeries( - const css::uno::Reference< css::chart2::XDiagram >& xDiagram, + const rtl::Reference< ::chart::Diagram >& xDiagram, const css::uno::Reference< css::chart2::XDataSeries >& xSeries ); static std::vector< css::uno::Reference< css::chart2::XDataSeries > > getDataSeriesFromDiagram( - const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + const rtl::Reference< ::chart::Diagram > & xDiagram ); /** return all data series in this diagram grouped by chart-types */ @@ -174,20 +175,20 @@ public: css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > > > getDataSeriesGroups( - const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + const rtl::Reference< ::chart::Diagram > & xDiagram ); static bool isCategoryDiagram( - const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + const rtl::Reference< ::chart::Diagram >& xDiagram ); static void setCategoriesToDiagram( const css::uno::Reference< css::chart2::data::XLabeledDataSequence >& xCategories, - const css::uno::Reference< css::chart2::XDiagram >& xDiagram, + const rtl::Reference< ::chart::Diagram >& xDiagram, bool bSetAxisType = false, // when this flag is true ... bool bCategoryAxis = true);// set the AxisType to CATEGORY or back to REALNUMBER static css::uno::Reference< css::chart2::data::XLabeledDataSequence > getCategoriesFromDiagram( - const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + const rtl::Reference< ::chart::Diagram > & xDiagram ); static css::uno::Sequence< OUString > getExplicitSimpleCategories( ChartModel& rModel ); @@ -202,7 +203,7 @@ public: static void switchToTextCategories( const rtl::Reference<::chart::ChartModel> & xChartDoc ); - static bool isSupportingDateAxis( const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + static bool isSupportingDateAxis( const rtl::Reference< ::chart::Diagram >& xDiagram ); static bool isDateNumberFormat( sal_Int32 nNumberFormat, const css::uno::Reference< css::util::XNumberFormats >& xNumberFormats ); static sal_Int32 getDateNumberFormat( const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); static sal_Int32 getDateTimeInputNumberFormat( const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier, double fNumber ); @@ -211,11 +212,11 @@ public: css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); static rtl::Reference< ChartType > - getChartTypeByIndex( const css::uno::Reference< css::chart2::XDiagram >& xDiagram, sal_Int32 nIndex ); + getChartTypeByIndex( const rtl::Reference< ::chart::Diagram >& xDiagram, sal_Int32 nIndex ); static std::vector< rtl::Reference< ChartType > > getChartTypesFromDiagram( - const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + const rtl::Reference< ::chart::Diagram > & xDiagram ); SAL_DLLPRIVATE static bool areChartTypesCompatible( const rtl::Reference< ::chart::ChartType >& xFirstType, @@ -237,7 +238,7 @@ public: * */ static bool isSeriesMoveable( - const css::uno::Reference< css::chart2::XDiagram >& xDiagram, + const rtl::Reference< ::chart::Diagram >& xDiagram, const css::uno::Reference< css::chart2::XDataSeries >& xGivenDataSeries, bool bForward ); @@ -257,28 +258,28 @@ public: * */ static bool moveSeries( - const css::uno::Reference< css::chart2::XDiagram >& xDiagram, + const rtl::Reference< ::chart::Diagram >& xDiagram, const css::uno::Reference< css::chart2::XDataSeries >& xGivenDataSeries, bool bForward ); - static bool isSupportingFloorAndWall( const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + static bool isSupportingFloorAndWall( const rtl::Reference< ::chart::Diagram > & xDiagram ); - static bool isPieOrDonutChart( const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + static bool isPieOrDonutChart( const rtl::Reference< ::chart::Diagram >& xDiagram ); static sal_Int32 getGeometry3D( - const css::uno::Reference< css::chart2::XDiagram > & xDiagram, + const rtl::Reference< ::chart::Diagram > & xDiagram, bool& rbFound, bool& rbAmbiguous ); static void setGeometry3D( - const css::uno::Reference< css::chart2::XDiagram > & xDiagram, + const rtl::Reference< ::chart::Diagram > & xDiagram, sal_Int32 nNewGeometry ); //returns integer from constant group css::chart::MissingValueTreatment static sal_Int32 getCorrectedMissingValueTreatment( - const css::uno::Reference< css::chart2::XDiagram > & xDiagram, + const rtl::Reference< ::chart::Diagram > & xDiagram, const rtl::Reference< ::chart::ChartType >& xChartType ); - static DiagramPositioningMode getDiagramPositioningMode( const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + static DiagramPositioningMode getDiagramPositioningMode( const rtl::Reference< ::chart::Diagram > & xDiagram ); static bool setDiagramPositioning( const rtl::Reference<::chart::ChartModel>& xChartModel, const css::awt::Rectangle& rPosRect /*100th mm*/ ); diff --git a/chart2/source/inc/RegressionCurveHelper.hxx b/chart2/source/inc/RegressionCurveHelper.hxx index 318b29d7db36..00a70a5aece4 100644 --- a/chart2/source/inc/RegressionCurveHelper.hxx +++ b/chart2/source/inc/RegressionCurveHelper.hxx @@ -33,6 +33,7 @@ namespace com::sun::star::chart2 { class XRegressionCurveContainer; } namespace com::sun::star::chart2::data { class XDataSource; } namespace com::sun::star::frame { class XModel; } namespace chart { class ChartModel; } +namespace chart { class Diagram; } namespace chart::RegressionCurveHelper { @@ -162,7 +163,7 @@ namespace chart::RegressionCurveHelper OOO_DLLPUBLIC_CHARTTOOLS std::vector<css::uno::Reference<css::chart2::XRegressionCurve> > getAllRegressionCurvesNotMeanValueLine( - const css::uno::Reference<css::chart2::XDiagram>& xDiagram ); + const rtl::Reference<::chart::Diagram>& xDiagram ); OOO_DLLPUBLIC_CHARTTOOLS void resetEquationPosition( const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve ); diff --git a/chart2/source/inc/ThreeDHelper.hxx b/chart2/source/inc/ThreeDHelper.hxx index 93b1c995f388..b5edf986c26d 100644 --- a/chart2/source/inc/ThreeDHelper.hxx +++ b/chart2/source/inc/ThreeDHelper.hxx @@ -20,6 +20,7 @@ #pragma once #include <com/sun/star/drawing/CameraGeometry.hpp> +#include <rtl/ref.hxx> #include "charttoolsdllapi.hxx" namespace com::sun::star::beans { class XPropertySet; } @@ -27,6 +28,7 @@ namespace com::sun::star::chart2 { class XDiagram; } namespace chart { +class Diagram; enum class ThreeDLookScheme { @@ -61,14 +63,14 @@ public: const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties , double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad ); static void setRotationAngleToDiagram( - const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties + const rtl::Reference< ::chart::Diagram >& xSceneProperties , double fXAngleRad, double fYAngleRad, double fZAngleRad ); static void getRotationFromDiagram( - const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties + const rtl::Reference< ::chart::Diagram >& xSceneProperties , sal_Int32& rnHorizontalAngleDegree, sal_Int32& rnVerticalAngleDegree ); static void setRotationToDiagram( - const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties + const rtl::Reference< ::chart::Diagram >& xSceneProperties , sal_Int32 nHorizontalAngleDegree, sal_Int32 nVerticalYAngleDegree ); static void switchRightAngledAxes( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties @@ -99,29 +101,29 @@ public: static double CameraDistanceToPerspective( double fCameraDistance ); static double PerspectiveToCameraDistance( double fPerspective ); - static void set3DSettingsToDefault( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties ); - static void setDefaultRotation( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties ); - static void setDefaultIllumination( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties ); + static void set3DSettingsToDefault( const rtl::Reference< ::chart::Diagram >& xSceneProperties ); + static void setDefaultRotation( const rtl::Reference< ::chart::Diagram >& xDiagram ); + static void setDefaultIllumination( const rtl::Reference< ::chart::Diagram >& xDiagram ); static void setDefaultRotation( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties, bool bPieOrDonut ); - static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardLeftWall( const css::uno::Reference< - css::beans::XPropertySet >& xSceneProperties ); - static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBackWall(const css::uno::Reference< - css::beans::XPropertySet >& xSceneProperties ); - static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBottom(const css::uno::Reference< - css::beans::XPropertySet >& xSceneProperties ); + static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardLeftWall( const rtl::Reference< + ::chart::Diagram >& xDiagram ); + static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBackWall(const rtl::Reference< + ::chart::Diagram >& xDiagram ); + static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBottom(const rtl::Reference< + ::chart::Diagram >& xDiagram ); - static ThreeDLookScheme detectScheme( const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); - static void setScheme( const css::uno::Reference< css::chart2::XDiagram >& xDiagram + static ThreeDLookScheme detectScheme( const rtl::Reference< ::chart::Diagram >& xDiagram ); + static void setScheme( const rtl::Reference< ::chart::Diagram >& xDiagram , ThreeDLookScheme aScheme ); //sal_Int32 nRoundedEdges: <0 or >100 -> mixed state //sal_Int32 nObjectLines: 0->no lines; 1->all lines on; other->mixed state - static void getRoundedEdgesAndObjectLines( const css::uno::Reference< css::chart2::XDiagram >& xDiagram + static void getRoundedEdgesAndObjectLines( const rtl::Reference< ::chart::Diagram >& xDiagram , sal_Int32& rnRoundedEdges, sal_Int32& rnObjectLines ); - static void setRoundedEdgesAndObjectLines( const css::uno::Reference< css::chart2::XDiagram >& xDiagram + static void setRoundedEdgesAndObjectLines( const rtl::Reference< ::chart::Diagram >& xDiagram , sal_Int32 nRoundedEdges, sal_Int32 nObjectLines ); }; diff --git a/chart2/source/model/template/BarChartTypeTemplate.cxx b/chart2/source/model/template/BarChartTypeTemplate.cxx index 947df608c78b..4a46b502a2d0 100644 --- a/chart2/source/model/template/BarChartTypeTemplate.cxx +++ b/chart2/source/model/template/BarChartTypeTemplate.cxx @@ -288,11 +288,10 @@ void BarChartTypeTemplate::resetStyles( } void BarChartTypeTemplate::createCoordinateSystems( - const Reference< chart2::XCoordinateSystemContainer > & xCooSysCnt ) + const rtl::Reference< ::chart::Diagram > & xDiagram ) { - ChartTypeTemplate::createCoordinateSystems( xCooSysCnt ); + ChartTypeTemplate::createCoordinateSystems( xDiagram ); - Reference< chart2::XDiagram > xDiagram( xCooSysCnt, uno::UNO_QUERY ); DiagramHelper::setVertical( xDiagram, m_eBarDirection == HORIZONTAL ); } diff --git a/chart2/source/model/template/BarChartTypeTemplate.hxx b/chart2/source/model/template/BarChartTypeTemplate.hxx index af6e1096a7f1..6c5f66bd9cc3 100644 --- a/chart2/source/model/template/BarChartTypeTemplate.hxx +++ b/chart2/source/model/template/BarChartTypeTemplate.hxx @@ -85,7 +85,7 @@ protected: virtual bool isSwapXAndY() const override; virtual void createCoordinateSystems( - const css::uno::Reference< css::chart2::XCoordinateSystemContainer > & xCooSysCnt ) override; + const rtl::Reference< ::chart::Diagram > & xDiagram ) override; private: StackMode m_eStackMode; diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index 997de84ad302..0cb57443441a 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -489,9 +489,9 @@ bool ChartTypeTemplate::isSwapXAndY() const } void ChartTypeTemplate::createCoordinateSystems( - const Reference< chart2::XCoordinateSystemContainer > & xOutCooSysCnt ) + const rtl::Reference< ::chart::Diagram > & xDiagram ) { - if( ! xOutCooSysCnt.is()) + if( ! xDiagram.is()) return; std::vector< rtl::Reference< ChartType > > aFormerlyUsedChartTypes; rtl::Reference< ChartType > xChartType( getChartTypeForNewSeries(aFormerlyUsedChartTypes)); @@ -501,7 +501,7 @@ void ChartTypeTemplate::createCoordinateSystems( if( ! xCooSys.is()) { // chart type wants no coordinate systems - xOutCooSysCnt->setCoordinateSystems( Sequence< Reference< XCoordinateSystem > >()); + xDiagram->setCoordinateSystems( Sequence< Reference< XCoordinateSystem > >()); return; } // #i69680# make grid of first y-axis visible (was in the CooSys CTOR before) @@ -513,7 +513,7 @@ void ChartTypeTemplate::createCoordinateSystems( } Sequence< Reference< XCoordinateSystem > > aCoordinateSystems( - xOutCooSysCnt->getCoordinateSystems()); + xDiagram->getCoordinateSystems()); if( aCoordinateSystems.hasElements()) { @@ -550,7 +550,7 @@ void ChartTypeTemplate::createCoordinateSystems( // set new coordinate systems aCoordinateSystems = { xCooSys }; - xOutCooSysCnt->setCoordinateSystems( aCoordinateSystems ); + xDiagram->setCoordinateSystems( aCoordinateSystems ); } void ChartTypeTemplate::adaptScales( diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 03d15f47b921..2e223831aa98 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -185,7 +185,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( } else if( xChartDoc.is() && xChartDoc->hasInternalDataProvider() && nDimensionIndex == 0 ) //maybe date axis { - Reference< chart2::XDiagram > xDiagram( xChartDoc->getFirstDiagram() ); + rtl::Reference< Diagram > xDiagram( xChartDoc->getFirstChartDiagram() ); if( DiagramHelper::isSupportingDateAxis( xDiagram ) ) { nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc ); @@ -491,7 +491,7 @@ void AxisHelper::makeAxisInvisible( const Reference< XAxis >& xAxis ) } } -void AxisHelper::hideAxisIfNoDataIsAttached( const Reference< XAxis >& xAxis, const Reference< XDiagram >& xDiagram ) +void AxisHelper::hideAxisIfNoDataIsAttached( const Reference< XAxis >& xAxis, const rtl::Reference< Diagram >& xDiagram ) { //axis is hidden if no data is attached anymore but data is available bool bOtherSeriesAttachedToThisAxis = false; @@ -875,7 +875,7 @@ Sequence< Reference< beans::XPropertySet > > AxisHelper::getAllGrids( const Refe } void AxisHelper::getAxisOrGridPossibilities( Sequence< sal_Bool >& rPossibilityList - , const Reference< XDiagram>& xDiagram, bool bAxis ) + , const rtl::Reference< Diagram>& xDiagram, bool bAxis ) { rPossibilityList.realloc(6); sal_Bool* pPossibilityList = rPossibilityList.getArray(); @@ -1123,7 +1123,7 @@ void AxisHelper::setRTLAxisLayout( const Reference< XCoordinateSystem >& xCooSys } } -rtl::Reference< ChartType > AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( const Reference< chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex ) +rtl::Reference< ChartType > AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( const rtl::Reference< Diagram >& xDiagram, const sal_Int32 nAttachedAxisIndex ) { rtl::Reference< ChartType > xChartType; std::vector< Reference< XDataSeries > > aSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) ); diff --git a/chart2/source/tools/DataSourceHelper.cxx b/chart2/source/tools/DataSourceHelper.cxx index b21ccd11b254..eda39aa7de78 100644 --- a/chart2/source/tools/DataSourceHelper.cxx +++ b/chart2/source/tools/DataSourceHelper.cxx @@ -225,7 +225,9 @@ uno::Reference< chart2::data::XDataSource > DataSourceHelper::pressUsedDataIntoR std::vector< Reference< chart2::data::XLabeledDataSequence > > aResultVector; //categories are always the first sequence - Reference< chart2::XDiagram > xDiagram( xChartDoc->getFirstDiagram()); + auto pModel = dynamic_cast<ChartModel*>(xChartDoc.get()); + assert(pModel); + rtl::Reference< Diagram > xDiagram( pModel->getFirstChartDiagram()); Reference< chart2::data::XLabeledDataSequence > xCategories( DiagramHelper::getCategoriesFromDiagram( xDiagram ) ); if( xCategories.is() ) @@ -254,7 +256,7 @@ uno::Reference< chart2::data::XDataSource > DataSourceHelper::pressUsedDataIntoR } uno::Sequence< OUString > DataSourceHelper::getUsedDataRanges( - const uno::Reference< chart2::XDiagram > & xDiagram ) + const rtl::Reference< Diagram > & xDiagram ) { std::vector< OUString > aResult; @@ -336,7 +338,7 @@ bool DataSourceHelper::detectRangeSegmentation( bSomethingDetected = !rOutRangeString.isEmpty(); uno::Reference< chart2::data::XLabeledDataSequence > xCategories( - DiagramHelper::getCategoriesFromDiagram( xChartModel->getFirstDiagram() )); + DiagramHelper::getCategoriesFromDiagram( xChartModel->getFirstChartDiagram() )); rOutHasCategories = xCategories.is(); } catch( uno::Exception & ) diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index 8a1a5350a227..99618fdd44d2 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -78,15 +78,13 @@ namespace chart DiagramHelper::tTemplateWithServiceName DiagramHelper::getTemplateForDiagram( - const Reference< XDiagram > & xDiagram, + const rtl::Reference< Diagram > & xDiagram, const rtl::Reference< ::chart::ChartTypeManager > & xChartTypeManager ) { DiagramHelper::tTemplateWithServiceName aResult; if( ! (xChartTypeManager.is() && xDiagram.is())) return aResult; - auto pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); - assert(pDiagram); Sequence< OUString > aServiceNames( xChartTypeManager->getAvailableServiceNames()); const sal_Int32 nLength = aServiceNames.getLength(); @@ -100,7 +98,7 @@ DiagramHelper::tTemplateWithServiceName rtl::Reference< ::chart::ChartTypeTemplate > xTempl = xChartTypeManager->createTemplate( aServiceNames[ i ] ); - if (xTempl.is() && xTempl->matchesTemplate(pDiagram, true)) + if (xTempl.is() && xTempl->matchesTemplate(xDiagram, true)) { aResult.xChartTypeTemplate = xTempl; aResult.sServiceName = aServiceNames[ i ]; @@ -117,7 +115,7 @@ DiagramHelper::tTemplateWithServiceName } void DiagramHelper::setVertical( - const Reference< XDiagram > & xDiagram, + const rtl::Reference< Diagram > & xDiagram, bool bVertical /* = true */ ) { try @@ -125,12 +123,9 @@ void DiagramHelper::setVertical( if (!xDiagram.is()) return; - Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); - assert(pDiagram); - uno::Any aValue; aValue <<= bVertical; - for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : pDiagram->getBaseCoordinateSystems() ) + for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : xDiagram->getBaseCoordinateSystems() ) { bool bChanged = false; bool bOldSwap = false; @@ -187,7 +182,7 @@ void DiagramHelper::setVertical( } } -bool DiagramHelper::getVertical( const uno::Reference< chart2::XDiagram > & xDiagram, +bool DiagramHelper::getVertical( const rtl::Reference< Diagram > & xDiagram, bool& rbFound, bool& rbAmbiguous ) { bool bValue = false; @@ -197,10 +192,7 @@ bool DiagramHelper::getVertical( const uno::Reference< chart2::XDiagram > & xDia if (!xDiagram.is()) return false; - Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); - assert(pDiagram); - - for (rtl::Reference<BaseCoordinateSystem> const & coords : pDiagram->getBaseCoordinateSystems()) + for (rtl::Reference<BaseCoordinateSystem> const & coords : xDiagram->getBaseCoordinateSystems()) { bool bCurrent = false; if (coords->getPropertyValue("SwapXAndYAxis") >>= bCurrent) @@ -221,12 +213,10 @@ bool DiagramHelper::getVertical( const uno::Reference< chart2::XDiagram > & xDia } void DiagramHelper::setStackMode( - const Reference< XDiagram > & xDiagram, + const rtl::Reference< Diagram > & xDiagram, StackMode eStackMode ) { - Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); - assert(pDiagram); try { bool bValueFound = false; @@ -249,7 +239,7 @@ void DiagramHelper::setStackMode( bPercent = true; //iterate through all coordinate systems - for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : pDiagram->getBaseCoordinateSystems() ) + for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : xDiagram->getBaseCoordinateSystems() ) { //set correct percent stacking const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(1); @@ -297,7 +287,7 @@ void DiagramHelper::setStackMode( } } -StackMode DiagramHelper::getStackMode( const Reference< XDiagram > & xDiagram, bool& rbFound, bool& rbAmbiguous ) +StackMode DiagramHelper::getStackMode( const rtl::Reference< Diagram > & xDiagram, bool& rbFound, bool& rbAmbiguous ) { rbFound=false; rbAmbiguous=false; @@ -306,11 +296,9 @@ StackMode DiagramHelper::getStackMode( const Reference< XDiagram > & xDiagram, b if( !xDiagram.is() ) return eGlobalStackMode; - Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); - assert(pDiagram); //iterate through all coordinate systems - for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : pDiagram->getBaseCoordinateSystems() ) + for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : xDiagram->getBaseCoordinateSystems() ) { //iterate through all chart types in the current coordinate system std::vector< rtl::Reference< ChartType > > aChartTypeList( xCooSys->getChartTypes2() ); @@ -415,19 +403,16 @@ StackMode DiagramHelper::getStackModeFromChartType( return eStackMode; } -sal_Int32 DiagramHelper::getDimension( const Reference< XDiagram > & xDiagram ) +sal_Int32 DiagramHelper::getDimension( const rtl::Reference< Diagram > & xDiagram ) { // -1: not yet set sal_Int32 nResult = -1; if (!xDiagram) return nResult; - Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); - assert(pDiagram); - try { - for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : pDiagram->getBaseCoordinateSystems() ) + for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : xDiagram->getBaseCoordinateSystems() ) { if(xCooSys.is()) { @@ -445,13 +430,11 @@ sal_Int32 DiagramHelper::getDimension( const Reference< XDiagram > & xDiagram ) } void DiagramHelper::setDimension( - const Reference< XDiagram > & xDiagram, + const rtl::Reference< Diagram > & xDiagram, sal_Int32 nNewDimensionCount ) { if( ! xDiagram.is()) return; - Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); - assert(pDiagram); if( DiagramHelper::getDimension( xDiagram ) == nNewDimensionCount ) return; @@ -464,7 +447,7 @@ void DiagramHelper::setDimension( bool bIsSupportingOnlyDeepStackingFor3D=false; //change all coordinate systems: - auto aCoordSystems = pDiagram->getBaseCoordinateSystems(); + auto aCoordSystems = xDiagram->getBaseCoordinateSystems(); for( rtl::Reference<BaseCoordinateSystem> const & xOldCooSys : aCoordSystems ) { rtl::Reference< BaseCoordinateSystem > xNewCooSys; @@ -501,7 +484,7 @@ void DiagramHelper::setDimension( } void DiagramHelper::replaceCoordinateSystem( - const Reference< XDiagram > & xDiagram, + const rtl::Reference< Diagram > & xDiagram, const Reference< XCoordinateSystem > & xCooSysToReplace, const Reference< XCoordinateSystem > & xReplacement ) { @@ -510,9 +493,6 @@ void DiagramHelper::replaceCoordinateSystem( return; // update the coordinate-system container - Reference< XCoordinateSystemContainer > xCont( xDiagram, uno::UNO_QUERY ); - if( !xCont.is()) - return; try { @@ -523,8 +503,8 @@ void DiagramHelper::replaceCoordinateSystem( Reference< XChartTypeContainer > xCTCntReplacement( xReplacement, uno::UNO_QUERY_THROW ); xCTCntReplacement->setChartTypes( xCTCntCooSys->getChartTypes()); - xCont->removeCoordinateSystem( xCooSysToReplace ); - xCont->addCoordinateSystem( xReplacement ); + xDiagram->removeCoordinateSystem( xCooSysToReplace ); + xDiagram->addCoordinateSystem( xReplacement ); if( xCategories.is() ) DiagramHelper::setCategoriesToDiagram( xCategories, xDiagram ); @@ -544,7 +524,7 @@ bool DiagramHelper::isSeriesAttachedToMainAxis( bool DiagramHelper::attachSeriesToAxis( bool bAttachToMainAxis , const uno::Reference< chart2::XDataSeries >& xDataSeries - , const uno::Reference< chart2::XDiagram >& xDiagram + , const rtl::Reference< Diagram >& xDiagram , const uno::Reference< uno::XComponentContext > & xContext , bool bAdaptAxes ) { @@ -587,28 +567,26 @@ bool DiagramHelper::attachSeriesToAxis( bool bAttachToMainAxis uno::Reference< XAxis > DiagramHelper::getAttachedAxis( const uno::Reference< XDataSeries >& xSeries, - const uno::Reference< XDiagram >& xDiagram ) + const rtl::Reference< Diagram >& xDiagram ) { return AxisHelper::getAxis( 1, DiagramHelper::isSeriesAttachedToMainAxis( xSeries ), xDiagram ); } rtl::Reference< ChartType > DiagramHelper::getChartTypeOfSeries( - const uno::Reference< chart2::XDiagram >& xDiagram + const rtl::Reference< Diagram >& xDiagram , const uno::Reference< XDataSeries >& xGivenDataSeries ) { if( !xGivenDataSeries.is() ) return nullptr; if(!xDiagram.is()) return nullptr; - Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); - assert(pDiagram); //iterate through the model to find the given xSeries //the found parent indicates the charttype //iterate through all coordinate systems - for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : pDiagram->getBaseCoordinateSystems() ) + for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : xDiagram->getBaseCoordinateSystems() ) { //iterate through all chart types in the current coordinate system const std::vector< rtl::Reference< ChartType > > & aChartTypeList( xCooSys->getChartTypes2() ); @@ -628,17 +606,15 @@ rtl::Reference< ChartType > DiagramHelper::getChartTypeOfSeries( std::vector< Reference< XDataSeries > > DiagramHelper::getDataSeriesFromDiagram( - const Reference< XDiagram > & xDiagram ) + const rtl::Reference< Diagram > & xDiagram ) { std::vector< Reference< XDataSeries > > aResult; if (!xDiagram) return aResult; - Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); - assert(pDiagram); try { - for( rtl::Reference< BaseCoordinateSystem > const & coords : pDiagram->getBaseCoordinateSystems() ) + for( rtl::Reference< BaseCoordinateSystem > const & coords : xDiagram->getBaseCoordinateSystems() ) { const Sequence< Reference< XChartType > > aChartTypeSeq( coords->getChartTypes()); for( Reference< XChartType> const & chartType : aChartTypeSeq ) @@ -658,17 +634,15 @@ std::vector< Reference< XDataSeries > > } Sequence< Sequence< Reference< XDataSeries > > > - DiagramHelper::getDataSeriesGroups( const Reference< XDiagram > & xDiagram ) + DiagramHelper::getDataSeriesGroups( const rtl::Reference< Diagram > & xDiagram ) { if (!xDiagram) return {}; vector< Sequence< Reference< XDataSeries > > > aResult; - Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); - assert(pDiagram); //iterate through all coordinate systems - for( rtl::Reference< BaseCoordinateSystem > const & coords : pDiagram->getBaseCoordinateSystems() ) + for( rtl::Reference< BaseCoordinateSystem > const & coords : xDiagram->getBaseCoordinateSystems() ) { //iterate through all chart types in the current coordinate system const Sequence< Reference< XChartType > > aChartTypeList( coords->getChartTypes() ); @@ -684,19 +658,16 @@ Sequence< Sequence< Reference< XDataSeries > > > } rtl::Reference< ChartType > - DiagramHelper::getChartTypeByIndex( const Reference< XDiagram >& xDiagram, sal_Int32 nIndex ) + DiagramHelper::getChartTypeByIndex( const rtl::Reference< Diagram >& xDiagram, sal_Int32 nIndex ) { if (!xDiagram) return nullptr; - Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); - assert(pDiagram); - rtl::Reference< ChartType > xChartType; //iterate through all coordinate systems sal_Int32 nTypesSoFar = 0; - for( rtl::Reference< BaseCoordinateSystem > const & coords : pDiagram->getBaseCoordinateSystems() ) + for( rtl::Reference< BaseCoordinateSystem > const & coords : xDiagram->getBaseCoordinateSystems() ) { const std::vector< rtl::Reference< ChartType > > & aChartTypeList( coords->getChartTypes2() ); if( nIndex >= 0 && nIndex < static_cast<sal_Int32>(nTypesSoFar + aChartTypeList.size()) ) @@ -760,13 +731,11 @@ std::vector< Reference< XAxis > > lcl_getAxisHoldingCategoriesFromDiagram( } // anonymous namespace bool DiagramHelper::isCategoryDiagram( - const Reference< XDiagram >& xDiagram ) + const rtl::Reference< Diagram >& xDiagram ) { try { - Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); - assert(pDiagram); - for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : pDiagram->getBaseCoordinateSystems() ) + for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : xDiagram->getBaseCoordinateSystems() ) { for( sal_Int32 nN = xCooSys->getDimension(); nN--; ) { @@ -795,14 +764,12 @@ bool DiagramHelper::isCategoryDiagram( void DiagramHelper::setCategoriesToDiagram( const Reference< chart2::data::XLabeledDataSequence >& xCategories, - const Reference< XDiagram >& xDiagram, + const rtl::Reference< Diagram >& xDiagram, bool bSetAxisType /* = false */, bool bCategoryAxis /* = true */ ) { - Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); - assert(pDiagram); std::vector< Reference< chart2::XAxis > > aCatAxes( - lcl_getAxisHoldingCategoriesFromDiagram( pDiagram )); + lcl_getAxisHoldingCategoriesFromDiagram( xDiagram )); for (const Reference< chart2::XAxis >& xCatAxis : aCatAxes) { @@ -824,16 +791,14 @@ void DiagramHelper::setCategoriesToDiagram( Reference< data::XLabeledDataSequence > DiagramHelper::getCategoriesFromDiagram( - const Reference< XDiagram > & xDiagram ) + const rtl::Reference< Diagram > & xDiagram ) { Reference< data::XLabeledDataSequence > xResult; - Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); - assert(pDiagram); try { std::vector< Reference< chart2::XAxis > > aCatAxes( - lcl_getAxisHoldingCategoriesFromDiagram( pDiagram )); + lcl_getAxisHoldingCategoriesFromDiagram( xDiagram )); //search for first categories if (!aCatAxes.empty()) { @@ -1049,7 +1014,7 @@ void DiagramHelper::switchToTextCategories( const rtl::Reference<::chart::ChartM } } -bool DiagramHelper::isSupportingDateAxis( const Reference< chart2::XDiagram >& xDiagram ) +bool DiagramHelper::isSupportingDateAxis( const rtl::Reference< Diagram >& xDiagram ) { return ::chart::ChartTypeHelper::isSupportingDateAxis( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ), 0 ); @@ -1151,17 +1116,15 @@ sal_Int32 DiagramHelper::getPercentNumberFormat( const Reference< util::XNumberF std::vector< rtl::Reference< ChartType > > DiagramHelper::getChartTypesFromDiagram( - const Reference< XDiagram > & xDiagram ) + const rtl::Reference< Diagram > & xDiagram ) { if(!xDiagram) return {}; - Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); - assert(pDiagram); std::vector< rtl::Reference< ChartType > > aResult; try { - for( rtl::Reference< BaseCoordinateSystem > const & coords : pDiagram->getBaseCoordinateSystems() ) + for( rtl::Reference< BaseCoordinateSystem > const & coords : xDiagram->getBaseCoordinateSystems() ) { const std::vector< rtl::Reference< ChartType > > & aChartTypeSeq( coords->getChartTypes2()); aResult.insert( aResult.end(), aChartTypeSeq.begin(), aChartTypeSeq.end() ); @@ -1352,34 +1315,29 @@ bool lcl_moveSeriesOrCheckIfMoveIsAllowed( } // anonymous namespace bool DiagramHelper::isSeriesMoveable( - const Reference< XDiagram >& xDiagram, + const rtl::Reference< Diagram >& xDiagram, const Reference< XDataSeries >& xGivenDataSeries, bool bForward ) { const bool bDoMove = false; - Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); - assert(!xDiagram || pDiagram); bool bIsMoveable = lcl_moveSeriesOrCheckIfMoveIsAllowed( - pDiagram, xGivenDataSeries, bForward, bDoMove ); + xDiagram, xGivenDataSeries, bForward, bDoMove ); return bIsMoveable; } -bool DiagramHelper::moveSeries( const Reference< XDiagram >& xDiagram, const Reference< XDataSeries >& xGivenDataSeries, bool bForward ) +bool DiagramHelper::moveSeries( const rtl::Reference< Diagram >& xDiagram, const Reference< XDataSeries >& xGivenDataSeries, bool bForward ) { const bool bDoMove = true; - Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); - assert(!xDiagram || pDiagram); bool bMoved = lcl_moveSeriesOrCheckIfMoveIsAllowed( - pDiagram, xGivenDataSeries, bForward, bDoMove ); + xDiagram, xGivenDataSeries, bForward, bDoMove ); return bMoved; } -bool DiagramHelper::isSupportingFloorAndWall( const Reference< - chart2::XDiagram >& xDiagram ) +bool DiagramHelper::isSupportingFloorAndWall( const rtl::Reference< Diagram >& xDiagram ) { //pies and donuts currently do not support this because of wrong files from older versions //todo: allow this in future again, if fileversion is available for OLE objects (metastream) @@ -1399,9 +1357,9 @@ bool DiagramHelper::isSupportingFloorAndWall( const Reference< return true; } -bool DiagramHelper::isPieOrDonutChart( const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) +bool DiagramHelper::isPieOrDonutChart( const rtl::Reference< Diagram >& xDiagram ) { - uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( + rtl::Reference< ChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); if( xChartType .is() ) @@ -1414,7 +1372,7 @@ bool DiagramHelper::isPieOrDonutChart( const css::uno::Reference< css::chart2::X } sal_Int32 DiagramHelper::getGeometry3D( - const uno::Reference< chart2::XDiagram > & xDiagram, + const rtl::Reference< Diagram > & xDiagram, bool& rbFound, bool& rbAmbiguous ) { sal_Int32 nCommonGeom( DataPointGeometry3D::CUBOID ); @@ -1459,7 +1417,7 @@ sal_Int32 DiagramHelper::getGeometry3D( } void DiagramHelper::setGeometry3D( - const Reference< chart2::XDiagram > & xDiagram, + const rtl::Reference< Diagram > & xDiagram, sal_Int32 nNewGeometry ) { std::vector< Reference< chart2::XDataSeries > > aSeriesVec( @@ -1473,15 +1431,14 @@ void DiagramHelper::setGeometry3D( } sal_Int32 DiagramHelper::getCorrectedMissingValueTreatment( - const Reference< chart2::XDiagram > & xDiagram, + const rtl::Reference< Diagram > & xDiagram, const rtl::Reference< ChartType >& xChartType ) { sal_Int32 nResult = css::chart::MissingValueTreatment::LEAVE_GAP; const uno::Sequence < sal_Int32 > aAvailableMissingValueTreatments( ChartTypeHelper::getSupportedMissingValueTreatments( xChartType ) ); - uno::Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY ); - if( xDiaProp.is() && (xDiaProp->getPropertyValue( "MissingValueTreatment" ) >>= nResult) ) + if( xDiagram.is() && (xDiagram->getPropertyValue( "MissingValueTreatment" ) >>= nResult) ) { //ensure that the set value is supported by this charttype for( sal_Int32 n : aAvailableMissingValueTreatments ) @@ -1499,20 +1456,19 @@ sal_Int32 DiagramHelper::getCorrectedMissingValueTreatment( return nResult; } -DiagramPositioningMode DiagramHelper::getDiagramPositioningMode( const uno::Reference< - chart2::XDiagram > & xDiagram ) +DiagramPositioningMode DiagramHelper::getDiagramPositioningMode( const rtl::Reference< + Diagram > & xDiagram ) { DiagramPositioningMode eMode = DiagramPositioningMode_AUTO; - uno::Reference< beans::XPropertySet > xDiaProps( xDiagram, uno::UNO_QUERY ); - if( xDiaProps.is() ) + if( xDiagram.is() ) { RelativePosition aRelPos; RelativeSize aRelSize; - if( (xDiaProps->getPropertyValue("RelativePosition") >>= aRelPos ) && - (xDiaProps->getPropertyValue("RelativeSize") >>= aRelSize ) ) + if( (xDiagram->getPropertyValue("RelativePosition") >>= aRelPos ) && + (xDiagram->getPropertyValue("RelativeSize") >>= aRelSize ) ) { bool bPosSizeExcludeAxes=false; - xDiaProps->getPropertyValue("PosSizeExcludeAxes") >>= bPosSizeExcludeAxes; + xDiagram->getPropertyValue("PosSizeExcludeAxes") >>= bPosSizeExcludeAxes; if( bPosSizeExcludeAxes ) eMode = DiagramPositioningMode_EXCLUDING; else diff --git a/chart2/source/tools/RangeHighlighter.cxx b/chart2/source/tools/RangeHighlighter.cxx index 5e89b097f2f9..766cbfc91f73 100644 --- a/chart2/source/tools/RangeHighlighter.cxx +++ b/chart2/source/tools/RangeHighlighter.cxx @@ -192,21 +192,6 @@ void RangeHighlighter::determineRanges() } } -void RangeHighlighter::fillRangesForDiagram( const Reference< chart2::XDiagram > & xDiagram ) -{ - Sequence< OUString > aSelectedRanges( DataSourceHelper::getUsedDataRanges( xDiagram )); - m_aSelectedRanges.realloc( aSelectedRanges.getLength()); - auto pSelectedRanges = m_aSelectedRanges.getArray(); - // @todo: merge ranges - for( sal_Int32 i=0; i<aSelectedRanges.getLength(); ++i ) - { - pSelectedRanges[i].RangeRepresentation = aSelectedRanges[i]; - pSelectedRanges[i].Index = -1; - pSelectedRanges[i].PreferredColor = sal_Int32(defaultPreferredColor); - pSelectedRanges[i].AllowMerginigWithOtherRanges = true; - } -} - void RangeHighlighter::fillRangesForDiagram( const rtl::Reference< Diagram > & xDiagram ) { Sequence< OUString > aSelectedRanges( DataSourceHelper::getUsedDataRanges( xDiagram )); diff --git a/chart2/source/tools/ReferenceSizeProvider.cxx b/chart2/source/tools/ReferenceSizeProvider.cxx index 46dfb1d593f8..2df37be326a7 100644 --- a/chart2/source/tools/ReferenceSizeProvider.cxx +++ b/chart2/source/tools/ReferenceSizeProvider.cxx @@ -93,7 +93,7 @@ void ReferenceSizeProvider::setValuesAtTitle( void ReferenceSizeProvider::setValuesAtAllDataSeries() { - Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartDoc )); + rtl::Reference< Diagram > xDiagram( ChartModelHelper::findDiagram( m_xChartDoc )); // DataSeries/Points std::vector< Reference< XDataSeries > > aSeries( @@ -230,14 +230,13 @@ ReferenceSizeProvider::AutoResizeState ReferenceSizeProvider::getAutoResizeState return eResult; // diagram is needed by the rest of the objects - Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xChartDoc ); + rtl::Reference< Diagram > xDiagram = ChartModelHelper::findDiagram( xChartDoc ); if( ! xDiagram.is()) return eResult; // Sub Title - Reference< XTitled > xDiaTitled( xDiagram, uno::UNO_QUERY ); - if( xDiaTitled.is()) - impl_getAutoResizeFromTitled( xDiaTitled, eResult ); + if( xDiagram.is()) + impl_getAutoResizeFromTitled( xDiagram, eResult ); if( eResult == AUTO_RESIZE_AMBIGUOUS ) return eResult; diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx index 52ab1e1785e9..00e846105c7f 100644 --- a/chart2/source/tools/RegressionCurveHelper.cxx +++ b/chart2/source/tools/RegressionCurveHelper.cxx @@ -688,7 +688,7 @@ OUString RegressionCurveHelper::getRegressionCurveName( const Reference< XRegres std::vector< Reference< chart2::XRegressionCurve > > RegressionCurveHelper::getAllRegressionCurvesNotMeanValueLine( - const Reference< chart2::XDiagram > & xDiagram ) + const rtl::Reference< Diagram > & xDiagram ) { std::vector< Reference< chart2::XRegressionCurve > > aResult; std::vector< Reference< chart2::XDataSeries > > aSeries( DiagramHelper::getDataSeriesFromDiagram( xDiagram )); diff --git a/chart2/source/tools/ThreeDHelper.cxx b/chart2/source/tools/ThreeDHelper.cxx index 6ffa8be980d4..c3397bcde3d8 100644 --- a/chart2/source/tools/ThreeDHelper.cxx +++ b/chart2/source/tools/ThreeDHelper.cxx @@ -18,6 +18,7 @@ */ #include <ThreeDHelper.hxx> +#include <Diagram.hxx> #include <DiagramHelper.hxx> #include <ChartTypeHelper.hxx> #include <ChartType.hxx> @@ -48,15 +49,14 @@ using ::rtl::math::tan; namespace { -bool lcl_isRightAngledAxesSetAndSupported( const Reference< beans::XPropertySet >& xSceneProperties ) +bool lcl_isRightAngledAxesSetAndSupported( const rtl::Reference< Diagram >& xDiagram ) { - if( xSceneProperties.is() ) + if( xDiagram.is() ) { bool bRightAngledAxes = false; - xSceneProperties->getPropertyValue( "RightAngledAxes") >>= bRightAngledAxes; + xDiagram->getPropertyValue( "RightAngledAxes") >>= bRightAngledAxes; if(bRightAngledAxes) { - uno::Reference< chart2::XDiagram > xDiagram( xSceneProperties, uno::UNO_QUERY ); if( ChartTypeHelper::isSupportingRightAngledAxes( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ) ) { @@ -144,31 +144,30 @@ bool lcl_isEqual( const drawing::Direction3D& rA, const drawing::Direction3D& rB && ::rtl::math::approxEqual(rA.DirectionZ, rB.DirectionZ); } -bool lcl_isLightScheme( const uno::Reference< beans::XPropertySet >& xDiagramProps, bool bRealistic ) +bool lcl_isLightScheme( const rtl::Reference< Diagram >& xDiagram, bool bRealistic ) { - if(!xDiagramProps.is()) + if(!xDiagram.is()) return false; bool bIsOn = false; - xDiagramProps->getPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_2 ) >>= bIsOn; + xDiagram->getPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_2 ) >>= bIsOn; if(!bIsOn) return false; - uno::Reference< chart2::XDiagram > xDiagram( xDiagramProps, uno::UNO_QUERY ); rtl::Reference< ChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); sal_Int32 nColor = 0; - xDiagramProps->getPropertyValue( UNO_NAME_3D_SCENE_LIGHTCOLOR_2 ) >>= nColor; + xDiagram->getPropertyValue( UNO_NAME_3D_SCENE_LIGHTCOLOR_2 ) >>= nColor; if( nColor != ::chart::ChartTypeHelper::getDefaultDirectLightColor( !bRealistic, xChartType ) ) return false; sal_Int32 nAmbientColor = 0; - xDiagramProps->getPropertyValue( UNO_NAME_3D_SCENE_AMBIENTCOLOR ) >>= nAmbientColor; + xDiagram->getPropertyValue( UNO_NAME_3D_SCENE_AMBIENTCOLOR ) >>= nAmbientColor; if( nAmbientColor != ::chart::ChartTypeHelper::getDefaultAmbientLightColor( !bRealistic, xChartType ) ) return false; drawing::Direction3D aDirection(0,0,0); - xDiagramProps->getPropertyValue( UNO_NAME_3D_SCENE_LIGHTDIRECTION_2 ) >>= aDirection; + xDiagram->getPropertyValue( UNO_NAME_3D_SCENE_LIGHTDIRECTION_2 ) >>= aDirection; drawing::Direction3D aDefaultDirection( bRealistic ? ChartTypeHelper::getDefaultRealisticLightDirection(xChartType) @@ -177,13 +176,13 @@ bool lcl_isLightScheme( const uno::Reference< beans::XPropertySet >& xDiagramPro //rotate default light direction when right angled axes are off but supported { bool bRightAngledAxes = false; - xDiagramProps->getPropertyValue( "RightAngledAxes") >>= bRightAngledAxes; + xDiagram->getPropertyValue( "RightAngledAxes") >>= bRightAngledAxes; if(!bRightAngledAxes) { if( ChartTypeHelper::isSupportingRightAngledAxes( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ) ) { - ::basegfx::B3DHomMatrix aRotation( lcl_getCompleteRotationMatrix( xDiagramProps ) ); + ::basegfx::B3DHomMatrix aRotation( lcl_getCompleteRotationMatrix( xDiagram ) ); BaseGFXHelper::ReduceToRotationMatrix( aRotation ); ::basegfx::B3DVector aLightVector( BaseGFXHelper::Direction3DToB3DVector( aDefaultDirection ) ); aLightVector = aRotation*aLightVector; @@ -195,52 +194,51 @@ bool lcl_isLightScheme( const uno::Reference< beans::XPropertySet >& xDiagramPro return lcl_isEqual( aDirection, aDefaultDirection ); } -bool lcl_isRealisticLightScheme( const uno::Reference< beans::XPropertySet >& xDiagramProps ) +bool lcl_isRealisticLightScheme( const rtl::Reference< Diagram >& xDiagram ) { - return lcl_isLightScheme( xDiagramProps, true /*bRealistic*/ ); + return lcl_isLightScheme( xDiagram, true /*bRealistic*/ ); } -bool lcl_isSimpleLightScheme( const uno::Reference< beans::XPropertySet >& xDiagramProps ) +bool lcl_isSimpleLightScheme( const rtl::Reference< Diagram >& xDiagram ) { - return lcl_isLightScheme( xDiagramProps, false /*bRealistic*/ ); + return lcl_isLightScheme( xDiagram, false /*bRealistic*/ ); } -void lcl_setLightsForScheme( const uno::Reference< beans::XPropertySet >& xDiagramProps, const ThreeDLookScheme& rScheme ) +void lcl_setLightsForScheme( const rtl::Reference< Diagram >& xDiagram, const ThreeDLookScheme& rScheme ) { - if(!xDiagramProps.is()) + if(!xDiagram.is()) return; if( rScheme == ThreeDLookScheme::ThreeDLookScheme_Unknown) return; - xDiagramProps->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_2, uno::Any( true ) ); + xDiagram->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_2, uno::Any( true ) ); - uno::Reference< chart2::XDiagram > xDiagram( xDiagramProps, uno::UNO_QUERY ); rtl::Reference< ChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); uno::Any aADirection( rScheme == ThreeDLookScheme::ThreeDLookScheme_Simple ? ChartTypeHelper::getDefaultSimpleLightDirection(xChartType) : ChartTypeHelper::getDefaultRealisticLightDirection(xChartType) ); - xDiagramProps->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTDIRECTION_2, aADirection ); + xDiagram->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTDIRECTION_2, aADirection ); //rotate light direction when right angled axes are off but supported { bool bRightAngledAxes = false; - xDiagramProps->getPropertyValue( "RightAngledAxes") >>= bRightAngledAxes; + xDiagram->getPropertyValue( "RightAngledAxes") >>= bRightAngledAxes; if(!bRightAngledAxes) { if( ChartTypeHelper::isSupportingRightAngledAxes( xChartType ) ) { - ::basegfx::B3DHomMatrix aRotation( lcl_getCompleteRotationMatrix( xDiagramProps ) ); + ::basegfx::B3DHomMatrix aRotation( lcl_getCompleteRotationMatrix( xDiagram ) ); BaseGFXHelper::ReduceToRotationMatrix( aRotation ); - lcl_RotateLightSource( xDiagramProps, "D3DSceneLightDirection2", "D3DSceneLightOn2", aRotation ); + lcl_RotateLightSource( xDiagram, "D3DSceneLightDirection2", "D3DSceneLightOn2", aRotation ); } } } sal_Int32 nColor = ::chart::ChartTypeHelper::getDefaultDirectLightColor( rScheme == ThreeDLookScheme::ThreeDLookScheme_Simple, xChartType); - xDiagramProps->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTCOLOR_2, uno::Any( nColor ) ); + xDiagram->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTCOLOR_2, uno::Any( nColor ) ); sal_Int32 nAmbientColor = ::chart::ChartTypeHelper::getDefaultAmbientLightColor( rScheme == ThreeDLookScheme::ThreeDLookScheme_Simple, xChartType); - xDiagramProps->setPropertyValue( UNO_NAME_3D_SCENE_AMBIENTCOLOR, uno::Any( nAmbientColor ) ); + xDiagram->setPropertyValue( UNO_NAME_3D_SCENE_AMBIENTCOLOR, uno::Any( nAmbientColor ) ); } bool lcl_isRealisticScheme( drawing::ShadeMode aShadeMode @@ -259,7 +257,7 @@ bool lcl_isRealisticScheme( drawing::ShadeMode aShadeMode bool lcl_isSimpleScheme( drawing::ShadeMode aShadeMode , sal_Int32 nRoundedEdges , sal_Int32 nObjectLines - , const uno::Reference< XDiagram >& xDiagram ) + , const rtl::Reference< Diagram >& xDiagram ) { if(aShadeMode!=drawing::ShadeMode_FLAT) return false; @@ -287,7 +285,7 @@ void lcl_setRealisticScheme( drawing::ShadeMode& rShadeMode void lcl_setSimpleScheme( drawing::ShadeMode& rShadeMode , sal_Int32& rnRoundedEdges , sal_Int32& rnObjectLines - , const uno::Reference< XDiagram >& xDiagram ) + , const rtl::Reference< Diagram >& xDiagram ) { rShadeMode = drawing::ShadeMode_FLAT; rnRoundedEdges = 0; @@ -967,7 +965,7 @@ void ThreeDHelper::switchRightAngledAxes( const Reference< beans::XPropertySet > } void ThreeDHelper::setRotationAngleToDiagram( - const Reference< beans::XPropertySet >& xSceneProperties + const rtl::Reference< Diagram >& xDiagram , double fXAngleRad, double fYAngleRad, double fZAngleRad ) { //the rotation of the camera is not touched but taken into account @@ -975,18 +973,18 @@ void ThreeDHelper::setRotationAngleToDiagram( //the light sources will be adapted also - if( !xSceneProperties.is() ) + if( !xDiagram.is() ) return; try { //remind old rotation for adaptation of light directions - ::basegfx::B3DHomMatrix aInverseOldRotation( lcl_getInverseRotationMatrix( xSceneProperties ) ); + ::basegfx::B3DHomMatrix aInverseOldRotation( lcl_getInverseRotationMatrix( xDiagram ) ); ::basegfx::B3DHomMatrix aInverseCameraRotation; { ::basegfx::B3DTuple aR( BaseGFXHelper::GetRotationFromMatrix( - lcl_getCameraMatrix( xSceneProperties ) ) ); + lcl_getCameraMatrix( xDiagram ) ) ); aInverseCameraRotation.rotate( 0.0, 0.0, -aR.getZ() ); aInverseCameraRotation.rotate( 0.0, -aR.getY(), 0.0 ); aInverseCameraRotation.rotate( -aR.getX(), 0.0, 0.0 ); @@ -1000,19 +998,18 @@ void ThreeDHelper::setRotationAngleToDiagram( BaseGFXHelper::ReduceToRotationMatrix( aSceneRotation ); //set new rotation to transformation matrix - xSceneProperties->setPropertyValue( + xDiagram->setPropertyValue( "D3DTransformMatrix", uno::Any( BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aSceneRotation ))); //rotate lights if RightAngledAxes are not set or not supported bool bRightAngledAxes = false; - xSceneProperties->getPropertyValue( "RightAngledAxes") >>= bRightAngledAxes; - uno::Reference< chart2::XDiagram > xDiagram( xSceneProperties, uno::UNO_QUERY ); + xDiagram->getPropertyValue( "RightAngledAxes") >>= bRightAngledAxes; if(!bRightAngledAxes || !ChartTypeHelper::isSupportingRightAngledAxes( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ) ) { ::basegfx::B3DHomMatrix aNewRotation; aNewRotation.rotate( fXAngleRad, fYAngleRad, fZAngleRad ); - lcl_rotateLights( aNewRotation*aInverseOldRotation, xSceneProperties ); + lcl_rotateLights( aNewRotation*aInverseOldRotation, xDiagram ); } } catch( const uno::Exception & ) @@ -1021,7 +1018,7 @@ void ThreeDHelper::setRotationAngleToDiagram( } } -void ThreeDHelper::getRotationFromDiagram( const uno::Reference< beans::XPropertySet >& xSceneProperties +void ThreeDHelper::getRotationFromDiagram( const rtl::Reference< Diagram >& xSceneProperties , sal_Int32& rnHorizontalAngleDegree, sal_Int32& rnVerticalAngleDegree ) { double fXAngle, fYAngle, fZAngle; @@ -1044,7 +1041,7 @@ void ThreeDHelper::getRotationFromDiagram( const uno::Reference< beans::XPropert rnVerticalAngleDegree = NormAngle180(rnVerticalAngleDegree); } -void ThreeDHelper::setRotationToDiagram( const uno::Reference< beans::XPropertySet >& xSceneProperties +void ThreeDHelper::setRotationToDiagram( const rtl::Reference< Diagram >& xDiagram , sal_Int32 nHorizontalAngleDegree, sal_Int32 nVerticalYAngleDegree ) { //todo: x and y is not equal to horz and vert in case of RightAngledAxes==false @@ -1052,11 +1049,11 @@ void ThreeDHelper::setRotationToDiagram( const uno::Reference< beans::XPropertyS double fYAngle = basegfx::deg2rad(-1 * nVerticalYAngleDegree); double fZAngle = 0.0; - if( !lcl_isRightAngledAxesSetAndSupported( xSceneProperties ) ) + if( !lcl_isRightAngledAxesSetAndSupported( xDiagram ) ) ThreeDHelper::convertElevationRotationDegToXYZAngleRad( nHorizontalAngleDegree, -1*nVerticalYAngleDegree, fXAngle, fYAngle, fZAngle ); - ThreeDHelper::setRotationAngleToDiagram( xSceneProperties, fXAngle, fYAngle, fZAngle ); + ThreeDHelper::setRotationAngleToDiagram( xDiagram, fXAngle, fYAngle, fZAngle ); } void ThreeDHelper::getCameraDistanceRange( double& rfMinimumDistance, double& rfMaximumDistance ) @@ -1154,7 +1151,7 @@ double ThreeDHelper::PerspectiveToCameraDistance( double fPerspective ) return fRet; } -ThreeDLookScheme ThreeDHelper::detectScheme( const uno::Reference< XDiagram >& xDiagram ) +ThreeDLookScheme ThreeDHelper::detectScheme( const rtl::Reference< Diagram >& xDiagram ) { ThreeDLookScheme aScheme = ThreeDLookScheme::ThreeDLookScheme_Unknown; @@ -1164,11 +1161,10 @@ ThreeDLookScheme ThreeDHelper::detectScheme( const uno::Reference< XDiagram >& x //get shade mode and light settings: drawing::ShadeMode aShadeMode( drawing::ShadeMode_SMOOTH ); - uno::Reference< beans::XPropertySet > xDiagramProps( xDiagram, uno::UNO_QUERY ); try { - if( xDiagramProps.is() ) - xDiagramProps->getPropertyValue( "D3DSceneShadeMode" )>>= aShadeMode; + if( xDiagram.is() ) + xDiagram->getPropertyValue( "D3DSceneShadeMode" )>>= aShadeMode; } catch( const uno::Exception & ) { @@ -1177,19 +1173,19 @@ ThreeDLookScheme ThreeDHelper::detectScheme( const uno::Reference< XDiagram >& x if( lcl_isSimpleScheme( aShadeMode, nRoundedEdges, nObjectLines, xDiagram ) ) { - if( lcl_isSimpleLightScheme(xDiagramProps) ) + if( lcl_isSimpleLightScheme(xDiagram) ) aScheme = ThreeDLookScheme::ThreeDLookScheme_Simple; } else if( lcl_isRealisticScheme( aShadeMode, nRoundedEdges, nObjectLines ) ) { - if( lcl_isRealisticLightScheme(xDiagramProps) ) + if( lcl_isRealisticLightScheme(xDiagram) ) aScheme = ThreeDLookScheme::ThreeDLookScheme_Realistic; } return aScheme; } -void ThreeDHelper::setScheme( const uno::Reference< XDiagram >& xDiagram, ThreeDLookScheme aScheme ) +void ThreeDHelper::setScheme( const rtl::Reference< Diagram >& xDiagram, ThreeDLookScheme aScheme ) { if( aScheme == ThreeDLookScheme::ThreeDLookScheme_Unknown ) return; @@ -1207,18 +1203,17 @@ void ThreeDHelper::setScheme( const uno::Reference< XDiagram >& xDiagram, ThreeD { ThreeDHelper::setRoundedEdgesAndObjectLines( xDiagram, nRoundedEdges, nObjectLines ); - uno::Reference< beans::XPropertySet > xProp( xDiagram, uno::UNO_QUERY ); - if( xProp.is() ) + if( xDiagram.is() ) { drawing::ShadeMode aOldShadeMode; - if( ! ( (xProp->getPropertyValue( "D3DSceneShadeMode" )>>=aOldShadeMode) && + if( ! ( (xDiagram->getPropertyValue( "D3DSceneShadeMode" )>>=aOldShadeMode) && aOldShadeMode == aShadeMode )) { - xProp->setPropertyValue( "D3DSceneShadeMode", uno::Any( aShadeMode )); + xDiagram->setPropertyValue( "D3DSceneShadeMode", uno::Any( aShadeMode )); } } - lcl_setLightsForScheme( xProp, aScheme ); + lcl_setLightsForScheme( xDiagram, aScheme ); } catch( const uno::Exception & ) { @@ -1227,16 +1222,15 @@ void ThreeDHelper::setScheme( const uno::Reference< XDiagram >& xDiagram, ThreeD } -void ThreeDHelper::set3DSettingsToDefault( const uno::Reference< beans::XPropertySet >& xSceneProperties ) +void ThreeDHelper::set3DSettingsToDefault( const rtl::Reference< Diagram >& xDiagram ) { - Reference< beans::XPropertyState > xState( xSceneProperties, uno::UNO_QUERY ); - if(xState.is()) + if(xDiagram.is()) { - xState->setPropertyToDefault( "D3DSceneDistance"); - xState->setPropertyToDefault( "D3DSceneFocalLength"); + xDiagram->setPropertyToDefault( "D3DSceneDistance"); + xDiagram->setPropertyToDefault( "D3DSceneFocalLength"); } - ThreeDHelper::setDefaultRotation( xSceneProperties ); - ThreeDHelper::setDefaultIllumination( xSceneProperties ); + ThreeDHelper::setDefaultRotation( xDiagram ); + ThreeDHelper::setDefaultIllumination( xDiagram ); } void ThreeDHelper::setDefaultRotation( const uno::Reference< beans::XPropertySet >& xSceneProperties, bool bPieOrDonut ) @@ -1254,28 +1248,28 @@ void ThreeDHelper::setDefaultRotation( const uno::Reference< beans::XPropertySet uno::Any( BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aSceneRotation ))); } -void ThreeDHelper::setDefaultRotation( const uno::Reference< beans::XPropertySet >& xSceneProperties ) +void ThreeDHelper::setDefaultRotation( const rtl::Reference< Diagram >& xDiagram ) { - bool bPieOrDonut( DiagramHelper::isPieOrDonutChart( uno::Reference< XDiagram >(xSceneProperties, uno::UNO_QUERY) ) ); - ThreeDHelper::setDefaultRotation( xSceneProperties, bPieOrDonut ); + bool bPieOrDonut( DiagramHelper::isPieOrDonutChart( xDiagram ) ); + ThreeDHelper::setDefaultRotation( xDiagram, bPieOrDonut ); } -void ThreeDHelper::setDefaultIllumination( const uno::Reference< beans::XPropertySet >& xSceneProperties ) +void ThreeDHelper::setDefaultIllumination( const rtl::Reference<::chart::Diagram>& xDiagram ) { - if( !xSceneProperties.is() ) + if( !xDiagram.is() ) return; drawing::ShadeMode aShadeMode( drawing::ShadeMode_SMOOTH ); try { - xSceneProperties->getPropertyValue( "D3DSceneShadeMode" )>>= aShadeMode; - xSceneProperties->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_1, uno::Any( false ) ); - xSceneProperties->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_3, uno::Any( false ) ); - xSceneProperties->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_4, uno::Any( false ) ); - xSceneProperties->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_5, uno::Any( false ) ); - xSceneProperties->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_6, uno::Any( false ) ); - xSceneProperties->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_7, uno::Any( false ) ); - xSceneProperties->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_8, uno::Any( false ) ); + xDiagram->getPropertyValue( "D3DSceneShadeMode" )>>= aShadeMode; + xDiagram->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_1, uno::Any( false ) ); + xDiagram->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_3, uno::Any( false ) ); + xDiagram->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_4, uno::Any( false ) ); + xDiagram->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_5, uno::Any( false ) ); + xDiagram->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_6, uno::Any( false ) ); + xDiagram->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_7, uno::Any( false ) ); + xDiagram->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_8, uno::Any( false ) ); } catch( const uno::Exception & ) { @@ -1285,11 +1279,11 @@ void ThreeDHelper::setDefaultIllumination( const uno::Reference< beans::XPropert ThreeDLookScheme aScheme = (aShadeMode == drawing::ShadeMode_FLAT) ? ThreeDLookScheme::ThreeDLookScheme_Simple : ThreeDLookScheme::ThreeDLookScheme_Realistic; - lcl_setLightsForScheme( xSceneProperties, aScheme ); + lcl_setLightsForScheme( xDiagram, aScheme ); } void ThreeDHelper::getRoundedEdgesAndObjectLines( - const uno::Reference< XDiagram > & xDiagram + const rtl::Reference< Diagram > & xDiagram , sal_Int32& rnRoundedEdges, sal_Int32& rnObjectLines ) { rnRoundedEdges = -1; @@ -1388,7 +1382,7 @@ void ThreeDHelper::getRoundedEdgesAndObjectLines( } void ThreeDHelper::setRoundedEdgesAndObjectLines( - const uno::Reference< XDiagram > & xDiagram + const rtl::Reference< Diagram > & xDiagram , sal_Int32 nRoundedEdges, sal_Int32 nObjectLines ) { if( (nRoundedEdges<0||nRoundedEdges>100) && nObjectLines!=0 && nObjectLines!=1 ) @@ -1416,13 +1410,13 @@ void ThreeDHelper::setRoundedEdgesAndObjectLines( } } -CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( const Reference< beans::XPropertySet >& xSceneProperties ) +CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( const rtl::Reference< ::chart::Diagram >& xDiagram ) { CuboidPlanePosition eRet(CuboidPlanePosition_Left); double fXAngleRad=0.0; double fYAngleRad=0.0; double fZAngleRad=0.0; - ThreeDHelper::getRotationAngleFromDiagram( xSceneProperties, fXAngleRad, fYAngleRad, fZAngleRad ); - if( lcl_isRightAngledAxesSetAndSupported( xSceneProperties ) ) + ThreeDHelper::getRotationAngleFromDiagram( xDiagram, fXAngleRad, fYAngleRad, fZAngleRad ); + if( lcl_isRightAngledAxesSetAndSupported( xDiagram ) ) { ThreeDHelper::adaptRadAnglesForRightAngledAxes( fXAngleRad, fYAngleRad ); } @@ -1431,13 +1425,13 @@ CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeft return eRet; } -CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( const Reference< beans::XPropertySet >& xSceneProperties ) +CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( const rtl::Reference< Diagram >& xDiagram ) { CuboidPlanePosition eRet(CuboidPlanePosition_Back); double fXAngleRad=0.0; double fYAngleRad=0.0; double fZAngleRad=0.0; - ThreeDHelper::getRotationAngleFromDiagram( xSceneProperties, fXAngleRad, fYAngleRad, fZAngleRad ); - if( lcl_isRightAngledAxesSetAndSupported( xSceneProperties ) ) + ThreeDHelper::getRotationAngleFromDiagram( xDiagram, fXAngleRad, fYAngleRad, fZAngleRad ); + if( lcl_isRightAngledAxesSetAndSupported( xDiagram ) ) { ThreeDHelper::adaptRadAnglesForRightAngledAxes( fXAngleRad, fYAngleRad ); } @@ -1446,13 +1440,13 @@ CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBack return eRet; } -CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( const Reference< beans::XPropertySet >& xSceneProperties ) +CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( const rtl::Reference< Diagram >& xDiagram ) { CuboidPlanePosition eRet(CuboidPlanePosition_Bottom); double fXAngleRad=0.0; double fYAngleRad=0.0; double fZAngleRad=0.0; - ThreeDHelper::getRotationAngleFromDiagram( xSceneProperties, fXAngleRad, fYAngleRad, fZAngleRad ); - if( lcl_isRightAngledAxesSetAndSupported( xSceneProperties ) ) + ThreeDHelper::getRotationAngleFromDiagram( xDiagram, fXAngleRad, fYAngleRad, fZAngleRad ); + if( lcl_isRightAngledAxesSetAndSupported( xDiagram ) ) { ThreeDHelper::adaptRadAnglesForRightAngledAxes( fXAngleRad, fYAngleRad ); } diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx index 51f6ccf2a6b7..775b1241c65c 100644 --- a/chart2/source/tools/TitleHelper.cxx +++ b/chart2/source/tools/TitleHelper.cxx @@ -41,7 +41,7 @@ namespace { uno::Reference< XTitled > lcl_getTitleParentFromDiagram( TitleHelper::eTitleType nTitleIndex - , const uno::Reference< XDiagram >& xDiagram ) + , const rtl::Reference< Diagram >& xDiagram ) { uno::Reference< XTitled > xResult; @@ -61,7 +61,7 @@ uno::Reference< XTitled > lcl_getTitleParentFromDiagram( { case TitleHelper::SUB_TITLE: if( xDiagram.is()) - xResult.set( xDiagram, uno::UNO_QUERY ); + xResult = xDiagram; break; case TitleHelper::X_AXIS_TITLE: if( xDiagram.is()) @@ -94,7 +94,7 @@ uno::Reference< XTitled > lcl_getTitleParentFromDiagram( } uno::Reference< XTitled > lcl_getTitleParent( TitleHelper::eTitleType nTitleIndex - , const uno::Reference< XDiagram >& xDiagram ) + , const rtl::Reference< Diagram >& xDiagram ) { uno::Reference< XTitled > xResult; switch( nTitleIndex ) @@ -128,10 +128,10 @@ uno::Reference< XTitled > lcl_getTitleParent( TitleHelper::eTitleType nTitleInde return xModel; } - uno::Reference< XDiagram > xDiagram; + rtl::Reference< Diagram > xDiagram; if( xModel.is()) - xDiagram.set( xModel->getFirstDiagram()); + xDiagram = xModel->getFirstChartDiagram(); return lcl_getTitleParent( nTitleIndex, xDiagram ); } @@ -144,7 +144,7 @@ uno::Reference< XTitle > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIn if(nTitleIndex == TitleHelper::MAIN_TITLE) return rModel.getTitleObject(); - uno::Reference< XDiagram > xDiagram = rModel.getFirstDiagram(); + rtl::Reference< Diagram > xDiagram = rModel.getFirstChartDiagram(); uno::Reference< XTitled > xTitled( lcl_getTitleParent( nTitleIndex, xDiagram ) ); if( xTitled.is()) return xTitled->getTitleObject(); @@ -225,7 +225,7 @@ uno::Reference< XTitle > TitleHelper::createTitle( if(xTitled.is()) { - uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ) ); + rtl::Reference< Diagram > xDiagram( ChartModelHelper::findDiagram( xModel ) ); xTitle.set( xContext->getServiceManager()->createInstanceWithContext( "com.sun.star.chart2.Title", 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; ... etc. - the rest is truncated