We don't want or need any LOKClipboard on iOS

Try to make the code more like in the co-2021 branch, where copy/paste
between Collabora Office and other iOS apps currently works again, in
both directions, both for text and images. Sadly something is broken
or missing either here in core or in online as it doesn't fully work
in a Collabora Office based on the master branch of core, even after
this commit, though.

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/+/128037
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
This commit is contained in:
Tor Lillqvist
2022-01-06 13:52:00 +01:00
committed by Tor Lillqvist
parent 69880354d1
commit 6bcf007634
3 changed files with 27 additions and 1 deletions
+1 -1
View File
@@ -132,7 +132,7 @@ ifneq ($(filter $(OS),ANDROID iOS MACOSX WNT),)
$(eval $(call gb_Library_add_exception_objects,sofficeapp,\
desktop/source/lib/init \
desktop/source/lib/lokinteractionhandler \
$(if $(filter-out $(OS),IOS), \
$(if $(filter-out $(OS),iOS), \
desktop/source/lib/lokclipboard) \
$(if $(filter $(OS),ANDROID), \
desktop/source/lib/lokandroid) \
+22
View File
@@ -2352,7 +2352,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;
@@ -4706,6 +4708,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;
@@ -4782,6 +4796,7 @@ static int doc_getClipboard(LibreOfficeKitDocument* pThis,
}
return 1;
#endif
}
static int doc_setClipboard(LibreOfficeKitDocument* pThis,
@@ -5529,7 +5544,9 @@ static void doc_destroyView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* pThis,
SolarMutexGuard aGuard;
SetLastExceptionMsg();
#ifndef IOS
LOKClipboardFactory::releaseClipboardForView(nId);
#endif
SfxLokHelper::destroyView(nId);
@@ -5796,6 +5813,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));
@@ -5817,6 +5835,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
}
}
+4
View File
@@ -416,6 +416,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, and the way that
// (happens to?) work is that apparently this function is called at most once for each such
@@ -425,6 +428,7 @@ Reference< XInterface > SalInstance::CreateClipboard( const Sequence< Any >& arg
// SAL_USE_VCLPLUGIN=svp and the clipboard"):
return Reference< XInterface >( static_cast<cppu::OWeakObject *>(new vcl::GenericClipboard()) );
}
#endif
DBG_TESTSOLARMUTEX();
if (!m_clipboard.is()) {
m_clipboard = static_cast<cppu::OWeakObject *>(new vcl::GenericClipboard());