summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-11-26 16:53:33 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-11-26 20:03:55 +0100
commit162722dfa96dc10243e9a07a3c123f22481d42cd (patch)
treeb99a0e1e55c24848cd73167c5640cd001fee58ef
parent9b20a87144c16e695b97f193da734b1c0b05baed (diff)
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@collabora.com> Tested-by: Jenkins
-rw-r--r--sw/qa/extras/ww8import/data/tdf128605.docbin0 -> 22016 bytes
-rw-r--r--sw/qa/extras/ww8import/ww8import.cxx11
-rw-r--r--sw/source/filter/ww8/ww8par.cxx5
3 files changed, 13 insertions, 3 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ww8import/data/tdf128605.doc
Binary files 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...