summaryrefslogtreecommitdiff
path: root/chart2/source/model/main
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/model/main
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/model/main')
-rw-r--r--chart2/source/model/main/ChartModel.cxx46
-rw-r--r--chart2/source/model/main/ChartModel_Persistence.cxx22
2 files changed, 34 insertions, 34 deletions
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& )
- {
- }
}
}