diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2019-05-02 17:10:30 +0200 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2019-05-03 10:22:32 +0200 |
commit | 40df8019ff3a8b1fd87b3e20e154fc487ab4a7db (patch) | |
tree | 8cce3138bfe094ee135a1a2404e6660e8a351fea | |
parent | a010011fd362536beb8d1cd44cf058180f7c06ec (diff) |
tdf#125039 sw_redlinehide: keep shape selected when changing anchor type
Avoid the problem by not moving the drawing object to the invisible
layer, which isn't necessary because it will be inserted immediately
anyway.
(regression from 214e6ed5286566e689a4ef13a9115e2ad38fff57)
Change-Id: I9936de990d1db56fa4c00c37d05b4ed2923790ff
Reviewed-on: https://gerrit.libreoffice.org/71685
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
-rw-r--r-- | sw/qa/extras/uiwriter/data/test_anchor_as_character.odt | bin | 0 -> 10284 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 21 | ||||
-rw-r--r-- | sw/source/core/txtnode/atrflyin.cxx | 2 |
3 files changed, 22 insertions, 1 deletions
diff --git a/sw/qa/extras/uiwriter/data/test_anchor_as_character.odt b/sw/qa/extras/uiwriter/data/test_anchor_as_character.odt Binary files differnew file mode 100644 index 000000000000..cad88f5bfd09 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/test_anchor_as_character.odt diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index aa32c236eaab..2f69a53ef5ce 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -179,6 +179,7 @@ public: void testTdf98512(); void testShapeTextboxSelect(); void testShapeTextboxDelete(); + void testAnchorChangeSelection(); void testCp1000071(); void testShapeTextboxVertadjust(); void testShapeTextboxAutosize(); @@ -384,6 +385,7 @@ public: CPPUNIT_TEST(testTdf98512); CPPUNIT_TEST(testShapeTextboxSelect); CPPUNIT_TEST(testShapeTextboxDelete); + CPPUNIT_TEST(testAnchorChangeSelection); CPPUNIT_TEST(testCp1000071); CPPUNIT_TEST(testShapeTextboxVertadjust); CPPUNIT_TEST(testShapeTextboxAutosize); @@ -1279,6 +1281,25 @@ void SwUiWriterTest::testShapeTextboxDelete() CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), nActual); } +void SwUiWriterTest::testAnchorChangeSelection() +{ + SwDoc* pDoc = createDoc("test_anchor_as_character.odt"); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); + SdrObject* pObject = pPage->GetObj(0); + CPPUNIT_ASSERT(pObject); + + // Then select it. + pWrtShell->SelectObj(Point(), 0, pObject); + const SdrMarkList& rMarkList = pWrtShell->GetDrawView()->GetMarkedObjectList(); + CPPUNIT_ASSERT_EQUAL(pObject, rMarkList.GetMark(0)->GetMarkedSdrObj()); + + pWrtShell->ChgAnchor(RndStdIds::FLY_AS_CHAR); + + // tdf#125039 shape must still be selected, extensions depend on that + CPPUNIT_ASSERT_EQUAL(pObject, rMarkList.GetMark(0)->GetMarkedSdrObj()); +} + void SwUiWriterTest::testCp1000071() { SwDoc* pDoc = createDoc("cp1000071.odt"); diff --git a/sw/source/core/txtnode/atrflyin.cxx b/sw/source/core/txtnode/atrflyin.cxx index a8fe920630a3..1509c0cf3d40 100644 --- a/sw/source/core/txtnode/atrflyin.cxx +++ b/sw/source/core/txtnode/atrflyin.cxx @@ -198,7 +198,7 @@ void SwTextFlyCnt::SetAnchor( const SwTextNode *pNode ) { if (SdrObject const*const pObj = pFormat->FindSdrObject()) { // tdf#123259 disconnect with *old* anchor position - static_cast<SwDrawContact*>(::GetUserCall(pObj))->DisconnectFromLayout(); + static_cast<SwDrawContact*>(::GetUserCall(pObj))->DisconnectFromLayout(false); } } pFormat->SetFormatAttr( aAnchor ); // only set the anchor |