fold DataSeriesHelper functions into ChartType

Where it better belongs, and where we can do a much better implementation.

Change-Id: I00d77c28d3dc78c672e8a6756797a768a2eb0d02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184097
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
This commit is contained in:
Noel Grandin
2025-04-13 14:20:23 +02:00
parent 7abefc023c
commit 84f7b84052
6 changed files with 28 additions and 27 deletions
@@ -586,7 +586,7 @@ void DialogModel::deleteSeries(
m_aTimerTriggeredControllerLock.startTimer();
ControllerLockGuardUNO aLockedControllers( m_xChartDocument );
DataSeriesHelper::deleteSeries( xSeries, xChartType );
xChartType->deleteSeries( xSeries );
}
uno::Reference< chart2::data::XLabeledDataSequence > DialogModel::getCategories() const
@@ -114,7 +114,7 @@ bool lcl_deleteDataSeries(
rtl::Reference< Diagram > xDiagram = xModel->getFirstChartDiagram();
rtl::Reference< Axis > xAxis = xDiagram->getAttachedAxis( xSeries );
DataSeriesHelper::deleteSeries( xSeries, xChartType );
xChartType->deleteSeries( xSeries );
AxisHelper::hideAxisIfNoDataIsAttached( xAxis, xDiagram );
+3
View File
@@ -115,6 +115,9 @@ public:
createCoordinateSystem2( sal_Int32 DimensionCount );
virtual void createCalculatedDataSeries();
void deleteSeries( const rtl::Reference< ::chart::DataSeries > & xSeries );
protected:
// ____ XModifyListener ____
-4
View File
@@ -110,10 +110,6 @@ rtl::Reference< ::chart::ChartType >
const rtl::Reference< ::chart::DataSeries > & xSeries,
const rtl::Reference< ::chart::Diagram > & xDiagram );
void deleteSeries(
const rtl::Reference< ::chart::DataSeries > & xSeries,
const rtl::Reference< ::chart::ChartType > & xChartType );
sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nClippedIndex, const css::uno::Reference<
css::chart2::data::XDataSequence >& xDataSequence, bool bTranslate );
@@ -322,6 +322,29 @@ using impl::ChartType_Base;
IMPLEMENT_FORWARD_XINTERFACE2( ChartType, ChartType_Base, ::property::OPropertySet )
IMPLEMENT_FORWARD_XTYPEPROVIDER2( ChartType, ChartType_Base, ::property::OPropertySet )
void ChartType::deleteSeries( const rtl::Reference< ::chart::DataSeries > & xSeries )
{
try
{
SolarMutexGuard g;
auto it = std::find( m_aDataSeries.begin(), m_aDataSeries.end(), xSeries );
if( it == m_aDataSeries.end())
return;
ModifyListenerHelper::removeListener( *it, m_xModifyEventForwarder );
fireModifyEvent();
createCalculatedDataSeries();
}
catch( const uno::Exception & )
{
DBG_UNHANDLED_EXCEPTION("chart2");
}
}
} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-21
View File
@@ -307,27 +307,6 @@ rtl::Reference< ::chart::ChartType > getChartTypeOfSeries(
return xResult;
}
void deleteSeries(
const rtl::Reference< ::chart::DataSeries > & xSeries,
const rtl::Reference< ::chart::ChartType > & xChartType )
{
try
{
std::vector< rtl::Reference< DataSeries > > aSeries = xChartType->getDataSeries2();
auto aIt = std::find( aSeries.begin(), aSeries.end(), xSeries );
if( aIt != aSeries.end())
{
aSeries.erase( aIt );
xChartType->setDataSeries( aSeries );
}
}
catch( const uno::Exception & )
{
DBG_UNHANDLED_EXCEPTION("chart2");
}
}
sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nIndex, const Reference< chart2::data::XDataSequence >& xDataSequence, bool bTranslate )
{
if( !bTranslate )