svx/source/svdraw/svdograf.cxx |   23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

New commits:
commit 4f5ed06e55a711b0e6182c57f1daf059ced03a27
Author:     Caolán McNamara <[email protected]>
AuthorDate: Wed Oct 1 16:37:12 2025 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Fri Oct 3 09:38:43 2025 +0200

    include any invisible objects in group
    
    Change-Id: I2e7a145b16817129e130fb2217eecfd1cbbfc573
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191747
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index c766e7d4780d..63579069896b 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -35,6 +35,7 @@
 #include <svx/svdhdl.hxx>
 #include <svx/svdmodel.hxx>
 #include <svx/svdpage.hxx>
+#include <svx/svdpagv.hxx>
 #include <svx/svdview.hxx>
 #include <svx/svdograf.hxx>
 #include <svx/svdogrp.hxx>
@@ -413,9 +414,25 @@ css::uno::Reference<css::lang::XComponent> 
SdrGrafObj::GetReplacementGraphicMode
 
     if (SdrView* pView = pViewShell->GetDrawView())
     {
-        // Group shapes together
-        pView->MarkAllObj();
-        pView->GroupMarked();
+        if (SdrPageView* pPV = pView->GetSdrPageView())
+        {
+            // Group shapes together, including invisible objects
+
+            rtl::Reference<SdrObject> xGrp(new SdrObjGroup(rSdrModel));
+            SdrObjList* pDstList = xGrp->GetSubList();
+
+            SdrObjList* pSrcList = pPV->GetObjList();
+            size_t i = pSrcList->GetObjCount();
+            while (i > 0)
+            {
+                --i;
+                rtl::Reference<SdrObject> xObj(pSrcList->GetObj(i));
+                pSrcList->RemoveObject(i);
+                pDstList->InsertObject(xObj.get(), 0);
+            }
+
+            pSrcList->InsertObject(xGrp.get(), 0);
+        }
     }
 
     return xComponent;

Reply via email to