diff --git a/sw/qa/extras/uiwriter/data/tdf131124_Extruded_Shape_Selection.odt b/sw/qa/extras/uiwriter/data/tdf131124_Extruded_Shape_Selection.odt new file mode 100644 index 000000000000..5d2d0ef7bd1a Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf131124_Extruded_Shape_Selection.odt differ diff --git a/sw/qa/extras/uiwriter/data/tdf131124_Fontwork_Selection.odt b/sw/qa/extras/uiwriter/data/tdf131124_Fontwork_Selection.odt new file mode 100644 index 000000000000..8b3090d1ae65 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf131124_Fontwork_Selection.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter11.cxx b/sw/qa/extras/uiwriter/uiwriter11.cxx index cc642e56d600..dfe2c60ffee5 100644 --- a/sw/qa/extras/uiwriter/uiwriter11.cxx +++ b/sw/qa/extras/uiwriter/uiwriter11.cxx @@ -397,6 +397,34 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest11, testTdf162120AutoRTL) getProperty(getRun(getParagraph(1), 1), u"WritingMode"_ustr)); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest11, testFontworkSelection) +{ + // Load a document with a Fontwork shape and select the shape + createSwDoc("tdf131124_Fontwork_Selection.odt"); + dispatchCommand(mxComponent, u".uno:JumpToNextFrame"_ustr, {}); + + // Make sure the CurrentSelection of the document is not empty. + uno::Reference xModel(mxComponent, uno::UNO_QUERY); + uno::Reference xSelections(xModel->getCurrentSelection(), + uno::UNO_QUERY); + // Without fix, this test would have failed here + CPPUNIT_ASSERT(xSelections.is()); +} + +CPPUNIT_TEST_FIXTURE(SwUiWriterTest11, testExtrudedShapeSelection) +{ + // Load a document with an extruded custom shape and select the shape + createSwDoc("tdf131124_Extruded_Shape_Selection.odt"); + dispatchCommand(mxComponent, u".uno:JumpToNextFrame"_ustr, {}); + + // Make sure the CurrentSelection of the document is not empty. + uno::Reference xModel(mxComponent, uno::UNO_QUERY); + uno::Reference xSelections(xModel->getCurrentSelection(), + uno::UNO_QUERY); + // Without fix, this test would have failed here + CPPUNIT_ASSERT(xSelections.is()); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index d57845269f18..a002755973ea 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -321,6 +321,8 @@ uno::Any SwXTextView::getSelection() case ShellMode::DrawForm : case ShellMode::DrawText : case ShellMode::Bezier : + case ShellMode::ExtrudedCustomShape: + case ShellMode::FontWork: { uno::Reference< drawing::XShapes > xShCol = drawing::ShapeCollection::create( comphelper::getProcessComponentContext());