From 4b0fa253a4540f5461397815d290586f9ddabe61 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Tue, 28 Nov 2023 13:46:21 +0900 Subject: tdf#136472 adjust ooxml import to handle first header/footer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously the ooxml import added a new page style when the first header or footer was detected. Since then we gained support to add first page header/footer in an existing page style so we don't need to import it like that anymore. This changes the import code so that the old complication to add "First Page" page style is removed and it always just uses the "Standard" page style for all 3 cases: first, left and right headers and footers. This also adjusts the existing tests to align with this change. Change-Id: Ibf69597e6990499ac520ea9e323a5f73f429800b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157860 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- sw/qa/extras/rtfimport/rtfimport.cxx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'sw/qa/extras/rtfimport') diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index a0a75c1559d1..3d516a004218 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1030,11 +1030,13 @@ CPPUNIT_TEST_FIXTURE(Test, testBehindDoc) CPPUNIT_TEST_FIXTURE(Test, testFdo82114) { createSwDoc("fdo82114.rtf"); - uno::Reference xHeaderText = getProperty>( - getStyles("PageStyles")->getByName("Converted1"), "HeaderText"); - OUString aActual = xHeaderText->getString(); - // This was 'Right page header, section 1'. - CPPUNIT_ASSERT_EQUAL(OUString("First page header, section 2"), aActual); + uno::Reference xHeaderTextPage1 = getProperty>( + getStyles("PageStyles")->getByName("Standard"), "HeaderTextFirst"); + CPPUNIT_ASSERT_EQUAL(OUString("First page header, section 1"), xHeaderTextPage1->getString()); + + uno::Reference xHeaderTextPage2 = getProperty>( + getStyles("PageStyles")->getByName("Converted1"), "HeaderTextFirst"); + CPPUNIT_ASSERT_EQUAL(OUString("First page header, section 2"), xHeaderTextPage2->getString()); } CPPUNIT_TEST_FIXTURE(Test, testFdo44984) @@ -1522,7 +1524,7 @@ CPPUNIT_TEST_FIXTURE(Test, testImportHeaderFooter) //Check if Headers/Footers only contain what they should in this document uno::Reference xHeaderText = getProperty>( - getStyles("PageStyles")->getByName("First Page"), "HeaderText"); + getStyles("PageStyles")->getByName("Default Page Style"), "HeaderTextFirst"); OUString aActual = xHeaderText->getString(); CPPUNIT_ASSERT_EQUAL(OUString("First Page Header"), aActual); @@ -1537,7 +1539,7 @@ CPPUNIT_TEST_FIXTURE(Test, testImportHeaderFooter) CPPUNIT_ASSERT_EQUAL(OUString("Header uneven"), aActual); uno::Reference xFooterText = getProperty>( - getStyles("PageStyles")->getByName("First Page"), "FooterText"); + getStyles("PageStyles")->getByName("Default Page Style"), "FooterTextFirst"); aActual = xFooterText->getString(); CPPUNIT_ASSERT_EQUAL(OUString("First Page Footer"), aActual); @@ -1566,7 +1568,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108947) uno::Reference xHeaderTextLeft = getProperty>( getStyles("PageStyles")->getByName("Default Page Style"), "HeaderTextLeft"); aActual = xHeaderTextLeft->getString(); - CPPUNIT_ASSERT_EQUAL(OUString(SAL_NEWLINE_STRING "Header Page 2 ?"), aActual); + CPPUNIT_ASSERT_EQUAL(OUString("Header Page 2 ?"), aActual); #endif } -- cgit