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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 26 19:05:52 UTC 2019


 sw/qa/extras/ww8import/data/tdf128605.doc |binary
 sw/qa/extras/ww8import/ww8import.cxx      |   11 +++++++++++
 sw/source/filter/ww8/ww8par.cxx           |    5 ++---
 3 files changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 162722dfa96dc10243e9a07a3c123f22481d42cd
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Nov 26 16:53:33 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Nov 26 20:03:55 2019 +0100

    tdf#128605 DOC import: fix cont sect break with different top/bottom margin
    
    Word has a feature to attach different page margins to sections, and
    then refer to these section definitions via continuous section breaks.
    The result is that the margin changes never introduce a page break, and
    left/right margins are applied instantly, while top/bottom margins are
    applied from the next page.
    
    Now in Writer, either these continuous section breaks are mapped to a
    page break and all margins show up as expected, or we don't do a page
    break, and then the number of page breaks are as expected; but you can't
    have both at the same time till the feature is missing in Writer core.
    
    Commit c5ed52b1cd6f22787c94bec035ceecf9e1da3271 (ww8import create a
    pagedesc if continuous section changes margins (bnc#875383), 2014-07-21)
    tweaked this decision, so that the DOC import always creates a page
    break, but left the DOCX import unchanged.
    
    Fix the bug by going back to not creating page breaks on top/bottom
    margin changes: this resolves the scenario and still keeps the original
    situation fixed, too.
    
    Change-Id: Id0e8c3a4ce40db8da024a0a20005eb0445325a1a
    Reviewed-on: https://gerrit.libreoffice.org/83789
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/ww8import/data/tdf128605.doc b/sw/qa/extras/ww8import/data/tdf128605.doc
new file mode 100644
index 000000000000..2bbfe6b73033
Binary files /dev/null and b/sw/qa/extras/ww8import/data/tdf128605.doc differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index a79781d781d3..c67f2c9385b0 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -94,6 +94,17 @@ DECLARE_WW8IMPORT_TEST(testTdf124601, "tdf124601.doc")
     CPPUNIT_ASSERT(getProperty<bool>(getShapeByName("Grafik 19"), "IsFollowingTextFlow"));
 }
 
+DECLARE_WW8IMPORT_TEST(testTdf128605, "tdf128605.doc")
+{
+    OUString aPara1PageStyleName = getProperty<OUString>(getParagraph(1), "PageStyleName");
+    OUString aPara2PageStyleName = getProperty<OUString>(getParagraph(2), "PageStyleName");
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: Standard
+    // - Actual  : Convert 1
+    // i.e. the continuous section break resulted in an unwanted page break.
+    CPPUNIT_ASSERT_EQUAL(aPara1PageStyleName, aPara2PageStyleName);
+}
+
 DECLARE_WW8IMPORT_TEST(testTdf112535, "tdf112535.doc")
 {
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index f9d3a5df580b..b1cf6ac76796 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4542,9 +4542,8 @@ void wwSectionManager::InsertSegments()
 
         bool bInsertSection = (aIter != aStart) && aIter->IsContinuous() &&  bThisAndPreviousAreCompatible;
         bool bInsertPageDesc = !bInsertSection;
-        // HACK Force new pagedesc if margins change, otherwise e.g. floating tables may be anchored improperly.
-        if( aIter->maSep.dyaTop != aPrev->maSep.dyaTop || aIter->maSep.dyaBottom != aPrev->maSep.dyaBottom
-            || aIter->maSep.dxaLeft != aPrev->maSep.dxaLeft || aIter->maSep.dxaRight != aPrev->maSep.dxaRight )
+        // HACK Force new pagedesc if left/right margins change, otherwise e.g. floating tables may be anchored improperly.
+        if( aIter->maSep.dxaLeft != aPrev->maSep.dxaLeft || aIter->maSep.dxaRight != aPrev->maSep.dxaRight )
             bInsertPageDesc = true;
         bool bProtected = SectionIsProtected(*aIter); // do we really  need this ?? I guess I have a different logic in editshell which disables this...
 


More information about the Libreoffice-commits mailing list