diff --git a/sw/qa/extras/ooxmlexport/data/tdf153526_commentInNumbering.docx b/sw/qa/extras/ooxmlexport/data/tdf153526_commentInNumbering.docx new file mode 100644 index 000000000000..f26240092c10 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf153526_commentInNumbering.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index 8b6795b726c5..2e71b5bcc7fe 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -80,6 +80,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf147646, "tdf147646_mergedCellNumbering.docx") CPPUNIT_ASSERT_EQUAL(OUString("2."),parseDump("/root/page/body/tab/row[4]/cell/txt/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Number']","expand")); } +DECLARE_OOXMLEXPORT_TEST(testTdf153526_commentInNumbering, "tdf153526_commentInNumbering.docx") +{ + // an exception was prematurely ending finishParagraph, losing numbering and CRs + // so before the patch, this was 6. + CPPUNIT_ASSERT_EQUAL(13, getParagraphs()); +} + DECLARE_OOXMLEXPORT_TEST(testTdf153042_largeTab, "tdf153042_largeTab.docx") { // This is not the greatest test because it is slightly weird, and has a different layout diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index efc83477f818..558d71f90fe7 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2332,11 +2332,14 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con uno::Reference xCurrentNumberingRules(itNumberingRules->Value, uno::UNO_QUERY); if (xCurrentNumberingRules.is()) aCurrentNumberingName = xCurrentNumberingRules->getName(); - if (m_xPreviousParagraph.is()) + try { - uno::Reference xPreviousNumberingRules(m_xPreviousParagraph->getPropertyValue("NumberingRules"), uno::UNO_QUERY); - if (xPreviousNumberingRules.is()) - aPreviousNumberingName = xPreviousNumberingRules->getName(); + uno::Reference xPreviousNumberingRules(m_xPreviousParagraph->getPropertyValue("NumberingRules"), uno::UNO_QUERY_THROW); + aPreviousNumberingName = xPreviousNumberingRules->getName(); + } + catch (const uno::Exception&) + { + TOOLS_WARN_EXCEPTION("writerfilter", "DomainMapper_Impl::finishParagraph NumberingRules"); } } else if ( m_xPreviousParagraph->getPropertySetInfo()->hasPropertyByName("NumberingStyleName") &&