[Libreoffice-commits] core.git: sw/qa sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Fri May 3 08:24:20 UTC 2019


 sw/qa/extras/uiwriter/data/test_anchor_as_character.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx                      |   21 ++++++++++++++++
 sw/source/core/txtnode/atrflyin.cxx                     |    2 -
 3 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 40df8019ff3a8b1fd87b3e20e154fc487ab4a7db
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu May 2 17:10:30 2019 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri May 3 10:22:32 2019 +0200

    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 at cib.de>

diff --git a/sw/qa/extras/uiwriter/data/test_anchor_as_character.odt b/sw/qa/extras/uiwriter/data/test_anchor_as_character.odt
new file mode 100644
index 000000000000..cad88f5bfd09
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/test_anchor_as_character.odt differ
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


More information about the Libreoffice-commits mailing list