desktop/Library_sofficeapp.mk        |    6 ++++--
 desktop/source/lib/init.cxx          |   22 ++++++++++++++++++++++
 postprocess/Rdb_services.mk          |    5 +++--
 solenv/bin/native-code.py            |    2 +-
 vcl/source/components/dtranscomp.cxx |    4 ++++
 vcl/source/treelist/transfer2.cxx    |    5 +++++
 6 files changed, 39 insertions(+), 5 deletions(-)

New commits:
commit cde6577dcb9c94aca7605790d34c83a5ff62edad
Author:     Tor Lillqvist <t...@iki.fi>
AuthorDate: Tue Jan 4 16:33:16 2022 +0200
Commit:     Aron Budea <aron.bu...@collabora.com>
CommitDate: Wed Jan 5 22:54:22 2022 +0100

    We don't want or need any LOKClipboard on iOS
    
    We use only the system clipboard on iOS. (It is actually called the
    "pasteboard" in Apple's operating systems.) The code to interface with
    the system clipboard is in vcl. It has worked fine to copy and paste
    between the Collabora Office iOS app and other iOS apps without any
    LOKClipboard being involved. If LOKClipboard is used it doesn't work
    at all.
    
    Change-Id: I0d3b4e3eabe17b633390e071701225e1d356a75a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127968
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Aron Budea <aron.bu...@collabora.com>

diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk
index 91f992e4501f..ab4fde902a18 100644
--- a/desktop/Library_sofficeapp.mk
+++ b/desktop/Library_sofficeapp.mk
@@ -156,11 +156,13 @@ ifneq ($(filter $(OS),ANDROID iOS MACOSX WNT),)
 $(eval $(call gb_Library_add_exception_objects,sofficeapp,\
        desktop/source/lib/init \
        desktop/source/lib/lokinteractionhandler \
-       desktop/source/lib/lokclipboard \
+       $(if $(filter-out $(OS),iOS), \
+               desktop/source/lib/lokclipboard) \
        $(if $(filter $(OS),ANDROID), \
                desktop/source/lib/lokandroid) \
 ))
-$(eval $(call gb_Library_set_componentfile,sofficeapp,desktop/lokclipboard))
+$(if $(filter-out $(OS),iOS), \
+       $(eval $(call 
gb_Library_set_componentfile,sofficeapp,desktop/lokclipboard)))
 else
 ifeq ($(USING_X11),TRUE)
 $(eval $(call gb_Library_add_exception_objects,sofficeapp,\
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 22523ecc2227..1ef25f2c5dc6 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2380,7 +2380,9 @@ static void doc_destroy(LibreOfficeKitDocument *pThis)
 
     SolarMutexGuard aGuard;
 
+#ifndef IOS
     LOKClipboardFactory::releaseClipboardForView(-1);
+#endif
 
     LibLODocument_Impl *pDocument = static_cast<LibLODocument_Impl*>(pThis);
     delete pDocument;
@@ -4749,6 +4751,18 @@ static int doc_getClipboard(LibreOfficeKitDocument* 
pThis,
                             size_t     **pOutSizes,
                             char      ***pOutStreams)
 {
+#ifdef IOS
+    (void) pThis;
+    (void) pMimeTypes;
+    (void) pOutCount;
+    (void) pOutMimeTypes;
+    (void) pOutSizes;
+    (void) pOutStreams;
+
+    assert(!"doc_getClipboard should not be called on iOS");
+
+    return 0;
+#else
     comphelper::ProfileZone aZone("doc_getClipboard");
 
     SolarMutexGuard aGuard;
@@ -4825,6 +4839,7 @@ static int doc_getClipboard(LibreOfficeKitDocument* pThis,
     }
 
     return 1;
+#endif
 }
 
 static int doc_setClipboard(LibreOfficeKitDocument* pThis,
@@ -5572,7 +5587,9 @@ static void doc_destroyView(SAL_UNUSED_PARAMETER 
LibreOfficeKitDocument* pThis,
     SolarMutexGuard aGuard;
     SetLastExceptionMsg();
 
+#ifndef IOS
     LOKClipboardFactory::releaseClipboardForView(nId);
+#endif
 
     SfxLokHelper::destroyView(nId);
 
@@ -5844,6 +5861,7 @@ static void doc_postWindow(LibreOfficeKitDocument* 
/*pThis*/, unsigned nLOKWindo
     }
     else if (nAction == LOK_WINDOW_PASTE)
     {
+#ifndef IOS
         OUString aMimeType;
         css::uno::Sequence<sal_Int8> aData;
         std::vector<beans::PropertyValue> 
aArgs(jsonToPropertyValuesVector(pData));
@@ -5865,6 +5883,10 @@ static void doc_postWindow(LibreOfficeKitDocument* 
/*pThis*/, unsigned nLOKWindo
         }
         else
             SetLastExceptionMsg("Window command 'paste': wrong parameters.");
+#else
+        (void) pData;
+        assert(!"doc_postWindow() with LOK_WINDOW_PASTE should not be called 
on iOS");
+#endif
     }
 }
 
diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk
index 75cbc02a4004..f54447ccd148 100644
--- a/postprocess/Rdb_services.mk
+++ b/postprocess/Rdb_services.mk
@@ -341,8 +341,9 @@ endif
 
 # lokclipboard.component
 ifneq ($(filter $(OS),ANDROID iOS MACOSX WNT),)
-$(eval $(call gb_Rdb_add_components,services,\
-       desktop/lokclipboard))
+$(if $(filter-out $(OS),iOS), \
+       $(eval $(call gb_Rdb_add_components,services,\
+               desktop/lokclipboard)))
 else
 ifeq ($(USING_X11),TRUE)
 $(eval $(call gb_Rdb_add_components,services,\
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 4fa814e7ee64..027781914d89 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -124,7 +124,7 @@ core_constructor_list = [
     "com_sun_star_comp_dba_ODatabaseSource",
     "com_sun_star_comp_dba_ORowSet_get_implementation",
 # desktop/lokclipboard.component
-    "desktop_LOKClipboard_get_implementation",
+    ("desktop_LOKClipboard_get_implementation", "#ifndef IOS"),
 # drawinglayer/drawinglayer.component
     "drawinglayer_XPrimitive2DRenderer",
 # embeddedobj/util/embobj.component
diff --git a/vcl/source/components/dtranscomp.cxx 
b/vcl/source/components/dtranscomp.cxx
index ee3e0d027105..c451e9568b57 100644
--- a/vcl/source/components/dtranscomp.cxx
+++ b/vcl/source/components/dtranscomp.cxx
@@ -423,6 +423,9 @@ Reference< XInterface > SalInstance::CreateClipboard( const 
Sequence< Any >& arg
         throw css::lang::IllegalArgumentException(
             "non-empty SalInstance::CreateClipboard arguments", {}, -1);
     }
+#ifdef IOS
+    return Reference< XInterface >( static_cast<cppu::OWeakObject *>(new 
vcl::GenericClipboard()) );
+#else
     if (comphelper::LibreOfficeKit::isActive()) {
         // In LOK, each document view shall have its own clipboard instance 
(whereas
         // in non-LOK below we keep handing out one single instance; see also
@@ -433,6 +436,7 @@ Reference< XInterface > SalInstance::CreateClipboard( const 
Sequence< Any >& arg
                 comphelper::getProcessComponentContext());
         return xClipboard;
     }
+#endif
     DBG_TESTSOLARMUTEX();
     if (!m_clipboard.is()) {
         m_clipboard = static_cast<cppu::OWeakObject *>(new 
vcl::GenericClipboard());
diff --git a/vcl/source/treelist/transfer2.cxx 
b/vcl/source/treelist/transfer2.cxx
index c06abcde72c3..ef392a08e6c5 100644
--- a/vcl/source/treelist/transfer2.cxx
+++ b/vcl/source/treelist/transfer2.cxx
@@ -486,11 +486,16 @@ Reference<XClipboard> GetSystemClipboard()
     Reference<XClipboard> xClipboard;
     try
     {
+#ifdef IOS
+        if (false)
+            ;
+#else
         if (comphelper::LibreOfficeKit::isActive())
         {
             xClipboard = css::datatransfer::clipboard::LokClipboard::create(
                     comphelper::getProcessComponentContext());
         }
+#endif
         else
         {
             xClipboard = css::datatransfer::clipboard::SystemClipboard::create(

Reply via email to