include/svx/svdpage.hxx       |    2 ++
 svx/source/svdraw/svdpage.cxx |   30 +++++++++++++++++++++---------
 2 files changed, 23 insertions(+), 9 deletions(-)

New commits:
commit 2fe50b2f11e2236ae7145fd633ad93342f5a0f6c
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Jun 30 13:21:56 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Jul 1 11:27:50 2022 +0200

    tdf#137544 ReformatAllEdgeObjects use recursion
    
    rather than SdrObjListIter, which wants to build a vector of all the
    child objects, of which there are a great many
    
    Change-Id: If6a4213b94e2ef2133100e406fb435b82944ac18
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136719
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index 2ba7017a01a3..dde46e1cc61f 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -273,6 +273,8 @@ private:
     */
     void RemoveObjectFromContainer (
         const sal_uInt32 nObjectPosition);
+
+    void ImplReformatAllEdgeObjects(const SdrObjList& );
 };
 
 // Used for all methods which return a page number
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index a98b88947b76..61a58b3dbc35 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -774,17 +774,29 @@ void SdrObjList::ReformatAllTextObjects()
 */
 void SdrObjList::ReformatAllEdgeObjects()
 {
-    // #i120437# go over whole hierarchy, not only over object level null 
(seen from grouping)
-    SdrObjListIter aIter(this, SdrIterMode::DeepNoGroups);
+    ImplReformatAllEdgeObjects(*this);
+}
 
-    while(aIter.IsMore())
+void SdrObjList::ImplReformatAllEdgeObjects(const SdrObjList& rObjList)
+{
+    // #i120437# go over whole hierarchy, not only over object level null 
(seen from grouping)
+    for(size_t nIdx(0), nCount(rObjList.GetObjCount()); nIdx < nCount; ++nIdx)
     {
-        SdrObject* pObj = aIter.Next();
-        if (pObj->GetObjIdentifier() != SdrObjKind::Edge)
-            continue;
-
-        SdrEdgeObj* pSdrEdgeObj = static_cast< SdrEdgeObj* >(pObj);
-        pSdrEdgeObj->Reformat();
+        SdrObject* pSdrObject(rObjList.GetObjectForNavigationPosition(nIdx));
+        const SdrObjList* pChildren(pSdrObject->getChildrenOfSdrObject());
+        const bool bIsGroup(nullptr != pChildren);
+        if(!bIsGroup)
+        {
+            if (pSdrObject->GetObjIdentifier() == SdrObjKind::Edge)
+            {
+                SdrEdgeObj* pSdrEdgeObj = static_cast< SdrEdgeObj* 
>(pSdrObject);
+                pSdrEdgeObj->Reformat();
+            }
+        }
+        else
+        {
+            ImplReformatAllEdgeObjects(*pChildren);
+        }
     }
 }
 

Reply via email to