summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-11-26 17:05:41 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2022-03-16 15:36:17 +0100
commit6b7e187c017af3809b3d50ad7cb4b3593cf6f326 (patch)
tree3de638ea67a16732047e8653b8a4fc9aa9223809 /desktop/source
parenta512c9a47f1ecb160451a3352e1e0de3c39a20d6 (diff)
Make LOKClipboard available to other modules
LOKClipboard has higher level dependencies (sfx2) so it cannot be moved to the vcl where SystemClibpoard instance is created. - introduce new interface LokClipboard to differentiate from SystemClipboard so we can have vcl's and lok's implementations at the same time - publish LOKClipboard using new interface for other modules by adding component file in desktop module Thanks to that when code calls GetClipboard and we cannot get clipboard assigned to the vcl::Window* (for welded widgets) in GetSystemClipboard correct instance is returned (shared clipboard for current view) so we can access content which was copied before. Previously always a new instance was created (with empty content). test ScTiledRenderingTest::testPasteIntoWrapTextCell was broken add some content to clipboard to simulate more real case and test the content copied Change-Id: I23c0298960a710c498646493f33122b908864cba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126310 Reviewed-by: Luboš Luňák <l.lunak@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131644 Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Tested-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/lib/lokclipboard.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx
index b4de36c56578..e4a4c1af4930 100644
--- a/desktop/source/lib/lokclipboard.cxx
+++ b/desktop/source/lib/lokclipboard.cxx
@@ -10,9 +10,11 @@
#include "lokclipboard.hxx"
#include <unordered_map>
#include <vcl/lazydelete.hxx>
+#include <vcl/svapp.hxx>
#include <sfx2/lokhelper.hxx>
#include <sal/log.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
using namespace css;
using namespace css::uno;
@@ -75,7 +77,7 @@ LOKClipboard::LOKClipboard()
Sequence<OUString> LOKClipboard::getSupportedServiceNames_static()
{
- Sequence<OUString> aRet{ "com.sun.star.datatransfer.clipboard.SystemClipboard" };
+ Sequence<OUString> aRet{ "com.sun.star.datatransfer.clipboard.LokClipboard" };
return aRet;
}
@@ -227,4 +229,17 @@ sal_Bool SAL_CALL LOKTransferable::isDataFlavorSupported(const datatransfer::Dat
!= std::cend(m_aFlavors);
}
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+desktop_LOKClipboard_get_implementation(css::uno::XComponentContext*,
+ css::uno::Sequence<css::uno::Any> const& /*args*/)
+{
+ SolarMutexGuard aGuard;
+
+ auto pClipboard
+ = static_cast<cppu::OWeakObject*>(LOKClipboardFactory::getClipboardForCurView().get());
+
+ pClipboard->acquire();
+ return pClipboard;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */