diff --git a/sw/qa/writerfilter/rtftok/data/cell-then-intbl.rtf b/sw/qa/writerfilter/rtftok/data/cell-then-intbl.rtf new file mode 100644 index 000000000000..f80c1b8720cd --- /dev/null +++ b/sw/qa/writerfilter/rtftok/data/cell-then-intbl.rtf @@ -0,0 +1 @@ +{\rtf1\cell x\intbl} \ No newline at end of file diff --git a/sw/qa/writerfilter/rtftok/rtfdispatchsymbol.cxx b/sw/qa/writerfilter/rtftok/rtfdispatchsymbol.cxx index 72780e7a4b2b..7c2a3ed6c114 100644 --- a/sw/qa/writerfilter/rtftok/rtfdispatchsymbol.cxx +++ b/sw/qa/writerfilter/rtftok/rtfdispatchsymbol.cxx @@ -84,6 +84,23 @@ CPPUNIT_TEST_FIXTURE(Test, testFloattableThenSectBreak) // i.e. the floating table was on the 2nd page, not on the 1st page. assertXPath(pXmlDoc, "/root/page[1]/sorted_objs/fly", 1); } + +CPPUNIT_TEST_FIXTURE(Test, testCellThenIntbl) +{ + // Given a document where the \intbl comes after the \cell: + // When loading that file: + loadFromFile(u"cell-then-intbl.rtf"); + + // Then make sure that the text after the cell end is in the document: + uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xText(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference xParagraphs = xText->createEnumeration(); + uno::Reference xParagraph(xParagraphs->nextElement(), uno::UNO_QUERY); + // Without the accompanying fix in place, this test would have failed, the import replayed + // the buffered cell end with no properties to put it in. + CPPUNIT_ASSERT_EQUAL(u"x"_ustr, xParagraph->getString()); + CPPUNIT_ASSERT(!xParagraphs->hasMoreElements()); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx b/sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx index 8a34962da790..e82ec722ee93 100644 --- a/sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx +++ b/sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx @@ -142,6 +142,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) pCurrentBuffer->begin(), pCurrentBuffer->end(), [](auto const& it) { return ::std::get<0>(it) == RTFBufferTypes::PAR + || ::std::get<0>(it) == RTFBufferTypes::CellEnd || (::std::get<0>(it) == RTFBufferTypes::Props && ::std::get<1>(it)->getSprms().find( NS_ooxml::LN_inTbl)