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

Stephan Bergmann sbergman at redhat.com
Wed Mar 8 10:04:02 UTC 2017


 svx/source/customshapes/EnhancedCustomShape2d.cxx |   15 ++++++---------
 svx/source/dialog/dlgctl3d.cxx                    |    7 ++++---
 svx/source/fmcomp/fmgridcl.cxx                    |    2 +-
 svx/source/fmcomp/fmgridif.cxx                    |    9 ++++-----
 svx/source/fmcomp/gridctrl.cxx                    |    2 +-
 svx/source/form/fmobj.cxx                         |    3 ++-
 svx/source/items/numinf.cxx                       |    2 +-
 svx/source/sidebar/line/LinePropertyPanelBase.cxx |    6 +++---
 svx/source/svdraw/svddrgmt.cxx                    |   19 +++++++------------
 svx/source/svdraw/svdotextpathdecomposition.cxx   |    4 ++--
 svx/source/tbxctrls/fontworkgallery.cxx           |    7 +++----
 svx/source/tbxctrls/tbcontrl.cxx                  |   21 ++++++++-------------
 svx/source/toolbars/fontworkbar.cxx               |    3 +--
 13 files changed, 43 insertions(+), 57 deletions(-)

New commits:
commit df016bf7f46122b79d9c8df6fbb1a95faa44c465
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 8 11:03:22 2017 +0100

    loplugin:loopvartoosmall
    
    Change-Id: Iedec0d8b1f031f8c311acba80609b59df5f9f4cf

diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index b8accf9..c45e41a 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -2065,10 +2065,9 @@ void CorrectCalloutArrows( MSO_SPT eSpType, sal_uInt32 nLineObjectCount, std::ve
         case mso_sptAccentCallout90 :
         case mso_sptAccentBorderCallout90 :
         {
-            sal_uInt32 i, nLine = 0;
-            for ( i = 0; i < vObjectList.size(); i++ )
+            sal_uInt32 nLine = 0;
+            for ( SdrPathObj* pObj: vObjectList )
             {
-                SdrPathObj* pObj( vObjectList[ i ] );
                 if(pObj->IsLine())
                 {
                     nLine++;
@@ -2090,10 +2089,9 @@ void CorrectCalloutArrows( MSO_SPT eSpType, sal_uInt32 nLineObjectCount, std::ve
         case mso_sptCallout2 :
         case mso_sptBorderCallout2 :
         {
-            sal_uInt32 i, nLine = 0;
-            for ( i = 0; i < vObjectList.size(); i++ )
+            sal_uInt32 nLine = 0;
+            for ( SdrPathObj* pObj: vObjectList )
             {
-                SdrPathObj* pObj( vObjectList[ i ] );
                 if(pObj->IsLine())
                 {
                     nLine++;
@@ -2116,10 +2114,9 @@ void CorrectCalloutArrows( MSO_SPT eSpType, sal_uInt32 nLineObjectCount, std::ve
         case mso_sptCallout3 :
         case mso_sptBorderCallout3 :
         {
-            sal_uInt32 i, nLine = 0;
-            for ( i = 0; i < vObjectList.size(); i++ )
+            sal_uInt32 nLine = 0;
+            for ( SdrPathObj* pObj: vObjectList )
             {
-                SdrPathObj* pObj( vObjectList[ i ] );
                 if(pObj->IsLine())
                 {
                     if ( nLine )
diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx
index 84b5a50..cd103ce 100644
--- a/svx/source/dialog/dlgctl3d.cxx
+++ b/svx/source/dialog/dlgctl3d.cxx
@@ -473,11 +473,12 @@ void Svx3DLightControl::TrySelection(Point aPosPixel)
             // the hits. It's invisible, but for HitTest, it's included
             const E3dCompoundObject* pResult = nullptr;
 
-            for(sal_uInt32 b(0); !pResult && b < aResult.size(); b++)
+            for(auto const & b: aResult)
             {
-                if(aResult[b] && aResult[b] != mpExpansionObject)
+                if(b && b != mpExpansionObject)
                 {
-                    pResult = aResult[b];
+                    pResult = b;
+                    break;
                 }
             }
 
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index df87cc0..141938b 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -918,7 +918,7 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe
             {   // it was a "show column/<colname>" command (there are at most 16 such items)
                 // search the nExecutionResult'th hidden col
                 Reference< css::beans::XPropertySet >  xCurCol;
-                for (sal_uInt16 i=0; i<xCols->getCount() && nExecutionResult; ++i)
+                for (sal_Int32 i=0; i<xCols->getCount() && nExecutionResult; ++i)
                 {
                     xCurCol.set(xCols->getByIndex(i), css::uno::UNO_QUERY);
                     Any aHidden = xCurCol->getPropertyValue(FM_PROP_HIDDEN);
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index b1980f9..0a679c3 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -1150,7 +1150,7 @@ using namespace ::com::sun::star::util;
     {
         const Sequence< URL>& aSupportedURLs = getSupportedURLs();
         const URL* pSupportedURLs = aSupportedURLs.getConstArray();
-        for ( sal_uInt16 i=0; i < ( aSupportedURLs.getLength() ) && !bKnownSender; ++i, ++pSupportedURLs )
+        for ( sal_Int32 i=0; i < ( aSupportedURLs.getLength() ) && !bKnownSender; ++i, ++pSupportedURLs )
         {
             if ( m_pDispatchers[i] == e.Source )
             {
@@ -2571,7 +2571,7 @@ void FmXGridPeer::statusChanged(const css::frame::FeatureStateEvent& Event)
 
     const std::vector<DbGridControlNavigationBarState>& aSlots = getSupportedGridSlots();
 
-    sal_uInt16 i;
+    sal_Int32 i;
     for (i=0; i<aUrls.getLength(); ++i, ++pUrls)
     {
         if (pUrls->Main == Event.FeatureURL.Main)
@@ -2681,16 +2681,15 @@ Sequence< css::util::URL>& FmXGridPeer::getSupportedURLs()
         };
         aSupported.realloc(SAL_N_ELEMENTS(sSupported));
         css::util::URL* pSupported = aSupported.getArray();
-        sal_uInt16 i;
 
-        for ( i = 0; i < aSupported.getLength(); ++i, ++pSupported)
+        for ( sal_Int32 i = 0; i < aSupported.getLength(); ++i, ++pSupported)
             pSupported->Complete = OUString::createFromAscii(sSupported[i]);
 
         // let an css::util::URL-transformer normalize the URLs
         Reference< css::util::XURLTransformer >  xTransformer(
             util::URLTransformer::create(::comphelper::getProcessComponentContext()) );
         pSupported = aSupported.getArray();
-        for (i=0; i<aSupported.getLength(); ++i)
+        for (sal_Int32 i=0; i<aSupported.getLength(); ++i)
             xTransformer->parseStrict(pSupported[i]);
     }
 
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 4f03d36..14a35ef 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -1732,7 +1732,7 @@ void DbGridControl::ColumnMoved(sal_uInt16 nId)
     sal_uInt16 nNewViewPos = GetViewColumnPos(nId);
 
     // from that we can compute the new model pos
-    sal_uInt16 nNewModelPos;
+    DbGridColumns::size_type nNewModelPos;
     for (nNewModelPos = 0; nNewModelPos < m_aColumns.size(); ++nNewModelPos)
     {
         if (!m_aColumns[ nNewModelPos ]->IsHidden())
diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx
index 8f4090d..acb25f5 100644
--- a/svx/source/form/fmobj.cxx
+++ b/svx/source/form/fmobj.cxx
@@ -483,7 +483,8 @@ Reference< XInterface >  FmFormObj::ensureModelEnv(const Reference< XInterface >
 
         // calc the number of (source) form siblings with the same DSS
         Reference< XPropertySet >  xCurrentSourceForm, xCurrentDestForm;
-        sal_Int16 nCurrentSourceIndex = 0, nCurrentDestIndex = 0;
+        sal_Int16 nCurrentSourceIndex = 0;
+        sal_Int32 nCurrentDestIndex = 0;
         while (nCurrentSourceIndex <= nIndex)
         {
             bool bEqualDSS = false;
diff --git a/svx/source/items/numinf.cxx b/svx/source/items/numinf.cxx
index 37c4963..faefb80 100644
--- a/svx/source/items/numinf.cxx
+++ b/svx/source/items/numinf.cxx
@@ -133,7 +133,7 @@ bool SvxNumberInfoItem::operator==( const SfxPoolItem& rItem ) const
             {
                 bEqual = true;
 
-                for ( sal_uInt16 i = 0; i < nDelCount && bEqual; ++i )
+                for ( sal_uInt32 i = 0; i < nDelCount && bEqual; ++i )
                     bEqual = ( pDelFormatArr[i] == rOther.pDelFormatArr[i] );
             }
         }
diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
index 89e105b..daf2816 100644
--- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
@@ -807,7 +807,7 @@ void LinePropertyPanelBase::SelectLineStyle()
             if(mpDashItem && mxLineStyleList.is())
             {
                 const XDash& rDash = mpDashItem->GetDashValue();
-                for(sal_Int32 a(0);!bSelected &&  a < mxLineStyleList->Count(); a++)
+                for(long a(0);!bSelected &&  a < mxLineStyleList->Count(); a++)
                 {
                     const XDashEntry* pEntry = mxLineStyleList->GetDash(a);
                     const XDash& rEntry = pEntry->GetDash();
@@ -843,7 +843,7 @@ void LinePropertyPanelBase::SelectEndStyle(bool bStart)
         if (mpStartItem && mxLineEndList.is())
         {
             const basegfx::B2DPolyPolygon& rItemPolygon = mpStartItem->GetLineStartValue();
-            for(sal_Int32 a(0);!bSelected &&  a < mxLineEndList->Count(); a++)
+            for(long a(0);!bSelected &&  a < mxLineEndList->Count(); a++)
             {
                 const XLineEndEntry* pEntry = mxLineEndList->GetLineEnd(a);
                 const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
@@ -872,7 +872,7 @@ void LinePropertyPanelBase::SelectEndStyle(bool bStart)
         if (mpEndItem && mxLineEndList.is())
         {
             const basegfx::B2DPolyPolygon& rItemPolygon = mpEndItem->GetLineEndValue();
-            for(sal_Int32 a(0);!bSelected &&  a < mxLineEndList->Count(); a++)
+            for(long a(0);!bSelected &&  a < mxLineEndList->Count(); a++)
             {
                 const XLineEndEntry* pEntry = mxLineEndList->GetLineEnd(a);
                 const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 50d4da0..15968a4 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -245,11 +245,10 @@ drawinglayer::primitive2d::Primitive2DContainer SdrDragEntryPointGlueDrag::creat
     if(!maPositions.empty())
     {
         basegfx::B2DPolygon aPolygon;
-        sal_uInt32 a(0);
 
-        for(a = 0; a < maPositions.size(); a++)
+        for(auto const & a: maPositions)
         {
-            aPolygon.append(maPositions[a]);
+            aPolygon.append(a);
         }
 
         basegfx::B2DPolyPolygon aPolyPolygon(aPolygon);
@@ -261,7 +260,7 @@ drawinglayer::primitive2d::Primitive2DContainer SdrDragEntryPointGlueDrag::creat
 
         aTransformedPositions.reserve(aTransformed.count());
 
-        for(a = 0; a < aTransformed.count(); a++)
+        for(sal_uInt32 a = 0; a < aTransformed.count(); a++)
         {
             aTransformedPositions.push_back(aTransformed.getB2DPoint(a));
         }
@@ -689,13 +688,12 @@ void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay
         // and evtl. remember if it was an edge
         SdrObjectAndCloneMap aOriginalAndClones;
         std::vector< SdrEdgeObj* > aEdges;
-        sal_uInt32 a;
 
         // #i54102# execute prepareCurrentState for all SdrDragEntrySdrObject, register pair of original and
         // clone, remember edges
-        for(a = 0; a < maSdrDragEntries.size(); a++)
+        for(auto const & a: maSdrDragEntries)
         {
-            SdrDragEntrySdrObject* pSdrDragEntrySdrObject = dynamic_cast< SdrDragEntrySdrObject*>(maSdrDragEntries[a]);
+            SdrDragEntrySdrObject* pSdrDragEntrySdrObject = dynamic_cast< SdrDragEntrySdrObject*>(a);
 
             if(pSdrDragEntrySdrObject)
             {
@@ -718,9 +716,8 @@ void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay
         // #i54102# if there are edges, reconnect their ends to the corresponding clones (if found)
         if(aEdges.size())
         {
-            for(a = 0; a < aEdges.size(); a++)
+            for(SdrEdgeObj* pSdrEdgeObj: aEdges)
             {
-                SdrEdgeObj* pSdrEdgeObj = aEdges[a];
                 SdrObject* pConnectedTo = pSdrEdgeObj->GetConnectedNode(true);
 
                 if(pConnectedTo)
@@ -751,10 +748,8 @@ void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay
         drawinglayer::primitive2d::Primitive2DContainer aResult;
         drawinglayer::primitive2d::Primitive2DContainer aResultTransparent;
 
-        for(a = 0; a < maSdrDragEntries.size(); a++)
+        for(SdrDragEntry* pCandidate: maSdrDragEntries)
         {
-            SdrDragEntry* pCandidate = maSdrDragEntries[a];
-
             if(pCandidate)
             {
                 const drawinglayer::primitive2d::Primitive2DContainer aCandidateResult(pCandidate->createPrimitive2DSequenceInCurrentState(*this));
diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx
index 3e6e5f3..9ee2fdf 100644
--- a/svx/source/svdraw/svdotextpathdecomposition.cxx
+++ b/svx/source/svdraw/svdotextpathdecomposition.cxx
@@ -332,9 +332,9 @@ namespace
             }
 
             // handle text portions for this paragraph
-            for(sal_uInt32 a(0L); a < rTextPortions.size() && fPolyStart < fPolyEnd; a++)
+            for(auto a = rTextPortions.begin(); a != rTextPortions.end() && fPolyStart < fPolyEnd; ++a)
             {
-                const impPathTextPortion* pCandidate = rTextPortions[a];
+                const impPathTextPortion* pCandidate = *a;
                 basegfx::B2DVector aFontScaling;
 
                 if(pCandidate && pCandidate->getTextLength())
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
index e9b19cd..b343879 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -106,7 +106,7 @@ void FontWorkGalleryDialog::dispose()
 void FontWorkGalleryDialog::initFavorites(sal_uInt16 nThemeId)
 {
     // Ueber die Gallery werden die Favoriten eingelesen
-    sal_uIntPtr nFavCount = GalleryExplorer::GetSdrObjCount( nThemeId );
+    sal_uInt32 nFavCount = GalleryExplorer::GetSdrObjCount( nThemeId );
 
     // Gallery thema locken
     GalleryExplorer::BeginLocking(nThemeId);
@@ -167,12 +167,11 @@ void FontWorkGalleryDialog::fillFavorites(sal_uInt16 nThemeId)
 
     mpCtlFavorites->Clear();
 
-    sal_uInt32 nFavorite;
-    for( nFavorite = 1; nFavorite <= nFavCount; nFavorite++ )
+    for( std::vector<Bitmap *>::size_type nFavorite = 1; nFavorite <= nFavCount; nFavorite++ )
     {
         OUString aStr(SVX_RESSTR(RID_SVXFLOAT3D_FAVORITE));
         aStr += " ";
-        aStr += OUString::number((sal_Int32)nFavorite);
+        aStr += OUString::number(nFavorite);
         Image aThumbImage( maFavoritesHorizontal[nFavorite-1] );
         mpCtlFavorites->InsertItem( (sal_uInt16)nFavorite, aThumbImage, aStr );
     }
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index a0f5c5e..28f1799 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2445,9 +2445,6 @@ void SvxStyleToolBoxControl::FillStyleBox()
             pBox->Clear();
 
             {
-                sal_uInt16  _i;
-                sal_uInt32  nCnt = pImpl->aDefaultStyles.size();
-
                 pStyle = pStyleSheetPool->First();
 
                 if( pImpl->bSpecModeWriter || pImpl->bSpecModeCalc )
@@ -2457,9 +2454,9 @@ void SvxStyleToolBoxControl::FillStyleBox()
                         // sort out default styles
                         bool bInsert = true;
                         OUString aName( pStyle->GetName() );
-                        for( _i = 0 ; _i < nCnt ; ++_i )
+                        for( auto const & _i: pImpl->aDefaultStyles )
                         {
-                            if( pImpl->aDefaultStyles[_i] == aName )
+                            if( _i == aName )
                             {
                                 bInsert = false;
                                 break;
@@ -2489,12 +2486,10 @@ void SvxStyleToolBoxControl::FillStyleBox()
                 pBox->SetStyle( nWinBits );
 
                 // insert default styles
-                sal_uInt16  _i;
-                sal_uInt32  nCnt = pImpl->aDefaultStyles.size();
                 sal_uInt16 nPos = 1;
-                for( _i = 0 ; _i < nCnt ; ++_i )
+                for( auto const & _i: pImpl->aDefaultStyles )
                 {
-                    pBox->InsertEntry( pImpl->aDefaultStyles[_i], nPos );
+                    pBox->InsertEntry( _i, nPos );
                     ++nPos;
                 }
 
@@ -3161,7 +3156,7 @@ void SvxCurrencyToolBoxControl::GetCurrencySymbols( std::vector<OUString>& rList
         aStr += ApplyLreOrRleEmbedding( SvtLanguageTable::GetLanguageString(
                                         rCurrencyTable[i].GetLanguage() ) );
 
-        sal_uInt16 j = nStart;
+        std::vector<OUString>::size_type j = nStart;
         for( ; j < rList.size(); ++j )
             if ( aCollator.compareString( aStr, rList[j] ) < 0 )
                 break;  // insert before first greater than
@@ -3173,14 +3168,14 @@ void SvxCurrencyToolBoxControl::GetCurrencySymbols( std::vector<OUString>& rList
     // Append ISO codes to symbol list.
     // XXX If this is to be changed, various other places would had to be
     // adapted that assume this order!
-    sal_uInt16 nCont = rList.size();
+    std::vector<OUString>::size_type nCont = rList.size();
 
     for ( sal_uInt16 i = 1; i < nCount; ++i )
     {
         bool bInsert = true;
         OUString aStr( ApplyLreOrRleEmbedding( rCurrencyTable[i].GetBankSymbol() ) );
 
-        sal_uInt16 j = nCont;
+        std::vector<OUString>::size_type j = nCont;
         for ( ; j < rList.size() && bInsert; ++j )
         {
             if( rList[j] == aStr )
@@ -3252,7 +3247,7 @@ void SvxColorListBox::LockWidthRequest()
     NamedColor aLongestColor;
     long nMaxStandardColorTextWidth = 0;
     XColorListRef const xColorTable = XColorList::CreateStdColorList();
-    for (sal_Int32 i = 0; i != xColorTable->Count(); ++i)
+    for (long i = 0; i != xColorTable->Count(); ++i)
     {
         XColorEntry& rEntry = *xColorTable->GetColor(i);
         long nColorTextWidth = GetTextWidth(rEntry.GetName());
diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx
index 493571b..ef40b45 100644
--- a/svx/source/toolbars/fontworkbar.cxx
+++ b/svx/source/toolbars/fontworkbar.cxx
@@ -344,8 +344,7 @@ void GetGeometryForCustomShape( SdrCustomShapeGeometryItem& rGeometryItem, const
         std::vector< OUString > aObjList;
         if ( GalleryExplorer::FillObjListTitle( GALLERY_THEME_POWERPOINT, aObjList ) )
         {
-            sal_uInt16 i;
-            for ( i = 0; i < aObjList.size(); i++ )
+            for ( std::vector<OUString>::size_type i = 0; i < aObjList.size(); i++ )
             {
                 if ( aObjList[ i ].equalsIgnoreAsciiCase( rCustomShape ) )
                 {


More information about the Libreoffice-commits mailing list