diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-28 15:13:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-29 07:17:37 +0100 |
commit | 21de55596c0fdc2be736c6d0369bd9d3783020be (patch) | |
tree | 07d0f0cd54690e54405fe574c572cb2be74a3336 /xmloff/source/draw/shapeimport.cxx | |
parent | da9fb5d6d9ebf9363981c370ce937d8848989fcb (diff) |
remove unnecessary "if (!empty()" checks before loops
found with
git grep -n -A4 'if.*!.*empty' | grep -B3 -P
'(\bfor)|(\bwhile)|(\bdo)'
Change-Id: I582235b7cf977a0f9fb4099eb306fdb4a07b5334
Reviewed-on: https://gerrit.libreoffice.org/64169
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source/draw/shapeimport.cxx')
-rw-r--r-- | xmloff/source/draw/shapeimport.cxx | 67 |
1 files changed, 32 insertions, 35 deletions
diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx index c55cd25411a9..14b5e5acc2a6 100644 --- a/xmloff/source/draw/shapeimport.cxx +++ b/xmloff/source/draw/shapeimport.cxx @@ -911,47 +911,44 @@ void XMLShapeImportHelper::addShapeConnection( css::uno::Reference< css::drawing void XMLShapeImportHelper::restoreConnections() { - if( !mpImpl->maConnections.empty() ) + const vector<ConnectionHint>::size_type nCount = mpImpl->maConnections.size(); + for( vector<ConnectionHint>::size_type i = 0; i < nCount; i++ ) { - const vector<ConnectionHint>::size_type nCount = mpImpl->maConnections.size(); - for( vector<ConnectionHint>::size_type i = 0; i < nCount; i++ ) + ConnectionHint& rHint = mpImpl->maConnections[i]; + uno::Reference< beans::XPropertySet > xConnector( rHint.mxConnector, uno::UNO_QUERY ); + if( xConnector.is() ) { - ConnectionHint& rHint = mpImpl->maConnections[i]; - uno::Reference< beans::XPropertySet > xConnector( rHint.mxConnector, uno::UNO_QUERY ); - if( xConnector.is() ) + // #86637# remember line deltas + uno::Any aLine1Delta; + uno::Any aLine2Delta; + uno::Any aLine3Delta; + OUString aStr1("EdgeLine1Delta"); + OUString aStr2("EdgeLine2Delta"); + OUString aStr3("EdgeLine3Delta"); + aLine1Delta = xConnector->getPropertyValue(aStr1); + aLine2Delta = xConnector->getPropertyValue(aStr2); + aLine3Delta = xConnector->getPropertyValue(aStr3); + + // #86637# simply setting these values WILL force the connector to do + // an new layout promptly. So the line delta values have to be rescued + // and restored around connector changes. + uno::Reference< drawing::XShape > xShape( + mrImporter.getInterfaceToIdentifierMapper().getReference( rHint.aDestShapeId ), uno::UNO_QUERY ); + if( xShape.is() ) { - // #86637# remember line deltas - uno::Any aLine1Delta; - uno::Any aLine2Delta; - uno::Any aLine3Delta; - OUString aStr1("EdgeLine1Delta"); - OUString aStr2("EdgeLine2Delta"); - OUString aStr3("EdgeLine3Delta"); - aLine1Delta = xConnector->getPropertyValue(aStr1); - aLine2Delta = xConnector->getPropertyValue(aStr2); - aLine3Delta = xConnector->getPropertyValue(aStr3); - - // #86637# simply setting these values WILL force the connector to do - // an new layout promptly. So the line delta values have to be rescued - // and restored around connector changes. - uno::Reference< drawing::XShape > xShape( - mrImporter.getInterfaceToIdentifierMapper().getReference( rHint.aDestShapeId ), uno::UNO_QUERY ); - if( xShape.is() ) - { - xConnector->setPropertyValue( rHint.bStart ? gsStartShape : gsEndShape, uno::Any(xShape) ); - - sal_Int32 nGlueId = rHint.nDestGlueId < 4 ? rHint.nDestGlueId : getGluePointId( xShape, rHint.nDestGlueId ); - xConnector->setPropertyValue( rHint.bStart ? gsStartGluePointIndex : gsEndGluePointIndex, uno::Any(nGlueId) ); - } - - // #86637# restore line deltas - xConnector->setPropertyValue(aStr1, aLine1Delta ); - xConnector->setPropertyValue(aStr2, aLine2Delta ); - xConnector->setPropertyValue(aStr3, aLine3Delta ); + xConnector->setPropertyValue( rHint.bStart ? gsStartShape : gsEndShape, uno::Any(xShape) ); + + sal_Int32 nGlueId = rHint.nDestGlueId < 4 ? rHint.nDestGlueId : getGluePointId( xShape, rHint.nDestGlueId ); + xConnector->setPropertyValue( rHint.bStart ? gsStartGluePointIndex : gsEndGluePointIndex, uno::Any(nGlueId) ); } + + // #86637# restore line deltas + xConnector->setPropertyValue(aStr1, aLine1Delta ); + xConnector->setPropertyValue(aStr2, aLine2Delta ); + xConnector->setPropertyValue(aStr3, aLine3Delta ); } - mpImpl->maConnections.clear(); } + mpImpl->maConnections.clear(); } SvXMLImportPropertyMapper* XMLShapeImportHelper::CreateShapePropMapper( const uno::Reference< frame::XModel>& rModel, SvXMLImport& rImport ) |