sd/inc/drawdoc.hxx          |    3 +++
 sd/inc/sdpage.hxx           |    2 +-
 sd/source/core/drawdoc2.cxx |    6 ------
 sd/source/core/sdpage.cxx   |    7 +++++++
 4 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit b40fd051d70c34a5300a7a60c6110b731469a785
Author:     Mohit Marathe <[email protected]>
AuthorDate: Tue Dec 9 13:51:58 2025 +0530
Commit:     Mohit Marathe <[email protected]>
CommitDate: Thu Dec 11 09:04:04 2025 +0100

    sd: refactor SdPage::SetCanvasPage
    
    Signed-off-by: Mohit Marathe <[email protected]>
    Change-Id: Iec7dd09162a9a51de3bcb9c3126a365b26c0507a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195286
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index bef514d5b9c8..d3002d37ea3c 100644
--- a/sd/inc/drawdoc.hxx
+++ b/sd/inc/drawdoc.hxx
@@ -36,6 +36,7 @@
 #include "sddllapi.h"
 #include "pres.hxx"
 #include "stlpool.hxx"
+#include "sdpage.hxx"
 
 namespace com::sun::star::xml::dom { class XNode; }
 namespace com::sun::star::uno { class XInterface; }
@@ -1105,6 +1106,8 @@ public:
         bool bUndo = true,
         const OUString& sNewName = OUString());
 
+    void StoreCanvasPage(SdPage* pPage) { mpCanvasPage = pPage; }
+
     /** Re-order the pages based on the position of their previews on canvas 
page.
      */
     void ReshufflePages();
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx
index a338a880ad2b..4415fd28506c 100644
--- a/sd/inc/sdpage.hxx
+++ b/sd/inc/sdpage.hxx
@@ -404,7 +404,7 @@ public:
     static sal_uInt16 mnLastPageId;
 
     bool IsCanvasPage() const { return mbIsCanvasPage; }
-    void SetCanvasPage() { mbIsCanvasPage = true; }
+    void SetCanvasPage();
 
     bool IsCanvasMasterPage() const { return mbIsCanvasMasterPage; }
     void SetCanvasMasterPage() { mbIsCanvasMasterPage = true; }
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index ee980fd7fa3e..9817cff1bc2b 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -1516,8 +1516,6 @@ void SdDrawDocument::ImportCanvasPage()
     SdPage* pPage = GetSdPage(0, PageKind::Standard);
     bool bIsCanvasPageValid = ValidateCanvasPage(pPage);
     pPage->SetCanvasPage();
-    pPage->SetExcluded(true);
-    mpCanvasPage = pPage;
     SdPage* pMPage = static_cast<SdPage*>(&pPage->TRG_GetMasterPage());
     pMPage->SetCanvasMasterPage();
     // re-populate the previews grid if not valid
@@ -1626,9 +1624,6 @@ sal_uInt16 SdDrawDocument::GetOrInsertCanvasPage()
     if (!pCanvasPage)
         return 0xffff;
 
-    // exclude from slideshow
-    pCanvasPage->SetExcluded(true);
-
     // move the canvas page to the top
     sal_uInt16 nCanvasPageNum = 2 * nCanvasPageIndex + 1;
     MovePage(nCanvasPageNum, 1); // Canvas page
@@ -1638,7 +1633,6 @@ sal_uInt16 SdDrawDocument::GetOrInsertCanvasPage()
 
     ResizeCurrentPage(pCanvasPage, aCanvasSize, PageKind::Standard);
     pCanvasPage->SetCanvasPage();
-    mpCanvasPage = pCanvasPage;
 
     SdPage* pMasterCanvas = 
static_cast<SdPage*>(&pCanvasPage->TRG_GetMasterPage());
     pMasterCanvas->SetCanvasMasterPage();
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 5812572bc1fc..64217fc8bca2 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -1402,6 +1402,13 @@ OUString SdPage::autoLayoutToString(AutoLayout nLayoutId)
     return enumtoString(nLayoutId);
 }
 
+void SdPage::SetCanvasPage()
+{
+    mbIsCanvasPage = true;
+    SetExcluded(true);
+    
static_cast<SdDrawDocument&>(getSdrModelFromSdrPage()).StoreCanvasPage(this);
+}
+
 static void CalcAutoLayoutRectangles( SdPage const & rPage,::tools::Rectangle* 
rRectangle ,const OUString& sLayoutType )
 {
     ::tools::Rectangle aTitleRect;

Reply via email to