diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 716341d3bc56..12a0608e4480 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -708,7 +708,7 @@ public: /// Update content of all charts for table with given name. void UpdateCharts( const UIName& rName ); - OUString GetCurWord() const; + SW_DLLPUBLIC OUString GetCurWord() const; // used in CppunitTest_sw_uiwriter9 /** Glossary from glossary document in current document. Styles only if not already existent. */ diff --git a/sw/qa/extras/uiwriter/data/floattable-nosection-7in.docx b/sw/qa/extras/uiwriter/data/floattable-nosection-7in.docx new file mode 100644 index 000000000000..8d5167af9a3a Binary files /dev/null and b/sw/qa/extras/uiwriter/data/floattable-nosection-7in.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index 281fd974e61f..7d3732214329 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -1864,6 +1864,20 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf168355) CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pPageFrm->GetVirtPageNum()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testSplitFloattableGetCurWord) +{ + // Given a document with a floating table that splits across pages: the anchor paragraph has + // text; it's split together with its floating table; and its first frame has no SwParaPortion + // (only the last follow frame has it). + createSwDoc("floattable-nosection-7in.docx"); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + // Go to end (the anchor paragraph for the floating table) + pWrtShell->SttEndDoc(/*bStt=*/false); + + // Without the fix this would crash + CPPUNIT_ASSERT_EQUAL(u"End"_ustr, pWrtShell->GetCurWord()); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT();