diff options
author | Daniel Arato (NISZ) <arato.daniel@nisz.hu> | 2021-09-22 15:03:48 +0200 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2021-09-29 07:38:33 +0200 |
commit | f75ec59c9a77065d4a39a4b433b139cabe1405e1 (patch) | |
tree | e0223c6701224b0ca50257cf24d39cf03ea3e435 | |
parent | 4e76220028b5db5018425a08c764ec073020232c (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>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122764
Tested-by: Jenkins
(cherry picked from commit ccd1393611ff7ea71d2dc5d75b0c27a4794ebdbb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122742
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-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 77e4bc37673e..f3bf709500b4 100644 --- a/sc/qa/unit/subsequent_export-test2.cxx +++ b/sc/qa/unit/subsequent_export-test2.cxx @@ -82,6 +82,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; @@ -125,6 +126,7 @@ public: void testRefStringConfigXLSX(); void testRefStringUnspecified(); void testHeaderImageODS(); + void testHeaderFooterContentODS(); void testTdf88657ODS(); void testTdf41722(); @@ -227,6 +229,7 @@ public: CPPUNIT_TEST(testRefStringConfigXLSX); CPPUNIT_TEST(testRefStringUnspecified); CPPUNIT_TEST(testHeaderImageODS); + CPPUNIT_TEST(testHeaderFooterContentODS); CPPUNIT_TEST(testTdf88657ODS); CPPUNIT_TEST(testTdf41722); @@ -474,6 +477,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 ); } } |