[Libreoffice-commits] core.git: sw/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Jun 18 05:04:15 PDT 2015


 sw/source/uibase/uno/unotxdoc.cxx |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 193b907b2bc49b9e48cfab2583e81a24aaa2e666
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jun 18 14:03:00 2015 +0200

    SwXTextDocument::getTextSelection: fix missing editeng forward
    
    When editing shape text, the text selection should be provided by
    editeng.
    
    Change-Id: I379f89fc28d2ff8172d0411bba347c959de6ab29

diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 268148e..6b81c637 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -142,6 +142,7 @@
 
 #include <editeng/eeitem.hxx>
 #include <editeng/editeng.hxx>
+#include <editeng/editview.hxx>
 #include <svx/svdoutl.hxx>
 #include <svl/languageoptions.hxx>
 #include <svx/svdview.hxx>
@@ -3256,8 +3257,21 @@ void SwXTextDocument::setTextSelection(int nType, int nX, int nY)
 
 OString SwXTextDocument::getTextSelection(const char* pMimeType)
 {
+    uno::Reference<datatransfer::XTransferable> xTransferable;
+
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
-    uno::Reference<datatransfer::XTransferable> xTransferable(new SwTransferable(*pWrtShell));
+    if (SdrView* pSdrView = pWrtShell->GetDrawView())
+    {
+        if (pSdrView->GetTextEditObject())
+        {
+            // Editing shape text
+            EditView& rEditView = pSdrView->GetTextEditOutlinerView()->GetEditView();
+            xTransferable = rEditView.GetEditEngine()->CreateTransferable(rEditView.GetSelection());
+        }
+    }
+
+    if (!xTransferable.is())
+        xTransferable = new SwTransferable(*pWrtShell);
 
     // Take care of UTF-8 text here.
     OString aMimeType(pMimeType);


More information about the Libreoffice-commits mailing list