diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2021-03-22 16:11:03 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2021-04-08 15:44:38 +0200 |
commit | 9968367d841a0a1bd81e1535cfc01b782d2febb5 (patch) | |
tree | 3daa04b4717c2db7ea26b5518412b5f31e5fc75a /sd | |
parent | 33ec919b6302a3e768488cb9e86a2b2c475cb177 (diff) |
impress: avoid crash when user edits text and other deletes slide
We need to end text edit when page is deleted by other user.
Change-Id: I89824c91f5652421a443feb9412acbae65db8800
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112917
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113784
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/view/drviews4.cxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index c3557b4980d8..ec3ec5d11d31 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -58,6 +58,7 @@ #include <drawview.hxx> #include <svx/bmpmask.hxx> #include <LayerTabBar.hxx> +#include <ViewShellBase.hxx> #include <SlideSorterViewShell.hxx> #include <svx/svditer.hxx> @@ -65,6 +66,26 @@ #include <navigatr.hxx> #include <memory> +namespace { + void EndTextEditOnPage(sal_uInt16 nPageId) + { + SfxViewShell* pShell = SfxViewShell::GetFirst(); + while (pShell) + { + ::sd::ViewShellBase* pBase = dynamic_cast<::sd::ViewShellBase*>(pShell); + if (pBase) + { + ::sd::ViewShell* pViewSh = pBase->GetMainViewShell().get(); + ::sd::DrawViewShell* pDrawSh = dynamic_cast<::sd::DrawViewShell*>(pViewSh); + if (pDrawSh && pDrawSh->GetDrawView() && pDrawSh->getCurrentPage()->getPageId() == nPageId) + pDrawSh->GetDrawView()->SdrEndTextEdit(); + } + + pShell = SfxViewShell::GetNext(*pShell); + } + } +} + namespace sd { #define PIPETTE_RANGE 0 @@ -97,6 +118,7 @@ void DrawViewShell::DeleteActualPage() if((bUseSlideSorter && IsSelected(nPageIndex)) || (!bUseSlideSorter && pPage->IsSelected())) { + EndTextEditOnPage(pPage->getPageId()); Reference< XDrawPage > xPage( xPages->getByIndex( nPageIndex ), UNO_QUERY_THROW ); pagesToDelete.push_back(xPage); } |