solenv/bin/macosx-codesign-app-bundle |   10 ++--
 vcl/ios/DataFlavorMapping.cxx         |   81 +++++++++++++++++-----------------
 2 files changed, 47 insertions(+), 44 deletions(-)

New commits:
commit 67b045c8aa66e2d2c51363d2d8448fa79b467628
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Fri Nov 20 01:02:02 2020 +0200
Commit:     Tor Lillqvist <t...@iki.fi>
CommitDate: Tue Apr 6 09:13:32 2021 +0300

    Check first if there is such a "bin" directory before attempting to use it
    
    In the test-install target in Makefile.in we remove the "bin" folder
    of the LibreOfficePython framework.
    
    Change-Id: Idf3d440c4f9465f21b5dcae60d4fc5ac21965dd8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106284
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tor Lillqvist <t...@collabora.com>

diff --git a/solenv/bin/macosx-codesign-app-bundle 
b/solenv/bin/macosx-codesign-app-bundle
index e34eee7e7111..a69efff0d37d 100755
--- a/solenv/bin/macosx-codesign-app-bundle
+++ b/solenv/bin/macosx-codesign-app-bundle
@@ -99,10 +99,12 @@ while read framework; do
         if test ! -L "$version" -a -d "$version"; then
            # Assume the framework has a XML (and not binary) Info.plist
            id=`grep -A 1 '<key>CFBundleIdentifier</key>' 
"$version/Resources/Info.plist" | tail -1 | sed -e 's,.*<string>,,' -e 
's,</string>.*,,'`
-            # files in bin are not covered by signing the framework...
-            for scriptorexecutable in $(find $version/bin/ -type f); do
-                codesign --verbose --options=runtime --force --identifier=$id 
--sign "$MACOSX_CODESIGNING_IDENTITY" "$scriptorexecutable" >> 
"/tmp/codesign_${fn}.log" 2>&1
-            done
+           if test -d $version/bin; then
+               # files in bin are not covered by signing the framework...
+               for scriptorexecutable in $(find $version/bin/ -type f); do
+                   codesign --verbose --options=runtime --force 
--identifier=$id --sign "$MACOSX_CODESIGNING_IDENTITY" "$scriptorexecutable" >> 
"/tmp/codesign_${fn}.log" 2>&1
+               done
+           fi
             codesign --verbose --force --identifier=$id --sign 
"$MACOSX_CODESIGNING_IDENTITY" "$version" >> "/tmp/codesign_${fn}.log" 2>&1
            if [ "$?" != "0" ] ; then
                exit 1
commit 77600de374646893146c6690e942f1cec898931f
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Fri Jan 15 15:32:58 2021 +0200
Commit:     Tor Lillqvist <t...@iki.fi>
CommitDate: Tue Apr 6 09:07:28 2021 +0300

    Fix handling of the OBJECTDESCRIPTOR clipboard (pasteboard) type on iOS
    
    This should fix https://github.com/CollaboraOnline/online/issues/849
    
    This is based on the corresponding fix for macOS. Much of our
    clipboard code for iOS is based on that for macOS.
    
    We need the pasteboard to have the OBJECTDESCRIPTOR type as a MIME
    type that includes the typename attribute, because the code in sc
    checks for that when it decides whether it is a proper
    OBJECTDESCRIPTOR.
    
    Simplify the data in the flavorMap array. No need to duplicate the
    same MIME type string as both the pasteboard type and MIME type, for
    those cases where the MIME type is used diretly as pasteboard type. We
    also know that for those types, the MIME type might have additional
    parameters, so be more lenient in checking.
    
    With this change, and my recent change to sot, this now works:
    
    Start the Collabora Office app. Open a spreadsheet. Select a cell
    range. (It can include formulas.) Copy. Close the spreadsheet
    document.
    
    (Killing the app process is not necessary, as no in-process
    clipboard is kept on iOS, but to make sure you are really accessing
    the system pasteboard and not some in-process cache, feel free to kill
    the process. After that, start Collabora Office again.)
    
    Open a spreadsheet. Paste. You get the very same cells that you pasted
    as such (with relative cell addresses in formulas properly adjusted,
    as expected).
    
    Previously, it would paste an image of the copied cell range, which is
    fairly pointless.
    
    There is still lots of opportunity for cleanup in the clipboard code
    for macOS and iOS.
    
    Change-Id: I4a385d52bbaafcd2ab8cb18e8f613c5efa592d11
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109368
    Tested-by: Tor Lillqvist <t...@collabora.com>
    Reviewed-by: Tor Lillqvist <t...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109373
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/vcl/ios/DataFlavorMapping.cxx b/vcl/ios/DataFlavorMapping.cxx
index a53cd8afdecb..6a3815cf7eb3 100644
--- a/vcl/ios/DataFlavorMapping.cxx
+++ b/vcl/ios/DataFlavorMapping.cxx
@@ -80,21 +80,6 @@ NSString* PBTYPE_PNG = (__bridge NSString*)kUTTypePNG;
 NSString* PBTYPE_JPEG = (__bridge NSString*)kUTTypeJPEG;
 NSString* PBTYPE_HTML = (__bridge NSString*)kUTTypeHTML;
 NSString* PBTYPE_PDF = (__bridge NSString*)kUTTypePDF;
-NSString* PBTYPE_SESX
-    = @"application/x-openoffice-embed-source-xml;windows_formatname=\"Star 
Embed Source (XML)\"";
-NSString* PBTYPE_SLSDX = @"application/"
-                         
@"x-openoffice-linksrcdescriptor-xml;windows_formatname=\"Star Link "
-                         @"Source Descriptor (XML)\"";
-NSString* PBTYPE_LSX
-    = @"application/x-openoffice-link-source-xml;windows_formatname=\"Star 
Link Source (XML)\"";
-NSString* PBTYPE_EOX = 
@"application/x-openoffice-embedded-obj-xml;windows_formatname=\"Star "
-                       @"Embedded Object (XML)\"";
-NSString* PBTYPE_SVXB
-    = @"application/x-openoffice-svbx;windows_formatname=\"SVXB (StarView 
Bitmap/Animation)\"";
-NSString* PBTYPE_GDIMF = 
@"application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"";
-NSString* PBTYPE_SODX = 
@"application/x-openoffice-objectdescriptor-xml;windows_formatname=\"Star "
-                        @"Object Descriptor (XML)\"";
-NSString* PBTYPE_DUMMY_INTERNAL = @"application/x-openoffice-internal";
 
 const char* FLAVOR_SESX
     = "application/x-openoffice-embed-source-xml;windows_formatname=\"Star 
Embed Source (XML)\"";
@@ -111,8 +96,6 @@ const char* FLAVOR_GDIMF
     = 
"application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"";
 const char* FLAVOR_SODX = 
"application/x-openoffice-objectdescriptor-xml;windows_formatname=\"Star "
                           "Object Descriptor (XML)\"";
-const char* FLAVOR_DUMMY_INTERNAL = "application/x-openoffice-internal";
-
 struct FlavorMap
 {
     NSString* SystemFlavor;
@@ -121,6 +104,17 @@ struct FlavorMap
     bool DataTypeOUString; // sequence<byte> otherwise
 };
 
+// The SystemFlavor member is nil for the cases where there is no predefined 
pasteboard type UTI and
+// we use the internal MIME type (media type) also on the pasteboard. That is 
OK, there dos not seem
+// to be a requirement that the types are well-formed UTIs even on iOS. For an 
introduction to UTIs,
+// see for instance
+// 
https://alastairs-place.net/blog/2012/06/06/utis-are-better-than-you-think-and-heres-why/
+//
+// In those cases the MIME type might actually have parameters appended, 
separated by semicolons.
+// At least the FLAVOR_SODX one must have at least a typename="%PRODUCTNAME 
%PRODUCTVERSION
+// Spreadsheet" parameter (with macros expanded and translated) for LO to 
recognise it. See
+// lcl_TestFormat() in sc/source/ui/view/cellsh.cxx.
+
 static const FlavorMap flavorMap[]
     = { { PBTYPE_UTF8PLAINTEXT, "text/plain;charset=utf-16", "Unicode Text 
(UTF-16)", true },
         { PBTYPE_RTF, "text/rtf", "Rich Text Format", false },
@@ -128,14 +122,13 @@ static const FlavorMap flavorMap[]
         { PBTYPE_JPEG, "image/jpeg", "JPEG", 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 },
-        { PBTYPE_LSX, FLAVOR_LSX, "Star Link Source (XML)", false },
-        { PBTYPE_EOX, FLAVOR_EOX, "Star Embedded Object (XML)", false },
-        { PBTYPE_SVXB, FLAVOR_SVXB, "SVXB (StarView Bitmap/Animation", false },
-        { PBTYPE_GDIMF, FLAVOR_GDIMF, "GDIMetaFile", false },
-        { PBTYPE_SODX, FLAVOR_SODX, "Star Object Descriptor (XML)", false },
-        { PBTYPE_DUMMY_INTERNAL, FLAVOR_DUMMY_INTERNAL, "internal data", false 
} };
+        { nil, FLAVOR_SESX, "Star Embed Source (XML)", false },
+        { nil, FLAVOR_SLSDX, "Star Link Source Descriptor (XML)", false },
+        { nil, FLAVOR_LSX, "Star Link Source (XML)", false },
+        { nil, FLAVOR_EOX, "Star Embedded Object (XML)", false },
+        { nil, FLAVOR_SVXB, "SVXB (StarView Bitmap/Animation", false },
+        { nil, FLAVOR_GDIMF, "GDIMetaFile", false },
+        { nil, FLAVOR_SODX, "Star Object Descriptor (XML)", false } };
 
 #define SIZE_FLAVOR_MAP (sizeof(flavorMap) / sizeof(FlavorMap))
 
@@ -360,11 +353,20 @@ DataFlavor 
DataFlavorMapper::systemToOpenOfficeFlavor(const NSString* systemData
 
     for (size_t i = 0; i < SIZE_FLAVOR_MAP; i++)
     {
-        if ([systemDataFlavor
-                
caseInsensitiveCompare:const_cast<NSString*>(flavorMap[i].SystemFlavor)]
-            == NSOrderedSame)
+        if ((flavorMap[i].SystemFlavor == nil
+             && ([systemDataFlavor
+                     isEqualToString:[NSString 
stringWithUTF8String:flavorMap[i].OOoFlavor]]
+                 ||
+                 [systemDataFlavor hasPrefix:[[NSString 
stringWithUTF8String:flavorMap[i].OOoFlavor]
+                                                 
stringByAppendingString:@";"]]))
+            || (flavorMap[i].SystemFlavor != nil &&
+                [systemDataFlavor
+                    
isEqualToString:const_cast<NSString*>(flavorMap[i].SystemFlavor)]))
         {
-            oOOFlavor.MimeType = 
OUString::createFromAscii(flavorMap[i].OOoFlavor);
+            if (flavorMap[i].SystemFlavor == nil)
+                oOOFlavor.MimeType = NSStringToOUString(systemDataFlavor);
+            else
+                oOOFlavor.MimeType = 
OUString::createFromAscii(flavorMap[i].OOoFlavor);
             oOOFlavor.HumanPresentableName
                 = OUString::createFromAscii(flavorMap[i].HumanPresentableName);
             oOOFlavor.DataType = flavorMap[i].DataTypeOUString
@@ -397,7 +399,10 @@ NSString* DataFlavorMapper::openOfficeToSystemFlavor(const 
DataFlavor& oOOFlavor
     {
         if 
(oOOFlavor.MimeType.startsWith(OUString::createFromAscii(flavorMap[i].OOoFlavor)))
         {
-            sysFlavor = flavorMap[i].SystemFlavor;
+            if (flavorMap[i].SystemFlavor != nil)
+                sysFlavor = flavorMap[i].SystemFlavor;
+            else
+                sysFlavor = OUStringToNSString(oOOFlavor.MimeType);
         }
     }
 
@@ -458,8 +463,10 @@ DataFlavorMapper::getDataProvider(const NSString* 
systemFlavor,
             dp = DataProviderPtr_t(new Utf8DataProvider(data));
         }
     }
-    catch (UnsupportedFlavorException&)
+    catch (const UnsupportedFlavorException& e)
     {
+        SAL_WARN("vcl.ios.clipboard",
+                 "DataFlavorMapper::getDataProvider(): Exception: " << 
e.Message);
         // Somebody violates the contract of the clipboard
         // interface @see XTransferable
     }
@@ -499,8 +506,10 @@ bool DataFlavorMapper::isValidMimeContentType(const 
OUString& contentType) const
     {
         Reference<XMimeContentType> 
xCntType(mrXMimeCntFactory->createMimeContentType(contentType));
     }
-    catch (IllegalArgumentException&)
+    catch (const IllegalArgumentException& e)
     {
+        SAL_WARN("vcl.ios.clipboard",
+                 "DataFlavorMapper::isValidMimeContentType(): Exception: " << 
e.Message);
         result = false;
     }
 
@@ -533,14 +542,6 @@ NSArray* DataFlavorMapper::flavorSequenceToTypesArray(
         }
     }
 
-    // #i89462# #i90747#
-    // in case no system flavor was found to report
-    // report at least one so D&D between OOo targets works
-    if ([array count] == 0 || bNeedDummyInternalFlavor)
-    {
-        [array addObject:PBTYPE_DUMMY_INTERNAL];
-    }
-
     return [array autorelease];
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to