/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #pragma once #include #include #include #include #include #include #include #include using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::lang; class Qt5Transferable : public cppu::WeakImplHelper { public: explicit Qt5Transferable(QClipboard::Mode aMode); virtual css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor& rFlavor) override; virtual std::vector getTransferDataFlavorsAsVector(); virtual css::uno::Sequence SAL_CALL getTransferDataFlavors() override; virtual sal_Bool SAL_CALL isDataFlavorSupported(const css::datatransfer::DataFlavor& rFlavor) override; private: QClipboard::Mode m_aClipboardMode; }; class VclQt5Clipboard : public QObject, public cppu::WeakComponentImplHelper { Q_OBJECT private Q_SLOTS: void handleClipboardChange(QClipboard::Mode mode); private: osl::Mutex m_aMutex; Reference m_aContents; Reference m_aOwner; std::vector> m_aListeners; OUString m_aClipboardName; QClipboard::Mode m_aClipboardMode; // custom MIME type to detect whether clipboard content was added by self or externally const QString m_sMimeTypeUuid = "application/x-libreoffice-clipboard-uuid"; const QByteArray m_aUuid; public: explicit VclQt5Clipboard(const OUString& aModeString); virtual ~VclQt5Clipboard() override; /* * XServiceInfo */ virtual OUString SAL_CALL getImplementationName() override; virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; virtual Sequence SAL_CALL getSupportedServiceNames() override; /* * XClipboard */ virtual Reference SAL_CALL getContents() override; virtual void SAL_CALL setContents( const Reference& xTrans, const Reference& xClipboardOwner) override; virtual OUString SAL_CALL getName() override; /* * XClipboardEx */ virtual sal_Int8 SAL_CALL getRenderingCapabilities() override; /* * XFlushableClipboard */ virtual void SAL_CALL flushClipboard() override; /* * XClipboardNotifier */ virtual void SAL_CALL addClipboardListener( const Reference& listener) override; virtual void SAL_CALL removeClipboardListener( const Reference& listener) override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */