diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-04-07 09:06:15 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-04-07 07:48:57 +0000 |
commit | 44a3eb37cd982c59f8350d53db3798b675230b35 (patch) | |
tree | 4b196496d26bce4a761bf037856078e72dc89733 /sw | |
parent | a3eadcd418b3768b3438c31cf47015270ec3a1f5 (diff) |
tdf#99120 DOC import: fix lack of first share after odd section break
Commit 848b1a05c5c41b5e7ff19c984f60c297a8143990 (fix for bnc#659631,
2011-02-04) made wwSectionManager::InsertSegments() use
SwPageDesc::WriteUseOn() directly, instead of going via
SwPageDesc::SetUseOn() that takes care of not throwing away the higher
share bits of the bitfield. This way the "is first shared" flag of the
bitfield got cleared, even when the input document had no title page
declared, so first header/footer must be shared.
Fix the problem by using SetUseOn() in the DOC import as well when it
comes to handling odd/even page section breaks.
Change-Id: If167f4582919fa177840ed81e0a53aa379485598
Reviewed-on: https://gerrit.libreoffice.org/23885
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/pagedesc.hxx | 1 | ||||
-rw-r--r-- | sw/qa/extras/ww8import/data/tdf99120.doc | bin | 0 -> 23040 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8import/ww8import.cxx | 9 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 3 |
4 files changed, 12 insertions, 1 deletions
diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx index 16c54bded936..4553d81849e5 100644 --- a/sw/inc/pagedesc.hxx +++ b/sw/inc/pagedesc.hxx @@ -189,6 +189,7 @@ public: bool IsHidden() const { return m_IsHidden; } void SetHidden(bool const bValue) { m_IsHidden = bValue; } + /// Same as WriteUseOn(), but the >= PD_HEADERSHARE part of the bitfield is not modified. inline void SetUseOn( UseOnPage eNew ); inline UseOnPage GetUseOn() const; diff --git a/sw/qa/extras/ww8import/data/tdf99120.doc b/sw/qa/extras/ww8import/data/tdf99120.doc Binary files differnew file mode 100644 index 000000000000..a93721c573a7 --- /dev/null +++ b/sw/qa/extras/ww8import/data/tdf99120.doc diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 689cd863624b..8727a00d201f 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -544,6 +544,15 @@ DECLARE_WW8IMPORT_TEST(testTdf99100, "tdf99100.doc") CPPUNIT_ASSERT(xField->supportsService("com.sun.star.text.textfield.Chapter")); } +DECLARE_WW8IMPORT_TEST(testTdf99120, "tdf99120.doc") +{ + CPPUNIT_ASSERT_EQUAL(OUString("Section 1, odd."), parseDump("/root/page[1]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Section 1, even."), parseDump("/root/page[2]/header/txt/text()")); + // This failed: the header was empty on the 3rd page, as the first page header was shown. + CPPUNIT_ASSERT_EQUAL(OUString("Section 2, odd."), parseDump("/root/page[3]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Section 2, even."), parseDump("/root/page[4]/header/txt/text()")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 7088a0b0c2ed..72919f674cba 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4536,7 +4536,8 @@ void wwSectionManager::InsertSegments() if ( aIter->maSep.bkc == 4 ) // Odd ( right ) Section break eUseOnPage = nsUseOnPage::PD_RIGHT; - aDesc.GetPageDesc()->WriteUseOn( eUseOnPage ); + // Keep the share flags. + aDesc.GetPageDesc()->SetUseOn( eUseOnPage ); aDesc.GetPageDesc()->SetFollow( aFollow.GetPageDesc() ); } |