From 8905ae9f0fc8b0e4a95113fd81e88d4e7db57bcc Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Thu, 5 Jul 2018 21:48:49 +0200 Subject: [PATCH] Writer: Insert signature line at current cursor position Change-Id: Ic7cbcd409372a2d8222f57e67e1109a74f6f5ce3 Reviewed-on: https://gerrit.libreoffice.org/57026 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt --- cui/source/dialogs/SignatureLineDialog.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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; }