diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-07-07 16:20:12 +0300 |
---|---|---|
committer | Arkadiy Illarionov <qarkai@gmail.com> | 2019-07-09 17:48:06 +0200 |
commit | 44a6335f49a64ac77207d3aa46c267503c65c5ff (patch) | |
tree | 8ed220967528dc6caa72fa9e753c0955f3de2433 /svx/source/customshapes/EnhancedCustomShape2d.cxx | |
parent | 4a96a5d862ed46bbcb64d34b32720b5b1b3d7ca8 (diff) |
Simplify Sequence iterations in svx
Use range-based loops, STL and comphelper functions
Change-Id: If6d190cf72b8653c1c3fbe9a6a6e47f10f1a6765
Reviewed-on: https://gerrit.libreoffice.org/75255
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'svx/source/customshapes/EnhancedCustomShape2d.cxx')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape2d.cxx | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index b2effd4649f5..7f16a469d91b 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -444,14 +444,11 @@ bool EnhancedCustomShape2d::ConvertSequenceToEnhancedCustomShape2dHandle( EnhancedCustomShape2d::Handle& rDestinationHandle ) { bool bRetValue = false; - sal_uInt32 i, nProperties = rHandleProperties.getLength(); - if ( nProperties ) + if ( rHandleProperties.hasElements() ) { rDestinationHandle.nFlags = HandleFlags::NONE; - for ( i = 0; i < nProperties; i++ ) + for ( const css::beans::PropertyValue& rPropVal : rHandleProperties ) { - const css::beans::PropertyValue& rPropVal = rHandleProperties[ i ]; - if ( rPropVal.Name == "Position" ) { if ( rPropVal.Value >>= rDestinationHandle.aPosition ) @@ -806,13 +803,13 @@ EnhancedCustomShape2d::EnhancedCustomShape2d(SdrObjCustomShape& rSdrObjCustomSha break; } - sal_Int32 i, nLength = seqEquations.getLength(); + sal_Int32 nLength = seqEquations.getLength(); if ( nLength ) { vNodesSharedPtr.resize( nLength ); vEquationResults.resize( nLength ); - for ( i = 0; i < seqEquations.getLength(); i++ ) + for ( sal_Int32 i = 0; i < nLength; i++ ) { vEquationResults[ i ].bReady = false; try @@ -2039,15 +2036,12 @@ void EnhancedCustomShape2d::CreateSubPath( SetPathSize( nIndex ); - sal_Int32 nCoordSize = seqCoordinates.getLength(); sal_Int32 nSegInfoSize = seqSegments.getLength(); if ( !nSegInfoSize ) { - const EnhancedCustomShapeParameterPair* pTmp = seqCoordinates.getArray(); - - for ( sal_Int32 nPtNum(0); nPtNum < nCoordSize; nPtNum++ ) + for ( const EnhancedCustomShapeParameterPair& rCoordinate : seqCoordinates ) { - const Point aTempPoint(GetPoint( *pTmp++, true, true )); + const Point aTempPoint(GetPoint( rCoordinate, true, true )); aNewB2DPolygon.append(basegfx::B2DPoint(aTempPoint.X(), aTempPoint.Y())); } @@ -2055,6 +2049,7 @@ void EnhancedCustomShape2d::CreateSubPath( } else { + sal_Int32 nCoordSize = seqCoordinates.getLength(); for ( ;rSegmentInd < nSegInfoSize; ) { sal_Int16 nCommand = seqSegments[ rSegmentInd ].Command; @@ -2998,14 +2993,13 @@ SdrObject* EnhancedCustomShape2d::CreateObject( bool bLineGeometryNeededOnly ) void EnhancedCustomShape2d::ApplyGluePoints( SdrObject* pObj ) { - if ( pObj && seqGluePoints.hasElements() ) + if ( pObj ) { - sal_uInt32 i, nCount = seqGluePoints.getLength(); - for ( i = 0; i < nCount; i++ ) + for ( const auto& rGluePoint : seqGluePoints ) { SdrGluePoint aGluePoint; - aGluePoint.SetPos( GetPoint( seqGluePoints[ i ], true, true ) ); + aGluePoint.SetPos( GetPoint( rGluePoint, true, true ) ); aGluePoint.SetPercent( false ); aGluePoint.SetAlign( SdrAlign::VERT_TOP | SdrAlign::HORZ_LEFT ); aGluePoint.SetEscDir( SdrEscapeDirection::SMART ); |