sd/source/core/drawdoc2.cxx    |   19 ++++++++++++++++++-
 sd/source/ui/view/drviews1.cxx |    6 +++++-
 2 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit 8781f625b1096bdfcc7212598cef77ca6ce4143d
Author:     Mohit Marathe <[email protected]>
AuthorDate: Fri Dec 12 13:19:47 2025 +0530
Commit:     Mohit Marathe <[email protected]>
CommitDate: Tue Jan 13 09:05:08 2026 +0100

    sd: update connectors when a page is inserted or deleted
    
    Signed-off-by: Mohit Marathe <[email protected]>
    Change-Id: Ic70e27ecadfe572f1f1ee267e88594f6dd5580b1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195551
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196818
    Tested-by: Jenkins

diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 160d0d07b4e8..1618298e9041 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -1763,6 +1763,7 @@ void SdDrawDocument::updatePagePreviewsGrid(SdPage* pPage)
 
         mpCanvasPage->CreatePresObj(PresObjKind::PagePreview, true, 
::tools::Rectangle(Point(nX,nY), Size(nPreviewWidth, nPreviewHeight)), 
OUString(), nPageNum);
     }
+    connectPagePreviews();
 }
 
 void SdDrawDocument::connectPagePreviews()
@@ -1775,7 +1776,12 @@ void SdDrawDocument::connectPagePreviews()
     SdrObjListIter aIter(pObjList, SdrIterMode::Flat);
     for (SdrObject* pObj = aIter.Next(); pObj; pObj = aIter.Next())
     {
-        if (pObj->GetObjIdentifier() == SdrObjKind::Page)
+        //remove the existing connectors
+        if (pObj->GetObjIdentifier() == SdrObjKind::Edge)
+        {
+            pObjList->NbcRemoveObject(pObj->GetOrdNum());
+        }
+        else if (pObj->GetObjIdentifier() == SdrObjKind::Page)
         {
             SdrPageObj* pPageObj = static_cast<SdrPageObj*>(pObj);
             SdPage* pPage = 
static_cast<SdPage*>(pPageObj->GetReferencedPage());
@@ -1789,6 +1795,9 @@ void SdDrawDocument::connectPagePreviews()
         SdrPageObj* pPageObj1 = aPageOrder[i];
         SdrPageObj* pPageObj2 = aPageOrder[i + 1];
 
+        if (!pPageObj1 || !pPageObj2)
+            continue;
+
         ::tools::Rectangle aRect1 = pPageObj1->GetSnapRect();
         ::tools::Rectangle aRect2 = pPageObj2->GetSnapRect();
 
commit ad5a78e4133042c275592a5032654cd4e3278f07
Author:     Mohit Marathe <[email protected]>
AuthorDate: Thu Dec 11 18:26:20 2025 +0530
Commit:     Mohit Marathe <[email protected]>
CommitDate: Tue Jan 13 09:04:54 2026 +0100

    sd: lok: send CanvasPageCenter command to client on canvas page creation
    
    Signed-off-by: Mohit Marathe <[email protected]>
    Change-Id: I5c29ac2393c25ed3f3b5f45303920e735e1f9bd6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195466
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196817
    Tested-by: Jenkins

diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index d76557587d00..160d0d07b4e8 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -65,6 +65,7 @@
 
 #include <DrawDocShell.hxx>
 #include <ViewShell.hxx>
+#include <DrawViewShell.hxx>
 
 #include "PageListWatcher.hxx"
 #include <strings.hxx>
@@ -514,7 +515,14 @@ rtl::Reference<SdrPage> 
SdDrawDocument::RemovePage(sal_uInt16 nPgNum)
 
     auto pSdPage = static_cast<SdPage*>(pPage.get());
     if (pSdPage->IsCanvasPage())
+    {
+        if (comphelper::LibreOfficeKit::isActive())
+        {
+            DrawViewShell* pDrawViewSh = 
dynamic_cast<DrawViewShell*>(mpDocSh->GetViewShell());
+            pDrawViewSh->RememberCanvasPageVisArea(::tools::Rectangle());
+        }
         mpCanvasPage = nullptr;
+    }
     pSdPage->DisconnectLink();
     ReplacePageInCustomShows( pSdPage, nullptr );
     UpdatePageObjectsInNotes(nPgNum);
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 8ec1ecce86ea..0ccfd2f5d50b 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -1118,8 +1118,12 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage, 
bool bAllowChangeFocus,
                 }
                 if (GetDoc()->HasCanvasPage() && 
getCurrentPage()->IsCanvasPage() && bAllowChangeFocus)
                 {
+                    bool bShowCenter = maCanvasPageVisArea.IsEmpty();
                     ::tools::JsonWriter aJsonWriter;
-                    aJsonWriter.put("commandName", "CanvasPageVisArea");
+                    if (bShowCenter)
+                        aJsonWriter.put("commandName", "CanvasPageCenter");
+                    else
+                        aJsonWriter.put("commandName", "CanvasPageVisArea");
                     {
                         auto jsonState = aJsonWriter.startNode("state");
                         aJsonWriter.put("x", maCanvasPageVisArea.Left());

Reply via email to