officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu | 8 ++++ sd/inc/app.hrc | 1 sd/inc/drawdoc.hxx | 3 + sd/inc/sdpage.hxx | 4 ++ sd/sdi/SlideSorterController.sdi | 5 ++ sd/sdi/_drvwsh.sdi | 5 ++ sd/sdi/sdraw.sdi | 17 ++++++++++ sd/source/core/drawdoc2.cxx | 17 ++++++++++ sd/source/ui/slidesorter/controller/SlsSlotManager.cxx | 14 ++++++++ sd/source/ui/view/drviews2.cxx | 8 ++++ 10 files changed, 82 insertions(+)
New commits: commit 1a03df815c8673919847ce02c6b2bd56237a6293 Author: Mohit Marathe <[email protected]> AuthorDate: Fri Oct 10 11:11:34 2025 +0530 Commit: Mohit Marathe <[email protected]> CommitDate: Thu Jan 8 06:53:23 2026 +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]> (cherry picked from commit 90d410298855a0e1c5d125685e80a0803809dc7c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196680 diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu index 46d9353ea053..95183de1111e 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu @@ -846,6 +846,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 d63a4d35c843..7adaa74bdbed 100644 --- a/sd/inc/app.hrc +++ b/sd/inc/app.hrc @@ -346,6 +346,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 3c16e264da04..db7656d450b1 100644 --- a/sd/inc/drawdoc.hxx +++ b/sd/inc/drawdoc.hxx @@ -999,6 +999,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 04e4fd1d3f3d..a63a362373f3 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; @@ -400,6 +401,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 a87109cb8b9e..2284cde27056 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 165a56f3d537..cffa0a8547bd 100644 --- a/sd/sdi/sdraw.sdi +++ b/sd/sdi/sdraw.sdi @@ -1673,6 +1673,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 c89b605a90e3..65efc70f84f9 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; @@ -1444,6 +1445,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 5d6f8b1dd796..04f6f57ea3ce 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -248,6 +248,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 e6d10e0f25db..d825f69b95b1 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1399,6 +1399,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: {
