From 99125ebab06f776cc8d44f063d6bed76d51996ff Mon Sep 17 00:00:00 2001 From: Vasily Melenchuk Date: Mon, 25 Mar 2024 16:01:48 +0300 Subject: tdf#160553: writerfilter: RTF import: fix problem with first table in section Handles section properties between tables. JUnit test included Change-Id: I1db8b80749d18c0e73112e4fd1d13d6331aa7291 Change-Id: I8b00bfeb260af024f48ba8a3e6e6ac38e834b684 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170924 Tested-by: Thorsten Behrens Reviewed-by: Thorsten Behrens --- sw/qa/extras/rtfimport/data/tdf160553.rtf | 20 ++++++++++++++++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 8 ++++++++ writerfilter/source/dmapper/DomainMapper.cxx | 3 ++- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100755 sw/qa/extras/rtfimport/data/tdf160553.rtf diff --git a/sw/qa/extras/rtfimport/data/tdf160553.rtf b/sw/qa/extras/rtfimport/data/tdf160553.rtf new file mode 100755 index 000000000000..2e7b26db4e70 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf160553.rtf @@ -0,0 +1,20 @@ +{\rtf1 + + +\trowd \cellx6096\cellx9356 +\intbl 1\cell +\intbl 2\cell +\trowd \cellx6096\cellx9356 +\row +\pard HELLO\par + +\sect\sectd + +\trowd \cellx6096\cellx9356 +\intbl 1\cell +\intbl 2\cell +\trowd \cellx6096\cellx9356 +\row +\pard + +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 58a6857cffd2..4feef4bd113c 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1837,6 +1837,14 @@ CPPUNIT_TEST_FIXTURE(Test, test158044Tdf) CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, fillStyle); } } + +CPPUNIT_TEST_FIXTURE(Test, test160553Tdf) +{ + createSwDoc("tdf160553.rtf"); + // new section should create second page + CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + // tests should only be added to rtfIMPORT *if* they fail round-tripping in rtfEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index d2fcefced9aa..01e2f043390a 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3350,7 +3350,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) } break; case NS_ooxml::LN_tblEnd: - m_pImpl->m_StreamStateStack.top().nTableDepth--; + if (m_pImpl->m_StreamStateStack.top().nTableDepth > 0) + m_pImpl->m_StreamStateStack.top().nTableDepth--; break; case NS_ooxml::LN_tcStart: m_pImpl->m_nTableCellDepth++; -- cgit v1.2.3