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

Miklos Vajna vmiklos at collabora.co.uk
Thu Apr 7 07:49:21 UTC 2016


 sw/inc/pagedesc.hxx                      |    1 +
 sw/qa/extras/ww8import/data/tdf99120.doc |binary
 sw/qa/extras/ww8import/ww8import.cxx     |    9 +++++++++
 sw/source/filter/ww8/ww8par.cxx          |    3 ++-
 4 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 44a3eb37cd982c59f8350d53db3798b675230b35
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Apr 7 09:06:15 2016 +0200

    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 at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
index 16c54bd..4553d81 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
new file mode 100644
index 0000000..a93721c
Binary files /dev/null and b/sw/qa/extras/ww8import/data/tdf99120.doc differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index 689cd86..8727a00 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 7088a0b..72919f6 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() );
             }
 


More information about the Libreoffice-commits mailing list