[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Sat Sep 10 09:14:53 UTC 2016


 sw/qa/extras/uiwriter/data/tdf78727.docx |binary
 sw/qa/extras/uiwriter/uiwriter.cxx       |   12 ++++++++++++
 sw/source/core/doc/docedt.cxx            |    3 ++-
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit ebd72cfc297ecfe617e9112f977a8ca12c2cacee
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Sep 7 22:17:34 2016 +0200

    tdf#78727 sw: fix missing textbox text when anchored inside flying table
    
    It was missing as the shape text range was deleted twice, as
    DelFlyInRange() thought both the fly and the draw frame format own its
    contents range, while only the fly one does (when called by
    SwDoc::MakeFlyAndMove(), called by SwXText::convertToTextFrame()).
    
    Thanks Red Hat for the pizza!
    
    (cherry picked from commit 9d9e5b40c1a6d91323564e60b25ccf04df86db4b)
    
    Conflicts:
    	sw/qa/extras/uiwriter/uiwriter.cxx
    
    Change-Id: I26e23550df085511e0e87f593f1a461057413d0e
    Reviewed-on: https://gerrit.libreoffice.org/28776
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/extras/uiwriter/data/tdf78727.docx b/sw/qa/extras/uiwriter/data/tdf78727.docx
new file mode 100644
index 0000000..a8787d4
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf78727.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 57d53fc..5dcb81e 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -199,6 +199,7 @@ public:
     void testTdf99004();
     void testTdf84695();
     void testTdf84695NormalChar();
+    void testTdf78727();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -300,6 +301,7 @@ public:
     CPPUNIT_TEST(testTdf99004);
     CPPUNIT_TEST(testTdf84695);
     CPPUNIT_TEST(testTdf84695NormalChar);
+    CPPUNIT_TEST(testTdf78727);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -3704,6 +3706,16 @@ void SwUiWriterTest::testTdf84695NormalChar()
     CPPUNIT_ASSERT_EQUAL(OUString("a"), xShape->getString());
 }
 
+void SwUiWriterTest::testTdf78727()
+{
+    SwDoc* pDoc = createDoc("tdf78727.docx");
+    SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+    // This was 1: make sure we don't loose the TextBox anchored inside the
+    // table that is moved inside a text frame.
+    std::set<const SwFrameFormat*> aSet;
+    CPPUNIT_ASSERT(SwTextBoxHelper::getCount(pPage, aSet) > 1);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 0f55ea6..a62ed4c 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -212,7 +212,8 @@ void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
             {
                 // If the Fly is deleted, all Flys in its content have to be deleted too.
                 const SwFormatContent &rContent = pFormat->GetContent();
-                if( rContent.GetContentIdx() )
+                // But only fly formats own their content, not draw formats.
+                if (rContent.GetContentIdx() && pFormat->Which() == RES_FLYFRMFMT)
                 {
                     DelFlyInRange( *rContent.GetContentIdx(),
                                     SwNodeIndex( *rContent.GetContentIdx()->


More information about the Libreoffice-commits mailing list