summaryrefslogtreecommitdiff
path: root/sw/qa/extras/odfimport
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-02-18 19:18:47 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-02-24 15:50:24 +0100
commit2e909f572229c16ae86a17d5a6fc83b67e818f9b (patch)
treed359c882ab560eee654b234b51e6f54bb3103815 /sw/qa/extras/odfimport
parent8130bd0bd25db1d9b0517b08c40640f3a96aea2b (diff)
tdf#125682 sw: don't insert empty page before first page with even number
This mostly reverts commit 14bb680949b47332d2921cc68f75340b31ad5c32 and replaces it by a hopefully better approach: if the first page in the document has an even number, it will become a right page, and "toggle" the document so that even pages are right pages and odd pages are left pages. This is closer to what Word does; the tests adapted in the above commit were actually regressions. Add a new function IsRightPageByNumber() to determine how the page number offsets should be interpreted. Also make it explicit that even/odd and right/left page are no longer synonymous by renaming various "Odd" variables. Historically documents that start with even page number didn't work well anyway; before the above commit you'd get a left page followed by a left page followed by a right page, which is clearly nonsense if the page style differs between left and right pages - so hopefully we can do without a compat setting for those. There is still one situation where an empty page is inserted before the first page: if the page style is "Left Page"; this appears to be impossible in Word so we'll have issues exporting that to Word formats anyway. Testing: Writer pre-commit; LO 5.4/OOo 3.3: 1.odd -> right, 2.even -> left 1.even -> left, 2.odd -> right + inserts a blank page on the right after reload: 1.even -> left, 2.odd -> left, no empty page Writer w/ commit; LO 6.0+: 1.odd -> right, 2.even -> left 1.even -> left, 2.odd -> right + blank page as first page (right) after reload: 1.even -> left, 2.odd -> right + blank page as first page (right) Word: 1.odd -> right, 2.even -> left 1.even -> right but left style, 2.odd -> left but right style [technically uses terminology even/odd instead of left/right, but if mirrored, the "inner margin" is always the same and leads to interpretation of left/right] Writer and Word appear to agree on inserting empty pages on SwFormatPageDesc items/Word section breaks: both even-ness of an explicit page number and "Left Page" only page style or explicit even/odd section break may insert empty page. A useful improvement would be to detect in Word import filters that the first page is even numbered and then invert the mapping of all of the page styles, i.e. odd header/footer->left instead of right, and if mirrorMargins, pgMar left -> inner instead of outer. Change-Id: Ibed0dbf888c120a3a7d11892f40d07ffb5bc0b68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88978 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit 509a02aa96f6d7620cb0bf06c20b3bfa0641be92) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89047 Tested-by: Xisco Faulí <xiscofauli@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa/extras/odfimport')
-rw-r--r--sw/qa/extras/odfimport/odfimport.cxx9
1 files changed, 3 insertions, 6 deletions
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index 08495526e572..eb65f0d63540 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -895,14 +895,11 @@ DECLARE_ODFIMPORT_TEST(testTdf94882, "tdf94882.odt")
DECLARE_ODFIMPORT_TEST(testBlankBeforeFirstPage, "tdf94882.odt")
{
- // This document starts on page 50, which is even, so it should have a
+ // This document starts on page 50, which is even, but it should not have a
// blank page inserted before it to make it a left page
- CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be 2 pages output",
- OUString("2"), parseDump("count(/root/page)")
- );
- CPPUNIT_ASSERT_EQUAL_MESSAGE("The first page should be blank",
- OUString("0"), parseDump("count(/root/page[1]/body)")
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be 1 pages output",
+ OUString("1"), parseDump("count(/root/page)")
);
}