summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-07-05 21:48:49 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-07-06 17:06:39 +0200
commita09ed9a9eae17103b7ad6b5f99c78f6c36b6084b (patch)
treed3342d74657e5751814efdb1d28d793b2a84d409 /cui
parent7c11c07d237c0ac60769564694a07f87b9a3cc02 (diff)
Writer: Insert signature line at current cursor position
Reviewed-on: https://gerrit.libreoffice.org/57026 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@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.Behrens@CIB.de>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/SignatureLineDialog.cxx13
1 files changed, 9 insertions, 4 deletions
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);
}
}