From 9df2821e61979dab32390d5c64dd49bee868adbb Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sat, 18 Apr 2020 14:08:51 +0200 Subject: loplugin:flatten in chart2 Change-Id: Iadc4da6515a7d82e7a92b33d74d589b61fa2c64f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92480 Tested-by: Jenkins Reviewed-by: Noel Grandin --- chart2/source/model/main/ChartModel.cxx | 46 +++++++++++----------- .../source/model/main/ChartModel_Persistence.cxx | 22 +++++------ 2 files changed, 34 insertions(+), 34 deletions(-) (limited to 'chart2/source/model/main') diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index a7159ced9972..96c49fb56655 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -260,35 +260,35 @@ void ChartModel::impl_notifyCloseListeners() void ChartModel::impl_adjustAdditionalShapesPositionAndSize( const awt::Size& aVisualAreaSize ) { uno::Reference< beans::XPropertySet > xProperties( static_cast< ::cppu::OWeakObject* >( this ), uno::UNO_QUERY ); - if ( xProperties.is() ) + if ( !xProperties.is() ) + return; + + uno::Reference< drawing::XShapes > xShapes; + xProperties->getPropertyValue( "AdditionalShapes" ) >>= xShapes; + if ( !xShapes.is() ) + return; + + sal_Int32 nCount = xShapes->getCount(); + for ( sal_Int32 i = 0; i < nCount; ++i ) { - uno::Reference< drawing::XShapes > xShapes; - xProperties->getPropertyValue( "AdditionalShapes" ) >>= xShapes; - if ( xShapes.is() ) + Reference< drawing::XShape > xShape; + if ( xShapes->getByIndex( i ) >>= xShape ) { - sal_Int32 nCount = xShapes->getCount(); - for ( sal_Int32 i = 0; i < nCount; ++i ) + if ( xShape.is() ) { - Reference< drawing::XShape > xShape; - if ( xShapes->getByIndex( i ) >>= xShape ) - { - if ( xShape.is() ) - { - awt::Point aPos( xShape->getPosition() ); - awt::Size aSize( xShape->getSize() ); + awt::Point aPos( xShape->getPosition() ); + awt::Size aSize( xShape->getSize() ); - double fWidth = static_cast< double >( aVisualAreaSize.Width ) / m_aVisualAreaSize.Width; - double fHeight = static_cast< double >( aVisualAreaSize.Height ) / m_aVisualAreaSize.Height; + double fWidth = static_cast< double >( aVisualAreaSize.Width ) / m_aVisualAreaSize.Width; + double fHeight = static_cast< double >( aVisualAreaSize.Height ) / m_aVisualAreaSize.Height; - aPos.X = static_cast< long >( aPos.X * fWidth ); - aPos.Y = static_cast< long >( aPos.Y * fHeight ); - aSize.Width = static_cast< long >( aSize.Width * fWidth ); - aSize.Height = static_cast< long >( aSize.Height * fHeight ); + aPos.X = static_cast< long >( aPos.X * fWidth ); + aPos.Y = static_cast< long >( aPos.Y * fHeight ); + aSize.Width = static_cast< long >( aSize.Width * fWidth ); + aSize.Height = static_cast< long >( aSize.Height * fHeight ); - xShape->setPosition( aPos ); - xShape->setSize( aSize ); - } - } + xShape->setPosition( aPos ); + xShape->setSize( aSize ); } } } diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx index 642aceb626ae..21b61c89cdbc 100644 --- a/chart2/source/model/main/ChartModel_Persistence.cxx +++ b/chart2/source/model/main/ChartModel_Persistence.cxx @@ -362,18 +362,18 @@ void ChartModel::impl_store( //notify parent data provider after saving thus the parent document can store //the ranges for which a load and update of the chart will be necessary Reference< beans::XPropertySet > xPropSet( m_xParent, uno::UNO_QUERY ); - if ( !hasInternalDataProvider() && xPropSet.is() ) + if ( !(!hasInternalDataProvider() && xPropSet.is()) ) + return; + + apphelper::MediaDescriptorHelper aMDHelper(rMediaDescriptor); + try + { + xPropSet->setPropertyValue( + "SavedObject", + uno::Any( aMDHelper.HierarchicalDocumentName ) ); + } + catch ( const uno::Exception& ) { - apphelper::MediaDescriptorHelper aMDHelper(rMediaDescriptor); - try - { - xPropSet->setPropertyValue( - "SavedObject", - uno::Any( aMDHelper.HierarchicalDocumentName ) ); - } - catch ( const uno::Exception& ) - { - } } } -- cgit v1.2.3