officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu | 8 + sd/inc/app.hrc | 1 sd/inc/drawdoc.hxx | 4 sd/sdi/_drvwsh.sdi | 5 sd/sdi/sdraw.sdi | 17 ++ sd/source/core/drawdoc2.cxx | 79 +++++++++- sd/source/ui/func/fusel.cxx | 11 + sd/source/ui/view/drviews2.cxx | 10 + vcl/Module_vcl.mk | 7 9 files changed, 140 insertions(+), 2 deletions(-)
New commits: commit 1b8aae678342fd0b641525c621968c2235f39d66 Author: Mohit Marathe <[email protected]> AuthorDate: Wed Nov 12 17:43:18 2025 +0530 Commit: Michael Stahl <[email protected]> CommitDate: Mon Jan 12 19:25:34 2026 +0100 sd: switch to corresponding page on double clicking page preview Signed-off-by: Mohit Marathe <[email protected]> Change-Id: I99f120fd0504d5925188cb9a4578ada49436c544 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193861 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Michael Stahl <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196799 Tested-by: Jenkins diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx index c65486f8e2a7..deeb3e56889a 100644 --- a/sd/source/ui/func/fusel.cxx +++ b/sd/source/ui/func/fusel.cxx @@ -20,6 +20,7 @@ #include <fusel.hxx> #include <svx/svddrgmt.hxx> #include <svx/svdpagv.hxx> +#include <svx/svdopage.hxx> #include <svx/svdogrp.hxx> #include <svx/scene3d.hxx> #include <vcl/imapobj.hxx> @@ -351,6 +352,16 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt) bReturn = pPV->EnterGroup(pObj); } } + else if (pObj->GetObjIdentifier() == SdrObjKind::Page) + { + if (rMEvt.GetClicks() == 2) + { + SdrPageObj* pPageObj = static_cast<SdrPageObj*>(pObj); + sal_uInt16 nPageNum = (pPageObj->GetReferencedPage()->GetPageNum() - 1) / 2; + DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(&mrViewShell); + pDrawViewShell->SwitchPage(nPageNum); + } + } } // #i71727# replaced else here with two possibilities, once the original else (!pObj) commit b162ae4be3aa6ff7401693313b2ebc0bbe43e56e Author: Mohit Marathe <[email protected]> AuthorDate: Fri Oct 24 12:34:55 2025 +0530 Commit: Michael Stahl <[email protected]> CommitDate: Mon Jan 12 19:25:26 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/+/196798 Tested-by: Jenkins diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu index 95183de1111e..4defbc77139f 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 2284cde27056..56f8c74e749d 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 956c92eb2180..533d7076f760 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 dd9b5ec78bee08253fe617ee4799bc5bb1110f06 Author: Tor Lillqvist <[email protected]> AuthorDate: Mon Mar 10 18:46:33 2025 +0200 Commit: Tor Lillqvist <[email protected]> CommitDate: Mon Jan 12 19:25:23 2026 +0100 We do need salsrc.res also in the --enable-headless case Change-Id: I4e53550585a156bb0be09eaaa97ef29f90f9bba8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194578 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197098 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <[email protected]> diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 6b16214b93dc..a23eb85a04f3 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -141,9 +141,14 @@ $(eval $(call gb_Module_add_targets,vcl,\ )) endif -ifeq ($(OS)-$(USE_HEADLESS_CODE),WNT-) +ifeq ($(OS),WNT) $(eval $(call gb_Module_add_targets,vcl,\ WinResTarget_vcl \ +)) +endif + +ifeq ($(OS)-$(USE_HEADLESS_CODE),WNT-) +$(eval $(call gb_Module_add_targets,vcl,\ Library_vclplug_win \ )) endif
