lotuswordpro/inc/xfilter/xfinputlist.hxx          |    4 ++--
 sc/source/ui/view/viewfun2.cxx                    |    9 ++++++---
 slideshow/source/engine/opengl/TransitionImpl.cxx |   16 ++++++++--------
 sw/source/uibase/utlui/uitool.cxx                 |    4 +---
 4 files changed, 17 insertions(+), 16 deletions(-)

New commits:
commit 5dadcd1ea9e63bcbc0a5d4c4cd95d7d8b37edef9
Author:     Keldin Maldonado (KNM) <kemaldon...@csumb.edu>
AuthorDate: Sat Feb 3 04:41:08 2024 -0800
Commit:     Hossein <hoss...@libreoffice.org>
CommitDate: Mon Feb 12 13:30:40 2024 +0100

    tdf#145538 use range based for loops
    
    using range based for loops instead of index based
    to increase readability in codebase
    
    Change-Id: Ib8c3ec3796fce9228cee1d90beb924128b0dea3f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162950
    Tested-by: Jenkins
    Reviewed-by: Hossein <hoss...@libreoffice.org>

diff --git a/lotuswordpro/inc/xfilter/xfinputlist.hxx 
b/lotuswordpro/inc/xfilter/xfinputlist.hxx
index 6e9719f21155..85dae8836e56 100644
--- a/lotuswordpro/inc/xfilter/xfinputlist.hxx
+++ b/lotuswordpro/inc/xfilter/xfinputlist.hxx
@@ -99,10 +99,10 @@ inline void XFInputList::ToXml(IXFStream *pStrm)
     pAttrList->AddAttribute( "text:value", " " );
     pStrm->StartElement( "text:label" );
     pStrm->EndElement( "text:label" );
-    for(size_t i=0; i< m_list.size();i++)
+    for(const OUString& rLabel : m_list)
     {
         pAttrList->Clear();
-        pAttrList->AddAttribute( "text:value", m_list[i] );
+        pAttrList->AddAttribute( "text:value", rLabel);
         pStrm->StartElement( "text:label" );
         pStrm->EndElement( "text:label" );
     }
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 2b5343d3bdb0..249105efd843 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -2563,11 +2563,14 @@ bool ScViewFunc::DeleteTables(const vector<SCTAB> 
&TheTabs, bool bRecord )
         SCTAB nCount = rDoc.GetTableCount();
 
         OUString aOldName;
-        for(size_t i=0; i<TheTabs.size(); ++i)
+        bool isFirstTab = true;
+        for(SCTAB nTab : TheTabs)
         {
-            SCTAB nTab = TheTabs[i];
-            if (i==0)
+            if (isFirstTab)
+            {
                 pUndoDoc->InitUndo( rDoc, nTab,nTab, true,true );   // incl. 
column/fow flags
+                isFirstTab = false;
+            }
             else
                 pUndoDoc->AddUndoTab( nTab,nTab, true,true );       // incl. 
column/fow flags
 
diff --git a/slideshow/source/engine/opengl/TransitionImpl.cxx 
b/slideshow/source/engine/opengl/TransitionImpl.cxx
index ba43acddc38c..99adca7f7bea 100644
--- a/slideshow/source/engine/opengl/TransitionImpl.cxx
+++ b/slideshow/source/engine/opengl/TransitionImpl.cxx
@@ -144,8 +144,8 @@ bool OGLTransitionImpl::prepare( sal_Int32 
glLeavingSlideTex, sal_Int32 glEnteri
     CHECK_GL_ERROR();
 
     const SceneObjects_t& rSceneObjects(maScene.getSceneObjects());
-    for(size_t i(0); i != rSceneObjects.size(); ++i) {
-        rSceneObjects[i]->prepare(m_nProgramObject);
+    for(const auto& rSceneObject : rSceneObjects) {
+        rSceneObject->prepare(m_nProgramObject);
     }
 
     GLint location = glGetUniformLocation( m_nProgramObject, 
"leavingSlideTexture" );
@@ -208,8 +208,8 @@ bool OGLTransitionImpl::prepare( sal_Int32 
glLeavingSlideTex, sal_Int32 glEnteri
 void OGLTransitionImpl::finish()
 {
     const SceneObjects_t& rSceneObjects(maScene.getSceneObjects());
-    for(size_t i(0); i != rSceneObjects.size(); ++i) {
-        rSceneObjects[i]->finish();
+    for(const auto& rSceneObject : rSceneObjects) {
+        rSceneObject->finish();
     }
 
     finishTransition();
@@ -278,8 +278,8 @@ void OGLTransitionImpl::applyOverallOperations( double 
nTime, double SlideWidthS
 {
     const Operations_t& rOverallOperations(maScene.getOperations());
     glm::mat4 matrix;
-    for(size_t i(0); i != rOverallOperations.size(); ++i)
-        rOverallOperations[i]->interpolate(matrix, nTime, SlideWidthScale, 
SlideHeightScale);
+    for(const auto& rOperation : rOverallOperations)
+        rOperation->interpolate(matrix, nTime, SlideWidthScale, 
SlideHeightScale);
     CHECK_GL_ERROR();
     if (m_nOperationsTransformLocation != -1) {
         glUniformMatrix4fv(m_nOperationsTransformLocation, 1, false, 
glm::value_ptr(matrix));
@@ -340,8 +340,8 @@ void OGLTransitionImpl::displayScene( double nTime, double 
SlideWidth, double Sl
 {
     const SceneObjects_t& rSceneObjects(maScene.getSceneObjects());
     CHECK_GL_ERROR();
-    for(size_t i(0); i != rSceneObjects.size(); ++i)
-        rSceneObjects[i]->display(m_nSceneTransformLocation, 
m_nPrimitiveTransformLocation, nTime, SlideWidth, SlideHeight, DispWidth, 
DispHeight);
+    for(const auto& rSceneObject : rSceneObjects)
+        rSceneObject->display(m_nSceneTransformLocation, 
m_nPrimitiveTransformLocation, nTime, SlideWidth, SlideHeight, DispWidth, 
DispHeight);
     CHECK_GL_ERROR();
 }
 
diff --git a/sw/source/uibase/utlui/uitool.cxx 
b/sw/source/uibase/utlui/uitool.cxx
index fd50bf6678b5..17e24de51caa 100644
--- a/sw/source/uibase/utlui/uitool.cxx
+++ b/sw/source/uibase/utlui/uitool.cxx
@@ -803,10 +803,8 @@ void FillCharStyleListBox(weld::ComboBox& rToFill, 
SwDocShell* pDocSh, bool bSor
         pBase = pPool->Next();
     }
     // non-pool styles
-    const SwCharFormats* pFormats = pDoc->GetCharFormats();
-    for(size_t i = 0; i < pFormats->size(); ++i)
+    for(const auto pFormat : *pDoc->GetCharFormats())
     {
-        const SwCharFormat* pFormat = (*pFormats)[i];
         if(pFormat->IsDefault())
             continue;
         const OUString& rName = pFormat->GetName();

Reply via email to