summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2019-07-02 17:36:50 +0200
committerXisco FaulĂ­ <xiscofauli@libreoffice.org>2019-07-04 15:24:16 +0200
commite79dbb8c6c4d2cf1ce2cf0ce67c53ed4bb09898b (patch)
treede570e5150c097018345963a8b336ff38c4eb66a
parent96d1b176f02f0396544e6c13c170f895b13fdfde (diff)
tdf#126197: EndTextEdit on all views before delete/cut shape
Change-Id: I3da93e5c72ee6f6f99120758e870d654e01a0ec7 Reviewed-on: https://gerrit.libreoffice.org/75001 Tested-by: Jenkins Reviewed-by: Xisco FaulĂ­ <xiscofauli@libreoffice.org> (cherry picked from commit 80db66c4f345ac469943f871308b14b7f5ed0a11) Reviewed-on: https://gerrit.libreoffice.org/75079
-rw-r--r--sd/qa/unit/data/tdf126197.odpbin0 -> 10501 bytes
-rw-r--r--sd/qa/unit/uiimpress.cxx31
-rw-r--r--sd/source/ui/view/drviewse.cxx5
3 files changed, 36 insertions, 0 deletions
diff --git a/sd/qa/unit/data/tdf126197.odp b/sd/qa/unit/data/tdf126197.odp
new file mode 100644
index 000000000000..cbe5b074464f
--- /dev/null
+++ b/sd/qa/unit/data/tdf126197.odp
Binary files differ
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index b8d9017b2cf9..2125820c7c50 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -120,6 +120,37 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf111522)
pViewShell2->GetViewFrame()->GetDispatcher()->Execute(SID_UNDO, SfxCallMode::SYNCHRON);
}
+CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf126197)
+{
+ // Load the document and create two new windows.
+ mxComponent = loadFromDesktop(m_directories.getURLFromSrc("sd/qa/unit/data/tdf126197.odp"));
+ auto pImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get());
+ sd::ViewShell* pViewShell = pImpressDocument->GetDocShell()->GetViewShell();
+ pViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_NEWWINDOW, SfxCallMode::SYNCHRON);
+ sd::ViewShell* pViewShell1 = pImpressDocument->GetDocShell()->GetViewShell();
+ pViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_NEWWINDOW, SfxCallMode::SYNCHRON);
+ sd::ViewShell* pViewShell2 = pImpressDocument->GetDocShell()->GetViewShell();
+ CPPUNIT_ASSERT(pViewShell1 != pViewShell2);
+
+ // Start text edit in window 1.
+ SdPage* pPage1 = pViewShell1->GetActualPage();
+ SdrObject* pShape1 = pPage1->GetObj(0);
+ SdrView* pView1 = pViewShell1->GetView();
+ pView1->MarkObj(pShape1, pView1->GetSdrPageView());
+ pView1->SdrBeginTextEdit(pShape1);
+ CPPUNIT_ASSERT(pView1->IsTextEdit());
+
+ SdPage* pPage2 = pViewShell2->GetActualPage();
+ CPPUNIT_ASSERT_EQUAL(pPage1, pPage2);
+ SdrObject* pShape2 = pPage2->GetObj(0);
+ CPPUNIT_ASSERT_EQUAL(pShape1, pShape2);
+ SdrView* pView2 = pViewShell2->GetView();
+ pView2->MarkObj(pShape2, pView2->GetSdrPageView());
+
+ // Without the accompanying fix in place, this test would have failed with an assertion failure
+ // in SdrObjEditView::SdrEndTextEdit()
+ pViewShell2->GetViewFrame()->GetDispatcher()->Execute(SID_DELETE, SfxCallMode::SYNCHRON);
+}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index 0c9ee3867fec..9cebd8c4f0d8 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -824,6 +824,10 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
}
else
{
+ //tdf#126197: EndTextEdit in all views if current one is not in TextEdit
+ if ( !mpDrawView->IsTextEdit() )
+ mpDrawView->EndTextEditAllViews();
+
if(HasCurrentFunction())
{
GetCurrentFunction()->DoCut();
@@ -998,6 +1002,7 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
}
else
{
+ mpDrawView->EndTextEditAllViews();
FuDeleteSelectedObjects();
}
rReq.Ignore ();