diff --git a/cui/source/dialogs/SignatureLineDialog.cxx b/cui/source/dialogs/SignatureLineDialog.cxx index 3089830ef7a4..7cf512d83265 100644 --- a/cui/source/dialogs/SignatureLineDialog.cxx +++ b/cui/source/dialogs/SignatureLineDialog.cxx @@ -30,6 +30,8 @@ #include #include #include +#include +#include using namespace css; using namespace css::uno; @@ -174,11 +176,12 @@ void SignatureLineDialog::Apply() const Reference xTextDocument(m_xModel, UNO_QUERY); if (xTextDocument.is()) { - // Insert into document - Reference const xEnd - = Reference(m_xModel, UNO_QUERY)->getText()->getEnd(); - Reference const xShapeContent(xShapeProps, UNO_QUERY); - xShapeContent->attach(xEnd); + Reference xText = xTextDocument->getText(); + Reference xTextContent(xShape, UNO_QUERY_THROW); + Reference xViewCursorSupplier(m_xModel->getCurrentController(), + UNO_QUERY_THROW); + Reference xCursor = xViewCursorSupplier->getViewCursor(); + xText->insertTextContent(xCursor, xTextContent, true); return; }