summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2018-08-16 15:49:37 +0300
committerAndras Timar <andras.timar@collabora.com>2018-09-12 10:12:59 +0200
commit40fb5d6c34f88b4a43aedb6d3d7da0d7a5d5409b (patch)
tree98239152d33d651c300ab46a1da6e0103306cc56
parent5063d9e7e677b0812ecfd81a5c4840fc1e58cbeb (diff)
tdf#119232 ww8import: even page means default to start on page 2
I didn't see this mentioned in the sprm documentation, but that is how MS Word seems to implement it. Change-Id: I5b86ecf99a884e768877cdb0e71f43cdb9f2ad76 Reviewed-on: https://gerrit.libreoffice.org/59221 Reviewed-by: Justin Luth <justin_luth@sil.org> Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit 2127581728ae61eca7470b288c21d1c02754fb5b)
-rw-r--r--sw/qa/extras/ww8export/data/tdf119232_startEvenPage.docbin0 -> 30720 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export2.cxx5
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx12
3 files changed, 14 insertions, 3 deletions
diff --git a/sw/qa/extras/ww8export/data/tdf119232_startEvenPage.doc b/sw/qa/extras/ww8export/data/tdf119232_startEvenPage.doc
new file mode 100644
index 000000000000..c50bf46c0b58
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf119232_startEvenPage.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index a076e1d4d3dc..fa69fb62736e 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -243,6 +243,11 @@ DECLARE_WW8EXPORT_TEST(testTdf112074_RTLtableJustification, "tdf112074_RTLtableJ
CPPUNIT_ASSERT_MESSAGE("Table Indent is 3750", getProperty<long>(xTable, "LeftMargin") < 4000 );
}
+DECLARE_WW8EXPORT_TEST(testTdf119232_startEvenPage, "tdf119232_startEvenPage.doc")
+{
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(2), getProperty<sal_Int16>(getParagraph(1), "PageNumberOffset"));
+}
+
DECLARE_WW8EXPORT_TEST(testTdf104805, "tdf104805.doc")
{
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WW8Num1"), uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 11cdf75f4412..d5d8813ce981 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -843,6 +843,8 @@ void wwSectionManager::CreateSep(const long nTextPos)
const sal_uInt16* pIds = eVer <= ww::eWW2 ? aVer2Ids0 : eVer <= ww::eWW7 ? aVer67Ids0 : aVer8Ids0;
+ SprmResult aRes = pSep->HasSprm(pIds[0]);
+ const sal_uInt8* pSprmBkc = aRes.pSprm;
if (!maSegments.empty())
{
// Type of break: break codes are:
@@ -851,8 +853,6 @@ void wwSectionManager::CreateSep(const long nTextPos)
// 2 New page
// 3 Even page
// 4 Odd page
- SprmResult aRes = pSep->HasSprm(pIds[0]);
- const sal_uInt8* pSprmBkc = aRes.pSprm;
if (pSprmBkc && aRes.nRemainingData >= 1)
aNewSection.maSep.bkc = *pSprmBkc;
}
@@ -1005,7 +1005,13 @@ void wwSectionManager::CreateSep(const long nTextPos)
aNewSection.maSep.pgnStart = ReadUSprm( pSep, pIds[7], 0 );
- SprmResult aRes;
+ // if the document's first page number is unspecified, but it starts with an even page break,
+ // then set the first page number to two
+ if ( maSegments.empty() && !aNewSection.maSep.fPgnRestart && pSprmBkc && *pSprmBkc == 3 )
+ {
+ aNewSection.maSep.pgnStart = 2;
+ aNewSection.maSep.fPgnRestart = 1;
+ }
if (eVer >= ww::eWW6)
{