diff options
-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 |