diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-01-24 18:44:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-25 06:54:44 +0100 |
commit | 1b728994b89b1518137a538f57ee3d7e6644d8da (patch) | |
tree | d6a10c78fea5fdd6abd07f5c083b27d827a60429 | |
parent | bf691e4598ae51b534d004ce21f839081dcd3df9 (diff) |
use more concrete types in chart2, ChartType
Change-Id: Ia3d49d53548a843301449c0fea97b81ba85e71e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128878
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | chart2/source/view/charttypes/AreaChart.cxx | 11 | ||||
-rw-r--r-- | chart2/source/view/charttypes/AreaChart.hxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/BarChart.cxx | 9 | ||||
-rw-r--r-- | chart2/source/view/charttypes/BarChart.hxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/BubbleChart.cxx | 3 | ||||
-rw-r--r-- | chart2/source/view/charttypes/BubbleChart.hxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/CandleStickChart.cxx | 13 | ||||
-rw-r--r-- | chart2/source/view/charttypes/CandleStickChart.hxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/NetChart.cxx | 3 | ||||
-rw-r--r-- | chart2/source/view/charttypes/NetChart.hxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/PieChart.cxx | 13 | ||||
-rw-r--r-- | chart2/source/view/charttypes/PieChart.hxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 10 | ||||
-rw-r--r-- | chart2/source/view/inc/VSeriesPlotter.hxx | 8 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 31 |
15 files changed, 54 insertions, 59 deletions
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index e5409ce5dff1..3bb573da8538 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -24,6 +24,7 @@ #include <ExplicitCategoriesProvider.hxx> #include <ObjectIdentifier.hxx> #include "Splines.hxx" +#include <ChartType.hxx> #include <ChartTypeHelper.hxx> #include <LabelPositionHelper.hxx> #include <Clipping.hxx> @@ -51,7 +52,7 @@ namespace chart using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; -AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel +AreaChart::AreaChart( const rtl::Reference<ChartType>& xChartTypeModel , sal_Int32 nDimensionCount , bool bCategoryXAxis , bool bNoArea @@ -73,11 +74,11 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel try { - if( m_xChartTypeModelProps.is() ) + if( m_xChartTypeModel.is() ) { - m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_CURVE_STYLE) >>= m_eCurveStyle; - m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_CURVE_RESOLUTION) >>= m_nCurveResolution; - m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_SPLINE_ORDER) >>= m_nSplineOrder; + m_xChartTypeModel->getPropertyValue(CHART_UNONAME_CURVE_STYLE) >>= m_eCurveStyle; + m_xChartTypeModel->getPropertyValue(CHART_UNONAME_CURVE_RESOLUTION) >>= m_nCurveResolution; + m_xChartTypeModel->getPropertyValue(CHART_UNONAME_SPLINE_ORDER) >>= m_nSplineOrder; } } catch( uno::Exception& e ) diff --git a/chart2/source/view/charttypes/AreaChart.hxx b/chart2/source/view/charttypes/AreaChart.hxx index 23d8adb0b4f1..2f7434f3c5c3 100644 --- a/chart2/source/view/charttypes/AreaChart.hxx +++ b/chart2/source/view/charttypes/AreaChart.hxx @@ -32,7 +32,7 @@ class AreaChart : public VSeriesPlotter public: AreaChart() = delete; - AreaChart( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel + AreaChart( const rtl::Reference< ::chart::ChartType >& xChartTypeModel , sal_Int32 nDimensionCount , bool bCategoryXAxis, bool bNoArea=false ); diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx index 938355192e35..f2dbf0d2422c 100644 --- a/chart2/source/view/charttypes/BarChart.cxx +++ b/chart2/source/view/charttypes/BarChart.cxx @@ -20,6 +20,7 @@ #include "BarChart.hxx" #include "BarPositionHelper.hxx" +#include <ChartType.hxx> #include <ShapeFactory.hxx> #include <CommonConverters.hxx> #include <ObjectIdentifier.hxx> @@ -44,7 +45,7 @@ using namespace ::com::sun::star; using namespace ::rtl::math; using namespace ::com::sun::star::chart2; -BarChart::BarChart( const uno::Reference<XChartType>& xChartTypeModel +BarChart::BarChart( const rtl::Reference<ChartType>& xChartTypeModel , sal_Int32 nDimensionCount ) : VSeriesPlotter( xChartTypeModel, nDimensionCount ) , m_pMainPosHelper( new BarPositionHelper() ) @@ -54,10 +55,10 @@ BarChart::BarChart( const uno::Reference<XChartType>& xChartTypeModel try { - if( m_xChartTypeModelProps.is() ) + if( m_xChartTypeModel.is() ) { - m_xChartTypeModelProps->getPropertyValue( "OverlapSequence" ) >>= m_aOverlapSequence; - m_xChartTypeModelProps->getPropertyValue( "GapwidthSequence" ) >>= m_aGapwidthSequence; + m_xChartTypeModel->getPropertyValue( "OverlapSequence" ) >>= m_aOverlapSequence; + m_xChartTypeModel->getPropertyValue( "GapwidthSequence" ) >>= m_aGapwidthSequence; } } catch( const uno::Exception& ) diff --git a/chart2/source/view/charttypes/BarChart.hxx b/chart2/source/view/charttypes/BarChart.hxx index 5e9ab5e49f48..badb65822837 100644 --- a/chart2/source/view/charttypes/BarChart.hxx +++ b/chart2/source/view/charttypes/BarChart.hxx @@ -32,7 +32,7 @@ class BarChart : public VSeriesPlotter public: BarChart() = delete; - BarChart( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel + BarChart( const rtl::Reference< ::chart::ChartType >& xChartTypeModel , sal_Int32 nDimensionCount ); virtual ~BarChart() override; diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx index fc7fcdd2597b..bf97f39c5061 100644 --- a/chart2/source/view/charttypes/BubbleChart.cxx +++ b/chart2/source/view/charttypes/BubbleChart.cxx @@ -22,6 +22,7 @@ #include <ShapeFactory.hxx> #include <ObjectIdentifier.hxx> #include <LabelPositionHelper.hxx> +#include <ChartType.hxx> #include <com/sun/star/chart/DataLabelPlacement.hpp> #include <sal/log.hxx> @@ -34,7 +35,7 @@ namespace chart using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; -BubbleChart::BubbleChart( const uno::Reference<XChartType>& xChartTypeModel +BubbleChart::BubbleChart( const rtl::Reference<ChartType>& xChartTypeModel , sal_Int32 nDimensionCount ) : VSeriesPlotter( xChartTypeModel, nDimensionCount, false ) , m_fMaxLogicBubbleSize( 0.0 ) diff --git a/chart2/source/view/charttypes/BubbleChart.hxx b/chart2/source/view/charttypes/BubbleChart.hxx index 06d1d1200340..c25e5b6345bf 100644 --- a/chart2/source/view/charttypes/BubbleChart.hxx +++ b/chart2/source/view/charttypes/BubbleChart.hxx @@ -30,7 +30,7 @@ class BubbleChart : public VSeriesPlotter public: BubbleChart() = delete; - BubbleChart( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel + BubbleChart( const rtl::Reference< ::chart::ChartType >& xChartTypeModel , sal_Int32 nDimensionCount ); virtual ~BubbleChart() override; diff --git a/chart2/source/view/charttypes/CandleStickChart.cxx b/chart2/source/view/charttypes/CandleStickChart.cxx index 44fcd600bd49..f1b11492ee60 100644 --- a/chart2/source/view/charttypes/CandleStickChart.cxx +++ b/chart2/source/view/charttypes/CandleStickChart.cxx @@ -18,6 +18,7 @@ */ #include "CandleStickChart.hxx" +#include <ChartType.hxx> #include <ShapeFactory.hxx> #include <CommonConverters.hxx> #include <ExplicitCategoriesProvider.hxx> @@ -33,7 +34,7 @@ namespace chart using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; -CandleStickChart::CandleStickChart( const uno::Reference<XChartType>& xChartTypeModel +CandleStickChart::CandleStickChart( const rtl::Reference<ChartType>& xChartTypeModel , sal_Int32 nDimensionCount ) : VSeriesPlotter( xChartTypeModel, nDimensionCount ) , m_pMainPosHelper( new BarPositionHelper() ) @@ -104,15 +105,15 @@ void CandleStickChart::createShapes() tAnySequence aWhiteBox_Values, aBlackBox_Values; try { - if( m_xChartTypeModelProps.is() ) + if( m_xChartTypeModel.is() ) { - m_xChartTypeModelProps->getPropertyValue( "ShowFirst" ) >>= bShowFirst; + m_xChartTypeModel->getPropertyValue( "ShowFirst" ) >>= bShowFirst; uno::Reference< beans::XPropertySet > xWhiteDayProps; uno::Reference< beans::XPropertySet > xBlackDayProps; - m_xChartTypeModelProps->getPropertyValue( "Japanese" ) >>= bJapaneseStyle; - m_xChartTypeModelProps->getPropertyValue( "WhiteDay" ) >>= xWhiteDayProps; - m_xChartTypeModelProps->getPropertyValue( "BlackDay" ) >>= xBlackDayProps; + m_xChartTypeModel->getPropertyValue( "Japanese" ) >>= bJapaneseStyle; + m_xChartTypeModel->getPropertyValue( "WhiteDay" ) >>= xWhiteDayProps; + m_xChartTypeModel->getPropertyValue( "BlackDay" ) >>= xBlackDayProps; tPropertyNameValueMap aWhiteBox_Map; PropertyMapper::getValueMap( aWhiteBox_Map, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), xWhiteDayProps ); diff --git a/chart2/source/view/charttypes/CandleStickChart.hxx b/chart2/source/view/charttypes/CandleStickChart.hxx index eddee6b72e12..93571889ee6d 100644 --- a/chart2/source/view/charttypes/CandleStickChart.hxx +++ b/chart2/source/view/charttypes/CandleStickChart.hxx @@ -32,7 +32,7 @@ class CandleStickChart : public VSeriesPlotter public: CandleStickChart() = delete; - CandleStickChart( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel + CandleStickChart( const rtl::Reference< ::chart::ChartType >& xChartTypeModel , sal_Int32 nDimensionCount ); virtual ~CandleStickChart() override; diff --git a/chart2/source/view/charttypes/NetChart.cxx b/chart2/source/view/charttypes/NetChart.cxx index 5507e30e0579..ada893b8d152 100644 --- a/chart2/source/view/charttypes/NetChart.cxx +++ b/chart2/source/view/charttypes/NetChart.cxx @@ -27,6 +27,7 @@ #include <Clipping.hxx> #include <PolarLabelPositionHelper.hxx> #include <DateHelper.hxx> +#include <ChartType.hxx> #include <com/sun/star/chart2/Symbol.hpp> #include <com/sun/star/chart/DataLabelPlacement.hpp> @@ -44,7 +45,7 @@ namespace chart using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; -NetChart::NetChart( const uno::Reference<XChartType>& xChartTypeModel +NetChart::NetChart( const rtl::Reference<ChartType>& xChartTypeModel , sal_Int32 nDimensionCount , bool bNoArea , std::unique_ptr<PlottingPositionHelper> pPlottingPositionHelper diff --git a/chart2/source/view/charttypes/NetChart.hxx b/chart2/source/view/charttypes/NetChart.hxx index 9883ba118ac2..42d06570e9f2 100644 --- a/chart2/source/view/charttypes/NetChart.hxx +++ b/chart2/source/view/charttypes/NetChart.hxx @@ -31,7 +31,7 @@ class NetChart : public VSeriesPlotter public: NetChart() = delete; - NetChart( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel + NetChart( const rtl::Reference< ::chart::ChartType >& xChartTypeModel , sal_Int32 nDimensionCount , bool bNoArea , std::unique_ptr<PlottingPositionHelper> pPlottingPositionHelper //takes ownership diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index 2fd709500d29..d05f10070598 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -25,6 +25,7 @@ #include <PolarLabelPositionHelper.hxx> #include <CommonConverters.hxx> #include <ObjectIdentifier.hxx> +#include <ChartType.hxx> #include <com/sun/star/chart/DataLabelPlacement.hpp> #include <com/sun/star/chart2/XChartType.hpp> @@ -191,7 +192,7 @@ bool PiePositionHelper::getInnerAndOuterRadius( double fCategoryX return true; } -PieChart::PieChart( const uno::Reference<XChartType>& xChartTypeModel +PieChart::PieChart( const rtl::Reference<ChartType>& xChartTypeModel , sal_Int32 nDimensionCount , bool bExcludingPositioning ) : VSeriesPlotter( xChartTypeModel, nDimensionCount ) @@ -205,13 +206,12 @@ PieChart::PieChart( const uno::Reference<XChartType>& xChartTypeModel m_pPosHelper->m_fRadiusOffset = 0.0; m_pPosHelper->m_fRingDistance = 0.0; - uno::Reference< beans::XPropertySet > xChartTypeProps( xChartTypeModel, uno::UNO_QUERY ); - if( !xChartTypeProps.is() ) + if( !xChartTypeModel.is() ) return; try { - xChartTypeProps->getPropertyValue( "UseRings") >>= m_bUseRings; + xChartTypeModel->getPropertyValue( "UseRings") >>= m_bUseRings; if( m_bUseRings ) { m_pPosHelper->m_fRadiusOffset = 1.0; @@ -704,12 +704,11 @@ void PieChart::createShapes() m_aLabelInfoList.clear(); m_fMaxOffset = std::numeric_limits<double>::quiet_NaN(); sal_Int32 n3DRelativeHeight = 100; - uno::Reference< beans::XPropertySet > xPropertySet( m_xChartTypeModel, uno::UNO_QUERY ); - if ( (m_nDimension==3) && xPropertySet.is()) + if ( (m_nDimension==3) && m_xChartTypeModel.is()) { try { - uno::Any aAny = xPropertySet->getPropertyValue( "3DRelativeHeight" ); + uno::Any aAny = m_xChartTypeModel->getPropertyValue( "3DRelativeHeight" ); aAny >>= n3DRelativeHeight; } catch (const uno::Exception&) { } diff --git a/chart2/source/view/charttypes/PieChart.hxx b/chart2/source/view/charttypes/PieChart.hxx index 5bd25eed53e6..cb6b92dddae7 100644 --- a/chart2/source/view/charttypes/PieChart.hxx +++ b/chart2/source/view/charttypes/PieChart.hxx @@ -35,7 +35,7 @@ class PieChart : public VSeriesPlotter public: PieChart() = delete; - PieChart( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel + PieChart( const rtl::Reference< ::chart::ChartType >& xChartTypeModel , sal_Int32 nDimensionCount, bool bExcludingPositioning ); virtual ~PieChart() override; diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 8f0c19e83078..5eab49ee6d4a 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -32,6 +32,7 @@ #include <StatisticsHelper.hxx> #include <PlottingPositionHelper.hxx> #include <LabelPositionHelper.hxx> +#include <ChartType.hxx> #include <ChartTypeHelper.hxx> #include <Clipping.hxx> #include <servicenames_charttypes.hxx> @@ -138,12 +139,11 @@ sal_Int32 VDataSeriesGroup::getSeriesCount() const return m_aSeriesVector.size(); } -VSeriesPlotter::VSeriesPlotter( const uno::Reference<XChartType>& xChartTypeModel +VSeriesPlotter::VSeriesPlotter( const rtl::Reference<ChartType>& xChartTypeModel , sal_Int32 nDimensionCount, bool bCategoryXAxis ) : PlotterBase( nDimensionCount ) , m_pMainPosHelper( nullptr ) , m_xChartTypeModel(xChartTypeModel) - , m_xChartTypeModelProps( uno::Reference< beans::XPropertySet >::query( xChartTypeModel )) , m_bCategoryXAxis(bCategoryXAxis) , m_nTimeResolution(css::chart::TimeUnit::DAY) , m_aNullDate(30,12,1899) @@ -2647,10 +2647,10 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries( CHART2_SERVICE_NAME_CHARTTYPE_PIE); try { - if (bIsPie && m_xChartTypeModelProps.is()) + if (bIsPie) { bool bDonut = false; - if ((m_xChartTypeModelProps->getPropertyValue("UseRings") >>= bDonut) && bDonut) + if ((m_xChartTypeModel->getPropertyValue("UseRings") >>= bDonut) && bDonut) bIsPie = false; } } @@ -2792,7 +2792,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries( } VSeriesPlotter* VSeriesPlotter::createSeriesPlotter( - const uno::Reference<XChartType>& xChartTypeModel + const rtl::Reference<ChartType>& xChartTypeModel , sal_Int32 nDimensionCount , bool bExcludingPositioning ) { diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index 83d97bc8b671..2182be97dcdb 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -49,6 +49,7 @@ namespace com::sun::star { namespace chart { +class ChartType; class NumberFormatterWrapper; class AxesNumberFormats @@ -218,7 +219,7 @@ public: std::vector< VDataSeries* > getAllSeries(); // This method creates a series plotter of the requested type; e.g. : return new PieChart... - static VSeriesPlotter* createSeriesPlotter( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel + static VSeriesPlotter* createSeriesPlotter( const rtl::Reference< ::chart::ChartType >& xChartTypeModel , sal_Int32 nDimensionCount , bool bExcludingPositioning /*for pie and donut charts labels and exploded segments are excluded from the given size*/); @@ -254,7 +255,7 @@ public: protected: - VSeriesPlotter( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel + VSeriesPlotter( const rtl::Reference< ::chart::ChartType >& xChartTypeModel , sal_Int32 nDimensionCount , bool bCategoryXAxis=true ); @@ -398,8 +399,7 @@ protected: protected: PlottingPositionHelper* m_pMainPosHelper; - css::uno::Reference< css::chart2::XChartType > m_xChartTypeModel; - css::uno::Reference< css::beans::XPropertySet > m_xChartTypeModelProps; + rtl::Reference< ::chart::ChartType > m_xChartTypeModel; std::vector< std::vector< VDataSeriesGroup > > m_aZSlots; diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 792ebd6fa3cd..d2a6c8ef797d 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -492,25 +492,21 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter( TOOLS_WARN_EXCEPTION("chart2", "" ); } //iterate through all chart types in the current coordinate system - uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xCooSys->getChartTypes() ); - for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT ) + std::vector< rtl::Reference< ChartType > > aChartTypeList( xCooSys->getChartTypes2() ); + for( sal_Int32 nT = 0; nT < static_cast<sal_Int32>(aChartTypeList.size()); ++nT ) { - uno::Reference< XChartType > xChartType( aChartTypeList[nT] ); + rtl::Reference< ChartType > xChartType( aChartTypeList[nT] ); if(nDimensionCount == 3 && xChartType->getChartType().equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE)) { - uno::Reference< beans::XPropertySet > xPropertySet( xChartType, uno::UNO_QUERY ); - if (xPropertySet.is()) + try { - try - { - sal_Int32 n3DRelativeHeightOldValue(100); - uno::Any aAny = xPropertySet->getPropertyValue( "3DRelativeHeight" ); - aAny >>= n3DRelativeHeightOldValue; - if (n3DRelativeHeightOldValue != n3DRelativeHeight) - xPropertySet->setPropertyValue( "3DRelativeHeight", uno::Any(n3DRelativeHeight) ); - } - catch (const uno::Exception&) { } + sal_Int32 n3DRelativeHeightOldValue(100); + uno::Any aAny = xChartType->getPropertyValue( "3DRelativeHeight" ); + aAny >>= n3DRelativeHeightOldValue; + if (n3DRelativeHeightOldValue != n3DRelativeHeight) + xChartType->setPropertyValue( "3DRelativeHeight", uno::Any(n3DRelativeHeight) ); } + catch (const uno::Exception&) { } } if(nT==0) @@ -531,15 +527,10 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter( if(pVCooSys) pVCooSys->addMinimumAndMaximumSupplier(pPlotter); - uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY ); - OSL_ASSERT( xDataSeriesContainer.is()); - if( !xDataSeriesContainer.is() ) - continue; - sal_Int32 zSlot=-1; sal_Int32 xSlot=-1; sal_Int32 ySlot=-1; - uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() ); + uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xChartType->getDataSeries() ); for( sal_Int32 nS = 0; nS < aSeriesList.getLength(); ++nS ) { uno::Reference< XDataSeries > const & xDataSeries = aSeriesList[nS]; |