officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu |    
8 
 sd/inc/app.hrc                                                           |    
1 
 sd/inc/drawdoc.hxx                                                       |    
9 
 sd/inc/pres.hxx                                                          |    
1 
 sd/inc/sdpage.hxx                                                        |    
6 
 sd/sdi/SlideSorterController.sdi                                         |    
5 
 sd/sdi/_drvwsh.sdi                                                       |    
5 
 sd/sdi/sdraw.sdi                                                         |   
17 +
 sd/source/core/drawdoc2.cxx                                              |  
139 +++++++++-
 sd/source/core/sdpage.cxx                                                |   
20 +
 sd/source/ui/slidesorter/controller/SlsSlotManager.cxx                   |   
14 +
 sd/source/ui/unoidl/unopage.cxx                                          |    
3 
 sd/source/ui/view/drviews2.cxx                                           |    
8 
 13 files changed, 230 insertions(+), 6 deletions(-)

New commits:
commit 0367235a3da2160b1afbff042bd13d0f685157ea
Author:     Mohit Marathe <[email protected]>
AuthorDate: Tue Oct 21 10:48:17 2025 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Wed Oct 29 15:30:13 2025 +0100

    sd: insert or remove the page preview from canvas page
    
    when the corresponding page has been inserted or removed
    
    Signed-off-by: Mohit Marathe <[email protected]>
    Change-Id: I4f9309a77a960814a85f8a015e3719ee7a0623b4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192768
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index 0bae3b89bd61..b13749c6fe6d 100644
--- a/sd/inc/drawdoc.hxx
+++ b/sd/inc/drawdoc.hxx
@@ -1032,6 +1032,8 @@ public:
         bool bIsPageObj,
         const sal_Int32 nInsertPosition);
 
+    SAL_DLLPRIVATE bool HasCanvasPage() const { return mpCanvasPage != 
nullptr; }
+
     SAL_DLLPRIVATE sal_uInt16 GetOrInsertCanvasPage ();
 
     /** return the document fonts for latin, cjk and ctl according to the 
current
@@ -1170,10 +1172,8 @@ private:
         bool bIsPageBack,
         bool bIsPageObj);
 
-    SAL_DLLPRIVATE bool hasCanvasPage() const { return mpCanvasPage != 
nullptr; }
-
     SAL_DLLPRIVATE void populatePagePreviewsGrid();
-    SAL_DLLPRIVATE void updateCanvasPreviewsGrid();
+    SAL_DLLPRIVATE void updatePagePreviewsGrid(SdPage* pPage);
 
     SAL_DLLPRIVATE virtual void PageListChanged() override;
     SAL_DLLPRIVATE virtual void MasterPageListChanged() override;
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 258281098993..a59e651094c3 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -445,21 +445,22 @@ void SdDrawDocument::InsertPage(SdrPage* pPage, 
sal_uInt16 nPos)
 
     FmFormModel::InsertPage(pPage, nPos);
 
-    static_cast<SdPage*>(pPage)->ConnectLink();
+    SdPage* pSdPage = static_cast<SdPage*>(pPage);
+    pSdPage->ConnectLink();
 
     UpdatePageObjectsInNotes(nPos);
 
     if (!bLast)
-        UpdatePageRelativeURLs(static_cast<SdPage*>( pPage ), nPos, 1);
+        UpdatePageRelativeURLs(pSdPage, nPos, 1);
 
-    if (comphelper::LibreOfficeKit::isActive() && 
static_cast<SdPage*>(pPage)->GetPageKind() == PageKind::Standard)
+    if (comphelper::LibreOfficeKit::isActive() && pSdPage->GetPageKind() == 
PageKind::Standard)
     {
         SdXImpressDocument* pDoc = getUnoModel();
         SfxLokHelper::notifyDocumentSizeChangedAllViews(pDoc);
     }
 
-    if (hasCanvasPage())
-        updateCanvasPreviewsGrid();
+    if (HasCanvasPage())
+        updatePagePreviewsGrid(pSdPage);
 }
 
 // Override SfxBaseModel::getUnoModel and return a more concrete type
@@ -475,8 +476,11 @@ void SdDrawDocument::DeletePage(sal_uInt16 nPgNum)
 
     UpdatePageObjectsInNotes(nPgNum);
 
-    if (hasCanvasPage())
-        updateCanvasPreviewsGrid();
+    // if (HasCanvasPage())
+    // {
+    //     SdPage* pPage = static_cast<SdPage*>(GetPage(nPgNum));
+    //     updatePagePreviewsGrid(pPage);
+    // }
 }
 
 // Remove page
@@ -500,8 +504,8 @@ rtl::Reference<SdrPage> 
SdDrawDocument::RemovePage(sal_uInt16 nPgNum)
         SfxLokHelper::notifyDocumentSizeChangedAllViews(pDoc);
     }
 
-    if (hasCanvasPage())
-        updateCanvasPreviewsGrid();
+    if (HasCanvasPage())
+        updatePagePreviewsGrid(pSdPage);
 
     return pPage;
 }
@@ -1457,7 +1461,7 @@ void SdDrawDocument::SetupNewPage (
 
 sal_uInt16 SdDrawDocument::GetOrInsertCanvasPage()
 {
-    if (hasCanvasPage())
+    if (HasCanvasPage())
         return mpCanvasPage->GetPageNum() / 2;
 
     sal_uInt16 nLastPageNum = GetSdPageCount(PageKind::Standard);
@@ -1544,10 +1548,39 @@ void SdDrawDocument::populatePagePreviewsGrid()
     }
 }
 
-void SdDrawDocument::updateCanvasPreviewsGrid()
+void SdDrawDocument::updatePagePreviewsGrid(SdPage* pPage)
 {
-    SdrPage* pPage = mpCanvasPage.get();
-    pPage->ClearSdrObjList();
-    populatePagePreviewsGrid();
+    SdrObjList* pObjList = mpCanvasPage.get();
+    sal_uInt16 nTotalPreviews = 0;
+    sal_uInt16 nPageCnt = GetSdPageCount(PageKind::Standard) - 1; // do not 
count canvas page
+
+    std::vector<SdrObject*> aToRemove;
+    SdrObjListIter aIter(pObjList, SdrIterMode::Flat);
+    for (SdrObject* pObj = aIter.Next(); pObj; pObj = aIter.Next())
+    {
+        if (pObj->GetObjIdentifier() == SdrObjKind::Page)
+        {
+            nTotalPreviews++;
+            SdrPageObj* pPageObj = static_cast<SdrPageObj*>(pObj);
+            if (pPage == pPageObj->GetReferencedPage())
+            {
+                aToRemove.push_back(pObj);
+            }
+        }
+    }
+    for (SdrObject* pObject : aToRemove)
+        pObjList->RemoveObject(pObject->GetOrdNum());
+
+    // page inserted
+    if (nTotalPreviews < nPageCnt)
+    {
+        const sal_uInt16 nPageNum = pPage->GetPageNum();
+        const ::tools::Long nPreviewWidth = pPage->GetWidth() / 5;
+        const ::tools::Long nPreviewHeight = pPage->GetHeight() / 5;
+        const ::tools::Long nX = (mpCanvasPage->GetWidth() - nPreviewWidth) / 
2;
+        const ::tools::Long nY = (mpCanvasPage->GetHeight() - nPreviewHeight) 
/ 2;
+
+        mpCanvasPage->CreatePresObj(PresObjKind::PagePreview, true, 
::tools::Rectangle(Point(nX,nY), Size(nPreviewWidth, nPreviewHeight)), 
OUString(), nPageNum);
+    }
 }
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit cd259c522b3876701ba9d321b7c314f06194ec21
Author:     Mohit Marathe <[email protected]>
AuthorDate: Mon Oct 13 20:36:55 2025 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Wed Oct 29 15:30:08 2025 +0100

    sd: populate page previews grid in canvas page
    
    Signed-off-by: Mohit Marathe <[email protected]>
    Change-Id: I9058a857cad403b78c20e3f771e1531d7f641a38
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192767
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index d1e4944e13ea..0bae3b89bd61 100644
--- a/sd/inc/drawdoc.hxx
+++ b/sd/inc/drawdoc.hxx
@@ -432,6 +432,8 @@ private:
 
     sal_Int32 mnImagePreferredDPI;
 
+    rtl::Reference<SdPage> mpCanvasPage;
+
     SAL_DLLPRIVATE virtual css::uno::Reference< css::frame::XModel > 
createUnoModel() override;
 
 public:
@@ -1030,8 +1032,7 @@ public:
         bool bIsPageObj,
         const sal_Int32 nInsertPosition);
 
-
-    SAL_DLLPRIVATE sal_uInt16 InsertCanvasPage ();
+    SAL_DLLPRIVATE sal_uInt16 GetOrInsertCanvasPage ();
 
     /** return the document fonts for latin, cjk and ctl according to the 
current
         languages set at this document */
@@ -1169,6 +1170,11 @@ private:
         bool bIsPageBack,
         bool bIsPageObj);
 
+    SAL_DLLPRIVATE bool hasCanvasPage() const { return mpCanvasPage != 
nullptr; }
+
+    SAL_DLLPRIVATE void populatePagePreviewsGrid();
+    SAL_DLLPRIVATE void updateCanvasPreviewsGrid();
+
     SAL_DLLPRIVATE virtual void PageListChanged() override;
     SAL_DLLPRIVATE virtual void MasterPageListChanged() override;
 };
diff --git a/sd/inc/pres.hxx b/sd/inc/pres.hxx
index ab2b44adf6c5..b0780b9dd47d 100644
--- a/sd/inc/pres.hxx
+++ b/sd/inc/pres.hxx
@@ -32,6 +32,7 @@ enum class PresObjKind
     Page,
     Handout,
     Notes,
+    PagePreview,
     Header,
     Footer,
     DateTime,
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx
index af4bdf48ed5b..f873efc819e8 100644
--- a/sd/inc/sdpage.hxx
+++ b/sd/inc/sdpage.hxx
@@ -168,7 +168,7 @@ public:
     sd::ShapeList&  GetPresentationShapeList() { return 
maPresentationShapeList; }
 
     void EnsureMasterPageDefaultBackground();
-    SD_DLLPUBLIC SdrObject* CreatePresObj(PresObjKind eObjKind, bool 
bVertical, const ::tools::Rectangle& rRect, const OUString& rCustomPrompt = 
OUString());
+    SD_DLLPUBLIC SdrObject* CreatePresObj(PresObjKind eObjKind, bool 
bVertical, const ::tools::Rectangle& rRect, const OUString& rCustomPrompt = 
OUString(), const sal_uInt16 nPagePreviewNum = 0xffff);
     SD_DLLPUBLIC rtl::Reference<SdrObject> CreateDefaultPresObj(PresObjKind 
eObjKind);
     SD_DLLPUBLIC void DestroyDefaultPresObj(PresObjKind eObjKind);
     SD_DLLPUBLIC SdrObject* GetPresObj(PresObjKind eObjKind, int nIndex = 1, 
bool bFuzzySearch = false );
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 660b4ee8234d..258281098993 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -457,6 +457,9 @@ void SdDrawDocument::InsertPage(SdrPage* pPage, sal_uInt16 
nPos)
         SdXImpressDocument* pDoc = getUnoModel();
         SfxLokHelper::notifyDocumentSizeChangedAllViews(pDoc);
     }
+
+    if (hasCanvasPage())
+        updateCanvasPreviewsGrid();
 }
 
 // Override SfxBaseModel::getUnoModel and return a more concrete type
@@ -471,6 +474,9 @@ void SdDrawDocument::DeletePage(sal_uInt16 nPgNum)
     FmFormModel::DeletePage(nPgNum);
 
     UpdatePageObjectsInNotes(nPgNum);
+
+    if (hasCanvasPage())
+        updateCanvasPreviewsGrid();
 }
 
 // Remove page
@@ -494,6 +500,9 @@ rtl::Reference<SdrPage> 
SdDrawDocument::RemovePage(sal_uInt16 nPgNum)
         SfxLokHelper::notifyDocumentSizeChangedAllViews(pDoc);
     }
 
+    if (hasCanvasPage())
+        updateCanvasPreviewsGrid();
+
     return pPage;
 }
 
@@ -1446,8 +1455,11 @@ void SdDrawDocument::SetupNewPage (
     }
 }
 
-sal_uInt16 SdDrawDocument::InsertCanvasPage()
+sal_uInt16 SdDrawDocument::GetOrInsertCanvasPage()
 {
+    if (hasCanvasPage())
+        return mpCanvasPage->GetPageNum() / 2;
+
     sal_uInt16 nLastPageNum = GetSdPageCount(PageKind::Standard);
     SdPage* pLastStandardPage = GetSdPage(nLastPageNum - 1, 
PageKind::Standard);
 
@@ -1458,6 +1470,10 @@ sal_uInt16 SdDrawDocument::InsertCanvasPage()
     const Size aCanvasSize(500000, 500000);
 
     ResizeCurrentPage(pCanvasPage, aCanvasSize, PageKind::Standard);
+    pCanvasPage->SetCanvasPage();
+    mpCanvasPage = pCanvasPage;
+
+    populatePagePreviewsGrid();
 
     return pCanvasPage->GetPageNum() / 2;
 }
@@ -1467,4 +1483,71 @@ sd::UndoManager* SdDrawDocument::GetUndoManager() const
     return mpDocSh ? dynamic_cast< sd::UndoManager* 
>(mpDocSh->GetUndoManager()) : nullptr;
 }
 
+static int calculateGridColumns(const sal_uInt16 nCnt)
+{
+    int n = static_cast<int>(nCnt);
+    int srqtN = std::round(std::sqrt(n));
+
+    return (n % srqtN) ? srqtN + 1 : srqtN;
+}
+
+void SdDrawDocument::populatePagePreviewsGrid()
+{
+    sal_uInt16 nPageCnt = GetSdPageCount(PageKind::Standard) - 1; // don't 
count the canvas page
+    sal_uInt16 nTotalCol = 
static_cast<sal_uInt16>(calculateGridColumns(nPageCnt));
+    sal_uInt16 nTotalRow = nPageCnt / nTotalCol + (nPageCnt % nTotalCol ? 1 : 
0);
+
+    // width and height of a standard 16:9 page
+    sal_uInt16 nWidth = 28000;
+    sal_uInt16 nHeight = 15750;
+
+    // the factor by which width & height will be divided
+    sal_uInt8 nFactor = 3;
+
+    // TODO: this should also vary based on the available space
+    sal_uInt16 nGapWidth = 500;
+    sal_uInt16 nGapHeight = 500;
+
+    ::tools::Long nPreviewWidth;
+    ::tools::Long nPreviewHeight;
+    ::tools::Long nTotalGridWidth;
+    ::tools::Long nTotalGridHeight;
+    do
+    {
+        nTotalGridWidth = (nTotalCol - 1) * nGapWidth;
+        nTotalGridHeight = (nTotalRow - 1) * nGapHeight;
+        nPreviewWidth = (nWidth / nFactor);
+        nPreviewHeight = (nHeight / nFactor);
+        nTotalGridWidth += nPreviewWidth * nTotalCol;
+        nTotalGridHeight += nPreviewHeight * nTotalRow;
+        nFactor++;
+    }
+    while (nTotalGridWidth >= mpCanvasPage->GetWidth() ||
+            nTotalGridHeight >= mpCanvasPage->GetHeight());
+
+    ::tools::Long nY = (mpCanvasPage->GetHeight() - nTotalGridHeight) / 2;
+    for (sal_uInt16 nRow = 0; nRow < nTotalRow; nRow++)
+    {
+        ::tools::Long nX = (mpCanvasPage->GetWidth() - nTotalGridWidth) / 2;
+        for (sal_uInt16 nCol = 0; nCol < nTotalCol; nCol++)
+        {
+            sal_uInt16 nCurrentPageIndex = nTotalCol * nRow + nCol;
+            if (nCurrentPageIndex == nPageCnt)
+                return;
+            SdPage* pPage = GetSdPage(nCurrentPageIndex, PageKind::Standard);
+            if (pPage->IsCanvasPage()) break;
+            const sal_uInt16 nPageNum = pPage->GetPageNum();
+            mpCanvasPage->CreatePresObj(PresObjKind::PagePreview, true, 
::tools::Rectangle(Point(nX, nY), Size(nPreviewWidth, nPreviewHeight)), 
OUString(), nPageNum);
+            nX += nPreviewWidth + nGapWidth;
+        }
+        nY += nPreviewHeight + nGapHeight;
+    }
+}
+
+void SdDrawDocument::updateCanvasPreviewsGrid()
+{
+    SdrPage* pPage = mpCanvasPage.get();
+    pPage->ClearSdrObjList();
+    populatePagePreviewsGrid();
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 0d8d5aeebd6c..386fc9bf930d 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -284,7 +284,7 @@ void SdPage::EnsureMasterPageDefaultBackground()
 
 /** creates a presentation object with the given PresObjKind on this page. A 
user call will be set
 */
-SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const 
::tools::Rectangle& rRect, const OUString& rCustomPrompt)
+SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const 
::tools::Rectangle& rRect, const OUString& rCustomPrompt, const sal_uInt16 
nPagePreviewNum)
 {
     SfxUndoManager* pUndoManager(static_cast< SdDrawDocument& 
>(getSdrModelFromSdrPage()).GetUndoManager());
     const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && 
IsInserted();
@@ -428,6 +428,22 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, 
bool bVertical, const ::t
         }
         break;
 
+        case PresObjKind::PagePreview:
+        {
+            if (nPagePreviewNum < getSdrModelFromSdrPage().GetPageCount())
+            {
+                pSdrObj = new SdrPageObj(getSdrModelFromSdrPage(), 
getSdrModelFromSdrPage().GetPage(nPagePreviewNum));
+            }
+            else
+            {
+                pSdrObj = new SdrPageObj(getSdrModelFromSdrPage());
+            }
+            pSdrObj->SetMarkProtect(false);
+            pSdrObj->SetResizeProtect(false);
+            pSdrObj->SetMoveProtect(false);
+        }
+        break;
+
         case PresObjKind::Header:
         case PresObjKind::Footer:
         case PresObjKind::DateTime:
@@ -916,7 +932,7 @@ const o3tl::enumarray<PresObjKind, const char*> 
PresObjKindVector = {
     "PRESOBJ_TEXT" ,"PRESOBJ_GRAPHIC" , "PRESOBJ_OBJECT",
     "PRESOBJ_CHART", "PRESOBJ_ORGCHART", "PRESOBJ_TABLE",
     "PRESOBJ_PAGE", "PRESOBJ_HANDOUT",
-    "PRESOBJ_NOTES","PRESOBJ_HEADER", "PRESOBJ_FOOTER",
+    "PRESOBJ_NOTES", "PRESOBJ_PAGEPREVIEW", "PRESOBJ_HEADER", "PRESOBJ_FOOTER",
     "PRESOBJ_DATETIME", "PRESOBJ_SLIDENUMBER", "PRESOBJ_CALC",
     "PRESOBJ_MEDIA"
 };
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx 
b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 9d10f5d8e838..23d130092c13 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -250,7 +250,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
         case SID_INSERT_CANVAS_SLIDE:
         {
             SdDrawDocument* pDoc = pShell->GetDoc();
-            sal_uInt16 nCanvasPageIndex = pDoc->InsertCanvasPage();
+            sal_uInt16 nCanvasPageIndex = pDoc->GetOrInsertCanvasPage();
             SdPage* pCanvasPage = 
static_cast<SdPage*>(pDoc->GetPage(nCanvasPageIndex));
 
             view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index a99c386a435e..ae0acb28b4b2 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -1503,6 +1503,9 @@ Reference< drawing::XShape >  
SdGenericDrawPage::CreateShape(SdrObject *pObj) co
             case PresObjKind::Handout:
                 aShapeType += "HandoutShape";
                 break;
+            case PresObjKind::PagePreview:
+                aShapeType += "PageShape";
+                break;
             case PresObjKind::Notes:
                 aShapeType += "NotesShape";
                 break;
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 541f13404dcb..47264a5f0b20 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1395,7 +1395,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
         break;
         case SID_INSERT_CANVAS_SLIDE:
         {
-            sal_uInt16 nCanvasPageIndex = GetDoc()->InsertCanvasPage();
+            sal_uInt16 nCanvasPageIndex = GetDoc()->GetOrInsertCanvasPage();
             Cancel(); // Don't know what this does
             SwitchPage(nCanvasPageIndex);
             rReq.Done();
commit 90d410298855a0e1c5d125685e80a0803809dc7c
Author:     Mohit Marathe <[email protected]>
AuthorDate: Fri Oct 10 11:11:34 2025 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Wed Oct 29 15:29:59 2025 +0100

    sd: add uno command for inserting a canvas page
    
    Executing `.uno:InsertCanvasPage` will insert a page of size 5m x 5m at
    the last page.
    
    Signed-off-by: Mohit Marathe <[email protected]>
    Change-Id: Ic6c9237e9e763de7f1e32d4d1a95c56c0e4ed5a1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192319
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
index 8d5102facea3..3b53ffb9e7e1 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
@@ -835,6 +835,14 @@
           <value>1</value>
         </prop>
       </node>
+      <node oor:name=".uno:InsertCanvasSlide" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">New Canvas Slide</value>
+        </prop>
+        <prop oor:name="Properties" oor:type="xs:int">
+          <value>1</value>
+        </prop>
+      </node>
       <node oor:name=".uno:ImportFromFile" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Insert Page from File...</value>
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index 4725c2f961e9..16433cd14ec8 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -376,6 +376,7 @@
 #define SID_NOTES_MASTER_MODE               (SID_SD_START+350)
     // FREE
 #define SID_INSERTPAGE_QUICK                (SID_SD_START+352)
+#define SID_INSERT_CANVAS_SLIDE             (SID_SD_START+353)
     // FREE
 #define SID_INSERT_FLD_PAGE_TITLE           (SID_SD_START+356)
 #define SID_INSERT_FLD_DATE_VAR             (SID_SD_START+357)
diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index 91677bc5b562..d1e4944e13ea 100644
--- a/sd/inc/drawdoc.hxx
+++ b/sd/inc/drawdoc.hxx
@@ -1030,6 +1030,9 @@ public:
         bool bIsPageObj,
         const sal_Int32 nInsertPosition);
 
+
+    SAL_DLLPRIVATE sal_uInt16 InsertCanvasPage ();
+
     /** return the document fonts for latin, cjk and ctl according to the 
current
         languages set at this document */
     SAL_DLLPRIVATE void getDefaultFonts( vcl::Font& rLatinFont, vcl::Font& 
rCJKFont, vcl::Font& rCTLFont );
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx
index 1b2cafc550c9..af4bdf48ed5b 100644
--- a/sd/inc/sdpage.hxx
+++ b/sd/inc/sdpage.hxx
@@ -122,6 +122,7 @@ friend class sd::UndoAttrObject;
     rtl_TextEncoding meCharSet;           ///< Text encoding
     sal_uInt16  mnPaperBin;               ///< PaperBin
     SdPageLink* mpPageLink;               ///< Page link (at left sides only)
+    bool    mbIsCanvasPage;               ///< whether the page is a canvas 
page
 
     // PDF link annotations for read-only pdfium
     std::vector<std::pair<basegfx::B2DRectangle, OUString>> maLinkAnnotations;
@@ -401,6 +402,9 @@ public:
 
     static sal_uInt16 mnLastPageId;
 
+    bool IsCanvasPage() const { return mbIsCanvasPage; }
+    void SetCanvasPage() { mbIsCanvasPage = true; }
+
 private:
     bool mbIsPrecious;
 
diff --git a/sd/sdi/SlideSorterController.sdi b/sd/sdi/SlideSorterController.sdi
index 22bc64214868..a278785f11cd 100644
--- a/sd/sdi/SlideSorterController.sdi
+++ b/sd/sdi/SlideSorterController.sdi
@@ -328,6 +328,11 @@ interface SlideSorterView
         ExecMethod = ExecMovePageLast ;
         StateMethod = GetStateMovePageLast ;
     ]
+    SID_INSERT_CANVAS_SLIDE
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetMenuState ;
+    ]
 }
 
 shell SlideSorterController
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index 9301c094a545..d934a9f12b10 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -160,6 +160,11 @@ interface DrawView
         ExecMethod = FuTemporary ;
         StateMethod = GetMenuState ;
     ]
+    SID_INSERT_CANVAS_SLIDE
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetMenuState ;
+    ]
     SID_HYPERLINK_SETLINK // ole : no, status : no
     [
         ExecMethod = FuTemporary ;
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index 96526e024d0d..819ff5f31cd0 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -2229,6 +2229,23 @@ SfxVoidItem InsertPage SID_INSERTPAGE
     GroupId = SfxGroupId::Insert;
 ]
 
+SfxVoidItem InsertCanvasSlide SID_INSERT_CANVAS_SLIDE
+()
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = SfxGroupId::Insert;
+]
+
 SfxVoidItem InsertPageField SID_INSERT_FLD_PAGE
 ()
 [
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 5c03bb7848e1..660b4ee8234d 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -56,6 +56,7 @@
 #include <DrawDocShell.hxx>
 
 #include "PageListWatcher.hxx"
+#include <strings.hxx>
 #include <unokywds.hxx>
 
 using namespace ::sd;
@@ -1445,6 +1446,22 @@ void SdDrawDocument::SetupNewPage (
     }
 }
 
+sal_uInt16 SdDrawDocument::InsertCanvasPage()
+{
+    sal_uInt16 nLastPageNum = GetSdPageCount(PageKind::Standard);
+    SdPage* pLastStandardPage = GetSdPage(nLastPageNum - 1, 
PageKind::Standard);
+
+    sal_uInt16 nCanvasPageNum = CreatePage(pLastStandardPage, 
PageKind::Standard, u"Canvas Page"_ustr, u"Canvas notes page"_ustr, 
AutoLayout::AUTOLAYOUT_NONE, AutoLayout::AUTOLAYOUT_NONE, false, true, 
pLastStandardPage->GetPageNum() + 2);
+
+    SdPage* pCanvasPage = GetSdPage(nCanvasPageNum, PageKind::Standard);
+
+    const Size aCanvasSize(500000, 500000);
+
+    ResizeCurrentPage(pCanvasPage, aCanvasSize, PageKind::Standard);
+
+    return pCanvasPage->GetPageNum() / 2;
+}
+
 sd::UndoManager* SdDrawDocument::GetUndoManager() const
 {
     return mpDocSh ? dynamic_cast< sd::UndoManager* 
>(mpDocSh->GetUndoManager()) : nullptr;
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx 
b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index c686e3a9246d..9d10f5d8e838 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -247,6 +247,20 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
             rRequest.Done();
             break;
 
+        case SID_INSERT_CANVAS_SLIDE:
+        {
+            SdDrawDocument* pDoc = pShell->GetDoc();
+            sal_uInt16 nCanvasPageIndex = pDoc->InsertCanvasPage();
+            SdPage* pCanvasPage = 
static_cast<SdPage*>(pDoc->GetPage(nCanvasPageIndex));
+
+            view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
+            PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
+            mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
+            
mrSlideSorter.GetController().GetPageSelector().SelectPage(pCanvasPage);
+            rRequest.Done();
+        }
+        break;
+
         case SID_DELETE_PAGE:
         case SID_DELETE_MASTER_PAGE:
         case SID_DELETE: // we need SID_CUT to handle the delete key
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index b2affde7eafe..541f13404dcb 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1393,6 +1393,14 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
             rReq.Done ();
         }
         break;
+        case SID_INSERT_CANVAS_SLIDE:
+        {
+            sal_uInt16 nCanvasPageIndex = GetDoc()->InsertCanvasPage();
+            Cancel(); // Don't know what this does
+            SwitchPage(nCanvasPageIndex);
+            rReq.Done();
+        }
+        break;
 
         case SID_DUPLICATE_PAGE:
         {

Reply via email to