summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Deller <ldeller@iress.com.au>2017-07-12 17:00:55 +1000
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-08-22 17:06:31 +0200
commit232885c66422ab8f05d86cfeac9b377a97462ae4 (patch)
tree6d11d88650f5e85a1fee936ec1c353a514c49783
parentb7ea55e6d7fbb14c931de1a32b8c872735aad1fd (diff)
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. Change-Id: I49cb00cef8b1d10120349073dee1511657dc84d1 Reviewed-on: https://gerrit.libreoffice.org/39851 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/qa/extras/odfimport/data/tdf94882.odtbin0 -> 9704 bytes
-rw-r--r--sw/qa/extras/odfimport/odfimport.cxx13
-rw-r--r--sw/source/core/layout/newfrm.cxx2
3 files changed, 14 insertions, 1 deletions
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
--- /dev/null
+++ b/sw/qa/extras/odfimport/data/tdf94882.odt
Binary files differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index edcdd5deb6f9..66d25f1919ef 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -844,5 +844,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 ddefc54aecdf..27e40e469fe7 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 );