summaryrefslogtreecommitdiff
path: root/chart2/source/controller/dialogs/DialogModel.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-18 14:08:51 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-19 11:01:18 +0200
commit9df2821e61979dab32390d5c64dd49bee868adbb (patch)
tree5b827e29e73ac2300c164b0a389a784a358956e6 /chart2/source/controller/dialogs/DialogModel.cxx
parent8b0a69498b025e13d9772689e9e4fa3d6b05e609 (diff)
loplugin:flatten in chart2
Change-Id: Iadc4da6515a7d82e7a92b33d74d589b61fa2c64f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92480 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/controller/dialogs/DialogModel.cxx')
-rw-r--r--chart2/source/controller/dialogs/DialogModel.cxx120
1 files changed, 60 insertions, 60 deletions
diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx
index 29e0f92ab756..db50eab8b9ed 100644
--- a/chart2/source/controller/dialogs/DialogModel.cxx
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -626,23 +626,23 @@ Reference< data::XLabeledDataSequence > DialogModel::getCategories() const
void DialogModel::setCategories( const Reference< chart2::data::XLabeledDataSequence > & xCategories )
{
- if( m_xChartDocument.is())
- {
- Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram());
- if( xDiagram.is())
- {
- // categories
- bool bSupportsCategories = true;
+ if( !m_xChartDocument.is())
+ return;
- Reference< XChartType > xFirstChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
- if( xFirstChartType.is() )
- {
- sal_Int32 nAxisType = ChartTypeHelper::getAxisType( xFirstChartType, 0 ); // x-axis
- bSupportsCategories = (nAxisType == AxisType::CATEGORY);
- }
- DiagramHelper::setCategoriesToDiagram( xCategories, xDiagram, true, bSupportsCategories );
- }
+ Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram());
+ if( !xDiagram.is())
+ return;
+
+ // categories
+ bool bSupportsCategories = true;
+
+ Reference< XChartType > xFirstChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
+ if( xFirstChartType.is() )
+ {
+ sal_Int32 nAxisType = ChartTypeHelper::getAxisType( xFirstChartType, 0 ); // x-axis
+ bSupportsCategories = (nAxisType == AxisType::CATEGORY);
}
+ DiagramHelper::setCategoriesToDiagram( xCategories, xDiagram, true, bSupportsCategories );
}
OUString DialogModel::getCategoriesRange() const
@@ -780,66 +780,66 @@ void DialogModel::applyInterpretedData(
m_aTimerTriggeredControllerLock.startTimer();
Reference< XDiagram > xDiagram( m_xChartDocument->getFirstDiagram());
- if( xDiagram.is())
+ if( !xDiagram.is())
+ return;
+
+ // styles
+ if( m_xTemplate.is() )
{
- // styles
- if( m_xTemplate.is() )
- {
- sal_Int32 nGroup = 0;
- sal_Int32 nSeriesCounter = 0;
- sal_Int32 nNewSeriesIndex = static_cast< sal_Int32 >( rSeriesToReUse.size());
- const sal_Int32 nOuterSize=rNewData.Series.getLength();
+ sal_Int32 nGroup = 0;
+ sal_Int32 nSeriesCounter = 0;
+ sal_Int32 nNewSeriesIndex = static_cast< sal_Int32 >( rSeriesToReUse.size());
+ const sal_Int32 nOuterSize=rNewData.Series.getLength();
- for(; nGroup < nOuterSize; ++nGroup)
+ for(; nGroup < nOuterSize; ++nGroup)
+ {
+ Sequence< Reference< XDataSeries > > aSeries( rNewData.Series[ nGroup ] );
+ const sal_Int32 nSeriesInGroup = aSeries.getLength();
+ for( sal_Int32 nSeries=0; nSeries<nSeriesInGroup; ++nSeries, ++nSeriesCounter )
{
- Sequence< Reference< XDataSeries > > aSeries( rNewData.Series[ nGroup ] );
- const sal_Int32 nSeriesInGroup = aSeries.getLength();
- for( sal_Int32 nSeries=0; nSeries<nSeriesInGroup; ++nSeries, ++nSeriesCounter )
+ if( std::find( rSeriesToReUse.begin(), rSeriesToReUse.end(), aSeries[nSeries] )
+ == rSeriesToReUse.end())
{
- if( std::find( rSeriesToReUse.begin(), rSeriesToReUse.end(), aSeries[nSeries] )
- == rSeriesToReUse.end())
+ Reference< beans::XPropertySet > xSeriesProp( aSeries[nSeries], uno::UNO_QUERY );
+ if( xSeriesProp.is())
{
- Reference< beans::XPropertySet > xSeriesProp( aSeries[nSeries], uno::UNO_QUERY );
- if( xSeriesProp.is())
- {
- // @deprecated: correct default color should be found by view
- // without setting it as hard attribute
- Reference< XColorScheme > xColorScheme( xDiagram->getDefaultColorScheme());
- if( xColorScheme.is())
- xSeriesProp->setPropertyValue( "Color" ,
- uno::Any( xColorScheme->getColorByIndex( nSeriesCounter )));
- }
- m_xTemplate->applyStyle( aSeries[nSeries], nGroup, nNewSeriesIndex++, nSeriesInGroup );
+ // @deprecated: correct default color should be found by view
+ // without setting it as hard attribute
+ Reference< XColorScheme > xColorScheme( xDiagram->getDefaultColorScheme());
+ if( xColorScheme.is())
+ xSeriesProp->setPropertyValue( "Color" ,
+ uno::Any( xColorScheme->getColorByIndex( nSeriesCounter )));
}
+ m_xTemplate->applyStyle( aSeries[nSeries], nGroup, nNewSeriesIndex++, nSeriesInGroup );
}
}
}
+ }
- // data series
- std::vector< Reference< XDataSeriesContainer > > aSeriesCnt( getAllDataSeriesContainers());
- auto aNewSeries(
- comphelper::sequenceToContainer<std::vector< Sequence< Reference< XDataSeries > > >>( rNewData.Series ));
+ // data series
+ std::vector< Reference< XDataSeriesContainer > > aSeriesCnt( getAllDataSeriesContainers());
+ auto aNewSeries(
+ comphelper::sequenceToContainer<std::vector< Sequence< Reference< XDataSeries > > >>( rNewData.Series ));
- OSL_ASSERT( aSeriesCnt.size() == aNewSeries.size());
+ OSL_ASSERT( aSeriesCnt.size() == aNewSeries.size());
- std::vector< Sequence< Reference< XDataSeries > > >::const_iterator aSrcIt( aNewSeries.begin());
- std::vector< Reference< XDataSeriesContainer > >::iterator aDestIt( aSeriesCnt.begin());
- for(; aSrcIt != aNewSeries.end() && aDestIt != aSeriesCnt.end();
- ++aSrcIt, ++aDestIt )
+ std::vector< Sequence< Reference< XDataSeries > > >::const_iterator aSrcIt( aNewSeries.begin());
+ std::vector< Reference< XDataSeriesContainer > >::iterator aDestIt( aSeriesCnt.begin());
+ for(; aSrcIt != aNewSeries.end() && aDestIt != aSeriesCnt.end();
+ ++aSrcIt, ++aDestIt )
+ {
+ try
{
- try
- {
- OSL_ASSERT( (*aDestIt).is());
- (*aDestIt)->setDataSeries( *aSrcIt );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ OSL_ASSERT( (*aDestIt).is());
+ (*aDestIt)->setDataSeries( *aSrcIt );
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
}
-
- DialogModel::setCategories(rNewData.Categories);
}
+
+ DialogModel::setCategories(rNewData.Categories);
}
sal_Int32 DialogModel::countSeries() const