officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu |    
8 
 officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu  |   
10 +
 sd/UIConfig_simpress.mk                                                  |    
2 
 sd/inc/app.hrc                                                           |    
1 
 sd/inc/drawdoc.hxx                                                       |    
6 
 sd/inc/sdpage.hxx                                                        |    
4 
 sd/sdi/_drvwsh.sdi                                                       |    
5 
 sd/sdi/sdraw.sdi                                                         |   
17 +
 sd/source/core/drawdoc2.cxx                                              |   
96 +++++++++-
 sd/source/core/sdpage.cxx                                                |    
2 
 sd/source/ui/slidesorter/controller/SlideSorterController.cxx            |   
14 +
 sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx                  |   
27 ++
 sd/source/ui/view/ViewClipboard.cxx                                      |    
5 
 sd/source/ui/view/drviews2.cxx                                           |   
10 +
 sd/source/ui/view/drviews7.cxx                                           |   
11 +
 sd/source/ui/view/viewshe3.cxx                                           |    
2 
 sd/uiconfig/simpress/popupmenu/pagepanecanvas.xml                        |   
13 +
 sd/uiconfig/simpress/popupmenu/pagepanecanvasmaster.xml                  |   
13 +
 18 files changed, 241 insertions(+), 5 deletions(-)

New commits:
commit d85ca5acb86cdbc764abfd33489a26dc23486b0b
Author:     Mohit Marathe <[email protected]>
AuthorDate: Fri Oct 24 12:34:55 2025 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Mon Jan 12 14:00:48 2026 +0100

    sd: add support for shuffling slides from canvas page
    
    added .uno:ReshufflePages which when executed will re-order the pages
    based on the position of their previews on the canvas page.
    
    Sorting logic:
    1. Sort the previews based on their y-center
    2. Form a row if the y-centers are within a tolerance limit
    3. Sort the row based on their x-center (also considering RTL locale)
    4. Repeat for each rows
    
    Signed-off-by: Mohit Marathe <[email protected]>
    Change-Id: If654e0cc14686aed2ad6cd69f2dc81249924ee2c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192940
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196697

diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
index 51c278d38124..ee76a67aba1c 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
@@ -2215,6 +2215,14 @@
           <value>1</value>
         </prop>
       </node>
+      <node oor:name=".uno:ReshufflePages" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Re-order pages</value>
+        </prop>
+        <prop oor:name="Properties" oor:type="xs:int">
+          <value>1</value>
+        </prop>
+      </node>
       <node oor:name=".uno:AssignLayout?WhatLayout:long=20" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Blank Slide</value>
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index 7adaa74bdbed..28f64693da82 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -347,6 +347,7 @@
     // FREE
 #define SID_INSERTPAGE_QUICK                (SID_SD_START+352)
 #define SID_INSERT_CANVAS_SLIDE             (SID_SD_START+353)
+#define SID_SHUFFLE_PAGES                   (SID_SD_START+354)
     // 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 c15f6a36a31e..6481b05a34b4 100644
--- a/sd/inc/drawdoc.hxx
+++ b/sd/inc/drawdoc.hxx
@@ -1069,6 +1069,10 @@ public:
         bool bUndo = true,
         const OUString& sNewName = OUString());
 
+    /** Re-order the pages based on the position of their previews on canvas 
page.
+     */
+    void ReshufflePages();
+
 private:
 
     void UpdatePageRelativeURLsImpl(const std::function<void(const 
SvxFieldItem & rFieldItem, editeng::SvxFieldItemUpdater& rFieldItemUpdater)>& 
rItemCallback);
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index c48f0489ae67..b6b2d805dfea 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -165,6 +165,11 @@ interface DrawView
         ExecMethod = FuTemporary ;
         StateMethod = GetMenuState ;
     ]
+    SID_SHUFFLE_PAGES
+    [
+        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 cffa0a8547bd..0c7b7ad9dbb3 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -1690,6 +1690,23 @@ SfxVoidItem InsertCanvasSlide SID_INSERT_CANVAS_SLIDE
     GroupId = SfxGroupId::Insert;
 ]
 
+SfxVoidItem ReshufflePages SID_SHUFFLE_PAGES
+()
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = SfxGroupId::Modify;
+]
+
 SfxVoidItem InsertPageField SID_INSERT_FLD_PAGE
 ()
 [
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 5acdde9def5c..bef7d40cc20f 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <algorithm>
 #include <vcl/settings.hxx>
 
 #include <sal/log.hxx>
@@ -1470,6 +1471,79 @@ void SdDrawDocument::SetupNewPage (
     }
 }
 
+void SdDrawDocument::ReshufflePages()
+{
+    SdrObjList* pObjList = mpCanvasPage.get();
+    std::vector<SdrPageObj*> aPageOrder;
+
+    SdrObjListIter aIter(pObjList, SdrIterMode::Flat);
+    for (SdrObject* pObj = aIter.Next(); pObj; pObj = aIter.Next())
+    {
+        if (pObj->GetObjIdentifier() == SdrObjKind::Page)
+        {
+            SdrPageObj* pPageObj = static_cast<SdrPageObj*>(pObj);
+            aPageOrder.push_back(pPageObj);
+        }
+    }
+
+    // Sort the previews by comparing their y-center (compare x-center as a 
tie-breaker)
+    std::sort(aPageOrder.begin(), aPageOrder.end(),
+        [](const SdrPageObj* pObj1, const SdrPageObj* pObj2) {
+              const ::tools::Rectangle& rect1 = pObj1->GetSnapRect();
+              const ::tools::Rectangle& rect2 = pObj2->GetSnapRect();
+              const ::tools::Long yCenter1 = (rect1.Top() + rect1.Bottom()) / 
2;
+              const ::tools::Long yCenter2 = (rect2.Top() + rect2.Bottom()) / 
2;
+
+              if (yCenter1 != yCenter2)
+                  return yCenter1 < yCenter2;
+
+              const ::tools::Long xCenter1 = (rect1.Left() + rect1.Right()) / 
2;
+              const ::tools::Long xCenter2 = (rect2.Left() + rect2.Right()) / 
2;
+              return xCenter1 < xCenter2;
+        }
+    );
+
+    const bool bIsRTL = AllSettings::GetLayoutRTL();
+
+    // Form a row, and sort them based on their x-center
+    for (size_t rowStart = 0; rowStart < aPageOrder.size();)
+    {
+        const ::tools::Rectangle& rect0 = aPageOrder[rowStart]->GetSnapRect();
+        const ::tools::Long top = rect0.Top();
+        const ::tools::Long bottom = rect0.Bottom();
+
+        size_t rowEnd = rowStart;
+        while (rowEnd < aPageOrder.size())
+        {
+            const ::tools::Rectangle& rect = aPageOrder[rowEnd]->GetSnapRect();
+            const ::tools::Long yCenter = (rect.Top() + rect.Bottom()) / 2;
+
+            if (yCenter < top || yCenter > bottom)
+                break;
+            rowEnd++;
+        }
+
+        std::stable_sort(aPageOrder.begin() + rowStart, aPageOrder.begin() + 
rowEnd,
+            [&bIsRTL](const SdrPageObj* pObj1, const SdrPageObj* pObj2) {
+            const ::tools::Rectangle& rect1 = pObj1->GetSnapRect();
+            const ::tools::Rectangle& rect2 = pObj2->GetSnapRect();
+            const ::tools::Long xCenter1 = (rect1.Left() + rect1.Right()) / 2;
+            const ::tools::Long xCenter2 = (rect2.Left() + rect2.Right()) / 2;
+
+            return bIsRTL ? (xCenter1 > xCenter2) : (xCenter1 < xCenter2);
+        });
+    }
+
+    for (size_t i = 0; i < aPageOrder.size(); i++)
+    {
+        SdPage* pPage = 
static_cast<SdPage*>(aPageOrder[i]->GetReferencedPage());
+        sal_uInt16 nCurrentPageNum = pPage->GetPageNum();
+        sal_uInt16 nTargetPageNum = 2 * i + 1;
+        MovePage(nCurrentPageNum, nTargetPageNum); // Standard page
+        MovePage(nCurrentPageNum + 1, nTargetPageNum + 1); // Notes page
+    }
+}
+
 sal_uInt16 SdDrawDocument::GetOrInsertCanvasPage()
 {
     if (HasCanvasPage())
@@ -1478,7 +1552,10 @@ sal_uInt16 SdDrawDocument::GetOrInsertCanvasPage()
     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);
+    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);
     if (!pCanvasPage)
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 3c590da5d15a..7d5903b786c4 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1408,6 +1408,16 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
         }
         break;
 
+        case SID_SHUFFLE_PAGES:
+        {
+            if (!GetDoc()->HasCanvasPage())
+                break;
+            GetDoc()->ReshufflePages();
+            Cancel();
+            rReq.Done();
+        }
+        break;
+
         case SID_DUPLICATE_PAGE:
         {
             auto slideSorter = 
sd::slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase());
commit 9e0c90103c83b0eaaef3773d5fcf0d4f513986ef
Author:     Mohit Marathe <[email protected]>
AuthorDate: Tue Oct 21 10:55:32 2025 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Mon Jan 12 14:00:36 2026 +0100

    sd: make sure that canvas page remains as the last page
    
    This commit restricts the following operations:
    - duplicating canvas page
    - moving canvas page up
    - inserting a page after the canvas page
    - including canvas page in the slideshow
    
    Also, prevent deleting the only non-canvas page.
    
    Signed-off-by: Mohit Marathe <[email protected]>
    Change-Id: I8050dfc9836719f345e0f5349f25b62cd164344d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192769
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196696

diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu
index 8475ac8c9847..2532a49ea2e8 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu
@@ -125,6 +125,11 @@
           <value xml:lang="en-US">Slide Sorter/Pane</value>
         </prop>
       </node>
+      <node oor:name="private:resource/popupmenu/pagepanecanvas" 
oor:op="replace">
+        <prop oor:name="UIName" oor:type="xs:string">
+          <value xml:lang="en-US">Slide Sorter/Pane (Canvas)</value>
+        </prop>
+      </node>
       <node oor:name="private:resource/popupmenu/pagepanenosel" 
oor:op="replace">
         <prop oor:name="UIName" oor:type="xs:string">
           <value xml:lang="en-US">Slide Sorter/Pane (no selection)</value>
@@ -135,6 +140,11 @@
           <value xml:lang="en-US">Master Slide Sorter/Pane</value>
         </prop>
       </node>
+      <node oor:name="private:resource/popupmenu/pagepanecanvasmaster" 
oor:op="replace">
+        <prop oor:name="UIName" oor:type="xs:string">
+          <value xml:lang="en-US">Master Slide Sorter/Pane (Canvas)</value>
+        </prop>
+      </node>
       <node oor:name="private:resource/popupmenu/pagepanenoselmaster" 
oor:op="replace">
         <prop oor:name="UIName" oor:type="xs:string">
           <value xml:lang="en-US">Master Slide Sorter/Pane (no 
selection)</value>
diff --git a/sd/UIConfig_simpress.mk b/sd/UIConfig_simpress.mk
index c70fc3bc9cb3..ad21ed0e48fb 100644
--- a/sd/UIConfig_simpress.mk
+++ b/sd/UIConfig_simpress.mk
@@ -37,9 +37,11 @@ $(eval $(call 
gb_UIConfig_add_popupmenufiles,modules/simpress,\
        sd/uiconfig/simpress/popupmenu/oleobject \
        sd/uiconfig/simpress/popupmenu/outline \
        sd/uiconfig/simpress/popupmenu/pagepanemaster \
+       sd/uiconfig/simpress/popupmenu/pagepanecanvasmaster \
        sd/uiconfig/simpress/popupmenu/pagepanenoselmaster \
        sd/uiconfig/simpress/popupmenu/pagepanenosel \
        sd/uiconfig/simpress/popupmenu/pagepane \
+       sd/uiconfig/simpress/popupmenu/pagepanecanvas \
        sd/uiconfig/simpress/popupmenu/pagetab \
        sd/uiconfig/simpress/popupmenu/page \
        sd/uiconfig/simpress/popupmenu/table \
diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index bb485147e9fb..c15f6a36a31e 100644
--- a/sd/inc/drawdoc.hxx
+++ b/sd/inc/drawdoc.hxx
@@ -1001,7 +1001,7 @@ public:
         bool bIsPageObj,
         const sal_Int32 nInsertPosition);
 
-    SAL_DLLPRIVATE bool HasCanvasPage() const { return mpCanvasPage != 
nullptr; }
+    SAL_DLLPRIVATE bool HasCanvasPage() const { return mpCanvasPage.is(); }
 
     SAL_DLLPRIVATE sal_uInt16 GetOrInsertCanvasPage ();
 
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx
index 013fecbccb56..35d095513cac 100644
--- a/sd/inc/sdpage.hxx
+++ b/sd/inc/sdpage.hxx
@@ -123,6 +123,7 @@ friend class sd::UndoAttrObject;
     sal_uInt16  mnPaperBin;               ///< PaperBin
     SdPageLink* mpPageLink;               ///< Page link (at left sides only)
     bool    mbIsCanvasPage;               ///< whether the page is a canvas 
page
+    bool    mbIsCanvasMasterPage;         ///< whether it is the master page 
of canvas page
 
     // PDF link annotations for read-only pdfium
     std::vector<std::pair<basegfx::B2DRectangle, OUString>> maLinkAnnotations;
@@ -404,6 +405,9 @@ public:
     bool IsCanvasPage() const { return mbIsCanvasPage; }
     void SetCanvasPage() { mbIsCanvasPage = true; }
 
+    bool IsCanvasMasterPage() const { return mbIsCanvasMasterPage; }
+    void SetCanvasMasterPage() { mbIsCanvasMasterPage = true; }
+
 private:
     bool mbIsPrecious;
 
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 03f1ceab22f6..5acdde9def5c 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -486,11 +486,16 @@ void SdDrawDocument::DeletePage(sal_uInt16 nPgNum)
 // Remove page
 rtl::Reference<SdrPage> SdDrawDocument::RemovePage(sal_uInt16 nPgNum)
 {
+    // Do not remove the only non-canvas page
+    if (HasCanvasPage() && GetSdPageCount(PageKind::Standard) == 2)
+        return nullptr;
     rtl::Reference<SdrPage> pPage = FmFormModel::RemovePage(nPgNum);
 
     bool bLast = ((nPgNum+1)/2 == (GetPageCount()+1)/2);
 
     auto pSdPage = static_cast<SdPage*>(pPage.get());
+    if (pSdPage->IsCanvasPage())
+        mpCanvasPage = nullptr;
     pSdPage->DisconnectLink();
     ReplacePageInCustomShows( pSdPage, nullptr );
     UpdatePageObjectsInNotes(nPgNum);
@@ -1220,6 +1225,8 @@ sal_uInt16 SdDrawDocument::CreatePage (
     bool bIsPageObj,
     const sal_Int32 nInsertPosition)
 {
+    if (pActualPage->IsCanvasPage())
+        return 0xffff;
     SdPage* pPreviousStandardPage;
     SdPage* pPreviousNotesPage;
     rtl::Reference<SdPage> pStandardPage;
@@ -1303,6 +1310,9 @@ sal_uInt16 SdDrawDocument::DuplicatePage (sal_uInt16 
nPageNum)
     // Get current page
     SdPage* pActualPage = GetSdPage(nPageNum, ePageKind);
 
+    if (pActualPage->IsCanvasPage())
+        return 0xffff;
+
     // Get background flags
     SdrLayerAdmin& rLayerAdmin = GetLayerAdmin();
     SdrLayerID aBckgrnd = rLayerAdmin.GetLayerID(sUNO_LayerName_background);
@@ -1326,6 +1336,8 @@ sal_uInt16 SdDrawDocument::DuplicatePage (
     bool bIsPageObj,
     const sal_Int32 nInsertPosition)
 {
+    if (pActualPage->IsCanvasPage())
+        return 0xffff;
     SdPage* pPreviousStandardPage;
     SdPage* pPreviousNotesPage;
     rtl::Reference<SdPage> pStandardPage;
@@ -1469,6 +1481,8 @@ sal_uInt16 SdDrawDocument::GetOrInsertCanvasPage()
     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);
+    if (!pCanvasPage)
+        return 0xffff;
 
     const Size aCanvasSize(500000, 500000);
 
@@ -1476,6 +1490,9 @@ sal_uInt16 SdDrawDocument::GetOrInsertCanvasPage()
     pCanvasPage->SetCanvasPage();
     mpCanvasPage = pCanvasPage;
 
+    SdPage* pMasterCanvas = 
static_cast<SdPage*>(&pCanvasPage->TRG_GetMasterPage());
+    pMasterCanvas->SetCanvasMasterPage();
+
     populatePagePreviewsGrid();
 
     return pCanvasPage->GetPageNum() / 2;
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 1918e12b2827..ecc7e7948139 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -122,6 +122,8 @@ SdPage::SdPage(SdDrawDocument& rNewDoc, bool bMasterPage)
 ,   meCharSet(osl_getThreadTextEncoding())
 ,   mnPaperBin(PAPERBIN_PRINTER_SETTINGS)
 ,   mpPageLink(nullptr)
+,   mbIsCanvasPage(false)
+,   mbIsCanvasMasterPage(false)
 ,   mnTransitionType(0)
 ,   mnTransitionSubtype(0)
 ,   mbTransitionDirection(true)
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx 
b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index 4d5e8ef107c9..802968eef71b 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -297,12 +297,22 @@ bool SlideSorterController::Command (
             if (mrModel.GetEditMode() == EditMode::Page)
             {
                 if (pPage != nullptr)
-                    aPopupId = "pagepane";
+                {
+                    if (pPage->IsCanvasPage())
+                        aPopupId = "pagepanecanvas";
+                    else
+                        aPopupId = "pagepane";
+                }
                 else
                     aPopupId = "pagepanenosel";
             }
             else if (pPage != nullptr)
-                aPopupId = "pagepanemaster";
+            {
+                if (pPage->IsCanvasMasterPage())
+                    aPopupId = "pagepanecanvasmaster";
+                else
+                    aPopupId = "pagepanemaster";
+            }
             else
                 aPopupId = "pagepanenoselmaster";
 
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx 
b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index b4b7a8905b70..14cb5f9b88c0 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -792,6 +792,13 @@ void SlideSorterViewShell::GetStateMovePageFirst 
(SfxItemSet& rSet)
         rSet.DisableItem( SID_MOVE_PAGE_FIRST );
         rSet.DisableItem( SID_MOVE_PAGE_UP );
     }
+
+    if (GetDoc()->HasCanvasPage())
+        if (firstSelectedPageNo == 
GetDoc()->GetSdPageCount(PageKind::Standard) - 1)
+        {
+            rSet.DisableItem( SID_MOVE_PAGE_FIRST );
+            rSet.DisableItem( SID_MOVE_PAGE_UP );
+        }
 }
 
 void SlideSorterViewShell::ExecMovePageUp (SfxRequest& /*rReq*/)
@@ -814,6 +821,10 @@ void SlideSorterViewShell::ExecMovePageUp (SfxRequest& 
/*rReq*/)
     if (firstSelectedPageNo == 0)
         return;
 
+    if (GetDoc()->HasCanvasPage())
+        if (firstSelectedPageNo == 
GetDoc()->GetSdPageCount(PageKind::Standard) - 1)
+            return;
+
     // Move pages before firstSelectedPageNo - 1 (so after firstSelectedPageNo 
- 2),
     // remembering that -1 means at first, which is good.
     GetDoc()->MoveSelectedPages( firstSelectedPageNo - 2 );
@@ -843,6 +854,9 @@ void SlideSorterViewShell::ExecMovePageDown (SfxRequest& 
/*rReq*/)
     lastSelectedPageNo = (lastSelectedPageNo - 1) / 2;
     if (lastSelectedPageNo == nNoOfPages - 1)
         return;
+    if (GetDoc()->HasCanvasPage())
+        if (lastSelectedPageNo == nNoOfPages - 2)
+            return;
 
     // Move to position after lastSelectedPageNo
     GetDoc()->MoveSelectedPages( lastSelectedPageNo + 1 );
@@ -869,7 +883,10 @@ void SlideSorterViewShell::ExecMovePageLast (SfxRequest& 
/*rReq*/)
     sal_uInt16 nNoOfPages = GetDoc()->GetSdPageCount(PageKind::Standard);
 
     // Move to position after last page No (=Number of pages - 1)
-    GetDoc()->MoveSelectedPages( nNoOfPages - 1 );
+    if (!GetDoc()->HasCanvasPage())
+        GetDoc()->MoveSelectedPages( nNoOfPages - 1 );
+    else
+        GetDoc()->MoveSelectedPages( nNoOfPages - 2 );
 
     PostMoveSlidesActions(xSelection);
 }
@@ -901,6 +918,14 @@ void SlideSorterViewShell::GetStateMovePageLast 
(SfxItemSet& rSet)
         rSet.DisableItem( SID_MOVE_PAGE_LAST );
         rSet.DisableItem( SID_MOVE_PAGE_DOWN );
     }
+    if (GetDoc()->HasCanvasPage())
+    {
+        if (lastSelectedPageNo == nNoOfPages - 2)
+        {
+            rSet.DisableItem( SID_MOVE_PAGE_LAST );
+            rSet.DisableItem( SID_MOVE_PAGE_DOWN );
+        }
+    }
 }
 
 void SlideSorterViewShell::PostMoveSlidesActions(const 
std::shared_ptr<SlideSorterViewShell::PageSelection> &rpSelection)
diff --git a/sd/source/ui/view/ViewClipboard.cxx 
b/sd/source/ui/view/ViewClipboard.cxx
index aa29705afd8d..25d1c572ff84 100644
--- a/sd/source/ui/view/ViewClipboard.cxx
+++ b/sd/source/ui/view/ViewClipboard.cxx
@@ -172,6 +172,11 @@ sal_uInt16 ViewClipboard::DetermineInsertPosition  ()
         if( pPage->IsSelected() )
             nInsertPos = nPage * 2 + 3;
     }
+    if (rDoc.HasCanvasPage())
+    {
+        if (nInsertPos == rDoc.GetPageCount())
+            nInsertPos = rDoc.GetPageCount() - 2;
+    }
 
     return nInsertPos;
 }
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 0084c405afc0..7c591d45ed67 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -851,6 +851,17 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
         rSet.DisableItem (SID_DELETE_MASTER_PAGE);
         rSet.DisableItem (SID_RENAME_MASTER_PAGE);
         rSet.DisableItem (SID_CLOSE_MASTER_VIEW);
+
+        if (mpActualPage->IsCanvasPage())
+        {
+            rSet.DisableItem(SID_INSERTPAGE);
+            rSet.DisableItem(SID_INSERTPAGE_QUICK);
+            rSet.DisableItem(SID_INSERTFILE);
+            rSet.DisableItem(SID_DUPLICATE_PAGE);
+            rSet.DisableItem(SID_PRESENTATION_LAYOUT);
+            rSet.DisableItem(SID_HIDE_SLIDE);
+            rSet.DisableItem(SID_SHOW_SLIDE);
+        }
     }
     else
     {
diff --git a/sd/source/ui/view/viewshe3.cxx b/sd/source/ui/view/viewshe3.cxx
index 894bf969af9c..6c7cd1f06d0d 100644
--- a/sd/source/ui/view/viewshe3.cxx
+++ b/sd/source/ui/view/viewshe3.cxx
@@ -164,6 +164,8 @@ SdPage* ViewShell::CreateOrDuplicatePage (
     SdPage* pPage,
     const sal_Int32 nInsertPosition)
 {
+    if (pPage->IsCanvasPage())
+        return nullptr;
     sal_uInt16 nSId = rRequest.GetSlot();
     SdDrawDocument* pDocument = GetDoc();
     SdrLayerAdmin& rLayerAdmin = pDocument->GetLayerAdmin();
diff --git a/sd/uiconfig/simpress/popupmenu/pagepanecanvas.xml 
b/sd/uiconfig/simpress/popupmenu/pagepanecanvas.xml
new file mode 100644
index 000000000000..0cff10845b42
--- /dev/null
+++ b/sd/uiconfig/simpress/popupmenu/pagepanecanvas.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu";>
+  <menu:menuitem menu:id=".uno:RenameSlide"/>
+  <menu:menuitem menu:id=".uno:DeleteSlide"/>
+</menu:menupopup>
diff --git a/sd/uiconfig/simpress/popupmenu/pagepanecanvasmaster.xml 
b/sd/uiconfig/simpress/popupmenu/pagepanecanvasmaster.xml
new file mode 100644
index 000000000000..c6d0366c333f
--- /dev/null
+++ b/sd/uiconfig/simpress/popupmenu/pagepanecanvasmaster.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu";>
+  <menu:menuitem menu:id=".uno:DeleteMasterPage"/>
+  <menu:menuitem menu:id=".uno:RenameMasterPage"/>
+</menu:menupopup>

Reply via email to