[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/qa sc/source
Daniel Arato (NISZ) (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 28 12:19:25 UTC 2021
sc/qa/unit/data/ods/header-footer-content.ods |binary
sc/qa/unit/subsequent_export-test2.cxx | 36 ++++++++++++++++++++++
sc/source/filter/xml/XMLTableMasterPageExport.cxx | 2 -
3 files changed, 37 insertions(+), 1 deletion(-)
New commits:
commit ccd1393611ff7ea71d2dc5d75b0c27a4794ebdbb
Author: Daniel Arato (NISZ) <arato.daniel at nisz.hu>
AuthorDate: Wed Sep 22 15:03:48 2021 +0200
Commit: Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Tue Sep 28 14:18:50 2021 +0200
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 at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122764
Tested-by: Jenkins
diff --git a/sc/qa/unit/data/ods/header-footer-content.ods b/sc/qa/unit/data/ods/header-footer-content.ods
new file mode 100644
index 000000000000..f365748ddc22
Binary files /dev/null and b/sc/qa/unit/data/ods/header-footer-content.ods differ
diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx
index dde758e2bd5b..dc72c46aebf4 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 );
}
}
More information about the Libreoffice-commits
mailing list