chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx | 5 chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx | 2 chart2/source/controller/dialogs/DialogModel.cxx | 2 chart2/source/controller/dialogs/dlg_ObjectProperties.cxx | 24 chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx | 3 chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx | 3 chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx | 2 chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx | 9 chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx | 2 chart2/source/controller/main/ChartController_Properties.cxx | 2 chart2/source/controller/main/ControllerCommandDispatch.cxx | 10 chart2/source/controller/main/DragMethod_RotateDiagram.cxx | 4 chart2/source/controller/main/ObjectHierarchy.cxx | 11 chart2/source/controller/sidebar/ChartElementsPanel.cxx | 4 chart2/source/inc/ChartType.hxx | 25 chart2/source/inc/ChartTypeHelper.hxx | 25 chart2/source/model/main/Diagram.cxx | 20 chart2/source/model/template/ChartType.cxx | 321 +++++++++ chart2/source/model/template/ChartTypeTemplate.cxx | 2 chart2/source/tools/AxisHelper.cxx | 11 chart2/source/tools/ChartTypeHelper.cxx | 353 ---------- chart2/source/tools/ExplicitCategoriesProvider.cxx | 3 chart2/source/tools/RegressionCurveHelper.cxx | 6 chart2/source/tools/ThreeDHelper.cxx | 4 chart2/source/view/charttypes/AreaChart.cxx | 2 chart2/source/view/charttypes/VSeriesPlotter.cxx | 8 chart2/source/view/diagram/VDiagram.cxx | 4 chart2/source/view/main/ChartView.cxx | 10 chart2/source/view/main/SeriesPlotterContainer.cxx | 12 29 files changed, 432 insertions(+), 457 deletions(-)
New commits: commit f355ddcbf2bf037263e336724829b5467b94ef40 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sun Apr 13 11:36:05 2025 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Mon Apr 14 02:48:06 2025 +0200 chart2: fold isSupported* functions into ChartType This moves isSupported* function from ChartTypeHelper to ChartType where it better belongs to. We can access the concrete classes now instead of accessing through UNO si this is possible to do. Change-Id: Icc52a8ba0d8ab6d5907d7942a1834cc6f7093cce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182712 Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> Tested-by: Jenkins diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx index 2ba43e61c326..fe2552f7f5b4 100644 --- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx @@ -536,9 +536,10 @@ bool DataSeriesPointWrapper::isSupportingAreaProperties() rtl::Reference< DataSeries > xSeries( getDataSeries() ); rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); rtl::Reference< ::chart::ChartType > xChartType( xDiagram->getChartTypeOfSeries( xSeries ) ); + if (!xChartType.is()) + return false; sal_Int32 nDimensionCount = xDiagram->getDimension(); - - return ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount ); + return xChartType->isSupportingAreaProperties(nDimensionCount); } rtl::Reference< DataSeries > DataSeriesPointWrapper::getDataSeries() diff --git a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx index 6043c5ff298a..19c05e5274bc 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx @@ -286,7 +286,7 @@ beans::PropertyState WrappedSymbolTypeProperty::getPropertyState( const Referenc rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); rtl::Reference< ::chart::DataSeries > xSeries( dynamic_cast<DataSeries*>(xInnerPropertyState.get()) ); rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeOfSeries( xSeries ) ); - if( ChartTypeHelper::isSupportingSymbolProperties( xChartType, 2 ) ) + if (xChartType.is() && xChartType->isSupportingSymbolProperties(2)) return beans::PropertyState_DIRECT_VALUE; } return WrappedProperty::getPropertyState( xInnerPropertyState ); diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx index 0eb6e395c894..45456d1327b8 100644 --- a/chart2/source/controller/dialogs/DialogModel.cxx +++ b/chart2/source/controller/dialogs/DialogModel.cxx @@ -623,7 +623,7 @@ void DialogModel::setCategories( const Reference< chart2::data::XLabeledDataSequ rtl::Reference< ChartType > xFirstChartType( xDiagram->getChartTypeByIndex( 0 ) ); if( xFirstChartType.is() ) { - sal_Int32 nAxisType = ChartTypeHelper::getAxisType( xFirstChartType, 0 ); // x-axis + sal_Int32 nAxisType = xFirstChartType->getAxisType(0); // x-axis bSupportsCategories = (nAxisType == AxisType::CATEGORY); } xDiagram->setCategories( xCategories, true, bSupportsCategories ); diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index 9286eb16f854..f678b051bc02 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -130,18 +130,18 @@ void ObjectPropertiesDialogParameter::init( const rtl::Reference<::chart::ChartM if( bHasSeriesProperties || bHasDataPointproperties ) { - m_bHasGeometryProperties = ChartTypeHelper::isSupportingGeometryProperties( xChartType, nDimensionCount ); - m_bHasAreaProperties = ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount ); - m_bHasSymbolProperties = ChartTypeHelper::isSupportingSymbolProperties( xChartType, nDimensionCount ); - m_bIsPieChartDataPoint = bHasDataPointproperties && ChartTypeHelper::isSupportingStartingAngle( xChartType ); + m_bHasGeometryProperties = xChartType->isSupportingGeometryProperties(nDimensionCount ); + m_bHasAreaProperties = xChartType->isSupportingAreaProperties(nDimensionCount); + m_bHasSymbolProperties = xChartType->isSupportingSymbolProperties(nDimensionCount); + m_bIsPieChartDataPoint = bHasDataPointproperties && xChartType->isSupportingStartingAngle(); if( bHasSeriesProperties ) { - m_bHasStatisticProperties = ChartTypeHelper::isSupportingStatisticProperties( xChartType, nDimensionCount ); - m_bProvidesSecondaryYAxis = ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount ); - m_bProvidesOverlapAndGapWidth = ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( xChartType, nDimensionCount ); - m_bProvidesBarConnectors = ChartTypeHelper::isSupportingBarConnectors( xChartType, nDimensionCount ); - m_bProvidesStartingAngle = ChartTypeHelper::isSupportingStartingAngle( xChartType ); + m_bHasStatisticProperties = xChartType->isSupportingStatisticProperties(nDimensionCount); + m_bProvidesSecondaryYAxis = xChartType->isSupportingSecondaryAxis(nDimensionCount); + m_bProvidesOverlapAndGapWidth = xChartType->isSupportingOverlapAndGapWidthProperties(nDimensionCount); + m_bProvidesBarConnectors = xChartType->isSupportingBarConnectors(nDimensionCount); + m_bProvidesStartingAngle = xChartType->isSupportingStartingAngle(); m_bProvidesMissingValueTreatments = ChartTypeHelper::getSupportedMissingValueTreatments( xChartType ) .hasElements(); @@ -191,10 +191,10 @@ void ObjectPropertiesDialogParameter::init( const rtl::Reference<::chart::ChartM { xChartType = AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( xDiagram, nAxisIndex ); //show positioning controls only if they make sense - m_bSupportingAxisPositioning = ChartTypeHelper::isSupportingAxisPositioning( xChartType, nDimensionCount, nDimensionIndex ); + m_bSupportingAxisPositioning = xChartType->isSupportingAxisPositioning(nDimensionCount, nDimensionIndex); //show axis origin only for secondary y axis - if( nDimensionIndex==1 && nAxisIndex==1 && ChartTypeHelper::isSupportingBaseValue( xChartType ) ) + if( nDimensionIndex==1 && nAxisIndex==1 && xChartType->isSupportingBaseValue()) m_bShowAxisOrigin = true; if ( nDimensionIndex == 0 && ( aData.AxisType == chart2::AxisType::CATEGORY || aData.AxisType == chart2::AxisType::DATE ) ) @@ -206,7 +206,7 @@ void ObjectPropertiesDialogParameter::init( const rtl::Reference<::chart::ChartM } if (!m_bComplexCategoriesAxis) - m_bSupportingCategoryPositioning = ChartTypeHelper::isSupportingCategoryPositioning( xChartType, nDimensionCount ); + m_bSupportingCategoryPositioning = xChartType->isSupportingCategoryPositioning(nDimensionCount); } } } diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx index d6711921fda4..99755db26f9e 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx @@ -113,7 +113,8 @@ ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage(weld::Container* pPar m_xMFPerspective->set_sensitive( m_xCbxPerspective->get_active() ); //RightAngledAxes - if (ChartTypeHelper::isSupportingRightAngledAxes(m_xDiagram->getChartTypeByIndex(0))) + auto xChartType = m_xDiagram->getChartTypeByIndex(0); + if (xChartType.is() && xChartType->isSupportingRightAngledAxes()) { bool bRightAngledAxes = false; m_xDiagram->getPropertyValue( u"RightAngledAxes"_ustr ) >>= bRightAngledAxes; diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx index 01c7971b15d6..a5880942aad9 100644 --- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx @@ -436,7 +436,8 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI AxisHelper::getCoordinateSystemOfAxis( m_xAxis, m_xChartDoc->getFirstChartDiagram() ) ); sal_Int32 nDimensionIndex=0; sal_Int32 nAxisIndex=0; AxisHelper::getIndicesForAxis(m_xAxis, xCooSys, nDimensionIndex, nAxisIndex ); - bool bChartTypeAllowsDateAxis = ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( xCooSys, 0 ), nDimensionIndex ); + auto xChartType = AxisHelper::getChartTypeByIndex(xCooSys, 0); + bool bChartTypeAllowsDateAxis = xChartType.is() ? xChartType->isSupportingDateAxis(nDimensionIndex) : true; rOutItemSet.Put( SfxBoolItem( nWhichId, bChartTypeAllowsDateAxis )); } break; diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx index a078fe9fc1fe..156c755e45db 100644 --- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx @@ -246,7 +246,7 @@ DataPointItemConverter::DataPointItemConverter( bool bSwapXAndY = xDiagram->getVertical( bFound, bAmbiguous ); m_aAvailableLabelPlacements = ChartTypeHelper::getSupportedLabelPlacements( xChartType, bSwapXAndY, xSeries ); - m_bForbidPercentValue = ChartTypeHelper::getAxisType( xChartType, 0 ) != AxisType::CATEGORY; + m_bForbidPercentValue = xChartType.is() ? xChartType->getAxisType(0) != AxisType::CATEGORY : false; if (bDataSeries) return; diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx index 737b6793a30c..96c27372090a 100644 --- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx @@ -83,7 +83,8 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter( } sal_Int32 nDimensionCount = xDiagram->getDimension(); - m_bSupportingOverlapAndGapWidthProperties = ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( xChartType, nDimensionCount ); + m_bSupportingOverlapAndGapWidthProperties = xChartType.is() ? + xChartType->isSupportingOverlapAndGapWidthProperties(nDimensionCount) : false; if( m_bSupportingOverlapAndGapWidthProperties ) { @@ -106,19 +107,19 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter( } } - m_bSupportingBarConnectors = ChartTypeHelper::isSupportingBarConnectors( xChartType, nDimensionCount ); + m_bSupportingBarConnectors = xChartType.is() ? xChartType->isSupportingBarConnectors(nDimensionCount) : false; if( m_bSupportingBarConnectors && xDiagram.is() ) { xDiagram->getPropertyValue( u"ConnectBars"_ustr ) >>= m_bConnectBars; } - m_bSupportingAxisSideBySide = ChartTypeHelper::isSupportingAxisSideBySide( xChartType, nDimensionCount ); + m_bSupportingAxisSideBySide = xChartType.is() ? xChartType->isSupportingAxisSideBySide(nDimensionCount) : false; if( m_bSupportingAxisSideBySide && xDiagram.is() ) { xDiagram->getPropertyValue( u"GroupBarsPerAxis"_ustr ) >>= m_bGroupBarsPerAxis; } - m_bSupportingStartingAngle = ChartTypeHelper::isSupportingStartingAngle( xChartType ); + m_bSupportingStartingAngle = xChartType.is() ? xChartType->isSupportingStartingAngle() : false; if( m_bSupportingStartingAngle ) { xDiagram->getPropertyValue( u"StartingAngle"_ustr ) >>= m_nStartingAngle; diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx index 9597caab2f68..bd1c8bc73258 100644 --- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx @@ -217,7 +217,7 @@ TextLabelItemConverter::TextLabelItemConverter( bool bSwapXAndY = xDiagram->getVertical(bFound, bAmbiguous); maAvailableLabelPlacements = ChartTypeHelper::getSupportedLabelPlacements(xChartType, bSwapXAndY, xSeries); - mbForbidPercentValue = ChartTypeHelper::getAxisType(xChartType, 0) != AxisType::CATEGORY; + mbForbidPercentValue = xChartType.is() ? xChartType->getAxisType(0) != AxisType::CATEGORY : false; } TextLabelItemConverter::~TextLabelItemConverter() diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index d1756ee9f6c9..1d3b930fd624 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -200,7 +200,7 @@ wrapper::ItemConverter* createItemConverter( rtl::Reference< Diagram > xDiagram = xChartModel->getFirstChartDiagram(); sal_Int32 nDimensionCount = xDiagram->getDimension(); - if( !ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount ) ) + if (xChartType.is() && !xChartType->isSupportingAreaProperties(nDimensionCount)) eMapTo = wrapper::GraphicObjectType::LineDataPoint; bool bDataSeries = eObjectType == OBJECTTYPE_DATA_SERIES; diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx index 8945d168f19e..501cf4c87c45 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.cxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx @@ -241,7 +241,7 @@ void ControllerState::update( // trend lines/mean value line if( (aObjectType == OBJECTTYPE_DATA_SERIES || aObjectType == OBJECTTYPE_DATA_POINT) - && ChartTypeHelper::isSupportingRegressionProperties( xFirstChartType, nDimensionCount )) + && xFirstChartType.is() ? xFirstChartType->isSupportingRegressionProperties(nDimensionCount) : true) { // Trendline bMayAddTrendline = true; @@ -253,7 +253,7 @@ void ControllerState::update( // error bars if( (aObjectType == OBJECTTYPE_DATA_SERIES || aObjectType == OBJECTTYPE_DATA_POINT) - && ChartTypeHelper::isSupportingStatisticProperties( xFirstChartType, nDimensionCount )) + && xFirstChartType.is() ? xFirstChartType->isSupportingStatisticProperties(nDimensionCount) : true) { bMayFormatXErrorBars = bMayDeleteXErrorBars = StatisticsHelper::hasErrorBars( xGivenDataSeries, false ); bMayAddXErrorBars = ! bMayDeleteXErrorBars; @@ -407,11 +407,11 @@ void ModelState::update( const rtl::Reference<::chart::ChartModel> & xModel ) if (xDiagram) nDimensionCount = xDiagram->getDimension(); - rtl::Reference< ChartType > xFirstChartType; + rtl::Reference<ChartType> xFirstChartType; if (xDiagram) xFirstChartType = xDiagram->getChartTypeByIndex( 0 ); - bSupportsStatistics = ChartTypeHelper::isSupportingStatisticProperties( xFirstChartType, nDimensionCount ); - bSupportsAxes = ChartTypeHelper::isSupportingMainAxis( xFirstChartType, nDimensionCount, 0 ); + bSupportsStatistics = xFirstChartType.is() ? xFirstChartType->isSupportingStatisticProperties(nDimensionCount) : true; + bSupportsAxes = xFirstChartType.is() ? xFirstChartType->isSupportingMainAxis(nDimensionCount, 0) : true; bIsThreeD = (nDimensionCount == 3); if (xModel.is()) diff --git a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx index c7bac7c33749..68698f195bae 100644 --- a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx +++ b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx @@ -80,8 +80,8 @@ DragMethod_RotateDiagram::DragMethod_RotateDiagram( DrawViewWrapper& rDrawViewWr xDiagram->getRotationAngle( m_fInitialXAngleRad, m_fInitialYAngleRad, m_fInitialZAngleRad ); - if( ChartTypeHelper::isSupportingRightAngledAxes( - xDiagram->getChartTypeByIndex( 0 ) ) ) + auto xChartType = xDiagram->getChartTypeByIndex(0); + if (xChartType.is() ? xChartType->isSupportingRightAngledAxes() : true) xDiagram->getPropertyValue(u"RightAngledAxes"_ustr) >>= m_bRightAngledAxes; if(m_bRightAngledAxes) { diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx index fc49f718b38b..c82d1c15bacb 100644 --- a/chart2/source/controller/main/ObjectHierarchy.cxx +++ b/chart2/source/controller/main/ObjectHierarchy.cxx @@ -212,8 +212,11 @@ void ObjectHierarchy::createAxesTree( { sal_Int32 nDimensionCount = xDiagram->getDimension(); rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeByIndex( 0 ) ); - bool bSupportsAxesGrids = ChartTypeHelper::isSupportingMainAxis( xChartType, nDimensionCount, 0 ); - if( !bSupportsAxesGrids ) + bool bSupportsAxesGrids = true; + if (xChartType.is()) + bSupportsAxesGrids = xChartType->isSupportingMainAxis(nDimensionCount, 0); + + if (!bSupportsAxesGrids) return; // Data Table @@ -243,7 +246,7 @@ void ObjectHierarchy::createAxesTree( sal_Int32 nDimensionIndex = 0; sal_Int32 nAxisIndex = 0; AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ); - if( nAxisIndex>0 && !ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount ) ) + if (nAxisIndex > 0 && !(xChartType.is() ? xChartType->isSupportingSecondaryAxis(nDimensionCount) : true)) continue; if( m_bOrderingForElementSelector ) @@ -351,7 +354,7 @@ void ObjectHierarchy::createDataSeriesTree( } // Statistics - if( ChartTypeHelper::isSupportingStatisticProperties( xChartType, nDimensionCount ) ) + if (xChartType.is() ? xChartType->isSupportingStatisticProperties(nDimensionCount) : true) { const std::vector< rtl::Reference< RegressionCurveModel > > & rCurves( xSeries->getRegressionCurves2()); for( size_t nCurveIdx=0; nCurveIdx<rCurves.size(); ++nCurveIdx ) diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx index c6fdd990eb1c..89dd339f9a48 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx @@ -475,8 +475,8 @@ void ChartElementsPanel::updateData() mxCB2ndXAxis->set_active(isAxisVisible(mxModel, AxisType::X_SECOND)); mxCB2ndYAxis->set_active(isAxisVisible(mxModel, AxisType::Y_SECOND)); - bool bSupportsMainAxis = ChartTypeHelper::isSupportingMainAxis( - getChartType(mxModel), 0, 0); + auto xChartType = getChartType(mxModel); + bool bSupportsMainAxis = xChartType.is() ? xChartType->isSupportingMainAxis(0, 0) : true; if (bSupportsMainAxis) { mxCBXAxis->show(); diff --git a/chart2/source/inc/ChartType.hxx b/chart2/source/inc/ChartType.hxx index 2dd05bb53ddc..899bfb385fcb 100644 --- a/chart2/source/inc/ChartType.hxx +++ b/chart2/source/inc/ChartType.hxx @@ -99,7 +99,7 @@ public: const css::uno::Reference< css::util::XModifyListener >& aListener ) override; virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override; - + virtual rtl::Reference<ChartType> cloneChartType() const = 0; void addDataSeries( @@ -118,6 +118,29 @@ public: void deleteSeries( const rtl::Reference< ::chart::DataSeries > & xSeries ); + // Tools + virtual bool isSupportingMainAxis(sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex); + virtual bool isSupportingStatisticProperties(sal_Int32 nDimensionCount); + virtual bool isSupportingRegressionProperties(sal_Int32 nDimensionCount); + virtual bool isSupportingGeometryProperties(sal_Int32 nDimensionCount); + virtual bool isSupportingAreaProperties(sal_Int32 nDimensionCount); + virtual bool isSupportingSymbolProperties(sal_Int32 nDimensionCount); + virtual bool isSupportingSecondaryAxis(sal_Int32 nDimensionCount); + virtual bool isSupportingRightAngledAxes(); + virtual bool isSupportingOverlapAndGapWidthProperties(sal_Int32 nDimensionCount); + virtual bool isSupportingBarConnectors(sal_Int32 nDimensionCount); + virtual bool isSupportingAxisSideBySide(sal_Int32 nDimensionCount); + virtual bool isSupportingBaseValue(); + virtual bool isSupportingAxisPositioning(sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex); + virtual bool isSupportingStartingAngle(); + virtual bool isSupportingDateAxis(sal_Int32 nDimensionIndex); + virtual bool isSupportingComplexCategory(); + virtual bool isSupportingCategoryPositioning(sal_Int32 nDimensionIndex); + virtual bool isSupportingOnlyDeepStackingFor3D(); + virtual bool isSeriesInFrontOfAxisLine(); + + virtual sal_Int32 getAxisType(sal_Int32 nDimensionIndex); + protected: // ____ XModifyListener ____ diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx index 4321ee49d1bb..0addc73790db 100644 --- a/chart2/source/inc/ChartTypeHelper.hxx +++ b/chart2/source/inc/ChartTypeHelper.hxx @@ -32,24 +32,7 @@ class DataSeries; class ChartTypeHelper { public: - static bool isSupportingGeometryProperties( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingStatisticProperties( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingRegressionProperties(const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingMainAxis( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ); - static bool isSupportingSecondaryAxis( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingAreaProperties( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingSymbolProperties( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingOverlapAndGapWidthProperties( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingBarConnectors( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingRightAngledAxes( const rtl::Reference< ::chart::ChartType >& xChartType ); - static bool isSupportingAxisSideBySide( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingStartingAngle( const rtl::Reference< ::chart::ChartType >& xChartType ); //starting value for bars or baseline for areas for example - static bool isSupportingBaseValue( const rtl::Reference< ::chart::ChartType >& xChartType ); - static bool isSupportingAxisPositioning( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ); - static bool isSupportingDateAxis( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionIndex ); - static bool isSupportingComplexCategory( const rtl::Reference< ::chart::ChartType >& xChartType ); - static bool isSupportingCategoryPositioning( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); static bool shiftCategoryPosAtXAxisPerDefault( const rtl::Reference< ::chart::ChartType >& xChartType ); //returns sequence of css::chart::DataLabelPlacement @@ -68,19 +51,11 @@ public: static sal_Int32 getNumberOfDisplayedSeries( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nNumberOfSeries ); static bool noBordersForSimpleScheme( const rtl::Reference< ::chart::ChartType >& xChartType ); - static bool isSeriesInFrontOfAxisLine( const rtl::Reference< ::chart::ChartType >& xChartType ); - - static sal_Int32 //one of css::chart2::AxisType - getAxisType( const rtl::Reference< ::chart::ChartType >& xChartType - , sal_Int32 nDimensionIndex ); - static OUString getRoleOfSequenceForYAxisNumberFormatDetection( const rtl::Reference< ::chart::ChartType >& xChartType ); static OUString getRoleOfSequenceForDataLabelNumberFormatDetection( const rtl::Reference< ::chart::ChartType >& xChartType ); - - static bool isSupportingOnlyDeepStackingFor3D( const rtl::Reference< ::chart::ChartType >& xChartType ); }; } //namespace chart diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx index 14055929f786..d478eec74ba7 100644 --- a/chart2/source/model/main/Diagram.cxx +++ b/chart2/source/model/main/Diagram.cxx @@ -530,7 +530,7 @@ static void lcl_setLightsForScheme( Diagram& rDiagram, const ThreeDLookScheme& r rDiagram.getFastPropertyValue( PROP_DIAGRAM_RIGHT_ANGLED_AXES ) >>= bRightAngledAxes; // "RightAngledAxes" if(!bRightAngledAxes) { - if( ChartTypeHelper::isSupportingRightAngledAxes( xChartType ) ) + if (xChartType.is() ? xChartType->isSupportingRightAngledAxes() : true) { ::basegfx::B3DHomMatrix aRotation( lcl_getCompleteRotationMatrix( rDiagram ) ); BaseGFXHelper::ReduceToRotationMatrix( aRotation ); @@ -1206,7 +1206,8 @@ rtl::Reference< ChartType > Diagram::getChartTypeByIndex( sal_Int32 nIndex ) bool Diagram::isSupportingDateAxis() { - return ::chart::ChartTypeHelper::isSupportingDateAxis( getChartTypeByIndex( 0 ), 0 ); + auto xChartType = getChartTypeByIndex(0); + return xChartType.is() ? xChartType->isSupportingDateAxis(0) : true; } static std::vector< rtl::Reference< Axis > > lcl_getAxisHoldingCategoriesFromDiagram( @@ -1536,7 +1537,7 @@ void Diagram::setDimension( sal_Int32 nNewDimensionCount ) const std::vector< rtl::Reference< ChartType > > aChartTypeList( xOldCooSys->getChartTypes2() ); for( rtl::Reference< ChartType > const & xChartType : aChartTypeList ) { - bIsSupportingOnlyDeepStackingFor3D = ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( xChartType ); + bIsSupportingOnlyDeepStackingFor3D = xChartType.is() ? xChartType->isSupportingOnlyDeepStackingFor3D() : false; if(!xNewCooSys.is()) { xNewCooSys = dynamic_cast<BaseCoordinateSystem*>(xChartType->createCoordinateSystem( nNewDimensionCount ).get()); @@ -1848,11 +1849,9 @@ static bool lcl_isRightAngledAxesSetAndSupported( Diagram& rDiagram ) rDiagram.getFastPropertyValue( PROP_DIAGRAM_RIGHT_ANGLED_AXES ) >>= bRightAngledAxes; // "RightAngledAxes" if(bRightAngledAxes) { - if( ChartTypeHelper::isSupportingRightAngledAxes( - rDiagram.getChartTypeByIndex( 0 ) ) ) - { + auto xChartType = rDiagram.getChartTypeByIndex(0); + if (xChartType.is() ? xChartType->isSupportingRightAngledAxes() : true) return true; - } } return false; } @@ -2052,8 +2051,8 @@ void Diagram::setRotationAngle( //rotate lights if RightAngledAxes are not set or not supported bool bRightAngledAxes = false; getFastPropertyValue( PROP_DIAGRAM_RIGHT_ANGLED_AXES ) >>= bRightAngledAxes; - if(!bRightAngledAxes || !ChartTypeHelper::isSupportingRightAngledAxes( - getChartTypeByIndex( 0 ) ) ) + auto xChartType = getChartTypeByIndex(0); + if (!bRightAngledAxes || !(xChartType.is() ? xChartType->isSupportingRightAngledAxes() : true)) { ::basegfx::B3DHomMatrix aNewRotation; aNewRotation.rotate( fXAngleRad, fYAngleRad, fZAngleRad ); @@ -2138,8 +2137,7 @@ static bool lcl_isLightScheme( Diagram& rDiagram, bool bRealistic ) rDiagram.getFastPropertyValue( PROP_DIAGRAM_RIGHT_ANGLED_AXES ) >>= bRightAngledAxes; // "RightAngledAxes" if(!bRightAngledAxes) { - if( ChartTypeHelper::isSupportingRightAngledAxes( - rDiagram.getChartTypeByIndex( 0 ) ) ) + if (xChartType.is() ? xChartType->isSupportingRightAngledAxes() : true) { ::basegfx::B3DHomMatrix aRotation( lcl_getCompleteRotationMatrix( rDiagram ) ); BaseGFXHelper::ReduceToRotationMatrix( aRotation ); diff --git a/chart2/source/model/template/ChartType.cxx b/chart2/source/model/template/ChartType.cxx index 6487e4213644..f59b0c5a3a7d 100644 --- a/chart2/source/model/template/ChartType.cxx +++ b/chart2/source/model/template/ChartType.cxx @@ -25,10 +25,14 @@ #include <AxisIndexDefines.hxx> #include <ModifyListenerHelper.hxx> #include <DataSeries.hxx> -#include <vcl/svapp.hxx> +#include <servicenames_charttypes.hxx> +#include <StackMode.hxx> +#include <DiagramHelper.hxx> #include <com/sun/star/chart2/AxisType.hpp> #include <com/sun/star/container/NoSuchElementException.hpp> +#include <com/sun/star/chart2/AxisType.hpp> #include <comphelper/diagnose_ex.hxx> +#include <vcl/svapp.hxx> using namespace ::com::sun::star; @@ -317,6 +321,321 @@ void ChartType::fireModifyEvent() m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this ))); } +bool ChartType::isSupportingStatisticProperties(sal_Int32 nDimensionCount) +{ + //3D charts, pie, net and stock do not support statistic properties + + if (nDimensionCount == 3) + return false; + + OUString aChartTypeName = getChartType(); + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE)) + return false; + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET)) + return false; + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET)) + return false; + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK)) + return false; + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE)) //todo: BubbleChart support error bars and trend lines + return false; + + return true; +} + +bool ChartType::isSupportingRegressionProperties(sal_Int32 nDimensionCount) +{ + // note: old chart: only scatter chart + return isSupportingStatisticProperties(nDimensionCount); +} + +bool ChartType::isSupportingGeometryProperties(sal_Int32 nDimensionCount) +{ + //form tab only for 3D-bar and 3D-column charts. + if (nDimensionCount == 3) + { + OUString aChartTypeName = getChartType(); + + if (aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_BAR) + return true; + + if (aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) + return true; + } + return false; +} + +bool ChartType::isSupportingAreaProperties(sal_Int32 nDimensionCount) +{ + //2D line charts, net and stock do not support area properties + if (nDimensionCount == 2) + { + OUString aChartTypeName = getChartType(); + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE)) + return false; + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER)) + return false; + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET)) + return false; + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK)) + return false; + } + return true; +} + +bool ChartType::isSupportingSymbolProperties(sal_Int32 nDimensionCount) +{ + //2D line charts, 2D scatter charts and 2D net charts do support symbols + if (nDimensionCount == 3) + return false; + + OUString aChartTypeName = getChartType(); + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE)) + return true; + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER)) + return true; + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET)) + return true; + + return false; +} + +bool ChartType::isSupportingSecondaryAxis(sal_Int32 nDimensionCount) +{ + //3D, pie and net charts do not support a secondary axis at all + if (nDimensionCount == 3) + return false; + + OUString aChartTypeName = getChartType(); + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE)) + return false; + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET)) + return false; + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET)) + return false; + + return true; +} + +bool ChartType::isSupportingRightAngledAxes() +{ + OUString aChartTypeName = getChartType(); + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE)) + return false; + return true; +} + +bool ChartType::isSupportingOverlapAndGapWidthProperties(sal_Int32 nDimensionCount) +{ + //2D bar charts do support a this special properties + if (nDimensionCount == 3) + return false; + + OUString aChartTypeName = getChartType(); + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN)) + return true; + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR)) + return true; + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_HISTOGRAM)) + return true; + return false; +} + +bool ChartType::isSupportingBarConnectors(sal_Int32 nDimensionCount) +{ + //2D bar charts with stacked series support this + + if (nDimensionCount == 3) + return false; + + bool bFound = false; + bool bAmbiguous = false; + StackMode eStackMode = DiagramHelper::getStackModeFromChartType(this, bFound, bAmbiguous, nullptr); + if (eStackMode != StackMode::YStacked || bAmbiguous) + return false; + + OUString aChartTypeName = getChartType(); + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN)) + return true; + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR)) + return true; // note: old chart was false here + + return false; +} + +bool ChartType::isSupportingAxisSideBySide(sal_Int32 nDimensionCount) +{ + bool bResult = false; + + if (nDimensionCount < 3) + { + bool bFound = false; + bool bAmbiguous = false; + StackMode eStackMode = DiagramHelper::getStackModeFromChartType(this, bFound, bAmbiguous, nullptr); + if (eStackMode == StackMode::NONE && !bAmbiguous) + { + OUString aChartTypeName = getChartType(); + + bResult = aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) || + aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR); + } + } + + return bResult; +} + +bool ChartType::isSupportingBaseValue() +{ + OUString aChartTypeName = getChartType(); + + return aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) + || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) + || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA); +} + +bool ChartType::isSupportingAxisPositioning(sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ) +{ + OUString aChartTypeName = getChartType(); + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET)) + return false; + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET)) + return false; + + if (nDimensionCount == 3) + return nDimensionIndex < 2; + + return true; +} + +bool ChartType::isSupportingMainAxis(sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex) +{ + // pie charts do not support axis at all + // no 3rd axis for 2D charts + + OUString aChartTypeName = getChartType(); + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE)) + return false; + + if (nDimensionIndex == 2) + return nDimensionCount == 3; + + return true; +} + +bool ChartType::isSupportingStartingAngle() +{ + OUString aChartTypeName = getChartType(); + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE)) + return true; + return false; +} + +bool ChartType::isSupportingDateAxis(sal_Int32 nDimensionIndex) +{ + if (nDimensionIndex != 0) + return false; + + sal_Int32 nType = getAxisType(nDimensionIndex); + + if (nType != chart2::AxisType::CATEGORY) + return false; + + OUString aChartTypeName = getChartType(); + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) + || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) + || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET)) + { + return false; + } + return true; +} + +bool ChartType::isSupportingComplexCategory() +{ + OUString aChartTypeName = getChartType(); + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE)) + return false; + return true; +} + +bool ChartType::isSupportingCategoryPositioning(sal_Int32 nDimensionCount) +{ + OUString aChartTypeName = getChartType(); + + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA) || + aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) || + aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK)) + { + return true; + } + else if (nDimensionCount == 2 && + (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) || + aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) || + aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_HISTOGRAM))) + { + return true; + } + return false; +} + +bool ChartType::isSupportingOnlyDeepStackingFor3D() +{ + OUString aChartTypeName = getChartType(); + return + aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) || + aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) || + aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA); +} + +bool ChartType::isSeriesInFrontOfAxisLine() +{ + OUString aChartTypeName = getChartType(); + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET)) + return false; + return true; +} + +sal_Int32 ChartType::getAxisType(sal_Int32 nDimensionIndex) +{ + //returned is a constant from constant group css::chart2::AxisType + + OUString aChartTypeName = getChartType(); + if (nDimensionIndex == 2) //z-axis + return chart2::AxisType::SERIES; + + if (nDimensionIndex == 1) //y-axis + return chart2::AxisType::REALNUMBER; + + if (nDimensionIndex == 0) //x-axis + { + if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) + || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE)) + return chart2::AxisType::REALNUMBER; + return chart2::AxisType::CATEGORY; + } + return chart2::AxisType::CATEGORY; +} + using impl::ChartType_Base; IMPLEMENT_FORWARD_XINTERFACE2( ChartType, ChartType_Base, ::property::OPropertySet ) diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index c5ca7b2c76b2..5685f9e06c0c 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -576,7 +576,7 @@ void ChartTypeTemplate::adaptScales( !m_aServiceName.indexOf("BarOfPie")) || m_aServiceName.endsWith("Close"); } - bool bSupportsDates = ::chart::ChartTypeHelper::isSupportingDateAxis( xChartType, nDimensionX ); + bool bSupportsDates = xChartType.is() ? xChartType->isSupportingDateAxis(nDimensionX) : true; if( aData.AxisType != AxisType::CATEGORY && ( aData.AxisType != AxisType::DATE || !bSupportsDates) ) { aData.AxisType = AxisType::CATEGORY; diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 17a845076fcb..33cd6059fe93 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -104,7 +104,8 @@ chart2::ScaleData AxisHelper::getDateCheckedScale( const rtl::Reference< Axis >& { sal_Int32 nDimensionIndex=0; sal_Int32 nAxisIndex=0; AxisHelper::getIndicesForAxis(xAxis, xCooSys, nDimensionIndex, nAxisIndex ); - bool bChartTypeAllowsDateAxis = ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( xCooSys, 0 ), nDimensionIndex ); + auto xChartType = AxisHelper::getChartTypeByIndex(xCooSys, 0); + bool bChartTypeAllowsDateAxis = xChartType.is() ? xChartType->isSupportingDateAxis(nDimensionIndex) : true; if( bChartTypeAllowsDateAxis ) aScale.AxisType = AxisType::DATE; } @@ -853,10 +854,10 @@ void AxisHelper::getAxisOrGridPossibilities( Sequence< sal_Bool >& rPossibilityL if (xDiagram) xChartType = xDiagram->getChartTypeByIndex( 0 ); for(nIndex=0;nIndex<3;nIndex++) - pPossibilityList[nIndex]=ChartTypeHelper::isSupportingMainAxis(xChartType,nDimensionCount,nIndex); + pPossibilityList[nIndex] = xChartType.is() ? xChartType->isSupportingMainAxis(nDimensionCount, nIndex) : true; for(nIndex=3;nIndex<6;nIndex++) if( bAxis ) - pPossibilityList[nIndex]=ChartTypeHelper::isSupportingSecondaryAxis(xChartType,nDimensionCount); + pPossibilityList[nIndex] = xChartType.is() ? xChartType->isSupportingSecondaryAxis(nDimensionCount) : true; else pPossibilityList[nIndex] = rPossibilityList[nIndex-3]; } @@ -897,9 +898,9 @@ bool AxisHelper::shouldAxisBeDisplayed( const rtl::Reference< Axis >& xAxis bool bMainAxis = (nAxisIndex==MAIN_AXIS_INDEX); if( bMainAxis ) - bRet = ChartTypeHelper::isSupportingMainAxis(xChartType,nDimensionCount,nDimensionIndex); + bRet = xChartType.is() ? xChartType->isSupportingMainAxis(nDimensionCount, nDimensionIndex) : true; else - bRet = ChartTypeHelper::isSupportingSecondaryAxis(xChartType,nDimensionCount); + bRet = xChartType.is() ? xChartType->isSupportingSecondaryAxis(nDimensionCount) : true; } } diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index dec8fcec29bf..03539c1883e8 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -37,209 +37,6 @@ using namespace ::chart::DataSeriesProperties; namespace chart { -bool ChartTypeHelper::isSupportingAxisSideBySide( - const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ) -{ - bool bResult = false; - - if( xChartType.is() && - nDimensionCount < 3 ) - { - bool bFound=false; - bool bAmbiguous=false; - StackMode eStackMode = DiagramHelper::getStackModeFromChartType( xChartType, bFound, bAmbiguous, nullptr ); - if( eStackMode == StackMode::NONE && !bAmbiguous ) - { - OUString aChartTypeName = xChartType->getChartType(); - bResult = ( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) || - aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) ); - } - } - - return bResult; -} - -bool ChartTypeHelper::isSupportingGeometryProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) -{ - //form tab only for 3D-bar and 3D-column charts. - - //@todo ask charttype itself --> need model change first - if(xChartType.is()) - { - if(nDimensionCount==3) - { - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_BAR ) - return true; - if( aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ) - return true; - } - } - return false; -} - -bool ChartTypeHelper::isSupportingStatisticProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) -{ - //3D charts, pie, net and stock do not support statistic properties - - //@todo ask charttype itself (and series? --> stock chart?) --> need model change first - if(xChartType.is()) - { - if(nDimensionCount==3) - return false; - - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) - return false; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) - return false; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) - return false; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) - return false; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) ) //todo: BubbleChart support error bars and trend lines - return false; - } - return true; -} - -bool ChartTypeHelper::isSupportingRegressionProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) -{ - // note: old chart: only scatter chart - return isSupportingStatisticProperties( xChartType, nDimensionCount ); -} - -bool ChartTypeHelper::isSupportingAreaProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) -{ - //2D line charts, net and stock do not support area properties - - //@todo ask charttype itself --> need model change first - if(xChartType.is()) - { - if(nDimensionCount==2) - { - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) ) - return false; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) ) - return false; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) - return false; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) - return false; - } - } - return true; -} - -bool ChartTypeHelper::isSupportingSymbolProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) -{ - //2D line charts, 2D scatter charts and 2D net charts do support symbols - - //@todo ask charttype itself --> need model change first - if(xChartType.is()) - { - if(nDimensionCount==3) - return false; - - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) ) - return true; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) ) - return true; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) - return true; - } - return false; -} - -bool ChartTypeHelper::isSupportingMainAxis( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ) -{ - //pie charts do not support axis at all - //no 3rd axis for 2D charts - - //@todo ask charttype itself --> need model change first - if(xChartType.is()) - { - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) - return false; - - if( nDimensionIndex == 2 ) - return nDimensionCount == 3; - } - return true; -} - -bool ChartTypeHelper::isSupportingSecondaryAxis( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) -{ - //3D, pie and net charts do not support a secondary axis at all - - //@todo ask charttype itself --> need model change first - if(xChartType.is()) - { - if(nDimensionCount==3) - return false; - - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) - return false; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) - return false; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) - return false; - } - return true; -} - -bool ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( - const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) -{ - //2D bar charts do support a this special properties - - //@todo ask charttype itself --> need model change first - if(xChartType.is()) - { - if(nDimensionCount==3) - return false; - - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) ) - return true; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) ) - return true; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_HISTOGRAM) ) - return true; - } - return false; -} - -bool ChartTypeHelper::isSupportingBarConnectors( - const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) -{ - //2D bar charts with stacked series support this - - //@todo ask charttype itself --> need model change first - if(xChartType.is()) - { - if(nDimensionCount==3) - return false; - - bool bFound=false; - bool bAmbiguous=false; - StackMode eStackMode = DiagramHelper::getStackModeFromChartType( xChartType, bFound, bAmbiguous, nullptr ); - if( eStackMode != StackMode::YStacked || bAmbiguous ) - return false; - - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) ) - return true; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) ) - return true; // note: old chart was false here - } - return false; -} - uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const rtl::Reference< ChartType >& xChartType , bool bSwapXAndY , const rtl::Reference< DataSeries >& xSeries ) @@ -381,105 +178,6 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const return aRet; } -bool ChartTypeHelper::isSupportingRightAngledAxes( const rtl::Reference< ChartType >& xChartType ) -{ - if(xChartType.is()) - { - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) - return false; - } - return true; -} - -bool ChartTypeHelper::isSupportingStartingAngle( const rtl::Reference< ChartType >& xChartType ) -{ - if(xChartType.is()) - { - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) - return true; - } - return false; -} -bool ChartTypeHelper::isSupportingBaseValue( const rtl::Reference< ChartType >& xChartType ) -{ - if(xChartType.is()) - { - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) - || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) - || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA) - ) - return true; - } - return false; -} - -bool ChartTypeHelper::isSupportingAxisPositioning( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ) -{ - if(xChartType.is()) - { - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) - return false; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) - return false; - } - if( nDimensionCount==3 ) - return nDimensionIndex<2; - return true; -} - -bool ChartTypeHelper::isSupportingDateAxis( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionIndex ) -{ - if( nDimensionIndex!=0 ) - return false; - if( xChartType.is() ) - { - sal_Int32 nType = ChartTypeHelper::getAxisType( xChartType, nDimensionIndex ); - if( nType != AxisType::CATEGORY ) - return false; - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) - return false; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) - return false; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) - return false; - } - return true; -} - -bool ChartTypeHelper::isSupportingComplexCategory( const rtl::Reference< ChartType >& xChartType ) -{ - if( xChartType.is() ) - { - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) - return false; - } - return true; -} - -bool ChartTypeHelper::isSupportingCategoryPositioning( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) -{ - if( xChartType.is() ) - { - OUString aChartTypeName = xChartType->getChartType(); - if (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA) || - aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) || - aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK)) - return true; - else if (nDimensionCount == 2 && - (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) || - aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) || - aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_HISTOGRAM))) - return true; - } - return false; -} - bool ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault( const rtl::Reference< ChartType >& xChartType ) { if(xChartType.is()) @@ -571,30 +269,6 @@ drawing::Direction3D ChartTypeHelper::getDefaultRealisticLightDirection( const r return aRet; } -sal_Int32 ChartTypeHelper::getAxisType( const rtl::Reference< - ChartType >& xChartType, sal_Int32 nDimensionIndex ) -{ - //returned is a constant from constant group css::chart2::AxisType - - //@todo ask charttype itself --> need model change first - if(!xChartType.is()) - return AxisType::CATEGORY; - - OUString aChartTypeName = xChartType->getChartType(); - if(nDimensionIndex==2)//z-axis - return AxisType::SERIES; - if(nDimensionIndex==1)//y-axis - return AxisType::REALNUMBER; - if(nDimensionIndex==0)//x-axis - { - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) - || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) ) - return AxisType::REALNUMBER; - return AxisType::CATEGORY; - } - return AxisType::CATEGORY; -} - sal_Int32 ChartTypeHelper::getNumberOfDisplayedSeries( const rtl::Reference< ChartType >& xChartType, sal_Int32 nNumberOfSeries ) @@ -690,17 +364,6 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments( return aRet; } -bool ChartTypeHelper::isSeriesInFrontOfAxisLine( const rtl::Reference< ChartType >& xChartType ) -{ - if( xChartType.is() ) - { - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName.match( CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ) ) - return false; - } - return true; -} - OUString ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( const rtl::Reference< ChartType >& xChartType ) { OUString aRet( u"values-y"_ustr ); @@ -724,22 +387,6 @@ OUString ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( co return aRet; } -bool ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( const rtl::Reference< ChartType >& xChartType ) -{ - bool bRet = false; - if( !xChartType.is() ) - return bRet; - - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) || - aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) || - aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA) ) - { - bRet = true; - } - return bRet; -} - } //namespace chart /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index 83217a40620c..9995ac23559a 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -499,7 +499,8 @@ void ExplicitCategoriesProvider::init() { if(m_bIsDateAxis) { - if( ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( m_xCooSysModel.get(), 0 ), 0 ) ) + auto xChartType = AxisHelper::getChartTypeByIndex(m_xCooSysModel.get(), 0); + if (xChartType.is() ? xChartType->isSupportingDateAxis(0) : true) m_bIsDateAxis = lcl_fillDateCategories( m_xOriginalCategories->getValues(), m_aDateCategories, m_bIsAutoDate, mrModel ); else m_bIsDateAxis = false; diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx index b471b3cac510..f7a773e5a0c8 100644 --- a/chart2/source/tools/RegressionCurveHelper.cxx +++ b/chart2/source/tools/RegressionCurveHelper.cxx @@ -174,8 +174,10 @@ void RegressionCurveHelper::initializeCurveCalculator( const rtl::Reference< ::chart::DataSeries > & xSeries, const rtl::Reference<::chart::ChartModel> & xModel ) { - sal_Int32 nAxisType = ChartTypeHelper::getAxisType( - xModel->getChartTypeOfSeries( xSeries ), 0 ); // x-axis + sal_Int32 nAxisType = AxisType::CATEGORY; + auto xChartType = xModel->getChartTypeOfSeries(xSeries); + if (xChartType.is()) + nAxisType = xChartType->getAxisType(0); // x-axis bool bUseXValuesIfAvailable = (nAxisType == AxisType::REALNUMBER); diff --git a/chart2/source/tools/ThreeDHelper.cxx b/chart2/source/tools/ThreeDHelper.cxx index b14ed61d385a..5db264e3505d 100644 --- a/chart2/source/tools/ThreeDHelper.cxx +++ b/chart2/source/tools/ThreeDHelper.cxx @@ -51,8 +51,8 @@ bool lcl_isRightAngledAxesSetAndSupported( const rtl::Reference< Diagram >& xDia xDiagram->getPropertyValue( u"RightAngledAxes"_ustr) >>= bRightAngledAxes; if(bRightAngledAxes) { - if( ChartTypeHelper::isSupportingRightAngledAxes( - xDiagram->getChartTypeByIndex( 0 ) ) ) + auto xChartType = xDiagram->getChartTypeByIndex(0); + if (xChartType.is() ? xChartType->isSupportingRightAngledAxes() : true) { return true; } diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index 7d78e1b38c2b..65b3c8721f5f 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -59,7 +59,7 @@ AreaChart::AreaChart( const rtl::Reference<ChartType>& xChartTypeModel : VSeriesPlotter( xChartTypeModel, nDimensionCount, bCategoryXAxis ) , m_bArea(!bNoArea) , m_bLine(bNoArea) - , m_bSymbol( ChartTypeHelper::isSupportingSymbolProperties(xChartTypeModel,nDimensionCount) ) + , m_bSymbol(xChartTypeModel.is() ? xChartTypeModel->isSupportingSymbolProperties(nDimensionCount) : false) , m_eCurveStyle(CurveStyle_LINES) , m_nCurveResolution(20) , m_nSplineOrder(3) diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 62760bf41cd5..03084929844f 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -948,7 +948,7 @@ void VSeriesPlotter::createErrorBar( , const double* pfScaledLogicX ) { - if( !ChartTypeHelper::isSupportingStatisticProperties( m_xChartTypeModel, m_nDimension ) ) + if (!m_xChartTypeModel->isSupportingStatisticProperties(m_nDimension)) return; if( ! xErrorBarProperties.is()) @@ -1140,7 +1140,7 @@ void VSeriesPlotter::createErrorRectangle( rtl::Reference<SvxShapeGroupAnyD> xErrorBorder_ShapesY = getErrorBarsGroupShape( rVDataSeries, rTarget, true ); - if( !ChartTypeHelper::isSupportingStatisticProperties( m_xChartTypeModel, m_nDimension ) ) + if (!m_xChartTypeModel->isSupportingStatisticProperties(m_nDimension)) return; try @@ -2369,7 +2369,7 @@ void VSeriesPlotter::setCoordinateSystemResolution( const Sequence< sal_Int32 >& bool VSeriesPlotter::WantToPlotInFrontOfAxisLine() { - return ChartTypeHelper::isSeriesInFrontOfAxisLine( m_xChartTypeModel ); + return m_xChartTypeModel->isSeriesInFrontOfAxisLine(); } bool VSeriesPlotter::shouldSnapRectToUsedArea() @@ -2789,7 +2789,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries( // don't show legend entry of regression curve & friends if this type of chart // doesn't support statistics #i63016#, fdo#37197 - if (!ChartTypeHelper::isSupportingStatisticProperties( m_xChartTypeModel, m_nDimension )) + if (!m_xChartTypeModel->isSupportingStatisticProperties(m_nDimension)) return aResult; const rtl::Reference< DataSeries >& xRegrCont = rSeries.getModel(); diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx index a7e1dfc997b1..1806483ff598 100644 --- a/chart2/source/view/diagram/VDiagram.cxx +++ b/chart2/source/view/diagram/VDiagram.cxx @@ -55,8 +55,8 @@ VDiagram::VDiagram( return; xDiagram->getRotationAngle( m_fXAnglePi, m_fYAnglePi, m_fZAnglePi ); - if( ChartTypeHelper::isSupportingRightAngledAxes( - m_xDiagram->getChartTypeByIndex( 0 ) ) ) + auto xChartType = m_xDiagram->getChartTypeByIndex(0); + if (xChartType.is() ? xChartType->isSupportingRightAngledAxes() : true) { if(xDiagram.is()) xDiagram->getPropertyValue(u"RightAngledAxes"_ustr) >>= m_bRightAngledAxes; diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index ab00e03e5cce..c5c453b8cc75 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2041,19 +2041,19 @@ bool ChartView::createAxisTitleShapes2D( CreateShapeParam2D& rParam, const css:: nDimension = xDiagram->getDimension(); } - if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 0 ) ) + if (xChartType.is() ? xChartType->isSupportingMainAxis(nDimension, 0) : true) rParam.mpVTitleX = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, mxRootShape, mrChartModel , rParam.maRemainingSpace, rPageSize, TitleAlignment::ALIGN_BOTTOM, rParam.mbAutoPosTitleX ); if (!bHasRelativeSize && (rParam.maRemainingSpace.Width <= 0 || rParam.maRemainingSpace.Height <= 0)) return false; - if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 1 ) ) + if (xChartType.is() ? xChartType->isSupportingMainAxis(nDimension, 1) : true) rParam.mpVTitleY = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, mxRootShape, mrChartModel , rParam.maRemainingSpace, rPageSize, TitleAlignment::ALIGN_LEFT, rParam.mbAutoPosTitleY ); if (!bHasRelativeSize && (rParam.maRemainingSpace.Width <= 0 || rParam.maRemainingSpace.Height <= 0)) return false; - if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 2 ) ) + if (xChartType.is() ? xChartType->isSupportingMainAxis(nDimension, 2) : true) rParam.mpVTitleZ = lcl_createTitle( TitleHelper::Z_AXIS_TITLE, mxRootShape, mrChartModel , rParam.maRemainingSpace, rPageSize, TitleAlignment::ALIGN_RIGHT, rParam.mbAutoPosTitleZ ); if (!bHasRelativeSize && (rParam.maRemainingSpace.Width <= 0 || rParam.maRemainingSpace.Height <= 0)) @@ -2062,13 +2062,13 @@ bool ChartView::createAxisTitleShapes2D( CreateShapeParam2D& rParam, const css:: bool bDummy = false; bool bIsVertical = xDiagram && xDiagram->getVertical( bDummy, bDummy ); - if( ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimension ) ) + if (xChartType.is() ? xChartType->isSupportingSecondaryAxis(nDimension) : true) rParam.mpVTitleSecondX = lcl_createTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, mxRootShape, mrChartModel , rParam.maRemainingSpace, rPageSize, bIsVertical? TitleAlignment::ALIGN_RIGHT : TitleAlignment::ALIGN_TOP, rParam.mbAutoPosSecondTitleX ); if (!bHasRelativeSize && (rParam.maRemainingSpace.Width <= 0 || rParam.maRemainingSpace.Height <= 0)) return false; - if( ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimension ) ) + if (xChartType.is() ? xChartType->isSupportingSecondaryAxis(nDimension) : true) rParam.mpVTitleSecondY = lcl_createTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, mxRootShape, mrChartModel , rParam.maRemainingSpace, rPageSize, bIsVertical? TitleAlignment::ALIGN_TOP : TitleAlignment::ALIGN_RIGHT, rParam.mbAutoPosSecondTitleY ); if (!bHasRelativeSize && (rParam.maRemainingSpace.Width <= 0 || rParam.maRemainingSpace.Height <= 0)) diff --git a/chart2/source/view/main/SeriesPlotterContainer.cxx b/chart2/source/view/main/SeriesPlotterContainer.cxx index ec9e38b031d0..36a7c2cbe985 100644 --- a/chart2/source/view/main/SeriesPlotterContainer.cxx +++ b/chart2/source/view/main/SeriesPlotterContainer.cxx @@ -299,7 +299,8 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart //ignore secondary axis for charttypes that do not support them if (pSeries->getAttachedAxisIndex() != MAIN_AXIS_INDEX - && (!ChartTypeHelper::isSupportingSecondaryAxis(xChartType, nDimensionCount) + && (!(xChartType.is() ? xChartType->isSupportingSecondaryAxis(nDimensionCount) + : true) || !bSecondaryYaxisVisible)) { pSeries->setAttachedAxisIndex(MAIN_AXIS_INDEX); @@ -385,13 +386,14 @@ void SeriesPlotterContainer::initAxisUsageList(const Date& rNullDate, ChartModel { rtl::Reference<BaseCoordinateSystem> xCooSys = pVCooSys->getModel(); sal_Int32 nDimCount = xCooSys->getDimension(); - bool bComplexCategoryAllowed = ChartTypeHelper::isSupportingComplexCategory( - AxisHelper::getChartTypeByIndex(xCooSys, 0)); + auto xChartType = AxisHelper::getChartTypeByIndex(xCooSys, 0); + bool bComplexCategoryAllowed + = xChartType.is() ? xChartType->isSupportingComplexCategory() : true; for (sal_Int32 nDimIndex = 0; nDimIndex < nDimCount; ++nDimIndex) { - bool bDateAxisAllowed = ChartTypeHelper::isSupportingDateAxis( - AxisHelper::getChartTypeByIndex(xCooSys, 0), nDimIndex); + bool bDateAxisAllowed + = xChartType.is() ? xChartType->isSupportingDateAxis(nDimIndex) : true; // Each dimension may have primary and secondary axes. const sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimIndex);