diff options
author | Daniel Arato (NISZ) <arato.daniel@nisz.hu> | 2021-09-22 15:03:48 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2021-09-28 11:32:53 +0200 |
commit | 6f04952e6828cf1419b991e82070514bae24896c (patch) | |
tree | e4789298af541db9205356ede3644c137d7e9404 /sc | |
parent | ac34bafb6cad056f843ff3ff0dee293bf1e18c56 (diff) |
tdf#144184 sc: fix first page footer export
Due to a typical case of copy-paste oversight LO Calc used to lose
the first page footer when exporting to ODS. With the typo fixed,
the export now works again.
Follow-up to commit 19fa853ce12136b5c14e0c5a0aa906c296b75388
"tdf#121715 XLSX: support custom first page header/footer".
Change-Id: If8f5ab4ff9a9392768789b886218d1d9c56ddbae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122455
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/ods/header-footer-content.ods | bin | 0 -> 8048 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export_test2.cxx | 36 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLTableMasterPageExport.cxx | 2 |
3 files changed, 37 insertions, 1 deletions
diff --git a/sc/qa/unit/data/ods/header-footer-content.ods b/sc/qa/unit/data/ods/header-footer-content.ods Binary files differnew file mode 100644 index 000000000000..f365748ddc22 --- /dev/null +++ b/sc/qa/unit/data/ods/header-footer-content.ods diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 41a25d2c0312..10743521d31c 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -83,6 +83,7 @@ #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/graphic/GraphicType.hpp> #include <com/sun/star/sheet/GlobalSheetSettings.hpp> +#include <com/sun/star/sheet/XHeaderFooterContent.hpp> #include <com/sun/star/text/XTextColumns.hpp> using namespace ::com::sun::star; @@ -126,6 +127,7 @@ public: void testRefStringConfigXLSX(); void testRefStringUnspecified(); void testHeaderImageODS(); + void testHeaderFooterContentODS(); void testTdf88657ODS(); void testTdf41722(); @@ -233,6 +235,7 @@ public: CPPUNIT_TEST(testRefStringConfigXLSX); CPPUNIT_TEST(testRefStringUnspecified); CPPUNIT_TEST(testHeaderImageODS); + CPPUNIT_TEST(testHeaderFooterContentODS); CPPUNIT_TEST(testTdf88657ODS); CPPUNIT_TEST(testTdf41722); @@ -485,6 +488,39 @@ void ScExportTest2::testHeaderImageODS() xDocSh->DoClose(); } +void ScExportTest2::testHeaderFooterContentODS() +{ + ScDocShellRef xShell = loadDoc(u"header-footer-content.", FORMAT_ODS); + ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_ODS); + uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xDocSh->GetModel(), + uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies + = xStyleFamiliesSupplier->getStyleFamilies(); + uno::Reference<container::XNameAccess> xPageStyles(xStyleFamilies->getByName("PageStyles"), + uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xStyle(xPageStyles->getByName("Default"), uno::UNO_QUERY); + + uno::Reference<css::sheet::XHeaderFooterContent> xContent; + xStyle->getPropertyValue("RightPageHeaderContent") >>= xContent; + CPPUNIT_ASSERT(xContent.is()); + CPPUNIT_ASSERT_EQUAL(OUString("header"), xContent->getCenterText()->getString()); + + xStyle->getPropertyValue("FirstPageHeaderContent") >>= xContent; + CPPUNIT_ASSERT(xContent.is()); + CPPUNIT_ASSERT_EQUAL(OUString("first page header"), xContent->getCenterText()->getString()); + + xStyle->getPropertyValue("RightPageFooterContent") >>= xContent; + CPPUNIT_ASSERT(xContent.is()); + CPPUNIT_ASSERT_EQUAL(OUString("footer"), xContent->getCenterText()->getString()); + + xStyle->getPropertyValue("FirstPageFooterContent") >>= xContent; + // First page footer content used to be lost upon export. + CPPUNIT_ASSERT(xContent.is()); + CPPUNIT_ASSERT_EQUAL(OUString("first page footer"), xContent->getCenterText()->getString()); + + xDocSh->DoClose(); +} + void ScExportTest2::testTextDirectionXLSX() { ScDocShellRef xDocSh = loadDoc(u"writingMode.", FORMAT_XLSX); diff --git a/sc/source/filter/xml/XMLTableMasterPageExport.cxx b/sc/source/filter/xml/XMLTableMasterPageExport.cxx index bf43b2c29fb2..59b29378ea16 100644 --- a/sc/source/filter/xml/XMLTableMasterPageExport.cxx +++ b/sc/source/filter/xml/XMLTableMasterPageExport.cxx @@ -187,7 +187,7 @@ void XMLTableMasterPageExport::exportMasterPageContent( bool bFirstFooter = (!::cppu::any2bool(rPropSet->getPropertyValue( SC_UNO_PAGE_FIRSTFTRSHARED )) && bFooter); - exportHeaderFooter( xFooterLeft, XML_FOOTER_FIRST, bFirstFooter ); + exportHeaderFooter( xFooterFirst, XML_FOOTER_FIRST, bFirstFooter ); } } |