summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2016-07-11 11:59:41 +0200
committerCaolán McNamara <caolanm@redhat.com>2016-07-11 15:31:04 +0000
commit570ad81bcbc56b1d20378c6342c27458fcee430c (patch)
tree9eeea5d85dabe4454cdf39076abbbfeea0ba441c
parent95024423f38a5050f614e2d14837eebdbc348a4a (diff)
rhbz#1351292 correctly set edit mode
... when switching between different shells, e.g., from Outline to Slide master. Change-Id: I22ef6f6cac73c52fb1bedd97e653b4b57c5a7a24 (cherry picked from commit b0535f3944975c1f6cdadc149d70502843331f86) Reviewed-on: https://gerrit.libreoffice.org/27110 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sd/source/ui/framework/tools/FrameworkHelper.cxx57
1 files changed, 40 insertions, 17 deletions
diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx
index 842df16b3aa2..ed74b7ee3123 100644
--- a/sd/source/ui/framework/tools/FrameworkHelper.cxx
+++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx
@@ -518,6 +518,41 @@ OUString FrameworkHelper::GetViewURL (ViewShell::ShellType eType)
}
}
+namespace
+{
+
+void updateEditMode(const Reference<XView> &xView, FrameworkHelper* const pHelper, const EditMode eEMode, bool updateFrameView)
+{
+ // Ensure we have the expected edit mode
+ // The check is only for DrawViewShell as OutlineViewShell
+ // and SlideSorterViewShell have no master mode
+ const ::std::shared_ptr<ViewShell> pCenterViewShell (pHelper->GetViewShell(xView));
+ DrawViewShell* pDrawViewShell
+ = dynamic_cast<DrawViewShell*>(pCenterViewShell.get());
+ if (pDrawViewShell != nullptr)
+ {
+ pCenterViewShell->Broadcast (
+ ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_START));
+
+ pDrawViewShell->ChangeEditMode(eEMode, pDrawViewShell->IsLayerModeActive());
+ if (updateFrameView)
+ pDrawViewShell->WriteFrameViewData();
+
+ pCenterViewShell->Broadcast (
+ ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_END));
+ }
+}
+
+void asyncUpdateEditMode(FrameworkHelper* const pHelper, const EditMode eEMode)
+{
+ Reference<XResourceId> xPaneId (
+ FrameworkHelper::CreateResourceId(framework::FrameworkHelper::msCenterPaneURL));
+ Reference<XView> xView (pHelper->GetView(xPaneId));
+ updateEditMode(xView, pHelper, eEMode, true);
+}
+
+}
+
void FrameworkHelper::HandleModeChangeSlot (
sal_uLong nSlotId,
SfxRequest& rRequest)
@@ -552,7 +587,6 @@ void FrameworkHelper::HandleModeChangeSlot (
Reference<XResourceId> xPaneId (
CreateResourceId(framework::FrameworkHelper::msCenterPaneURL));
Reference<XView> xView (GetView(xPaneId));
- ::std::shared_ptr<ViewShell> pCenterViewShell (GetViewShell(xView));
// Compute requested view
OUString sRequestedView;
@@ -595,26 +629,15 @@ void FrameworkHelper::HandleModeChangeSlot (
if (!(xView.is() && xView->getResourceId()->getResourceURL().equals(sRequestedView)))
{
+ const auto xId = CreateResourceId(sRequestedView, msCenterPaneURL);
mxConfigurationController->requestResourceActivation(
- CreateResourceId(sRequestedView, msCenterPaneURL),
+ xId,
ResourceActivationMode_REPLACE);
+ RunOnResourceActivation(xId, std::bind(&asyncUpdateEditMode, this, eEMode));
}
-
- // Ensure we have the expected edit mode
- // The check is only for DrawViewShell as OutlineViewShell
- // and SlideSorterViewShell have no master mode
- DrawViewShell* pDrawViewShell
- = dynamic_cast<DrawViewShell*>(pCenterViewShell.get());
- if (pDrawViewShell != nullptr)
+ else
{
- pCenterViewShell->Broadcast (
- ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_START));
-
- pDrawViewShell->ChangeEditMode (
- eEMode, pDrawViewShell->IsLayerModeActive());
-
- pCenterViewShell->Broadcast (
- ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_END));
+ updateEditMode(xView, this, eEMode, false);
}
}
catch (RuntimeException&)