sw/qa/extras/rtfimport/data/tdf167710.rtf | 6 ++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 7 +++++++ sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx | 3 +++ 3 files changed, 16 insertions(+)
New commits: commit 4893adb82277ad42076b1d82623dadba7d64c1bf Author: Michael Stahl <michael.st...@collabora.com> AuthorDate: Thu Jul 31 18:18:52 2025 +0200 Commit: Michael Stahl <michael.st...@collabora.com> CommitDate: Fri Aug 1 17:06:01 2025 +0200 tdf#167710 writerfilter: RTF import: ignore text in evtbl Only text in groups in evtbl is relevant. Same goes for \stylesheet. (regression from commit 82e17dbb2a16c7653a163139f0eea51faa4d46b8) Change-Id: I70a97f7815e1f83b10be7cf12ee5abcd6b662a92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188705 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@collabora.com> (cherry picked from commit b45ba94bf2d927d0306cdd0e885017735ae4b21e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188772 Tested-by: Michael Stahl <michael.st...@collabora.com> diff --git a/sw/qa/extras/rtfimport/data/tdf167710.rtf b/sw/qa/extras/rtfimport/data/tdf167710.rtf new file mode 100644 index 000000000000..02842a50fe37 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf167710.rtf @@ -0,0 +1,6 @@ +{ tf1 +{\* evtbl Unknown;} +\sectd +\pard\plain +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 41239394674a..b723aa10e889 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -2053,6 +2053,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf166191) CPPUNIT_ASSERT_EQUAL(12.0f, getProperty<float>(textRun, u"CharHeight"_ustr)); } +CPPUNIT_TEST_FIXTURE(Test, testTdf167710) +{ + createSwDoc("tdf167710.rtf"); + // problem was that text was erroneously imported + CPPUNIT_ASSERT(getParagraph(1)->getString().isEmpty()); +} + // tests should only be added to rtfIMPORT *if* they fail round-tripping in rtfEXPORT } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx b/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx index 2b0d361cefe0..d53145646967 100644 --- a/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx +++ b/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx @@ -1534,6 +1534,9 @@ void RTFDocumentImpl::text(OUString& rString) switch (m_aStates.top().getDestination()) { // Note: in stylesheet and revtbl groups are mandatory + case Destination::STYLESHEET: + case Destination::REVISIONTABLE: + break; // no text allowed here - ignore it case Destination::STYLEENTRY: case Destination::LISTNAME: case Destination::REVISIONENTRY: