summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-03-22 16:11:03 +0100
committerMichael Meeks <michael.meeks@collabora.com>2021-04-09 11:22:28 +0100
commit7625be8507b59eb51f98e1d28505fb24c17e6deb (patch)
tree9b96deafee20e8b456e8a8cd22a6ee1ee8d6ca12
parentimpress: delete correct page when has multiple users (diff)
downloadcore-7625be8507b59eb51f98e1d28505fb24c17e6deb.tar.gz
core-7625be8507b59eb51f98e1d28505fb24c17e6deb.zip
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>
-rw-r--r--sd/source/ui/view/drviews4.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index f86bb4b06f3b..f333dba5f71e 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);
}