sd/inc/drawdoc.hxx               |    2 +-
 sd/source/core/drawdoc2.cxx      |    7 +++----
 sd/source/ui/unoidl/unomodel.cxx |    7 +++----
 3 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 0ea7ee0bf5ef412b267038583441d308b2cb5943
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Apr 30 14:10:22 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Apr 30 20:33:26 2025 +0200

    const things up, elide a copy
    
    Change-Id: I8b81c69c4a01ff3a2dd9a58628e203f187ed5e0a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184843
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index 8abe00c78f55..61f374e46769 100644
--- a/sd/inc/drawdoc.hxx
+++ b/sd/inc/drawdoc.hxx
@@ -781,7 +781,7 @@ public:
     SAL_DLLPRIVATE void                SetSelected(SdPage* pPage, bool 
bSelect);
     SAL_DLLPRIVATE void                UnselectAllPages();
     SAL_DLLPRIVATE bool                MoveSelectedPages(sal_uInt16 
nTargetPage);
-    SAL_DLLPRIVATE bool MovePages(sal_uInt16 nTargetPage, 
std::vector<SdPage*>& vSelectedPages);
+    SAL_DLLPRIVATE bool MovePages(sal_uInt16 nTargetPage, const 
std::vector<SdPage*>& rSelectedPages);
 
     SdPage*GetMasterSdPage(sal_uInt16 nPgNum, PageKind ePgKind);
     sal_uInt16 GetMasterSdPageCount(PageKind ePgKind) const;
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 5c03bb7848e1..c89b605a90e3 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -806,7 +806,7 @@ bool SdDrawDocument::MoveSelectedPages(sal_uInt16 
nTargetPage)
 // + Move selected pages after said page
 //   (nTargetPage = (sal_uInt16)-1  --> move before first page)
 // + Returns sal_True when the page has been moved
-bool SdDrawDocument::MovePages(sal_uInt16 nTargetPage, std::vector<SdPage*>& 
vSelectedPages)
+bool SdDrawDocument::MovePages(sal_uInt16 nTargetPage, const 
std::vector<SdPage*>& rSelectedPages)
 {
     SdPage* pPage              = nullptr;
     sal_uInt16 nPage;
@@ -838,8 +838,7 @@ bool SdDrawDocument::MovePages(sal_uInt16 nTargetPage, 
std::vector<SdPage*>& vSe
     // Insert before the first page
     if (nPage == sal_uInt16(-1))
     {
-        std::vector<SdPage*>::reverse_iterator iter;
-        for (iter = vSelectedPages.rbegin(); iter != vSelectedPages.rend(); 
++iter)
+        for (auto iter = rSelectedPages.rbegin(); iter != 
rSelectedPages.rend(); ++iter)
         {
             nPage = (*iter)->GetPageNum();
             if (nPage != 0)
@@ -861,7 +860,7 @@ bool SdDrawDocument::MovePages(sal_uInt16 nTargetPage, 
std::vector<SdPage*>& vSe
     {
         nTargetPage = 2 * nPage + 1;    // PageKind::Standard --> absolute
 
-        for (const auto& rpPage : vSelectedPages)
+        for (const auto& rpPage : rSelectedPages)
         {
             nPage = rpPage->GetPageNum();
             if (nPage > nTargetPage)
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 0de64714ac22..4123f669e8c6 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -3991,10 +3991,9 @@ void SdXImpressDocument::moveSelectedParts(int 
nPosition, bool bDuplicate)
         = 
sd::slidesorter::SlideSorterViewShell::GetSlideSorter(pViewSh->GetViewShellBase());
     sd::slidesorter::SharedPageSelection pSelectedPage
         = pSlideSorter ? pSlideSorter->GetPageSelection() : nullptr;
-    std::vector<SdPage*> aPageList;
-    if (pSelectedPage)
-        aPageList = *pSelectedPage;
-    mpDoc->MovePages(nPosition, aPageList);
+    if (!pSelectedPage)
+        return;
+    mpDoc->MovePages(nPosition, *pSelectedPage);
 }
 
 OUString SdXImpressDocument::getPartInfo(int nPart)

Reply via email to