[Libreoffice-commits] core.git: 3 commits - include/sal vcl/ios

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Wed May 29 11:09:42 UTC 2019


 include/sal/log-areas.dox     |    1 +
 vcl/ios/DataFlavorMapping.cxx |   21 +++++++--------------
 vcl/ios/DataFlavorMapping.hxx |    4 ----
 vcl/ios/iOSTransferable.cxx   |   12 ++++++++++++
 4 files changed, 20 insertions(+), 18 deletions(-)

New commits:
commit 0e296d25e736038e76eab1f64aacff6d1aa3e7b1
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed May 29 13:50:14 2019 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Wed May 29 14:07:35 2019 +0300

    The iOS DataFlavorMapper::getAllSupportedPboardTypes() is unused
    
    Change-Id: Icc72fca62e189559956abc0ebbca9ce196a02073

diff --git a/vcl/ios/DataFlavorMapping.cxx b/vcl/ios/DataFlavorMapping.cxx
index a330209a2d36..fab611349c8a 100644
--- a/vcl/ios/DataFlavorMapping.cxx
+++ b/vcl/ios/DataFlavorMapping.cxx
@@ -568,16 +568,4 @@ DataFlavorMapper::typesArrayToFlavorSequence(NSArray* types) const
     return flavors;
 }
 
-NSArray* DataFlavorMapper::getAllSupportedPboardTypes()
-{
-    NSMutableArray* array = [[NSMutableArray alloc] initWithCapacity:SIZE_FLAVOR_MAP];
-
-    for (sal_uInt32 i = 0; i < SIZE_FLAVOR_MAP; i++)
-    {
-        [array addObject:flavorMap[i].SystemFlavor];
-    }
-
-    return [array autorelease];
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/DataFlavorMapping.hxx b/vcl/ios/DataFlavorMapping.hxx
index 9485e2561689..936d7fc2f48b 100644
--- a/vcl/ios/DataFlavorMapping.hxx
+++ b/vcl/ios/DataFlavorMapping.hxx
@@ -111,10 +111,6 @@ public:
     css::uno::Sequence<css::datatransfer::DataFlavor>
     typesArrayToFlavorSequence(NSArray* types) const;
 
-    /* Returns an NSArray containing all pasteboard types supported by OOo
-   */
-    static NSArray* getAllSupportedPboardTypes();
-
 private:
     /* Determines if the provided Mime content type is valid.
    */
commit 3f8ac50022215e53b592c1d630dd0609cab4e58e
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed May 29 13:35:54 2019 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Wed May 29 14:07:34 2019 +0300

    tdf#124752: We do need to accept text/html from the system clipboard
    
    Sadly we can't accept public.utf8-plain-text, i.e.
    text/plain;charset=utf-8, as the code does not know of such a
    SotClipboardFormatId. The only text/plain is UTF-16.
    
    And it probably is a good idea to accept HTML anyway. We have to
    continue to (I think) not offer text/html because of the assertion
    failure issue, see comment in DataFlavorMapper::openOfficeToSystemFlavor().
    
    Change-Id: If5d77b97649424e347c50af10475c2be997c8632

diff --git a/vcl/ios/DataFlavorMapping.cxx b/vcl/ios/DataFlavorMapping.cxx
index be4ecb299ff5..a330209a2d36 100644
--- a/vcl/ios/DataFlavorMapping.cxx
+++ b/vcl/ios/DataFlavorMapping.cxx
@@ -75,6 +75,8 @@ NSString* OUStringToNSString(const OUString& ustring)
 }
 
 NSString* PBTYPE_PLAINTEXT = (__bridge NSString*)kUTTypePlainText;
+// Nope. See commented-out use below.
+// NSString* PBTYPE_UTF8PLAINTEXT = (__bridge NSString*)kUTTypeUTF8PlainText;
 NSString* PBTYPE_RTF = (__bridge NSString*)kUTTypeRTF;
 NSString* PBTYPE_PNG = (__bridge NSString*)kUTTypePNG;
 NSString* PBTYPE_JPEG = (__bridge NSString*)kUTTypeJPEG;
@@ -123,11 +125,12 @@ struct FlavorMap
 
 static const FlavorMap flavorMap[]
     = { { PBTYPE_PLAINTEXT, "text/plain;charset=utf-16", "Unicode Text (UTF-16)", true },
+        // Nope. The LO code does not understand text/plain in UTF-8. Which is a shame.
+        // PBTYPE_UTF8PLAINTEXT, "text/plain;charset=utf-8", "Unicode Text (UTF-8)", false },
         { PBTYPE_RTF, "text/rtf", "Rich Text Format", false },
         { PBTYPE_PNG, "image/png", "Portable Network Graphics", false },
         { PBTYPE_JPEG, "image/jpeg", "Portable Network Graphics", false },
-        // Nope, sorry. See comment in openOfficeToSystemFlavor() below.
-        // { PBTYPE_HTML, "text/html", "Plain HTML", false },
+        { PBTYPE_HTML, "text/html", "Plain HTML", false },
         { PBTYPE_PDF, "application/pdf", "PDF File", false },
         { PBTYPE_SESX, FLAVOR_SESX, "Star Embed Source (XML)", false },
         { PBTYPE_SLSDX, FLAVOR_SLSDX, "Star Link Source Descriptor (XML)", false },
commit bcc36b632ecbf4a2e126e640055ad0ed852fb9e8
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed May 29 11:36:50 2019 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Wed May 29 14:07:34 2019 +0300

    Add a couple of SAL_INFOs about types available on the system clipboard
    
    Change-Id: I821a699ee4f44881aadac89f265974a10095b544

diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index 8d9a2c68ea92..904ba74b4425 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -478,6 +478,7 @@ certain functionality.
 @li @c vcl.headless - bitmap-based backend
 @li @c vcl.helper
 @li @c vcl.icontest
+ at li @c vcl.ios.clipboard
 @li @c vcl.kde5 - KDE5
 @li @c vcl.layout - Widget layout
 @li @c vcl.lazydelete
diff --git a/vcl/ios/DataFlavorMapping.cxx b/vcl/ios/DataFlavorMapping.cxx
index 37ff2181d651..be4ecb299ff5 100644
--- a/vcl/ios/DataFlavorMapping.cxx
+++ b/vcl/ios/DataFlavorMapping.cxx
@@ -557,6 +557,8 @@ DataFlavorMapper::typesArrayToFlavorSequence(NSArray* types) const
         {
             flavors.realloc(flavors.getLength() + 1);
             flavors[flavors.getLength() - 1] = oOOFlavor;
+            SAL_INFO("vcl.ios.clipboard",
+                     "Mapped " << [sysFormat UTF8String] << " to " << oOOFlavor.MimeType);
         }
     }
 
diff --git a/vcl/ios/iOSTransferable.cxx b/vcl/ios/iOSTransferable.cxx
index b1bc4043ea9e..9ec27867fb0b 100644
--- a/vcl/ios/iOSTransferable.cxx
+++ b/vcl/ios/iOSTransferable.cxx
@@ -21,6 +21,7 @@
 
 #include <com/sun/star/datatransfer/UnsupportedFlavorException.hpp>
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <sal/log.hxx>
 #include <sal/types.h>
 #include <osl/diagnose.h>
 
@@ -142,6 +143,17 @@ void iOSTransferable::initClipboardItemList()
         throw RuntimeException("Cannot get clipboard data", static_cast<XTransferable*>(this));
     }
 
+#ifdef SAL_LOG_INFO
+    NSString* types = @"";
+    for (unsigned i = 0; i < [pboardFormats count]; i++)
+    {
+        if ([types length] > 0)
+            types = [types stringByAppendingString:@", "];
+        types = [types stringByAppendingString:[pboardFormats objectAtIndex:i]];
+    }
+    SAL_INFO("vcl.ios.clipboard", "Types on clipboard: " << [types UTF8String]);
+#endif
+
     mFlavorList = mDataFlavorMapper->typesArrayToFlavorSequence(pboardFormats);
 }
 


More information about the Libreoffice-commits mailing list