[Libreoffice-commits] core.git: scaddins/source sdext/source sd/source

Noel Grandin noel at peralex.com
Tue May 10 06:29:57 UTC 2016


 scaddins/source/analysis/analysishelper.cxx       |    8 ++++----
 scaddins/source/datefunc/datefunc.cxx             |    4 ++--
 scaddins/source/pricing/pricing.cxx               |    4 ++--
 sd/source/core/CustomAnimationEffect.cxx          |    4 ++--
 sd/source/core/stlpool.cxx                        |    4 ++--
 sd/source/filter/html/htmlex.cxx                  |   11 +++++------
 sd/source/filter/html/pubdlg.cxx                  |    4 ++--
 sd/source/filter/ppt/pptin.cxx                    |    9 ++++-----
 sd/source/ui/animations/CustomAnimationDialog.cxx |    5 ++---
 sd/source/ui/dlg/animobjs.cxx                     |    6 +++---
 sd/source/ui/dlg/dlgass.cxx                       |   13 ++++++-------
 sd/source/ui/dlg/tpaction.cxx                     |    4 ++--
 sd/source/ui/docshell/docshel3.cxx                |    8 ++++----
 sd/source/ui/func/fumorph.cxx                     |    4 ++--
 sd/source/ui/presenter/PresenterTextView.cxx      |    3 +--
 sd/source/ui/unoidl/UnoDocumentSettings.cxx       |   16 ++++++++--------
 sd/source/ui/unoidl/unomodel.cxx                  |    3 +--
 sd/source/ui/view/ViewTabBar.cxx                  |    4 ++--
 sd/source/ui/view/drviews7.cxx                    |    6 +++---
 sd/source/ui/view/outlview.cxx                    |   22 +++++++++++-----------
 sd/source/ui/view/sdview3.cxx                     |   10 +++++-----
 sdext/source/pdfimport/filterdet.cxx              |   12 ++++++------
 sdext/source/pdfimport/tree/pdfiprocessor.cxx     |   10 +++++-----
 sdext/source/pdfimport/tree/style.cxx             |    8 ++++----
 24 files changed, 88 insertions(+), 94 deletions(-)

New commits:
commit f469309e265b8cf692b2048eb29ce972f939c3f2
Author: Noel Grandin <noel at peralex.com>
Date:   Mon May 9 13:22:38 2016 +0200

    clang-tidy modernize-loop-convert scaddins to sdext
    
    Change-Id: I63ccc56df1a1de8bc443abb95e520246c457912f
    Reviewed-on: https://gerrit.libreoffice.org/24798
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx
index 5598279..8c65fcb 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -1436,8 +1436,8 @@ sal_uInt16 FuncData::GetStrIndex( sal_uInt16 nParamNum ) const
 
 void InitFuncDataList( FuncDataList& rList, ResMgr& rResMgr )
 {
-    for( sal_uInt16 n = 0 ; n < SAL_N_ELEMENTS(pFuncDatas) ; n++ )
-        rList.push_back( FuncData( pFuncDatas[ n ], rResMgr ) );
+    for(const auto & rFuncData : pFuncDatas)
+        rList.push_back( FuncData( rFuncData, rResMgr ) );
 }
 
 
@@ -2073,8 +2073,8 @@ void Complex::Csch() throw( uno::RuntimeException, lang::IllegalArgumentExceptio
 
 ComplexList::~ComplexList()
 {
-    for( size_t i = 0; i < maVector.size(); ++i )
-        delete maVector[i];
+    for(Complex* p : maVector)
+        delete p;
 }
 
 
diff --git a/scaddins/source/datefunc/datefunc.cxx b/scaddins/source/datefunc/datefunc.cxx
index 9cd1fe7..cd9b3b0 100644
--- a/scaddins/source/datefunc/datefunc.cxx
+++ b/scaddins/source/datefunc/datefunc.cxx
@@ -95,8 +95,8 @@ sal_uInt16 ScaFuncData::GetStrIndex( sal_uInt16 nParam ) const
 
 void InitScaFuncDataList( ScaFuncDataList& rList, ResMgr& rResMgr )
 {
-    for( sal_uInt16 nIndex = 0; nIndex < SAL_N_ELEMENTS(pFuncDataArr); nIndex++ )
-        rList.push_back( ScaFuncData( pFuncDataArr[ nIndex ], rResMgr ) );
+    for(const auto & nIndex : pFuncDataArr)
+        rList.push_back( ScaFuncData( nIndex, rResMgr ) );
 }
 
 ScaFuncRes::ScaFuncRes( ResId& rResId, ResMgr& rResMgr, sal_uInt16 nIndex, OUString& rRet ) :
diff --git a/scaddins/source/pricing/pricing.cxx b/scaddins/source/pricing/pricing.cxx
index c35e2ae..77ffc47 100644
--- a/scaddins/source/pricing/pricing.cxx
+++ b/scaddins/source/pricing/pricing.cxx
@@ -98,8 +98,8 @@ sal_uInt16 ScaFuncData::GetStrIndex( sal_uInt16 nParam ) const
 
 void sca::pricing::InitScaFuncDataList( ScaFuncDataList& rList, ResMgr& rResMgr )
 {
-    for( sal_uInt16 nIndex = 0; nIndex < SAL_N_ELEMENTS(pFuncDataArr); nIndex++ )
-        rList.push_back( ScaFuncData( pFuncDataArr[ nIndex ], rResMgr ) ) ;
+    for(const auto & nIndex : pFuncDataArr)
+        rList.push_back( ScaFuncData( nIndex, rResMgr ) ) ;
 }
 
 ScaFuncRes::ScaFuncRes( ResId& rResId, ResMgr& rResMgr, sal_uInt16 nIndex, OUString& rRet ) :
diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx
index e9541ec..04b1862 100644
--- a/sd/source/core/CustomAnimationEffect.cxx
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -2293,9 +2293,9 @@ void CustomAnimationTextGroup::reset()
     mfGroupingAuto = -1.0;
     mnLastPara = -1; // used to check for TextReverse
 
-    for (int i = 0; i < PARA_LEVELS; ++i)
+    for (sal_Int8 & rn : mnDepthFlags)
     {
-        mnDepthFlags[i] = 0;
+        rn = 0;
     }
 
     maEffects.clear();
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index b6fe267..e21fa7f 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -1038,8 +1038,8 @@ void SdStyleSheetPool::UpdateStdNames()
     if (!aEraseList.empty())
     {
         // styles that could not be renamed, must be removed
-        for ( size_t i = 0, n = aEraseList.size(); i < n; ++i )
-            Remove( aEraseList[ i ] );
+        for (SfxStyleSheetBase* p : aEraseList)
+            Remove( p );
         Reindex();
     }
 }
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index 3f53692..383f533 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -1681,9 +1681,8 @@ bool HtmlExport::CreateHtmlForPresPages()
         {
             aStr.append("<map name=\"map0\">\r\n");
 
-            for (sal_uInt32 nObject = 0, n = aClickableObjects.size(); nObject < n; nObject++)
+            for (SdrObject* pObject : aClickableObjects)
             {
-                SdrObject* pObject = aClickableObjects[nObject];
                 SdAnimationInfo* pInfo     = mpDoc->GetAnimationInfo(pObject);
                 SdIMapInfo*      pIMapInfo = mpDoc->GetIMapInfo(pObject);
 
@@ -2939,9 +2938,9 @@ static const char * ASP_Scripts[] = { "common.inc", "webcast.asp", "show.asp", "
 /** creates and saves the ASP scripts for WebShow */
 bool HtmlExport::CreateASPScripts()
 {
-    for( sal_uInt16 n = 0; n < SAL_N_ELEMENTS(ASP_Scripts); n++ )
+    for(const char * p : ASP_Scripts)
     {
-        OUString aScript = OUString::createFromAscii(ASP_Scripts[n]);
+        OUString aScript = OUString::createFromAscii(p);
 
         if(!CopyScript(maExportPath, aScript, aScript))
             return false;
@@ -2958,9 +2957,9 @@ static const char *PERL_Scripts[] = { "webcast.pl", "common.pl", "editpic.pl", "
 // creates and saves the PERL scripts for WebShow
 bool HtmlExport::CreatePERLScripts()
 {
-    for( sal_uInt16 n = 0; n < SAL_N_ELEMENTS(PERL_Scripts); n++ )
+    for(const char * p : PERL_Scripts)
     {
-        OUString aScript = OUString::createFromAscii(PERL_Scripts[n]);
+        OUString aScript = OUString::createFromAscii(p);
 
         if(!CopyScript(maExportPath, aScript, aScript, true))
             return false;
diff --git a/sd/source/filter/html/pubdlg.cxx b/sd/source/filter/html/pubdlg.cxx
index bca3b3d..38b2e48 100644
--- a/sd/source/filter/html/pubdlg.cxx
+++ b/sd/source/filter/html/pubdlg.cxx
@@ -1329,8 +1329,8 @@ void SdPublishingDlg::LoadPreviewButtons()
         };
 
         std::vector< OUString > aButtonNames;
-        for( int i = 0; i < nButtonCount; ++i )
-            aButtonNames.push_back( OUString::createFromAscii( pButtonNames[i] ) );
+        for(const char * p : pButtonNames)
+            aButtonNames.push_back( OUString::createFromAscii( p ) );
 
         int nSetCount = mpButtonSet->getCount();
 
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 9facb30..4553de0 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -530,9 +530,8 @@ bool ImplSdPPTImport::Import()
         if ( SeekToRec( rStCtrl, PPT_PST_ExObjList, maDocHd.GetRecEndFilePos(), &aHyperHd ) )
         {
             sal_uInt32 nExObjHyperListLen = aHyperHd.GetRecEndFilePos();
-            for ( size_t i = 0, n = aHyperList.size(); i < n; ++i )
+            for (SdHyperlinkEntry* pPtr : aHyperList)
             {
-                SdHyperlinkEntry* pPtr = aHyperList[ i ];
                 DffRecordHeader aHyperE;
                 if ( !SeekToRec( rStCtrl, PPT_PST_ExHyperlink, nExObjHyperListLen, &aHyperE ) )
                     break;
@@ -2103,9 +2102,9 @@ void ImplSdPPTImport::FillSdAnimationInfo( SdAnimationInfo* pInfo, PptInteractiv
         case 0x04 :
         {
             SdHyperlinkEntry* pPtr = nullptr;
-            for ( size_t i = 0, n = aHyperList.size(); i < n; ++i ) {
-                if ( aHyperList[ i ]->nIndex == pIAtom->nExHyperlinkId ) {
-                    pPtr = aHyperList[ i ];
+            for (SdHyperlinkEntry* pEntry : aHyperList) {
+                if ( pEntry->nIndex == pIAtom->nExHyperlinkId ) {
+                    pPtr = pEntry;
                     break;
                 }
             }
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index 69a7ad3..7d363f6 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -1509,10 +1509,9 @@ void CustomAnimationEffectTabPage::fillSoundListBox()
 
     mpLBSound->InsertEntry( SD_RESSTR(STR_CUSTOMANIMATION_NO_SOUND) );
     mpLBSound->InsertEntry( SD_RESSTR(STR_CUSTOMANIMATION_STOP_PREVIOUS_SOUND) );
-    for( size_t i = 0; i < maSoundList.size(); i++ )
+    for(const OUString & rString : maSoundList)
     {
-        OUString aString = maSoundList[ i ];
-        INetURLObject aURL( aString );
+        INetURLObject aURL( rString );
         mpLBSound->InsertEntry( aURL.GetBase() );
     }
     mpLBSound->InsertEntry( SD_RESSTR(STR_CUSTOMANIMATION_BROWSE_SOUND) );
diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx
index 97c43fb..5b985d9 100644
--- a/sd/source/ui/dlg/animobjs.cxx
+++ b/sd/source/ui/dlg/animobjs.cxx
@@ -213,10 +213,10 @@ void AnimationWindow::dispose()
 {
     DELETEZ( pControllerItem );
 
-    for (size_t i = 0; i < m_FrameList.size(); ++i)
+    for (const std::pair<BitmapEx*, tools::Time*> & i : m_FrameList)
     {
-        delete m_FrameList[i].first;
-        delete m_FrameList[i].second;
+        delete i.first;
+        delete i.second;
     }
     m_FrameList.clear();
     m_nCurrentFrame = EMPTY_FRAMELIST;
diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx
index 2ad18db..ec125ef 100644
--- a/sd/source/ui/dlg/dlgass.cxx
+++ b/sd/source/ui/dlg/dlgass.cxx
@@ -1573,11 +1573,11 @@ void AssistentDlgImpl::SavePassword( const SfxObjectShellLock& xDoc, const OUStr
           {
 
             PasswordEntry* pEntry = nullptr;
-            for ( size_t i = 0, n = maPasswordList.size(); i < n; ++i )
+            for (PasswordEntry& rEntry : maPasswordList)
             {
-                if ( maPasswordList[ i ].maPath == rPath )
+                if ( rEntry.maPath == rPath )
                 {
-                    pEntry = &maPasswordList[ i ];
+                    pEntry = &rEntry;
                     break;
                 }
             }
@@ -1605,11 +1605,10 @@ void AssistentDlgImpl::RestorePassword( SfxItemSet* pSet, const OUString& rPath
 
 uno::Sequence < beans::NamedValue > AssistentDlgImpl::GetPassword( const OUString& rPath )
 {
-    for ( size_t i = 0, n = maPasswordList.size(); i < n; ++i )
+    for (PasswordEntry & rEntry : maPasswordList)
     {
-        PasswordEntry* pEntry = &maPasswordList[ i ];
-        if(pEntry->maPath == rPath)
-            return pEntry->aEncryptionData;
+        if(rEntry.maPath == rPath)
+            return rEntry.aEncryptionData;
     }
     return uno::Sequence < beans::NamedValue > ();
 }
diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx
index 3a6ed51..c5ea233 100644
--- a/sd/source/ui/dlg/tpaction.cxx
+++ b/sd/source/ui/dlg/tpaction.cxx
@@ -267,9 +267,9 @@ void SdTPAction::Construct()
     maCurrentActions.push_back( presentation::ClickAction_STOPPRESENTATION );
 
     // fill Action-Listbox
-    for (size_t nAction = 0, n = maCurrentActions.size(); nAction < n; nAction++)
+    for (presentation::ClickAction & rAction : maCurrentActions)
     {
-        sal_uInt16 nRId = GetClickActionSdResId( maCurrentActions[ nAction ] );
+        sal_uInt16 nRId = GetClickActionSdResId( rAction );
         m_pLbAction->InsertEntry( SD_RESSTR( nRId ) );
     }
 
diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx
index ccbc698..69f15c7 100644
--- a/sd/source/ui/docshell/docshel3.cxx
+++ b/sd/source/ui/docshell/docshel3.cxx
@@ -80,8 +80,8 @@ static void lcl_setLanguageForObj( SdrObject *pObj, LanguageType nLang, bool bLa
     {
         if( nLang == LANGUAGE_NONE )
         {
-            for(sal_Int32 n = 0; n < 3; n++ )
-                pObj->SetMergedItem( SvxLanguageItem( nLang, aLangWhichId_EE[n] ) );
+            for(sal_uInt16 n : aLangWhichId_EE)
+                pObj->SetMergedItem( SvxLanguageItem( nLang, n ) );
         }
         else
         {
@@ -101,8 +101,8 @@ static void lcl_setLanguageForObj( SdrObject *pObj, LanguageType nLang, bool bLa
     }
     else    // Reset to default
     {
-        for( sal_Int32 n = 0; n < 3; n++ )
-            pObj->ClearMergedItem( aLangWhichId_EE[n] );
+        for(sal_uInt16 n : aLangWhichId_EE)
+            pObj->ClearMergedItem( n );
     }
 }
 
diff --git a/sd/source/ui/func/fumorph.cxx b/sd/source/ui/func/fumorph.cxx
index 46893b6..889b858 100644
--- a/sd/source/ui/func/fumorph.cxx
+++ b/sd/source/ui/func/fumorph.cxx
@@ -173,8 +173,8 @@ void FuMorph::DoExecute( SfxRequest& )
                     mpView->EndUndo();
                 }
 
-                for( size_t i = 0, n = aPolyPolyList.size(); i < n; ++i ) {
-                    delete aPolyPolyList[ i ];
+                for(basegfx::B2DPolyPolygon * p : aPolyPolyList) {
+                    delete p;
                 }
             }
         }
diff --git a/sd/source/ui/presenter/PresenterTextView.cxx b/sd/source/ui/presenter/PresenterTextView.cxx
index 45f2ebd..7ea3579 100644
--- a/sd/source/ui/presenter/PresenterTextView.cxx
+++ b/sd/source/ui/presenter/PresenterTextView.cxx
@@ -302,9 +302,8 @@ EditEngine* PresenterTextView::Implementation::CreateEditEngine()
         aTable[1].nLang = MsLangId::resolveSystemLanguageByScriptType(aOpt.nDefaultLanguage_CJK, css::i18n::ScriptType::ASIAN);
         aTable[2].nLang = MsLangId::resolveSystemLanguageByScriptType(aOpt.nDefaultLanguage_CTL, css::i18n::ScriptType::COMPLEX);
 
-        for (int i = 0;  i < 3;  ++i)
+        for (FontDta & rFntDta : aTable)
         {
-            const FontDta &rFntDta = aTable[i];
             LanguageType nLang = (LANGUAGE_NONE == rFntDta.nLang) ?
                 rFntDta.nFallbackLang : rFntDta.nLang;
             vcl::Font aFont = OutputDevice::GetDefaultFont(
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index d3b506b..ec108a3 100644
--- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -278,20 +278,20 @@ static struct {
 
 static XPropertyListType getTypeOfName( const OUString &aName )
 {
-    for( size_t i = 0; i < SAL_N_ELEMENTS( aURLPropertyNames ); i++ ) {
-        if( aName.equalsAscii( aURLPropertyNames[i].pName ) )
-            return aURLPropertyNames[i].t;
+    for(const auto & rURLPropertyName : aURLPropertyNames) {
+        if( aName.equalsAscii( rURLPropertyName.pName ) )
+            return rURLPropertyName.t;
     }
     return UNKNOWN_XPROPERTYLISTTYPE;
 }
 
 static OUString getNameOfType( XPropertyListType t )
 {
-    for( size_t i = 0; i < SAL_N_ELEMENTS( aURLPropertyNames ); i++ ) {
-        if( t == aURLPropertyNames[i].t )
-            return OUString( aURLPropertyNames[i].pName,
-                                  strlen( aURLPropertyNames[i].pName ) - 3,
-                                  RTL_TEXTENCODING_UTF8 );
+    for(const auto & rURLPropertyName : aURLPropertyNames) {
+        if( t == rURLPropertyName.t )
+            return OUString( rURLPropertyName.pName,
+                                  strlen( rURLPropertyName.pName ) - 3,
+                                  RTL_TEXTENCODING_ASCII_US );
     }
     return OUString();
 }
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 845a8de..e0f6dbf 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1383,9 +1383,8 @@ uno::Any SAL_CALL SdXImpressDocument::getPropertyValue( const OUString& Property
                 const SfxItemPool& rPool = mpDoc->GetPool();
                 const SfxPoolItem* pItem;
 
-                for( sal_uInt16 i=0; i<3; i++ )
+                for(sal_uInt16 nWhichId : aWhichIds)
                 {
-                    sal_uInt16 nWhichId = aWhichIds[i];
                     sal_uInt32 nItems = rPool.GetItemCount2( nWhichId );
 
                     aSeq.realloc( aSeq.getLength() + nItems*5 + 5 );
diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx
index 87c74cb..e82108e 100644
--- a/sd/source/ui/view/ViewTabBar.cxx
+++ b/sd/source/ui/view/ViewTabBar.cxx
@@ -481,9 +481,9 @@ bool ViewTabBar::HasTabBarButton (
 {
     bool bResult (false);
 
-    for (size_t nIndex=0; nIndex<maTabBarButtons.size(); ++nIndex)
+    for (css::drawing::framework::TabBarButton & r : maTabBarButtons)
     {
-        if (IsEqual(maTabBarButtons[nIndex], rButton))
+        if (IsEqual(r, rButton))
         {
             bResult = true;
             break;
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 048c426..6d08aa4 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -1445,10 +1445,10 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
                                                      SID_DRAWTBX_CS_CALLOUT, SID_DRAWTBX_CS_STAR };
 
             const sal_uInt16 nCurrentSId = GetCurrentFunction()->GetSlotID();
-            for ( size_t i = 0; i < SAL_N_ELEMENTS( nCSTbArray ); ++i )
+            for (sal_uInt16 i : nCSTbArray)
             {
-                rSet.ClearItem( nCSTbArray[i] ); // Why is this necessary?
-                rSet.Put( SfxStringItem( nCSTbArray[i], nCurrentSId == nCSTbArray[i] && pShapeFunc
+                rSet.ClearItem( i ); // Why is this necessary?
+                rSet.Put( SfxStringItem( i, nCurrentSId == i && pShapeFunc
                                          ? pShapeFunc->GetShapeType() : OUString() ) );
             }
         }
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index f3d9457..e00721a 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -102,9 +102,9 @@ OutlineView::OutlineView( DrawDocShell& rDocSh, vcl::Window* pWindow, OutlineVie
     }
 
     // insert View into Outliner
-    for (sal_uInt16 nView = 0; nView < MAX_OUTLINERVIEWS; nView++)
+    for (OutlinerView* & rp : mpOutlinerView)
     {
-        mpOutlinerView[nView] = nullptr;
+        rp = nullptr;
     }
 
     mpOutlinerView[0] = new OutlinerView(&mrOutliner, pWindow);
@@ -168,13 +168,13 @@ OutlineView::~OutlineView()
     delete mpProgress;
 
     // unregister OutlinerViews and destroy them
-    for (sal_uInt16 nView = 0; nView < MAX_OUTLINERVIEWS; nView++)
+    for (OutlinerView* & rpView : mpOutlinerView)
     {
-        if (mpOutlinerView[nView] != nullptr)
+        if (rpView != nullptr)
         {
-            mrOutliner.RemoveView( mpOutlinerView[nView] );
-            delete mpOutlinerView[nView];
-            mpOutlinerView[nView] = nullptr;
+            mrOutliner.RemoveView( rpView );
+            delete rpView;
+            rpView = nullptr;
         }
     }
 
@@ -295,13 +295,13 @@ void OutlineView::DeleteWindowFromPaintView(OutputDevice* pWin)
 OutlinerView* OutlineView::GetViewByWindow (vcl::Window* pWin) const
 {
     OutlinerView* pOlView = nullptr;
-    for (sal_uInt16 nView = 0; nView < MAX_OUTLINERVIEWS; nView++)
+    for (OutlinerView* pView : mpOutlinerView)
     {
-        if (mpOutlinerView[nView] != nullptr)
+        if (pView != nullptr)
         {
-            if ( pWin == mpOutlinerView[nView]->GetWindow() )
+            if ( pWin == pView->GetWindow() )
             {
-                pOlView = mpOutlinerView[nView];
+                pOlView = pView;
             }
         }
     }
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index 37faa89..a88e240 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -105,10 +105,10 @@ struct ImpRememberOrigAndClone
 
 SdrObject* ImpGetClone(std::vector<ImpRememberOrigAndClone*>& aConnectorContainer, SdrObject* pConnObj)
 {
-    for(size_t a(0); a < aConnectorContainer.size(); a++)
+    for(ImpRememberOrigAndClone* p : aConnectorContainer)
     {
-        if(pConnObj == aConnectorContainer[a]->pOrig)
-            return aConnectorContainer[a]->pClone;
+        if(pConnObj == p->pOrig)
+            return p->pClone;
     }
     return nullptr;
 }
@@ -586,8 +586,8 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                                 }
 
                                 // cleanup remember classes
-                                for(size_t a = 0; a < aConnectorContainer.size(); ++a)
-                                    delete aConnectorContainer[a];
+                                for(ImpRememberOrigAndClone* p : aConnectorContainer)
+                                    delete p;
 
                                 if( pMarkList != mpDragSrcMarkList )
                                     delete pMarkList;
diff --git a/sdext/source/pdfimport/filterdet.cxx b/sdext/source/pdfimport/filterdet.cxx
index 5e5485f..6a84557 100644
--- a/sdext/source/pdfimport/filterdet.cxx
+++ b/sdext/source/pdfimport/filterdet.cxx
@@ -420,7 +420,7 @@ bool checkDocChecksum( const OUString& rInPDFFileURL,
     // prepare checksum to test
     sal_uInt8 nTestChecksum[ RTL_DIGEST_LENGTH_MD5 ];
     const sal_Unicode* pChar = rChkSum.getStr();
-    for( unsigned int i = 0; i < RTL_DIGEST_LENGTH_MD5; i++ )
+    for(sal_uInt8 & rn : nTestChecksum)
     {
         sal_uInt8 nByte = sal_uInt8( ( (*pChar >= '0' && *pChar <= '9') ? *pChar - '0' :
                           ( (*pChar >= 'A' && *pChar <= 'F') ? *pChar - 'A' + 10 :
@@ -433,7 +433,7 @@ bool checkDocChecksum( const OUString& rInPDFFileURL,
                  ( (*pChar >= 'a' && *pChar <= 'f') ? *pChar - 'a' + 10 :
                  0 ) ) );
         pChar++;
-        nTestChecksum[i] = nByte;
+        rn = nByte;
     }
 
     // open file and calculate actual checksum up to index nBytes
@@ -470,12 +470,12 @@ bool checkDocChecksum( const OUString& rInPDFFileURL,
     bRet = (0 == memcmp( nActualChecksum, nTestChecksum, sizeof( nActualChecksum ) ));
 #if OSL_DEBUG_LEVEL > 0
     OSL_TRACE( "test checksum: " );
-    for( unsigned int i = 0; i < sizeof(nTestChecksum); i++ )
-        OSL_TRACE( "%.2X", int(nTestChecksum[i]) );
+    for(sal_uInt8 i : nTestChecksum)
+        OSL_TRACE( "%.2X", int(i) );
     OSL_TRACE( "\n" );
     OSL_TRACE( "file checksum: " );
-    for( unsigned int i = 0; i < sizeof(nActualChecksum); i++ )
-        OSL_TRACE( "%.2X", int(nActualChecksum[i]) );
+    for(sal_uInt8 i : nActualChecksum)
+        OSL_TRACE( "%.2X", int(i) );
     OSL_TRACE( "\n" );
 #endif
     return bRet;
diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
index c48a2e3..2551bf4 100644
--- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx
+++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
@@ -206,9 +206,9 @@ void PDFIProcessor::processGlyphLine()
     double spaceDetectBoundary = 0.0;
 
     // Try to find space glyph and its width
-    for (size_t i = 0; i < m_GlyphsList.size(); i++)
+    for (CharGlyph & i : m_GlyphsList)
     {
-        OUString& glyph = m_GlyphsList[i].getGlyph();
+        OUString& glyph = i.getGlyph();
 
         sal_Unicode ch = '\0';
         if (!glyph.isEmpty())
@@ -216,7 +216,7 @@ void PDFIProcessor::processGlyphLine()
 
         if ((ch == 0x20) || (ch == 0xa0))
         {
-            double spaceWidth = m_GlyphsList[i].getWidth();
+            double spaceWidth = i.getWidth();
             spaceDetectBoundary = spaceWidth * 0.5;
             break;
         }
@@ -226,8 +226,8 @@ void PDFIProcessor::processGlyphLine()
     if (spaceDetectBoundary == 0.0)
     {
         double avgGlyphWidth = 0.0;
-        for (size_t i = 0; i < m_GlyphsList.size(); i++)
-            avgGlyphWidth += m_GlyphsList[i].getWidth();
+        for (CharGlyph & i : m_GlyphsList)
+            avgGlyphWidth += i.getWidth();
         avgGlyphWidth /= m_GlyphsList.size();
         spaceDetectBoundary = avgGlyphWidth * 0.2;
     }
diff --git a/sdext/source/pdfimport/tree/style.cxx b/sdext/source/pdfimport/tree/style.cxx
index 35ac61b..f6074b1 100644
--- a/sdext/source/pdfimport/tree/style.cxx
+++ b/sdext/source/pdfimport/tree/style.cxx
@@ -44,8 +44,8 @@ sal_Int32 StyleContainer::impl_getStyleId( const Style& rStyle, bool bSubStyle )
     aSearchStyle.Properties             = rStyle.Properties;
     aSearchStyle.Contents               = rStyle.Contents;
     aSearchStyle.ContainedElement       = rStyle.ContainedElement;
-    for( size_t n = 0; n < rStyle.SubStyles.size(); ++n )
-        aSearchStyle.SubStyles.push_back( impl_getStyleId( *rStyle.SubStyles[n], true ) );
+    for(Style* pSubStyle : rStyle.SubStyles)
+        aSearchStyle.SubStyles.push_back( impl_getStyleId( *pSubStyle, true ) );
 
     std::unordered_map< HashedStyle, sal_Int32, StyleHash >::iterator it =
         m_aStyleToId.find( aSearchStyle );
@@ -195,8 +195,8 @@ void StyleContainer::impl_emitStyle( sal_Int32           nStyleId,
             aProps[ "draw:name" ] = aProps[ "style:name" ];
         rContext.rEmitter.beginTag( rStyle.Name.getStr(), aProps );
 
-        for( size_t n = 0; n < rStyle.SubStyles.size(); ++n )
-            impl_emitStyle( rStyle.SubStyles[n], rContext, rContainedElemVisitor );
+        for(sal_Int32 nSubStyle : rStyle.SubStyles)
+            impl_emitStyle( nSubStyle, rContext, rContainedElemVisitor );
         if( !rStyle.Contents.isEmpty() )
             rContext.rEmitter.write( rStyle.Contents );
         if( rStyle.ContainedElement )


More information about the Libreoffice-commits mailing list