sd/source/ui/slidesorter/controller/SlideSorterController.cxx      |    7 
+++----
 sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx  |    4 ++--
 sd/source/ui/slidesorter/inc/view/SlsILayerPainter.hxx             |    3 +--
 sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx |    4 ++--
 sd/source/ui/slidesorter/model/SlideSorterModel.cxx                |    2 +-
 sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx            |    4 ++--
 sd/source/ui/slidesorter/view/SlideSorterView.cxx                  |    4 ++--
 sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx     |    4 ++--
 sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx                 |    4 ++--
 9 files changed, 17 insertions(+), 19 deletions(-)

New commits:
commit 3ea95fb50744eb576580360804a3b7cbe4074caa
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Jun 30 13:55:03 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Tue Jul 1 10:36:57 2025 +0200

    ILayerInvalidator can be held by unique_ptr
    
    Change-Id: I132e4a6593c35e55001a80ebdea94a46bb53f184
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187212
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sd/source/ui/slidesorter/inc/view/SlsILayerPainter.hxx 
b/sd/source/ui/slidesorter/inc/view/SlsILayerPainter.hxx
index 57b90af0a715..9acd8274f012 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsILayerPainter.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsILayerPainter.hxx
@@ -33,7 +33,6 @@ public:
 
     virtual void Invalidate (const ::tools::Rectangle& rInvalidationBox) = 0;
 };
-typedef std::shared_ptr<ILayerInvalidator> SharedILayerInvalidator;
 
 class ILayerPainter
 {
@@ -41,7 +40,7 @@ public:
     virtual ~ILayerPainter() {}
 
     virtual void SetLayerInvalidator (
-        const SharedILayerInvalidator& rpInvalidator) = 0;
+        std::unique_ptr<ILayerInvalidator> pInvalidator) = 0;
     virtual void Paint (
         OutputDevice& rDevice,
         const ::tools::Rectangle& rRepaintArea) = 0;
diff --git a/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx 
b/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx
index 3f4cc221862a..d676c4487b22 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx
@@ -47,7 +47,7 @@ public:
     InsertionIndicatorOverlay (SlideSorter& rSlideSorter);
     virtual ~InsertionIndicatorOverlay() override;
 
-    virtual void SetLayerInvalidator (const SharedILayerInvalidator& 
rpInvalidator) override;
+    virtual void SetLayerInvalidator (std::unique_ptr<ILayerInvalidator> 
pInvalidator) override;
 
     void Create (const SdTransferable* pTransferable);
 
@@ -72,7 +72,7 @@ public:
 private:
     SlideSorter& mrSlideSorter;
     bool mbIsVisible;
-    SharedILayerInvalidator mpLayerInvalidator;
+    std::unique_ptr<ILayerInvalidator> mpLayerInvalidator;
     // Center of the insertion indicator.
     Point maLocation;
     BitmapEx maIcon;
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx 
b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index 9c056f39f033..db01b437ec74 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -74,7 +74,7 @@ namespace {
             mrView.Paint(rDevice,rRepaintArea);
         }
 
-        virtual void SetLayerInvalidator (const SharedILayerInvalidator&) 
override {}
+        virtual void SetLayerInvalidator (std::unique_ptr<ILayerInvalidator>) 
override {}
 
     private:
         SlideSorterView& mrView;
@@ -98,7 +98,7 @@ public:
         rDevice.DrawRect(rRepaintArea);
     }
 
-    virtual void SetLayerInvalidator (const SharedILayerInvalidator&) override 
{}
+    virtual void SetLayerInvalidator (std::unique_ptr<ILayerInvalidator>) 
override {}
 
     void SetColor (const Color& rColor) { maBackgroundColor = rColor; }
 
diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx 
b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
index 3e5139d32fb9..a5f768bfb2f8 100644
--- a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
+++ b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
@@ -301,9 +301,9 @@ void InsertionIndicatorOverlay::Paint (
     rDevice.DrawImage(maLocation, Image(maIcon));
 }
 
-void InsertionIndicatorOverlay::SetLayerInvalidator (const 
SharedILayerInvalidator& rpInvalidator)
+void InsertionIndicatorOverlay::SetLayerInvalidator 
(std::unique_ptr<ILayerInvalidator> pInvalidator)
 {
-    mpLayerInvalidator = rpInvalidator;
+    mpLayerInvalidator = std::move(pInvalidator);
 
     if (mbIsVisible && mpLayerInvalidator)
         mpLayerInvalidator->Invalidate(GetBoundingBox());
diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx 
b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
index 4bd3808992e0..427771b55f03 100644
--- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
@@ -228,7 +228,7 @@ void LayeredDevice::RegisterPainter (
         (*mpLayers)[nLayer]->Initialize(mpTargetWindow);
 
     rpPainter->SetLayerInvalidator(
-        
std::make_shared<LayerInvalidator>(shared_from_this(),mpTargetWindow,nLayer));
+        
std::make_unique<LayerInvalidator>(shared_from_this(),mpTargetWindow,nLayer));
 }
 
 void LayeredDevice::RemovePainter (
@@ -246,7 +246,7 @@ void LayeredDevice::RemovePainter (
         return;
     }
 
-    rpPainter->SetLayerInvalidator(SharedILayerInvalidator());
+    rpPainter->SetLayerInvalidator({});
 
     (*mpLayers)[nLayer]->RemovePainter(rpPainter);
 
commit 2bf4f8e58133ebe992120ade4e87a7eb5cb6ab5d
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Jun 30 13:48:39 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Tue Jul 1 10:36:48 2025 +0200

    SlotManager can be held by unique_ptr
    
    Change-Id: I8aa9f5369cdb4cc66177962da19a597015b8fc46
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187211
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx 
b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index 108eca1b97fd..51e6be5e6650 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -118,7 +118,7 @@ void SlideSorterController::Init()
     mpCurrentSlideManager = 
std::make_unique<CurrentSlideManager>(mrSlideSorter);
     mpPageSelector.reset(new PageSelector(mrSlideSorter));
     mpFocusManager.reset(new FocusManager(mrSlideSorter));
-    mpSlotManager = std::make_shared<SlotManager>(mrSlideSorter);
+    mpSlotManager = std::make_unique<SlotManager>(mrSlideSorter);
     mpScrollBarManager.reset(new ScrollBarManager(mrSlideSorter));
     mpSelectionManager = std::make_shared<SelectionManager>(mrSlideSorter);
     mpClipboard.reset(new Clipboard(mrSlideSorter));
@@ -217,10 +217,9 @@ CurrentSlideManager& 
SlideSorterController::GetCurrentSlideManager() const
     return *mpCurrentSlideManager;
 }
 
-std::shared_ptr<SlotManager> const & SlideSorterController::GetSlotManager() 
const
+SlotManager& SlideSorterController::GetSlotManager() const
 {
-    OSL_ASSERT(mpSlotManager != nullptr);
-    return mpSlotManager;
+    return *mpSlotManager;
 }
 
 std::shared_ptr<SelectionManager> const & 
SlideSorterController::GetSelectionManager() const
diff --git a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx 
b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
index 88d0968e7781..d80a87d386f8 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
@@ -144,7 +144,7 @@ public:
     ScrollBarManager& GetScrollBarManager();
 
     CurrentSlideManager& GetCurrentSlideManager() const;
-    std::shared_ptr<SlotManager> const& GetSlotManager() const;
+    SlotManager& GetSlotManager() const;
     std::shared_ptr<SelectionManager> const& GetSelectionManager() const;
     std::shared_ptr<InsertionIndicatorHandler> const& 
GetInsertionIndicatorHandler() const;
 
@@ -253,7 +253,7 @@ private:
     view::SlideSorterView& mrView;
     std::unique_ptr<PageSelector> mpPageSelector;
     std::unique_ptr<FocusManager> mpFocusManager;
-    std::shared_ptr<SlotManager> mpSlotManager;
+    std::unique_ptr<SlotManager> mpSlotManager;
     std::unique_ptr<ScrollBarManager> mpScrollBarManager;
     mutable std::unique_ptr<CurrentSlideManager> mpCurrentSlideManager;
     std::shared_ptr<SelectionManager> mpSelectionManager;
diff --git a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx 
b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
index 763768382703..e9e73285fba0 100644
--- a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
+++ b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
@@ -428,7 +428,7 @@ void SlideSorterModel::SetDocumentSlides (
         }
     }
 
-    mrSlideSorter.GetController().GetSlotManager()->NotifyEditModeChange();
+    mrSlideSorter.GetController().GetSlotManager().NotifyEditModeChange();
 }
 
 Reference<container::XIndexAccess> SlideSorterModel::GetDocumentSlides() const
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx 
b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index bd9fe5f1d0b7..07276f3f9c08 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -355,14 +355,14 @@ void SlideSorterViewShell::GetMenuState ( SfxItemSet& 
rSet)
 {
     ViewShell::GetMenuState(rSet);
     assert(mpSlideSorter);
-    mpSlideSorter->GetController().GetSlotManager()->GetMenuState(rSet);
+    mpSlideSorter->GetController().GetSlotManager().GetMenuState(rSet);
 }
 
 void SlideSorterViewShell::GetClipboardState ( SfxItemSet& rSet)
 {
     ViewShell::GetMenuState(rSet);
     assert(mpSlideSorter);
-    mpSlideSorter->GetController().GetSlotManager()->GetClipboardState(rSet);
+    mpSlideSorter->GetController().GetSlotManager().GetClipboardState(rSet);
 }
 
 void SlideSorterViewShell::ExecCtrl (SfxRequest& rRequest)

Reply via email to