cui/source/dialogs/SignatureLineDialog.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
New commits: commit a09ed9a9eae17103b7ad6b5f99c78f6c36b6084b Author: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> Date: Thu Jul 5 21:48:49 2018 +0200 Writer: Insert signature line at current cursor position Reviewed-on: https://gerrit.libreoffice.org/57026 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> (cherry picked from commit 8905ae9f0fc8b0e4a95113fd81e88d4e7db57bcc) Change-Id: Ic7cbcd409372a2d8222f57e67e1109a74f6f5ce3 Reviewed-on: https://gerrit.libreoffice.org/57035 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/cui/source/dialogs/SignatureLineDialog.cxx b/cui/source/dialogs/SignatureLineDialog.cxx index bd3d2a75003a..f2a5ec06d26e 100644 --- a/cui/source/dialogs/SignatureLineDialog.cxx +++ b/cui/source/dialogs/SignatureLineDialog.cxx @@ -25,6 +25,8 @@ #include <com/sun/star/text/TextContentAnchorType.hpp> #include <com/sun/star/text/XTextContent.hpp> #include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/text/XTextViewCursor.hpp> +#include <com/sun/star/text/XTextViewCursorSupplier.hpp> using namespace css; using namespace css::uno; @@ -162,10 +164,13 @@ void SignatureLineDialog::Apply() xShapeProps->setPropertyValue("AnchorType", Any(TextContentAnchorType_AT_PARAGRAPH)); // Insert into document - Reference<XTextRange> const xEnd - = Reference<XTextDocument>(m_xModel, UNO_QUERY)->getText()->getEnd(); - Reference<XTextContent> const xShapeContent(xShapeProps, UNO_QUERY); - xShapeContent->attach(xEnd); + const Reference<XTextDocument> xTextDocument(m_xModel, UNO_QUERY); + Reference<XText> xText = xTextDocument->getText(); + Reference<XTextContent> xTextContent(xShape, UNO_QUERY_THROW); + Reference<XTextViewCursorSupplier> xViewCursorSupplier(m_xModel->getCurrentController(), + UNO_QUERY_THROW); + Reference<XTextViewCursor> xCursor = xViewCursorSupplier->getViewCursor(); + xText->insertTextContent(xCursor, xTextContent, true); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits