diff options
-rw-r--r-- | sd/source/ui/slidesorter/controller/SlsSlotManager.cxx | 19 | ||||
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 39 |
2 files changed, 39 insertions, 19 deletions
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index 05fd566fe9c3..1f54ce0f5fe2 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -334,23 +334,6 @@ void SlotManager::FuPermanent (SfxRequest& rRequest) // Invalidate( SID_OBJECT_SELECT ); } -class KeepSlideSorterInSyncWithPageChanges -{ - view::SlideSorterView::DrawLock m_aDrawLock; - SlideSorterController::ModelChangeLock m_aModelLock; - PageSelector::UpdateLock m_aUpdateLock; - SelectionObserver::Context m_aContext; - -public: - KeepSlideSorterInSyncWithPageChanges(SlideSorter& rSlideSorter) - : m_aDrawLock(rSlideSorter) - , m_aModelLock(rSlideSorter.GetController()) - , m_aUpdateLock(rSlideSorter) - , m_aContext(rSlideSorter) - { - } -}; - void SlotManager::FuSupport (SfxRequest& rRequest) { switch (rRequest.GetSlot()) @@ -423,7 +406,6 @@ void SlotManager::FuSupport (SfxRequest& rRequest) = dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell()); if (pViewShell != nullptr) { - KeepSlideSorterInSyncWithPageChanges aWatcher(mrSlideSorter); pViewShell->ImpSidUndo (false, rRequest); } break; @@ -435,7 +417,6 @@ void SlotManager::FuSupport (SfxRequest& rRequest) = dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell()); if (pViewShell != nullptr) { - KeepSlideSorterInSyncWithPageChanges aWatcher(mrSlideSorter); pViewShell->ImpSidRedo (false, rRequest); } break; diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index fa9d18925be0..c46b9ef84e1a 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -58,6 +58,8 @@ #include "TextObjectBar.hxx" #include "GraphicObjectBar.hxx" #include "MediaObjectBar.hxx" +#include "SlideSorter.hxx" +#include "SlideSorterViewShell.hxx" #include "ViewShellManager.hxx" #include "FormShellManager.hxx" #include <svx/dialogs.hrc> @@ -70,6 +72,10 @@ #include <svl/slstitm.hxx> #include <sfx2/request.hxx> #include "SpellDialogChildWindow.hxx" +#include "controller/SlideSorterController.hxx" +#include "controller/SlsPageSelector.hxx" +#include "controller/SlsSelectionObserver.hxx" +#include "view/SlideSorterView.hxx" #include <basegfx/tools/zoomtools.hxx> @@ -1226,8 +1232,33 @@ void ViewShell::ImpGetRedoStrings(SfxItemSet &rSet) const } } +class KeepSlideSorterInSyncWithPageChanges +{ + sd::slidesorter::view::SlideSorterView::DrawLock m_aDrawLock; + sd::slidesorter::controller::SlideSorterController::ModelChangeLock m_aModelLock; + sd::slidesorter::controller::PageSelector::UpdateLock m_aUpdateLock; + sd::slidesorter::controller::SelectionObserver::Context m_aContext; + +public: + KeepSlideSorterInSyncWithPageChanges(sd::slidesorter::SlideSorter& rSlideSorter) + : m_aDrawLock(rSlideSorter) + , m_aModelLock(rSlideSorter.GetController()) + , m_aUpdateLock(rSlideSorter) + , m_aContext(rSlideSorter) + { + } +}; + void ViewShell::ImpSidUndo(bool, SfxRequest& rReq) { + //The xWatcher keeps the SlideSorter selection in sync + //with the page insertions/deletions that Undo may introduce + std::unique_ptr<KeepSlideSorterInSyncWithPageChanges> xWatcher; + slidesorter::SlideSorterViewShell* pSlideSorterViewShell + = slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase()); + if (pSlideSorterViewShell) + xWatcher.reset(new KeepSlideSorterInSyncWithPageChanges(pSlideSorterViewShell->GetSlideSorter())); + ::svl::IUndoManager* pUndoManager = ImpGetUndoManager(); sal_uInt16 nNumber(1); const SfxItemSet* pReqArgs = rReq.GetArgs(); @@ -1271,6 +1302,14 @@ void ViewShell::ImpSidUndo(bool, SfxRequest& rReq) void ViewShell::ImpSidRedo(bool, SfxRequest& rReq) { + //The xWatcher keeps the SlideSorter selection in sync + //with the page insertions/deletions that Undo may introduce + std::unique_ptr<KeepSlideSorterInSyncWithPageChanges> xWatcher; + slidesorter::SlideSorterViewShell* pSlideSorterViewShell + = slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase()); + if (pSlideSorterViewShell) + xWatcher.reset(new KeepSlideSorterInSyncWithPageChanges(pSlideSorterViewShell->GetSlideSorter())); + ::svl::IUndoManager* pUndoManager = ImpGetUndoManager(); sal_uInt16 nNumber(1); const SfxItemSet* pReqArgs = rReq.GetArgs(); |