sd/source/ui/dlg/sdtreelb.cxx |   25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

New commits:
commit 8a2f32a74794c6ee736c5015c920651c9eb6fead
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Sat Nov 12 12:38:27 2022 -0900
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Tue Nov 15 08:53:41 2022 +0100

    Replace do while with all_foreach
    
    Change-Id: Ibe2d34a02628476ab2e2e1ad0b7c9236429e7e13
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142641
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 5a090a83391b..8a9002ac6c38 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -1296,23 +1296,18 @@ void SdPageObjsTLV::SelectEntry(const SdrObject *pObj)
 {
     if (pObj)
     {
-        std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
-        if (m_xTreeView->get_iter_first(*xEntry))
-        {
-            do
+        m_xTreeView->all_foreach([this, &pObj](weld::TreeIter& rEntry){
+            if (weld::fromId<SdrObject*>(m_xTreeView->get_id(rEntry)) == pObj)
             {
-                if (weld::fromId<SdrObject*>(m_xTreeView->get_id(*xEntry)) == 
pObj)
-                {
-                    // Only scroll to the row of the first selected. And only 
when the treeview
-                    // doesn't have the focus.
-                    if (!m_xTreeView->has_focus() && 
m_xTreeView->get_selected_rows().empty())
-                        m_xTreeView->set_cursor(*xEntry);
-                    m_xTreeView->select(*xEntry);
-                    break;
-                }
+                // Only scroll to the row of the first selected. And only when 
the treeview
+                // doesn't have the focus.
+                if (!m_xTreeView->has_focus() && 
m_xTreeView->get_selected_rows().empty())
+                    m_xTreeView->set_cursor(rEntry);
+                m_xTreeView->select(rEntry);
+                return true;
             }
-            while (m_xTreeView->iter_next(*xEntry));
-        }
+            return false;
+        });
     }
 }
 

Reply via email to