sw/qa/extras/ooxmlexport/data/tdf135786.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 10 +++++++++- writerfilter/source/dmapper/DomainMapper.cxx | 5 +++-- writerfilter/source/dmapper/DomainMapper_Impl.hxx | 1 + 4 files changed, 13 insertions(+), 3 deletions(-)
New commits: commit 5f138e23f61b58857b0e90dc09642ee832af29d4 Author: Czeber László Ádám <czeber.laszloa...@nisz.hu> AuthorDate: Mon Mar 27 09:59:28 2023 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Mon Mar 27 13:50:44 2023 +0000 tdf#135786: DOCX import: remove dummy paragraph before tables with comment Section-starting tables were imported with a section-starting dummy paragraph, when the tables contain comments. Remove dummy paragraph by postponing the call of RemoveDummyParaForTableInSection() after the annotations are processed. Regression from commit 2e8aad6d45c53d554ccaf26de998ede708cfc289 "fdo#39056 fdo#75431 Section Properties if section starts with table". Change-Id: I4c566d0adbe16e4f57018301a98db93b37bcd45f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149623 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/ooxmlexport/data/tdf135786.docx b/sw/qa/extras/ooxmlexport/data/tdf135786.docx new file mode 100644 index 000000000000..b766b1905aaf Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf135786.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index 9d7a81304588..90e9cf2e6543 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -658,6 +658,14 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf153664) assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableofFigures']/w:name", "val", "Table of Figures"); } -CPPUNIT_PLUGIN_IMPLEMENT(); +DECLARE_OOXMLEXPORT_TEST(testTdf135786, "tdf135786.docx") +{ + // Empty first line remain, if the section's initial dummy paragraph is not deleted: + // - Expected: 2 + // - Actual : 3 + CPPUNIT_ASSERT_EQUAL(2, getParagraphs()); +} + + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 9db58e721a1b..1438ba4fee2e 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3531,8 +3531,9 @@ void DomainMapper::lcl_endSectionGroup() pSectionContext->CloseSectionGroup( *m_pImpl ); // Remove the dummy paragraph if added for // handling the section properties if section starts with a table - if (m_pImpl->GetIsDummyParaAddedForTableInSection()) - m_pImpl->RemoveDummyParaForTableInSection(); + // tdf#135786: Added annotation condition + if (m_pImpl->GetIsDummyParaAddedForTableInSection() && (m_pImpl->GetAnnotationId() < 0)) + m_pImpl->RemoveDummyParaForTableInSection(); } m_pImpl->SetIsTextFrameInserted( false ); m_pImpl->PopProperties(CONTEXT_SECTION); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 050a510353a8..3150a890f88d 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -906,6 +906,7 @@ public: void PushAnnotation(); void PopAnnotation(); + sal_Int32 GetAnnotationId() { return m_nAnnotationId; } /// A field context starts with a cFieldStart. void PushFieldContext();