[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sw/qa sw/source

Luke Deller luke at deller.id.au
Wed Sep 13 19:31:51 UTC 2017


 sw/qa/extras/odfimport/data/tdf94882.odt |binary
 sw/qa/extras/odfimport/odfimport.cxx     |   13 +++++++++++++
 sw/source/core/layout/newfrm.cxx         |    2 +-
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 342a65bdb3ca3db19eb6b1244b6f866a0e526a86
Author: Luke Deller <luke at deller.id.au>
Date:   Mon Sep 4 22:40:34 2017 +1000

    tdf#94882 use first page header on first page
    
    The very first page of the document should always be formatted using
    the "first page" settings in the page style, regardless of the page
    number set for that page.
    
    (cherry picked from commit 232885c66422ab8f05d86cfeac9b377a97462ae4)
    
    Change-Id: I49cb00cef8b1d10120349073dee1511657dc84d1
    Reviewed-on: https://gerrit.libreoffice.org/41892
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/sw/qa/extras/odfimport/data/tdf94882.odt b/sw/qa/extras/odfimport/data/tdf94882.odt
new file mode 100644
index 000000000000..2aacb9836da2
Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf94882.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index 2439334ea512..9f871c08ea4e 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -837,5 +837,18 @@ DECLARE_ODFIMPORT_TEST(testTdf109228, "tdf109228.odt")
     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
 }
 
+DECLARE_ODFIMPORT_TEST(testTdf94882, "tdf94882.odt")
+{
+    // Get the header of the page containing our content
+    // (done this way to skip past any blank page inserted before it
+    //  due to the page number being even)
+    OUString headertext = parseDump(
+        "/root/page[starts-with(body/txt/text(),'The paragraph style on this')]"
+        "/header/txt/text()"
+    );
+    // This header should be the first page header
+    CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), headertext);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index dae63d1f8aa6..ee4674b54c40 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -538,7 +538,7 @@ void SwRootFrame::Init( SwFrameFormat* pFormat )
     if ( !pDesc )
         pDesc = &pDoc->GetPageDesc( 0 );
     const bool bOdd = !oPgNum || 0 != ( oPgNum.get() % 2 );
-    bool bFirst = !oPgNum || 1 == oPgNum.get();
+    const bool bFirst = true;
 
     // Create a page and put it in the layout
     SwPageFrame *pPage = ::InsertNewPage( *pDesc, this, bOdd, bFirst, false, false, nullptr );


More information about the Libreoffice-commits mailing list