sc/qa/unit/data/ods/tdf142764.ods |binary sc/qa/unit/subsequent_export-test2.cxx | 19 +++++++++++++++++++ sc/source/filter/xml/XMLTableHeaderFooterContext.cxx | 12 +++++++++--- 3 files changed, 28 insertions(+), 3 deletions(-)
New commits: commit 52beb3907dd3c7e6ae112e263def1005272cecd8 Author: Daniel Arato (NISZ) <arato.dan...@nisz.hu> AuthorDate: Thu Jun 24 15:01:54 2021 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Wed Jul 7 15:27:43 2021 +0200 tdf#142764 sc: import "Same content on first/left page" Different header of the first page was never imported (related to the missing UI support), despite its working ODF export. This commit sets the values of those options at ODS file load according to the "display" attribute used to hide or show a particular header/footer. Follow-up to commit 19fa853ce12136b5c14e0c5a0aa906c296b75388 "tdf#121715 XLSX: support custom first page header/footer". Change-Id: I3409ad94a4d3ff86fd7f6d8afede3e7603024515 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117788 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sc/qa/unit/data/ods/tdf142764.ods b/sc/qa/unit/data/ods/tdf142764.ods new file mode 100644 index 000000000000..bbc4355dab32 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf142764.ods differ diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx index ad08aa2802d0..0a44090734ab 100644 --- a/sc/qa/unit/subsequent_export-test2.cxx +++ b/sc/qa/unit/subsequent_export-test2.cxx @@ -142,6 +142,7 @@ public: void testPivotCacheAfterExportXLSX(); void testTdf114969XLSX(); void testTdf115192XLSX(); + void testTdf142764(); void testTdf91634XLSX(); void testTdf115159(); void testTdf112567(); @@ -240,6 +241,7 @@ public: CPPUNIT_TEST(testPivotCacheAfterExportXLSX); CPPUNIT_TEST(testTdf114969XLSX); CPPUNIT_TEST(testTdf115192XLSX); + CPPUNIT_TEST(testTdf142764); CPPUNIT_TEST(testTdf91634XLSX); CPPUNIT_TEST(testTdf115159); CPPUNIT_TEST(testTdf112567); @@ -1217,6 +1219,23 @@ void ScExportTest2::testTdf115192XLSX() xDocSh->DoClose(); } +void ScExportTest2::testTdf142764() +{ + ScDocShellRef xShell = loadDoc(u"tdf142764.", FORMAT_ODS); + CPPUNIT_ASSERT(xShell); + + auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); + + xmlDocUniquePtr pSheet + = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + CPPUNIT_ASSERT(pSheet); + + assertXPath(pSheet, "/x:worksheet/x:headerFooter", "differentOddEven", "true"); + assertXPath(pSheet, "/x:worksheet/x:headerFooter", "differentFirst", "true"); + + xShell->DoClose(); +} + void ScExportTest2::testTdf91634XLSX() { ScDocShellRef xDocSh = loadDoc(u"image_hyperlink.", FORMAT_XLSX); diff --git a/sc/source/filter/xml/XMLTableHeaderFooterContext.cxx b/sc/source/filter/xml/XMLTableHeaderFooterContext.cxx index a34015a999cf..c0b5c6eb6cc1 100644 --- a/sc/source/filter/xml/XMLTableHeaderFooterContext.cxx +++ b/sc/source/filter/xml/XMLTableHeaderFooterContext.cxx @@ -53,6 +53,7 @@ XMLTableHeaderFooterContext::XMLTableHeaderFooterContext( SvXMLImport& rImport, OUString sContentLeft( bFooter ? OUString(SC_UNO_PAGE_LEFTFTRCONT) : OUString(SC_UNO_PAGE_LEFTHDRCONT) ); OUString sContentFirst( bFooter ? OUString(SC_UNO_PAGE_FIRSTFTRCONT) : OUString(SC_UNO_PAGE_FIRSTHDRCONT) ); OUString sShareContent( bFooter ? OUString(SC_UNO_PAGE_FTRSHARED) : OUString(SC_UNO_PAGE_HDRSHARED) ); + OUString sShareFirstContent( bFooter ? OUString(SC_UNO_PAGE_FIRSTFTRSHARED) : OUString(SC_UNO_PAGE_FIRSTHDRSHARED) ); bool bDisplay( true ); for( auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ) ) { @@ -61,10 +62,9 @@ XMLTableHeaderFooterContext::XMLTableHeaderFooterContext( SvXMLImport& rImport, else XMLOFF_WARN_UNKNOWN("sc", aIter); } + bool bOn(::cppu::any2bool(xPropSet->getPropertyValue( sOn ))); if( bLeft ) { - bool bOn(::cppu::any2bool(xPropSet->getPropertyValue( sOn ))); - if( bOn && bDisplay ) { if( ::cppu::any2bool(xPropSet->getPropertyValue( sShareContent )) ) @@ -80,16 +80,22 @@ XMLTableHeaderFooterContext::XMLTableHeaderFooterContext( SvXMLImport& rImport, } else { - bool bOn(::cppu::any2bool(xPropSet->getPropertyValue( sOn ))); if ( bOn != bDisplay ) xPropSet->setPropertyValue( sOn, uno::makeAny(bDisplay) ); } if (bLeft) + { sCont = sContentLeft; + } else if (bFirst) + { sCont = sContentFirst; + xPropSet->setPropertyValue( sShareFirstContent, uno::makeAny(!bDisplay) ); + } else + { sCont = sContent; + } xPropSet->getPropertyValue( sCont ) >>= xHeaderFooterContent; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits