summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-03-22 08:29:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-03-22 17:15:15 +0000
commitf4cde4406217dd61e8d803eb38e6f5fac84a1f6d (patch)
tree3566e681494aff49f3c2fcd517bcd89e90ee62c6
parent826b20b049449c9c335ce00c781cdb52e4ee0512 (diff)
use more concrete type in chart2
Change-Id: I0ed45cf9acd1c9bf702bbe335f8a07b6947fb946 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149282 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--chart2/source/controller/dialogs/DialogModel.cxx2
-rw-r--r--chart2/source/controller/dialogs/DialogModel.hxx2
-rw-r--r--chart2/source/inc/DataSeries.hxx2
-rw-r--r--chart2/source/inc/DataSeriesHelper.hxx18
-rw-r--r--chart2/source/tools/DataSeriesHelper.cxx56
5 files changed, 34 insertions, 46 deletions
diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx
index 334fc0b1b0e2..c9084ca8f518 100644
--- a/chart2/source/controller/dialogs/DialogModel.cxx
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -581,7 +581,7 @@ rtl::Reference< ::chart::DataSeries > DialogModel::insertSeriesAfter(
}
void DialogModel::deleteSeries(
- const Reference< XDataSeries > & xSeries,
+ const rtl::Reference< DataSeries > & xSeries,
const rtl::Reference< ChartType > & xChartType )
{
m_aTimerTriggeredControllerLock.startTimer();
diff --git a/chart2/source/controller/dialogs/DialogModel.hxx b/chart2/source/controller/dialogs/DialogModel.hxx
index 576f29c20f4b..325cffe06773 100644
--- a/chart2/source/controller/dialogs/DialogModel.hxx
+++ b/chart2/source/controller/dialogs/DialogModel.hxx
@@ -115,7 +115,7 @@ public:
bool bCreateDataCachedSequences = false );
void deleteSeries(
- const css::uno::Reference< css::chart2::XDataSeries > & xSeries,
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
const rtl::Reference< ::chart::ChartType > & xChartType );
css::uno::Reference< css::chart2::data::XLabeledDataSequence >
diff --git a/chart2/source/inc/DataSeries.hxx b/chart2/source/inc/DataSeries.hxx
index fb8255d10f12..9e84ac99ab51 100644
--- a/chart2/source/inc/DataSeries.hxx
+++ b/chart2/source/inc/DataSeries.hxx
@@ -86,7 +86,6 @@ public:
virtual void SAL_CALL resetDataPoint( sal_Int32 nIndex ) override;
virtual void SAL_CALL resetAllDataPoints() override;
-private:
// ____ XDataSink ____
/// @see css::chart2::data::XDataSink
virtual void SAL_CALL setData( const css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > >& aData ) override;
@@ -94,7 +93,6 @@ private:
// ____ XDataSource ____
/// @see css::chart2::data::XDataSource
virtual css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences() override;
-public:
// ____ OPropertySet ____
virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
diff --git a/chart2/source/inc/DataSeriesHelper.hxx b/chart2/source/inc/DataSeriesHelper.hxx
index b07ff17b1e08..c3eb20af90d6 100644
--- a/chart2/source/inc/DataSeriesHelper.hxx
+++ b/chart2/source/inc/DataSeriesHelper.hxx
@@ -127,11 +127,11 @@ rtl::Reference< ::chart::BaseCoordinateSystem >
OOO_DLLPUBLIC_CHARTTOOLS
rtl::Reference< ::chart::ChartType >
getChartTypeOfSeries(
- const css::uno::Reference< css::chart2::XDataSeries > & xSeries,
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
const rtl::Reference< ::chart::Diagram > & xDiagram );
OOO_DLLPUBLIC_CHARTTOOLS void deleteSeries(
- const css::uno::Reference< css::chart2::XDataSeries > & xSeries,
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
const rtl::Reference< ::chart::ChartType > & xChartType );
OOO_DLLPUBLIC_CHARTTOOLS void switchSymbolsOnOrOff(
@@ -160,24 +160,24 @@ OOO_DLLPUBLIC_CHARTTOOLS bool hasAttributedDataPointDifferentValue(
const OUString& rPropertyName,
const css::uno::Any& rPropertyValue );
-OOO_DLLPUBLIC_CHARTTOOLS bool hasUnhiddenData( const css::uno::Reference<
- css::chart2::XDataSeries >& xSeries );
+OOO_DLLPUBLIC_CHARTTOOLS bool hasUnhiddenData( const rtl::Reference<
+ ::chart::DataSeries >& xSeries );
OOO_DLLPUBLIC_CHARTTOOLS
sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nClippedIndex, const css::uno::Reference<
css::chart2::data::XDataSequence >& xDataSequence, bool bTranslate );
-OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtSeries( const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
+OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtSeries( const rtl::Reference< ::chart::DataSeries >& xSeries );
-OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtPoints( const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
+OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtPoints( const rtl::Reference< ::chart::DataSeries >& xSeries );
-OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelAtPoint( const css::uno::Reference< css::chart2::XDataSeries >& xSeries, sal_Int32 nPointIndex );
+OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelAtPoint( const rtl::Reference< ::chart::DataSeries >& xSeries, sal_Int32 nPointIndex );
-OOO_DLLPUBLIC_CHARTTOOLS void insertDataLabelsToSeriesAndAllPoints( const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
+OOO_DLLPUBLIC_CHARTTOOLS void insertDataLabelsToSeriesAndAllPoints( const rtl::Reference< ::chart::DataSeries >& xSeries );
OOO_DLLPUBLIC_CHARTTOOLS void insertDataLabelToPoint( const css::uno::Reference< css::beans::XPropertySet >& xPointPropertySet );
-OOO_DLLPUBLIC_CHARTTOOLS void deleteDataLabelsFromSeriesAndAllPoints( const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
+OOO_DLLPUBLIC_CHARTTOOLS void deleteDataLabelsFromSeriesAndAllPoints( const rtl::Reference< ::chart::DataSeries >& xSeries );
OOO_DLLPUBLIC_CHARTTOOLS void deleteDataLabelsFromPoint( const css::uno::Reference< css::beans::XPropertySet >& xPointPropertySet );
diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx
index e1212ae1fa72..07883a1646bf 100644
--- a/chart2/source/tools/DataSeriesHelper.cxx
+++ b/chart2/source/tools/DataSeriesHelper.cxx
@@ -112,24 +112,23 @@ void lcl_getCooSysAndChartTypeOfSeries(
}
}
-void lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( const Reference< chart2::XDataSeries >& xSeries, bool bInsert )
+void lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( const rtl::Reference< ::chart::DataSeries >& xSeries, bool bInsert )
{
try
{
- Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
- if( xSeriesProperties.is() )
+ if( xSeries.is() )
{
DataPointLabel aLabelAtSeries;
- xSeriesProperties->getPropertyValue(CHART_UNONAME_LABEL) >>= aLabelAtSeries;
+ xSeries->getPropertyValue(CHART_UNONAME_LABEL) >>= aLabelAtSeries;
aLabelAtSeries.ShowNumber = bInsert;
if( !bInsert )
{
aLabelAtSeries.ShowNumberInPercent = false;
aLabelAtSeries.ShowCategoryName = false;
}
- xSeriesProperties->setPropertyValue(CHART_UNONAME_LABEL, uno::Any(aLabelAtSeries));
+ xSeries->setPropertyValue(CHART_UNONAME_LABEL, uno::Any(aLabelAtSeries));
uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
- if( xSeriesProperties->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
+ if( xSeries->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
{
for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
{
@@ -386,28 +385,24 @@ rtl::Reference< ::chart::BaseCoordinateSystem > getCoordinateSystemOfSeries(
}
rtl::Reference< ::chart::ChartType > getChartTypeOfSeries(
- const Reference< chart2::XDataSeries > & xSeries,
+ const rtl::Reference< DataSeries > & xSeries,
const rtl::Reference< Diagram > & xDiagram )
{
rtl::Reference< ::chart::ChartType > xResult;
rtl::Reference< ::chart::BaseCoordinateSystem > xDummy;
- rtl::Reference< DataSeries> pSeries = dynamic_cast<DataSeries*>(xSeries.get());
- assert(pSeries);
- lcl_getCooSysAndChartTypeOfSeries( pSeries, xDiagram, xDummy, xResult );
+ lcl_getCooSysAndChartTypeOfSeries( xSeries, xDiagram, xDummy, xResult );
return xResult;
}
void deleteSeries(
- const Reference< chart2::XDataSeries > & xSeries,
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
const rtl::Reference< ::chart::ChartType > & xChartType )
{
try
{
- rtl::Reference<DataSeries> pSeries = dynamic_cast<DataSeries*>(xSeries.get());
- assert(pSeries);
std::vector< rtl::Reference< DataSeries > > aSeries = xChartType->getDataSeries2();
- auto aIt = std::find( aSeries.begin(), aSeries.end(), pSeries );
+ auto aIt = std::find( aSeries.begin(), aSeries.end(), xSeries );
if( aIt != aSeries.end())
{
aSeries.erase( aIt );
@@ -555,11 +550,9 @@ bool lcl_SequenceHasUnhiddenData( const uno::Reference< chart2::data::XDataSeque
}
-bool hasUnhiddenData( const uno::Reference< chart2::XDataSeries >& xSeries )
+bool hasUnhiddenData( const rtl::Reference< DataSeries >& xSeries )
{
- uno::Reference< chart2::data::XDataSource > xDataSource( xSeries, uno::UNO_QUERY );
-
- uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aDataSequences = xDataSource->getDataSequences();
+ uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aDataSequences = xSeries->getDataSequences();
for(sal_Int32 nN = aDataSequences.getLength();nN--;)
{
@@ -605,16 +598,15 @@ sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nIndex, const Refere
return nIndex;
}
-bool hasDataLabelsAtSeries( const Reference< chart2::XDataSeries >& xSeries )
+bool hasDataLabelsAtSeries( const rtl::Reference< DataSeries >& xSeries )
{
bool bRet = false;
try
{
- Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY );
- if( xProp.is() )
+ if( xSeries.is() )
{
DataPointLabel aLabel;
- if( xProp->getPropertyValue(CHART_UNONAME_LABEL) >>= aLabel )
+ if( xSeries->getPropertyValue(CHART_UNONAME_LABEL) >>= aLabel )
bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName
|| aLabel.ShowSeriesName;
}
@@ -626,16 +618,15 @@ bool hasDataLabelsAtSeries( const Reference< chart2::XDataSeries >& xSeries )
return bRet;
}
-bool hasDataLabelsAtPoints( const Reference< chart2::XDataSeries >& xSeries )
+bool hasDataLabelsAtPoints( const rtl::Reference< DataSeries >& xSeries )
{
bool bRet = false;
try
{
- Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
- if( xSeriesProperties.is() )
+ if( xSeries.is() )
{
uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
- if( xSeriesProperties->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
+ if( xSeries->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
{
for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
{
@@ -661,23 +652,22 @@ bool hasDataLabelsAtPoints( const Reference< chart2::XDataSeries >& xSeries )
return bRet;
}
-bool hasDataLabelAtPoint( const Reference< chart2::XDataSeries >& xSeries, sal_Int32 nPointIndex )
+bool hasDataLabelAtPoint( const rtl::Reference< DataSeries >& xSeries, sal_Int32 nPointIndex )
{
bool bRet = false;
try
{
Reference< beans::XPropertySet > xProp;
- Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
- if( xSeriesProperties.is() )
+ if( xSeries.is() )
{
uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
- if( xSeriesProperties->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
+ if( xSeries->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
{
auto aIt = std::find( std::as_const(aAttributedDataPointIndexList).begin(), std::as_const(aAttributedDataPointIndexList).end(), nPointIndex );
if( aIt != std::as_const(aAttributedDataPointIndexList).end())
xProp = xSeries->getDataPointByIndex(nPointIndex);
else
- xProp = xSeriesProperties;
+ xProp = xSeries;
}
if( xProp.is() )
{
@@ -696,12 +686,12 @@ bool hasDataLabelAtPoint( const Reference< chart2::XDataSeries >& xSeries, sal_I
return bRet;
}
-void insertDataLabelsToSeriesAndAllPoints( const Reference< chart2::XDataSeries >& xSeries )
+void insertDataLabelsToSeriesAndAllPoints( const rtl::Reference< DataSeries >& xSeries )
{
lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( xSeries, true /*bInsert*/ );
}
-void deleteDataLabelsFromSeriesAndAllPoints( const Reference< chart2::XDataSeries >& xSeries )
+void deleteDataLabelsFromSeriesAndAllPoints( const rtl::Reference< DataSeries >& xSeries )
{
lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( xSeries, false /*bInsert*/ );
}