[Libreoffice-commits] core.git: cui/source
Samuel Mehrbrodt
Samuel.Mehrbrodt at cib.de
Fri Jul 6 05:44:49 UTC 2018
cui/source/dialogs/SignatureLineDialog.cxx | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
New commits:
commit 8905ae9f0fc8b0e4a95113fd81e88d4e7db57bcc
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Thu Jul 5 21:48:49 2018 +0200
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 <Samuel.Mehrbrodt at cib.de>
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 <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;
@@ -174,11 +176,12 @@ void SignatureLineDialog::Apply()
const Reference<XTextDocument> xTextDocument(m_xModel, UNO_QUERY);
if (xTextDocument.is())
{
- // 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);
+ 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);
return;
}
More information about the Libreoffice-commits
mailing list