summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2019-06-30 19:37:24 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-07-02 15:43:08 +0200
commit9dca7c2fac5c6b83a6910aa61b1a2a316f36d948 (patch)
tree93be150b27791ae6d5d520891c1bf13e9d7a861f
parent9ed060d38fd8dc85bebccbc735bce8bf66a89df4 (diff)
tdf#125824 svx: fix crash with view1 and view2 doing textedit
Similar to 3a874f1c80c37e8b35666e1d73161ff762eb7e4c Change-Id: I51bffa4d33e82bb90b8a42787f55c12746bcd8c2 Reviewed-on: https://gerrit.libreoffice.org/74931 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit 091f573728e7951d5dc4ef138117499b7480885f) Reviewed-on: https://gerrit.libreoffice.org/74949
-rw-r--r--sd/qa/unit/uiimpress.cxx18
-rw-r--r--svx/source/svdraw/svdedxv.cxx2
2 files changed, 19 insertions, 1 deletions
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 2d3710faa7ed..b8d9017b2cf9 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -19,6 +19,7 @@
#include <sfx2/viewfrm.hxx>
#include <svl/intitem.hxx>
#include <svx/svxids.hrc>
+#include <svl/stritem.hxx>
#include <DrawDocShell.hxx>
#include <ViewShell.hxx>
@@ -100,6 +101,23 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf111522)
// Without the accompanying fix in place, this test would have failed with an assertion failure
// in SdrObjEditView::SdrEndTextEdit() as mpOldTextEditUndoManager was not nullptr.
pViewShell2->GetViewFrame()->GetDispatcher()->Execute(SID_UNDO, SfxCallMode::SYNCHRON);
+
+ // Start text edit in window 2.
+ // tdf#125824
+ pView2->MarkObj(pShape2, pView2->GetSdrPageView());
+ pView2->SdrBeginTextEdit(pShape2);
+ CPPUNIT_ASSERT(pView2->IsTextEdit());
+ // Write 'test' inside the shape
+ SfxStringItem aInputString(SID_ATTR_CHAR, "test");
+ pViewShell2->GetViewFrame()->GetDispatcher()->ExecuteList(SID_ATTR_CHAR, SfxCallMode::SYNCHRON,
+ { &aInputString });
+ CPPUNIT_ASSERT(pView2->GetTextEditObject());
+ EditView& rEditView = pView2->GetTextEditOutlinerView()->GetEditView();
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), rEditView.GetSelection().nStartPos);
+ pView2->SdrEndTextEdit();
+ // Without the accompanying fix in place, this test would have failed with an assertion failure
+ // in SdrObjEditView::SdrEndTextEdit() as mpOldTextEditUndoManager was not nullptr.
+ pViewShell2->GetViewFrame()->GetDispatcher()->Execute(SID_UNDO, SfxCallMode::SYNCHRON);
}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 0f7361bbd6d8..2af15dba79a3 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1454,7 +1454,7 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
pTEOutliner->SetBeginPasteOrDropHdl(Link<PasteOrDropInfos*,void>());
pTEOutliner->SetEndPasteOrDropHdl(Link<PasteOrDropInfos*,void>());
- const bool bUndo = IsUndoEnabled();
+ const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
if( bUndo )
{
OUString aObjName(pTEObj->TakeObjNameSingul());