From 1cabcedcff279b95635e457ef36bb4a07f7947aa Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 12 Sep 2016 11:56:02 +0200 Subject: sw: implement SdrMarkView::GetSfxViewShell() API With this, the graphic selection is no longer lost when creating a new view. That happened as the SwView ctor calls SdrMarkView::SetMarkHandles() while the new view is not yet current, which resulted clearing the graphic selection in the old view, not in the new one. A side-effect of introducing SwDrawView::GetSfxViewShell() is that now SwView::getPart() is called from the SwView dtor, guard against doing any real work there in that situation to avoid potentially reading already deleted data. Change-Id: I4fab39a907d2cbe228c0fc8d44bedc64893387d1 Reviewed-on: https://gerrit.libreoffice.org/28832 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 65828fa693507d699369f0dbc3c0bfc31638d945) --- sw/source/core/draw/dview.cxx | 5 +++++ sw/source/core/inc/dview.hxx | 3 +++ 2 files changed, 8 insertions(+) (limited to 'sw/source/core') diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index ad6f7df0764e..ab5df7cad783 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -919,6 +919,11 @@ void SwDrawView::ReplaceMarkedDrawVirtObjs( SdrMarkView& _rMarkView ) } } +SfxViewShell* SwDrawView::GetSfxViewShell() const +{ + return rImp.GetShell()->GetSfxViewShell(); +} + void SwDrawView::DeleteMarked() { SwDoc* pDoc = Imp().GetShell()->GetDoc(); diff --git a/sw/source/core/inc/dview.hxx b/sw/source/core/inc/dview.hxx index 9bf76c1ede5e..4145c51f59a2 100644 --- a/sw/source/core/inc/dview.hxx +++ b/sw/source/core/inc/dview.hxx @@ -112,6 +112,9 @@ public: // method to replace marked/selected // by its reference object for delete of selection and group selection static void ReplaceMarkedDrawVirtObjs( SdrMarkView& _rMarkView ); + + /// See SdrMarkView::GetSfxViewShell(). + SfxViewShell* GetSfxViewShell() const override; }; #endif -- cgit v1.2.3