[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sd/qa svx/source

2019-07-31 Thread Xisco Fauli (via logerrit)
 sd/qa/uitest/impress_tests/tdf126605.py |   28 
 svx/source/svdraw/svdedtv1.cxx  |2 --
 2 files changed, 28 insertions(+), 2 deletions(-)

New commits:
commit ab1b1167b52f2fe73da921eb73abc299b497d3c2
Author: Xisco Fauli 
AuthorDate: Tue Jul 30 15:51:58 2019 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jul 31 15:22:43 2019 +0200

tdf#126605: Do not end TextEdit when changing an attribute

otherwise, pTextEditOutlinerView becomes nullptr in
svx/source/svdraw/svdedxv.cxx:2184

Regression from e6c7a018a0cfee395ce2886d41c908a2447ef5cc

Change-Id: I9d0645f637dc92b50d01682d119c0db60238e921
Reviewed-on: https://gerrit.libreoffice.org/76609
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 
Reviewed-by: Miklos Vajna 

diff --git a/sd/qa/uitest/impress_tests/tdf126605.py 
b/sd/qa/uitest/impress_tests/tdf126605.py
new file mode 100644
index ..744324717a6b
--- /dev/null
+++ b/sd/qa/uitest/impress_tests/tdf126605.py
@@ -0,0 +1,28 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf126605(UITestCase):
+
+   def test_run(self):
+self.ui_test.create_doc_in_start_center("impress")
+xTemplateDlg = self.xUITest.getTopFocusWindow()
+xCancelBtn = xTemplateDlg.getChild("cancel")
+self.ui_test.close_dialog_through_button(xCancelBtn)
+
+xDoc = self.xUITest.getTopFocusWindow()
+xEdit = xDoc.getChild("impress_win")
+xEdit.executeAction("TYPE", mkPropertyValues({"TEXT":"test"}))
+
+# Without the accompanying fix in place, it would crash at this point
+self.xUITest.executeCommand(".uno:ParaRightToLeft")
+self.xUITest.executeCommand(".uno:ParaLeftToRight")
+
+self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 44c4b2fe5201..b75099094576 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -765,8 +765,6 @@ void SdrEditView::SetNotPersistAttrToMarked(const 
SfxItemSet& rAttr)
 }
 
 const bool bUndo = IsUndoEnabled();
-if( bUndo )
-EndTextEditAllViews();
 
 // TODO: check if WhichRange is necessary.
 const size_t nMarkCount=GetMarkedObjectCount();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sd/qa svx/source

2019-07-01 Thread Xisco Fauli (via logerrit)
 sd/qa/unit/uiimpress.cxx  |   18 ++
 svx/source/svdraw/svdedxv.cxx |2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 1da42db5f3b8e382cc9ea3345a87e7ce495d44d9
Author: Xisco Fauli 
AuthorDate: Sun Jun 30 19:37:24 2019 +0200
Commit: Xisco Faulí 
CommitDate: Mon Jul 1 12:37:46 2019 +0200

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 
(cherry picked from commit 091f573728e7951d5dc4ef138117499b7480885f)
Reviewed-on: https://gerrit.libreoffice.org/74948
Reviewed-by: Xisco Faulí 

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 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -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,
+  {  
});
+CPPUNIT_ASSERT(pView2->GetTextEditObject());
+EditView& rEditView = pView2->GetTextEditOutlinerView()->GetEditView();
+CPPUNIT_ASSERT_EQUAL(static_cast(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 8935d2702804..cb9deae0ed19 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1475,7 +1475,7 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool 
bDontDeleteReally)
 
pTEOutliner->SetBeginPasteOrDropHdl(Link());
 pTEOutliner->SetEndPasteOrDropHdl(Link());
 
-const bool bUndo = IsUndoEnabled();
+const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
 if( bUndo )
 {
 OUString aObjName(pTEObj->TakeObjNameSingul());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sd/qa svx/source

2019-06-10 Thread Miklos Vajna (via logerrit)
 sd/qa/unit/uiimpress.cxx   |7 +++
 svx/source/svdraw/svddrgmt.cxx |2 +-
 svx/source/svdraw/svdedtv1.cxx |   24 
 3 files changed, 20 insertions(+), 13 deletions(-)

New commits:
commit 79cae65f4725d0a8abd5639dc298002d11b2626c
Author: Miklos Vajna 
AuthorDate: Fri Jun 7 17:20:34 2019 +0200
Commit: Xisco Faulí 
CommitDate: Mon Jun 10 11:57:58 2019 +0200

Related: tdf#111522 svx: fix crash with view1 doing textedit and 
resize/rotate

The two actually affected functions are SdrEditView::RotateMarkedObj()
and SdrDragObjOwn::EndSdrDrag(), but it looks like the other functions
in SdrEditView are safe to be changed the same way.

I expect IsUndoEnabled() can't be changed, though: that would mean there
would be no undo for the text edit itself, either.

If other actions still crash, the pattern is the same: put a breakpoint
on the SdrUndoAction constructor and see the backtrace to find the
function that calls IsUndoEnabled() without calling CanDoSdrUndo() at
the same time.

Change-Id: If9324e311ec6e9f68a951559e903e14bb72ea31c
Reviewed-on: https://gerrit.libreoffice.org/73669
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 9870ff897f088563426bee9567dd9cb722c2b929)
Reviewed-on: https://gerrit.libreoffice.org/73748
Reviewed-by: Xisco Faulí 

diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 910f4a9dd0c3..2d3710faa7ed 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -93,6 +93,13 @@ 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);
+
+// Rotate the shape in window 2 & undo.
+pView2->MarkObj(pShape2, pView2->GetSdrPageView());
+pView2->RotateMarkedObj(pShape2->GetLastBoundRect().Center(), 
/*nAngle=*/45);
+// 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/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 05d44ce6bf70..f41a7991ccec 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -1366,7 +1366,7 @@ bool SdrDragObjOwn::EndSdrDrag(bool /*bCopy*/)
 {
 std::unique_ptr pUndo;
 std::unique_ptr pUndo2;
-const bool bUndo = getSdrDragView().IsUndoEnabled();
+const bool bUndo = getSdrDragView().IsUndoEnabled() && 
getSdrDragView().CanDoSdrUndo();
 
 if( bUndo )
 {
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 66bc4c15ae69..47e05a0ad5e4 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -88,7 +88,7 @@ void SdrEditView::SetMarkedObjRect(const tools::Rectangle& 
rRect)
 long w1=rRect.Right()-x1;
 long h1=rRect.Bottom()-y1;
 
-const bool bUndo = IsUndoEnabled();
+const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
 if( bUndo )
 BegUndo(ImpGetDescriptionString(STR_EditPosSize));
 
@@ -208,7 +208,7 @@ void SdrEditView::MoveMarkedObj(const Size& rSiz, bool 
bCopy)
 
 void SdrEditView::ResizeMarkedObj(const Point& rRef, const Fraction& xFact, 
const Fraction& yFact, bool bCopy)
 {
-const bool bUndo = IsUndoEnabled();
+const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
 if( bUndo )
 {
 OUString aStr {ImpGetDescriptionString(STR_EditResize)};
@@ -242,7 +242,7 @@ void SdrEditView::ResizeMultMarkedObj(const Point& rRef,
 const bool bWdh,
 const bool bHgt)
 {
-const bool bUndo = IsUndoEnabled();
+const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
 if( bUndo )
 {
 BegUndo(ImpGetDescriptionString(STR_EditResize));
@@ -302,7 +302,7 @@ long SdrEditView::GetMarkedObjRotate() const
 
 void SdrEditView::RotateMarkedObj(const Point& rRef, long nAngle, bool bCopy)
 {
-const bool bUndo = IsUndoEnabled();
+const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
 if( bUndo )
 {
 OUString aStr {ImpGetDescriptionString(STR_EditRotate)};
@@ -357,7 +357,7 @@ void SdrEditView::RotateMarkedObj(const Point& rRef, long 
nAngle, bool bCopy)
 
 void SdrEditView::MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool 
bCopy)
 {
-const bool bUndo = IsUndoEnabled();
+const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
 
 if( bUndo )
 {
@@ -456,7 +456,7 @@ long SdrEditView::GetMarkedObjShear() const
 
 void SdrEditView::ShearMarkedObj(const Point& rRef, long nAngle, bool bVShear, 
bool