sw/qa/extras/ooxmlexport/data/tdf146346.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 9 +++++++++ writerfilter/source/dmapper/PropertyMap.cxx | 19 ++++++++++++++++++- 3 files changed, 27 insertions(+), 1 deletion(-)
New commits: commit e3cca5bb02c52f92b8fc7b4b87ca2fc2b9615ead Author: László Németh <[email protected]> AuthorDate: Tue May 3 11:06:59 2022 +0200 Commit: Xisco Fauli <[email protected]> CommitDate: Wed May 4 16:05:20 2022 +0200 tdf#146346 DOCX import: fix table margins in footnotes Paragraph of the anchoring point of the floating table needs zero top and bottom margins, if the table was a not floating table in the footnote originally, otherwise docDefault (Standard) margins could result bigger vertical spaces around the table. Quasi regression from commit c46950fee11f5207fb8324947280cd565ae483e7 "tdf#143583 DOCX import: fix lost empty paragraphs of footnotes" (before this commit, empty paragraphs at the end of the footnotes were removed by accident, which hid the real problem fixed now). See also commit e11c51eefe8c3210cef2b5850f401ba67a401d01 "tdf#95806 tdf#125877 tdf#141172 DOCX: fix tables in footnotes" (Note: before this commit, only a single table was shown instead of the eight tables of the eight footnotes.) Change-Id: I4180a6f7d7c49faf0842637b23aa1c8c5680a76c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133752 Tested-by: Jenkins Reviewed-by: László Németh <[email protected]> (cherry picked from commit d1ac8df139a2a65db45d1970ccc0b80e17d827f6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133728 diff --git a/sw/qa/extras/ooxmlexport/data/tdf146346.docx b/sw/qa/extras/ooxmlexport/data/tdf146346.docx new file mode 100644 index 000000000000..846a33e9ae56 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf146346.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index a8e416951a8c..ffa1968648ef 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -1245,6 +1245,15 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143583) assertXPath(pXml, "/w:footnotes/w:footnote[6]/w:p", 3); } +// skip test for macOS (missing fonts?) +#if !defined(MACOSX) +DECLARE_OOXMLEXPORT_TEST(testTdf146346, "tdf146346.docx") +{ + // This was 2 (by bad docDefault vertical margins around tables in footnotes) + CPPUNIT_ASSERT_EQUAL(1, getPages()); +} +#endif + DECLARE_OOXMLEXPORT_TEST(testContSectBreakHeaderFooter, "cont-sect-break-header-footer.docx") { // Load a document with a continuous section break on page 2. diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index dabdff851a9c..34058d9c4702 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1468,9 +1468,26 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) } } - xBodyText->convertToTextFrame(rInfo.m_xStart, rInfo.m_xEnd, + const uno::Reference< text::XTextContent >& xTextContent = + xBodyText->convertToTextFrame(rInfo.m_xStart, rInfo.m_xEnd, rInfo.m_aFrameProperties); + // paragraph of the anchoring point of the floating table needs zero top and bottom + // margins, if the table was a not floating table in the footnote, otherwise + // docDefault margins could result bigger vertical spaces around the table + if ( rInfo.m_bConvertToFloatingInFootnote && xTextContent.is() ) + { + uno::Reference<beans::XPropertySet> xParagraph( + xTextContent->getAnchor(), uno::UNO_QUERY); + if ( xParagraph.is() ) + { + xParagraph->setPropertyValue("ParaTopMargin", + uno::makeAny(static_cast<sal_Int32>(0))); + xParagraph->setPropertyValue("ParaBottomMargin", + uno::makeAny(static_cast<sal_Int32>(0))); + } + } + uno::Reference<text::XTextTablesSupplier> xTextDocument(rDM_Impl.GetTextDocument(), uno::UNO_QUERY); uno::Reference<container::XNameAccess> xTables = xTextDocument->getTextTables(); for( size_t i = 0; i < aFramedRedlines.size(); i+=3)
