diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-18 14:08:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-19 11:01:18 +0200 |
commit | 9df2821e61979dab32390d5c64dd49bee868adbb (patch) | |
tree | 5b827e29e73ac2300c164b0a389a784a358956e6 /chart2/source/tools/DiagramHelper.cxx | |
parent | 8b0a69498b025e13d9772689e9e4fa3d6b05e609 (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/tools/DiagramHelper.cxx')
-rw-r--r-- | chart2/source/tools/DiagramHelper.cxx | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index 0ea291db6c47..5f5abd19c191 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -531,27 +531,27 @@ void DiagramHelper::replaceCoordinateSystem( // update the coordinate-system container Reference< XCoordinateSystemContainer > xCont( xDiagram, uno::UNO_QUERY ); - if( xCont.is()) + if( !xCont.is()) + return; + + try { - try - { - Reference< chart2::data::XLabeledDataSequence > xCategories = DiagramHelper::getCategoriesFromDiagram( xDiagram ); + Reference< chart2::data::XLabeledDataSequence > xCategories = DiagramHelper::getCategoriesFromDiagram( xDiagram ); - // move chart types of xCooSysToReplace to xReplacement - Reference< XChartTypeContainer > xCTCntCooSys( xCooSysToReplace, uno::UNO_QUERY_THROW ); - Reference< XChartTypeContainer > xCTCntReplacement( xReplacement, uno::UNO_QUERY_THROW ); - xCTCntReplacement->setChartTypes( xCTCntCooSys->getChartTypes()); + // move chart types of xCooSysToReplace to xReplacement + Reference< XChartTypeContainer > xCTCntCooSys( xCooSysToReplace, uno::UNO_QUERY_THROW ); + Reference< XChartTypeContainer > xCTCntReplacement( xReplacement, uno::UNO_QUERY_THROW ); + xCTCntReplacement->setChartTypes( xCTCntCooSys->getChartTypes()); - xCont->removeCoordinateSystem( xCooSysToReplace ); - xCont->addCoordinateSystem( xReplacement ); + xCont->removeCoordinateSystem( xCooSysToReplace ); + xCont->addCoordinateSystem( xReplacement ); - if( xCategories.is() ) - DiagramHelper::setCategoriesToDiagram( xCategories, xDiagram ); - } - catch( const uno::Exception & ) - { - DBG_UNHANDLED_EXCEPTION("chart2"); - } + if( xCategories.is() ) + DiagramHelper::setCategoriesToDiagram( xCategories, xDiagram ); + } + catch( const uno::Exception & ) + { + DBG_UNHANDLED_EXCEPTION("chart2"); } } @@ -923,25 +923,25 @@ static void lcl_generateAutomaticCategoriesFromChartType( return; OUString aMainSeq( xChartType->getRoleOfSequenceForSeriesLabel() ); Reference< XDataSeriesContainer > xSeriesCnt( xChartType, uno::UNO_QUERY ); - if( xSeriesCnt.is() ) + if( !xSeriesCnt.is() ) + return; + + Sequence< Reference< XDataSeries > > aSeriesSeq( xSeriesCnt->getDataSeries() ); + for( sal_Int32 nS = 0; nS < aSeriesSeq.getLength(); nS++ ) { - Sequence< Reference< XDataSeries > > aSeriesSeq( xSeriesCnt->getDataSeries() ); - for( sal_Int32 nS = 0; nS < aSeriesSeq.getLength(); nS++ ) - { - Reference< data::XDataSource > xDataSource( aSeriesSeq[nS], uno::UNO_QUERY ); - if( !xDataSource.is() ) - continue; - Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( - ::chart::DataSeriesHelper::getDataSequenceByRole( xDataSource, aMainSeq )); - if( !xLabeledSeq.is() ) - continue; - Reference< chart2::data::XDataSequence > xValueSeq( xLabeledSeq->getValues() ); - if( !xValueSeq.is() ) - continue; - rRet = xValueSeq->generateLabel( chart2::data::LabelOrigin_LONG_SIDE ); - if( rRet.hasElements() ) - return; - } + Reference< data::XDataSource > xDataSource( aSeriesSeq[nS], uno::UNO_QUERY ); + if( !xDataSource.is() ) + continue; + Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( + ::chart::DataSeriesHelper::getDataSequenceByRole( xDataSource, aMainSeq )); + if( !xLabeledSeq.is() ) + continue; + Reference< chart2::data::XDataSequence > xValueSeq( xLabeledSeq->getValues() ); + if( !xValueSeq.is() ) + continue; + rRet = xValueSeq->generateLabel( chart2::data::LabelOrigin_LONG_SIDE ); + if( rRet.hasElements() ) + return; } } |