diff options
Diffstat (limited to 'chart2/source/tools')
-rw-r--r-- | chart2/source/tools/AxisHelper.cxx | 20 | ||||
-rw-r--r-- | chart2/source/tools/ChartModelHelper.cxx | 3 | ||||
-rw-r--r-- | chart2/source/tools/ChartTypeHelper.cxx | 21 | ||||
-rw-r--r-- | chart2/source/tools/DiagramHelper.cxx | 38 | ||||
-rw-r--r-- | chart2/source/tools/ExplicitCategoriesProvider.cxx | 1 | ||||
-rw-r--r-- | chart2/source/tools/ObjectIdentifier.cxx | 3 | ||||
-rw-r--r-- | chart2/source/tools/RegressionCurveHelper.cxx | 1 | ||||
-rw-r--r-- | chart2/source/tools/ThreeDHelper.cxx | 1 |
8 files changed, 56 insertions, 32 deletions
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 38bdb6f4f98f..36f6a84756cb 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -21,6 +21,7 @@ #include <DiagramHelper.hxx> #include <Diagram.hxx> #include <ChartTypeHelper.hxx> +#include <ChartType.hxx> #include <AxisIndexDefines.hxx> #include <LinePropertiesHelper.hxx> #include <servicenames_coosystems.hxx> @@ -889,7 +890,7 @@ void AxisHelper::getAxisOrGridPossibilities( Sequence< sal_Bool >& rPossibilityL //set possibilities: sal_Int32 nIndex=0; - Reference< XChartType > xChartType = DiagramHelper::getChartTypeByIndex( xDiagram, 0 ); + rtl::Reference< ChartType > xChartType = DiagramHelper::getChartTypeByIndex( xDiagram, 0 ); for(nIndex=0;nIndex<3;nIndex++) pPossibilityList[nIndex]=ChartTypeHelper::isSupportingMainAxis(xChartType,nDimensionCount,nIndex); for(nIndex=3;nIndex<6;nIndex++) @@ -1044,16 +1045,17 @@ rtl::Reference< BaseCoordinateSystem > AxisHelper::getCoordinateSystemOfAxis( return xRet; } -Reference< XChartType > AxisHelper::getChartTypeByIndex( const Reference< XCoordinateSystem >& xCooSys, sal_Int32 nIndex ) +rtl::Reference< ChartType > AxisHelper::getChartTypeByIndex( const Reference< XCoordinateSystem >& xCooSys, sal_Int32 nIndex ) { - Reference< XChartType > xChartType; + rtl::Reference< ChartType > xChartType; Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY ); - if( xChartTypeContainer.is() ) + if( xCooSys.is() ) { - Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() ); - if( nIndex >= 0 && nIndex < aChartTypeList.getLength() ) - xChartType.set( aChartTypeList[nIndex] ); + auto pCooSys = dynamic_cast<BaseCoordinateSystem*>(xCooSys.get()); + const std::vector< rtl::Reference< ChartType > > aChartTypeList( pCooSys->getChartTypes2() ); + if( nIndex >= 0 && nIndex < static_cast<sal_Int32>(aChartTypeList.size()) ) + xChartType = aChartTypeList[nIndex]; } return xChartType; @@ -1127,9 +1129,9 @@ void AxisHelper::setRTLAxisLayout( const Reference< XCoordinateSystem >& xCooSys } } -Reference< XChartType > AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( const Reference< chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex ) +rtl::Reference< ChartType > AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( const Reference< chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex ) { - Reference< XChartType > xChartType; + rtl::Reference< ChartType > xChartType; std::vector< Reference< XDataSeries > > aSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) ); for (auto const& series : aSeriesVector) { diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx index b81d047cc39d..829c3d9ffb47 100644 --- a/chart2/source/tools/ChartModelHelper.cxx +++ b/chart2/source/tools/ChartModelHelper.cxx @@ -26,6 +26,7 @@ #include <InternalDataProvider.hxx> #include <ChartModel.hxx> #include <BaseCoordinateSystem.hxx> +#include <ChartType.hxx> #include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/chart/XChartDocument.hpp> @@ -182,7 +183,7 @@ std::vector< uno::Reference< XDataSeries > > ChartModelHelper::getDataSeries( return getDataSeries( uno::Reference< chart2::XChartDocument >( xModel, uno::UNO_QUERY )); } -uno::Reference< XChartType > ChartModelHelper::getChartTypeOfSeries( +rtl::Reference< ChartType > ChartModelHelper::getChartTypeOfSeries( const uno::Reference< frame::XModel >& xModel , const uno::Reference< XDataSeries >& xGivenDataSeries ) { diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index 323e68197969..e921f01c1581 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -18,6 +18,7 @@ */ #include <ChartTypeHelper.hxx> +#include <ChartType.hxx> #include <DiagramHelper.hxx> #include <servicenames_charttypes.hxx> @@ -437,6 +438,26 @@ bool ChartTypeHelper::isSupportingDateAxis( const uno::Reference< chart2::XChart 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 uno::Reference< chart2::XChartType >& xChartType ) { if( xChartType.is() ) diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index 7d9136e7291a..b75df5b0f29c 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -21,6 +21,7 @@ #include <Diagram.hxx> #include <DataSeriesHelper.hxx> #include <AxisHelper.hxx> +#include <ChartType.hxx> #include <ChartTypeHelper.hxx> #include <ChartTypeManager.hxx> #include <ChartTypeTemplate.hxx> @@ -591,7 +592,7 @@ uno::Reference< XAxis > DiagramHelper::getAttachedAxis( return AxisHelper::getAxis( 1, DiagramHelper::isSeriesAttachedToMainAxis( xSeries ), xDiagram ); } -uno::Reference< XChartType > DiagramHelper::getChartTypeOfSeries( +rtl::Reference< ChartType > DiagramHelper::getChartTypeOfSeries( const uno::Reference< chart2::XDiagram >& xDiagram , const uno::Reference< XDataSeries >& xGivenDataSeries ) { @@ -610,16 +611,11 @@ uno::Reference< XChartType > DiagramHelper::getChartTypeOfSeries( for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : pDiagram->getBaseCoordinateSystems() ) { //iterate through all chart types in the current coordinate system - const uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xCooSys->getChartTypes() ); - for( uno::Reference< XChartType > const & xChartType : aChartTypeList ) + const std::vector< rtl::Reference< ChartType > > & aChartTypeList( xCooSys->getChartTypes2() ); + for( rtl::Reference< ChartType > const & xChartType : aChartTypeList ) { //iterate through all series in this chart type - uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY ); - OSL_ASSERT( xDataSeriesContainer.is()); - if( !xDataSeriesContainer.is() ) - continue; - - const uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() ); + const uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xChartType->getDataSeries() ); for( uno::Reference< XDataSeries > const & dataSeries : aSeriesList ) { if( xGivenDataSeries==dataSeries ) @@ -687,7 +683,7 @@ Sequence< Sequence< Reference< XDataSeries > > > return comphelper::containerToSequence( aResult ); } -Reference< XChartType > +rtl::Reference< ChartType > DiagramHelper::getChartTypeByIndex( const Reference< XDiagram >& xDiagram, sal_Int32 nIndex ) { if (!xDiagram) @@ -696,19 +692,19 @@ Reference< XChartType > Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); assert(pDiagram); - Reference< XChartType > xChartType; + rtl::Reference< ChartType > xChartType; //iterate through all coordinate systems sal_Int32 nTypesSoFar = 0; for( rtl::Reference< BaseCoordinateSystem > const & coords : pDiagram->getBaseCoordinateSystems() ) { - Sequence< Reference< XChartType > > aChartTypeList( coords->getChartTypes() ); - if( nIndex >= 0 && nIndex < (nTypesSoFar + aChartTypeList.getLength()) ) + const std::vector< rtl::Reference< ChartType > > & aChartTypeList( coords->getChartTypes2() ); + if( nIndex >= 0 && nIndex < static_cast<sal_Int32>(nTypesSoFar + aChartTypeList.size()) ) { - xChartType.set( aChartTypeList[nIndex - nTypesSoFar] ); + xChartType = aChartTypeList[nIndex - nTypesSoFar]; break; } - nTypesSoFar += aChartTypeList.getLength(); + nTypesSoFar += aChartTypeList.size(); } return xChartType; @@ -1153,7 +1149,7 @@ sal_Int32 DiagramHelper::getPercentNumberFormat( const Reference< util::XNumberF return nRet; } -Sequence< Reference< XChartType > > +std::vector< rtl::Reference< ChartType > > DiagramHelper::getChartTypesFromDiagram( const Reference< XDiagram > & xDiagram ) { @@ -1162,12 +1158,12 @@ Sequence< Reference< XChartType > > Diagram* pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); assert(pDiagram); - std::vector< Reference< XChartType > > aResult; + std::vector< rtl::Reference< ChartType > > aResult; try { for( rtl::Reference< BaseCoordinateSystem > const & coords : pDiagram->getBaseCoordinateSystems() ) { - const Sequence< Reference< XChartType > > aChartTypeSeq( coords->getChartTypes()); + const std::vector< rtl::Reference< ChartType > > & aChartTypeSeq( coords->getChartTypes2()); aResult.insert( aResult.end(), aChartTypeSeq.begin(), aChartTypeSeq.end() ); } } @@ -1176,7 +1172,7 @@ Sequence< Reference< XChartType > > DBG_UNHANDLED_EXCEPTION("chart2"); } - return comphelper::containerToSequence( aResult ); + return aResult; } bool DiagramHelper::areChartTypesCompatible( const Reference< ::chart2::XChartType >& xFirstType, @@ -1401,9 +1397,9 @@ bool DiagramHelper::isSupportingFloorAndWall( const Reference< //todo: allow this in future again, if fileversion is available for OLE objects (metastream) //thus the wrong bottom can be removed on import - const Sequence< Reference< chart2::XChartType > > aTypes( + const std::vector< rtl::Reference< ChartType > > aTypes( ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) ); - for( Reference< chart2::XChartType > const & xType : aTypes ) + for( rtl::Reference< ChartType > const & xType : aTypes ) { if( xType.is() && xType->getChartType().match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) return false; diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index 0f418198a08d..95ef825f7ecc 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -19,6 +19,7 @@ #include <ExplicitCategoriesProvider.hxx> #include <DiagramHelper.hxx> +#include <ChartType.hxx> #include <ChartTypeHelper.hxx> #include <AxisHelper.hxx> #include <DataSourceHelper.hxx> diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index f95022510203..8983e7ef427a 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -25,6 +25,7 @@ #include <TitleHelper.hxx> #include <ChartModel.hxx> #include <ChartModelHelper.hxx> +#include <ChartType.hxx> #include <AxisHelper.hxx> #include <servicenames_charttypes.hxx> #include <DiagramHelper.hxx> @@ -1369,7 +1370,7 @@ Reference< XDataSeries > ObjectIdentifier::getDataSeriesForCID( sal_Int32 nPointIndex = -1; lcl_parseSeriesIndices( nChartTypeIndex, nSeriesIndex, nPointIndex, rObjectCID ); - Reference< XDataSeriesContainer > xDataSeriesContainer( DiagramHelper::getChartTypeByIndex( xDiagram, nChartTypeIndex ), uno::UNO_QUERY ); + rtl::Reference< ChartType > xDataSeriesContainer( DiagramHelper::getChartTypeByIndex( xDiagram, nChartTypeIndex ) ); if( xDataSeriesContainer.is() ) { uno::Sequence< uno::Reference< XDataSeries > > aDataSeriesSeq( xDataSeriesContainer->getDataSeries() ); diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx index 1df7ac904da8..c7e231a614c2 100644 --- a/chart2/source/tools/RegressionCurveHelper.cxx +++ b/chart2/source/tools/RegressionCurveHelper.cxx @@ -28,6 +28,7 @@ #include <CommonConverters.hxx> #include "RegressionCurveModel.hxx" #include <ChartTypeHelper.hxx> +#include <ChartType.hxx> #include <ChartModelHelper.hxx> #include <ResId.hxx> #include <strings.hrc> diff --git a/chart2/source/tools/ThreeDHelper.cxx b/chart2/source/tools/ThreeDHelper.cxx index 0903459606bb..361b2f0b17a6 100644 --- a/chart2/source/tools/ThreeDHelper.cxx +++ b/chart2/source/tools/ThreeDHelper.cxx @@ -20,6 +20,7 @@ #include <ThreeDHelper.hxx> #include <DiagramHelper.hxx> #include <ChartTypeHelper.hxx> +#include <ChartType.hxx> #include <BaseGFXHelper.hxx> #include <DataSeriesHelper.hxx> #include <defines.hxx> |