[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara caolanm at redhat.com
Thu Jun 18 03:42:12 PDT 2015


 vcl/unx/gtk3/app/gtk3gtkinst.cxx |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit fe9da15401574551c34fffbd4e63eddca9743527
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 18 11:40:47 2015 +0100

    gtk3: implement most common case of text paste into us
    
    Change-Id: I733dd57e27330bc200f718ffb5680bbb81d5d77d

diff --git a/vcl/unx/gtk3/app/gtk3gtkinst.cxx b/vcl/unx/gtk3/app/gtk3gtkinst.cxx
index 902dd66..a96d1e4 100644
--- a/vcl/unx/gtk3/app/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/app/gtk3gtkinst.cxx
@@ -101,9 +101,19 @@ public:
               css::uno::RuntimeException, std::exception
               ) SAL_OVERRIDE
     {
-        fprintf(stderr, "TO-DO getTransferData\n");
-        (void)aFlavor;
-        return css::uno::Any();
+        css::uno::Any aRet;
+        GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
+        if (aFlavor.MimeType == "text/plain;charset=utf-16")
+        {
+            gchar *pText = gtk_clipboard_wait_for_text(clipboard);
+            OUString aStr(pText, rtl_str_getLength(pText),
+                RTL_TEXTENCODING_UTF8);
+            g_free(pText);
+            aRet <<= aStr.replaceAll("\r\n", "\n");
+        }
+        else
+            fprintf(stderr, "TO-DO getTransferData %s\n", OUStringToOString(aFlavor.MimeType, RTL_TEXTENCODING_UTF8).getStr());
+        return aRet;
     }
 
     virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors(  )


More information about the Libreoffice-commits mailing list