diff options
author | Czeber László Ádám <czeber.laszloadam@nisz.hu> | 2023-03-27 09:59:28 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2023-03-27 13:50:44 +0000 |
commit | 5f138e23f61b58857b0e90dc09642ee832af29d4 (patch) | |
tree | 79b6b7a7dedfe785796893bc713d0c453bd6f280 | |
parent | 5ed8d20d5f846e916e8af6f58d55955d9657e749 (diff) |
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 <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf135786.docx | bin | 0 -> 5569 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 10 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 1 |
4 files changed, 13 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf135786.docx b/sw/qa/extras/ooxmlexport/data/tdf135786.docx Binary files differnew file mode 100644 index 000000000000..b766b1905aaf --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf135786.docx 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(); |