[Libreoffice-commits] core.git: svx/source

Julien Nabet serval2412 at yahoo.fr
Tue Apr 12 17:48:42 UTC 2016


 svx/source/customshapes/EnhancedCustomShape3d.cxx        |    3 
 svx/source/customshapes/EnhancedCustomShapeFontWork.cxx  |   46 +++++++--------
 svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx |    4 -
 3 files changed, 27 insertions(+), 26 deletions(-)

New commits:
commit 2aabf1023990c68f48d740fcdd9a48ce5ed7b23c
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Tue Apr 12 15:30:26 2016 +0200

    Use const_iterator when possible (svx/customshapes)
    
    Change-Id: Ieb7b3d2eb8cc2626b21508fed3c6c3f01076c792
    Reviewed-on: https://gerrit.libreoffice.org/24025
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index 11f5747..8f7d6b6 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -725,7 +725,8 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
 
             // removing placeholder objects
             std::vector< E3dCompoundObject* >::iterator aObjectListIter( aPlaceholderObjectList.begin() );
-            while ( aObjectListIter != aPlaceholderObjectList.end() )
+            std::vector< E3dCompoundObject* >::const_iterator aEnd( aPlaceholderObjectList.end() );
+            while ( aObjectListIter != aEnd )
             {
                 pScene->Remove3DObj( *aObjectListIter );
                 delete *aObjectListIter++;
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index 20c8179..d52a01d 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -174,7 +174,7 @@ void CalculateHorizontalScalingFactor( const SdrObject* pCustomShape,
         bSingleLineMode = true;
 
     std::vector< FWTextArea >::iterator aTextAreaIter = rFWData.vTextAreas.begin();
-    std::vector< FWTextArea >::iterator aTextAreaIEnd = rFWData.vTextAreas.end();
+    std::vector< FWTextArea >::const_iterator aTextAreaIEnd = rFWData.vTextAreas.end();
     while( aTextAreaIter != aTextAreaIEnd )
     {
         // calculating the width of the corresponding 2d text area
@@ -217,7 +217,7 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F
                                     ? rFWData.nSingleLineHeight / 2 : 0;
 
     std::vector< FWParagraphData >::iterator aParagraphIter( rTextArea.vParagraphs.begin() );
-    std::vector< FWParagraphData >::iterator aParagraphIEnd( rTextArea.vParagraphs.end() );
+    std::vector< FWParagraphData >::const_iterator aParagraphIEnd( rTextArea.vParagraphs.end() );
     while( aParagraphIter != aParagraphIEnd )
     {
         const OUString& rText = aParagraphIter->aString;
@@ -287,7 +287,7 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F
                     {
                         sal_Int32 nTextWidth = pVirDev->GetTextWidth( aCharText);
                         std::vector< tools::PolyPolygon >::iterator aOutlineIter = aCharacterData.vOutlines.begin();
-                        std::vector< tools::PolyPolygon >::iterator aOutlineIEnd = aCharacterData.vOutlines.end();
+                        std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd = aCharacterData.vOutlines.end();
                         if ( aOutlineIter == aOutlineIEnd )
                         {
                             nHeight += rFWData.nSingleLineHeight;
@@ -317,11 +317,11 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F
                     aParagraphIter->vCharacters.push_back( aCharacterData );
                 }
                 std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
-                std::vector< FWCharacterData >::iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
+                std::vector< FWCharacterData >::const_iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
                 while ( aCharacterIter != aCharacterIEnd )
                 {
                     std::vector< tools::PolyPolygon >::iterator aOutlineIter( aCharacterIter->vOutlines.begin() );
-                    std::vector< tools::PolyPolygon >::iterator aOutlineIEnd( aCharacterIter->vOutlines.end() );
+                    std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd( aCharacterIter->vOutlines.end() );
                     while ( aOutlineIter != aOutlineIEnd )
                     {
                         aOutlineIter->Move( ( aSingleCharacterUnion.GetWidth() - aCharacterIter->aBoundRect.GetWidth() ) / 2, 0 );
@@ -349,11 +349,11 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F
 
             // vertical alignment
             std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
-            std::vector< FWCharacterData >::iterator aCharacterIEnd ( aParagraphIter->vCharacters.end() );
+            std::vector< FWCharacterData >::const_iterator aCharacterIEnd ( aParagraphIter->vCharacters.end() );
             while ( aCharacterIter != aCharacterIEnd )
             {
                 std::vector< tools::PolyPolygon >::iterator aOutlineIter( aCharacterIter->vOutlines.begin() );
-                std::vector< tools::PolyPolygon >::iterator aOutlineIEnd( aCharacterIter->vOutlines.end() );
+                std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd( aCharacterIter->vOutlines.end() );
                 while( aOutlineIter != aOutlineIEnd )
                 {
 
@@ -385,11 +385,11 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F
             if ( bSameLetterHeights )
             {
                 std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
-                std::vector< FWCharacterData >::iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
+                std::vector< FWCharacterData >::const_iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
                 while ( aCharacterIter != aCharacterIEnd )
                 {
                     std::vector< tools::PolyPolygon >::iterator aOutlineIter( aCharacterIter->vOutlines.begin() );
-                    std::vector< tools::PolyPolygon >::iterator aOutlineIEnd( aCharacterIter->vOutlines.end() );
+                    std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd( aCharacterIter->vOutlines.end() );
                     while( aOutlineIter != aOutlineIEnd )
                     {
                         Rectangle aPolyPolyBoundRect( aOutlineIter->GetBoundRect() );
@@ -419,7 +419,7 @@ void GetFontWorkOutline( FWData& rFWData, const SdrObject* pCustomShape )
     SdrFitToSizeType  eFTS( static_cast<const SdrTextFitToSizeTypeItem&>(pCustomShape->GetMergedItem( SDRATTR_TEXT_FITTOSIZE )).GetValue() );
 
     std::vector< FWTextArea >::iterator aTextAreaIter = rFWData.vTextAreas.begin();
-    std::vector< FWTextArea >::iterator aTextAreaIEnd = rFWData.vTextAreas.end();
+    std::vector< FWTextArea >::const_iterator aTextAreaIEnd = rFWData.vTextAreas.end();
 
     rFWData.nSingleLineHeight = (sal_Int32)( ( (double)pCustomShape->GetLogicRect().GetHeight()
                                                 / rFWData.nMaxParagraphsPerTextArea ) * rFWData.fHorizontalTextScaling );
@@ -436,7 +436,7 @@ void GetFontWorkOutline( FWData& rFWData, const SdrObject* pCustomShape )
         if ( eFTS == SDRTEXTFIT_ALLLINES )
         {
             std::vector< FWParagraphData >::iterator aParagraphIter( aTextAreaIter->vParagraphs.begin() );
-            std::vector< FWParagraphData >::iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() );
+            std::vector< FWParagraphData >::const_iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() );
             while ( aParagraphIter != aParagraphIEnd )
             {
                 sal_Int32 nParaWidth = aParagraphIter->aBoundRect.GetWidth();
@@ -445,11 +445,11 @@ void GetFontWorkOutline( FWData& rFWData, const SdrObject* pCustomShape )
                     double fScale = (double)aTextAreaIter->aBoundRect.GetWidth() / nParaWidth;
 
                     std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
-                    std::vector< FWCharacterData >::iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
+                    std::vector< FWCharacterData >::const_iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
                     while ( aCharacterIter != aCharacterIEnd )
                     {
                         std::vector< tools::PolyPolygon >::iterator aOutlineIter = aCharacterIter->vOutlines.begin();
-                        std::vector< tools::PolyPolygon >::iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
+                        std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
                         while( aOutlineIter != aOutlineIEnd )
                         {
                             aOutlineIter->Scale( fScale, 1.0 );
@@ -469,7 +469,7 @@ void GetFontWorkOutline( FWData& rFWData, const SdrObject* pCustomShape )
                 case SDRTEXTHORZADJUST_CENTER:
                 {
                     std::vector< FWParagraphData >::iterator aParagraphIter( aTextAreaIter->vParagraphs.begin() );
-                    std::vector< FWParagraphData >::iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() );
+                    std::vector< FWParagraphData >::const_iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() );
                     while ( aParagraphIter != aParagraphIEnd )
                     {
                         sal_Int32 nHorzDiff = 0;
@@ -480,11 +480,11 @@ void GetFontWorkOutline( FWData& rFWData, const SdrObject* pCustomShape )
                         if ( nHorzDiff )
                         {
                             std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
-                            std::vector< FWCharacterData >::iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
+                            std::vector< FWCharacterData >::const_iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
                             while ( aCharacterIter != aCharacterIEnd )
                             {
                                 std::vector< tools::PolyPolygon >::iterator aOutlineIter = aCharacterIter->vOutlines.begin();
-                                std::vector< tools::PolyPolygon >::iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
+                                std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
                                 while( aOutlineIter != aOutlineIEnd )
                                 {
                                     aOutlineIter->Move( nHorzDiff, 0 );
@@ -543,7 +543,7 @@ void CalcDistances( const tools::Polygon& rPoly, std::vector< double >& rDistanc
         if ( fLength > 0.0 )
         {
             std::vector< double >::iterator aIter = rDistances.begin();
-            std::vector< double >::iterator aEnd = rDistances.end();
+            std::vector< double >::const_iterator aEnd = rDistances.end();
             while ( aIter != aEnd )
                 *aIter++ /= fLength;
         }
@@ -659,15 +659,15 @@ void FitTextOutlinesToShapeOutlines( const tools::PolyPolygon& aOutlines2d, FWDa
                 if ( !vDistances.empty() )
                 {
                     std::vector< FWParagraphData >::iterator aParagraphIter( aTextAreaIter->vParagraphs.begin() );
-                    std::vector< FWParagraphData >::iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() );
+                    std::vector< FWParagraphData >::const_iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() );
                     while( aParagraphIter != aParagraphIEnd )
                     {
                         std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
-                        std::vector< FWCharacterData >::iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
+                        std::vector< FWCharacterData >::const_iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
                         while ( aCharacterIter != aCharacterIEnd )
                         {
                             std::vector< tools::PolyPolygon >::iterator aOutlineIter = aCharacterIter->vOutlines.begin();
-                            std::vector< tools::PolyPolygon >::iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
+                            std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
                             while( aOutlineIter != aOutlineIEnd )
                             {
                                 tools::PolyPolygon& rPolyPoly = *aOutlineIter;
@@ -722,15 +722,15 @@ void FitTextOutlinesToShapeOutlines( const tools::PolyPolygon& aOutlines2d, FWDa
                 CalcDistances( rOutlinePoly, vDistances );
                 CalcDistances( rOutlinePoly2, vDistances2 );
                 std::vector< FWParagraphData >::iterator aParagraphIter = aTextAreaIter->vParagraphs.begin();
-                std::vector< FWParagraphData >::iterator aParagraphIEnd = aTextAreaIter->vParagraphs.end();
+                std::vector< FWParagraphData >::const_iterator aParagraphIEnd = aTextAreaIter->vParagraphs.end();
                 while( aParagraphIter != aParagraphIEnd )
                 {
                     std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
-                    std::vector< FWCharacterData >::iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
+                    std::vector< FWCharacterData >::const_iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
                     while ( aCharacterIter != aCharacterIEnd )
                     {
                         std::vector< tools::PolyPolygon >::iterator aOutlineIter = aCharacterIter->vOutlines.begin();
-                        std::vector< tools::PolyPolygon >::iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
+                        std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
                         while( aOutlineIter != aOutlineIEnd )
                         {
                             tools::PolyPolygon& rPolyPoly = *aOutlineIter;
diff --git a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
index 161986f..4ff01ba 100644
--- a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
@@ -293,7 +293,7 @@ MSO_SPT EnhancedCustomShapeTypeNames::Get( const OUString& rShapeType )
     for ( i = 0; i < nLen; i++ )
         pBuf[ i ] = (char)rShapeType[ i ];
     pBuf[ i ] = 0;
-    TypeNameHashMap::iterator aHashIter( pHashMap->find( pBuf.get() ) );
+    TypeNameHashMap::const_iterator aHashIter( pHashMap->find( pBuf.get() ) );
     if ( aHashIter != pHashMap->end() )
         eRetValue = (*aHashIter).second;
     return eRetValue;
@@ -548,7 +548,7 @@ OUString EnhancedCustomShapeTypeNames::GetAccName( const OUString& rShapeType )
     for ( i = 0; i < nLen; i++ )
         pBuf[ i ] = (char)rShapeType[ i ];
     pBuf[ i ] = 0;
-    TypeACCNameHashMap::iterator aHashIter( pACCHashMap->find( pBuf.get() ) );
+    TypeACCNameHashMap::const_iterator aHashIter( pACCHashMap->find( pBuf.get() ) );
     if ( aHashIter != pACCHashMap->end() )
         sRetValue = OUString::createFromAscii( (*aHashIter).second );
     return sRetValue;


More information about the Libreoffice-commits mailing list