summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-05-17 16:25:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-05-18 12:54:38 +0100
commite226c19e9136dda366c1485a9d53a0c5d433387c (patch)
tree5c899941c808b44880f64f9fe1a4d031ef7dbec2
parent27fd3c4e66c079a0b19a5ff0ff1bf25caaa9b637 (diff)
give this tremendously useful snippet a descriptive name and de-duplicate it
This is the magic smoke which sets the right selection on an undo of move slides when the slidesorter has the focus. If the main shell has the focus then the undo doesn't reselect the original slides like it does when this artifact is in the mix. Change-Id: I5ebe0195225136bfaf81e28ad4ba8e9ec431cc22
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSlotManager.cxx27
1 files changed, 19 insertions, 8 deletions
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 56e7e4b7e2c4..05fd566fe9c3 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -334,6 +334,23 @@ 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())
@@ -406,10 +423,7 @@ void SlotManager::FuSupport (SfxRequest& rRequest)
= dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell());
if (pViewShell != nullptr)
{
- view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
- SlideSorterController::ModelChangeLock aModelLock (mrSlideSorter.GetController());
- PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
- SelectionObserver::Context aContext (mrSlideSorter);
+ KeepSlideSorterInSyncWithPageChanges aWatcher(mrSlideSorter);
pViewShell->ImpSidUndo (false, rRequest);
}
break;
@@ -421,10 +435,7 @@ void SlotManager::FuSupport (SfxRequest& rRequest)
= dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell());
if (pViewShell != nullptr)
{
- view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
- SlideSorterController::ModelChangeLock aModelLock (mrSlideSorter.GetController());
- PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
- SelectionObserver::Context aContext (mrSlideSorter);
+ KeepSlideSorterInSyncWithPageChanges aWatcher(mrSlideSorter);
pViewShell->ImpSidRedo (false, rRequest);
}
break;