Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / vcl / ios / clipboard.hxx
blob144e9c3acdeef55bbcf4cde61fb4a31ca0014bff
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_IOS_CLIPBOARD_HXX
21 #define INCLUDED_VCL_IOS_CLIPBOARD_HXX
23 #include "DataFlavorMapping.hxx"
24 #include <rtl/ustring.hxx>
25 #include <sal/types.h>
26 #include <cppuhelper/compbase.hxx>
27 #include <com/sun/star/datatransfer/XTransferable.hpp>
28 #include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
29 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
30 #include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
31 #include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
32 #include <com/sun/star/datatransfer/clipboard/XSystemClipboard.hpp>
33 #include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp>
34 #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <cppuhelper/basemutex.hxx>
37 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
39 #include <list>
41 #include <premac.h>
42 #import <UIKit/UIKit.h>
43 #include <postmac.h>
45 class iOSClipboard
46 : public ::cppu::BaseMutex,
47 public ::cppu::WeakComponentImplHelper<css::datatransfer::clipboard::XSystemClipboard,
48 css::lang::XServiceInfo>
50 public:
51 iOSClipboard();
53 virtual ~iOSClipboard() override;
54 iOSClipboard(const iOSClipboard&) = delete;
55 iOSClipboard& operator=(const iOSClipboard&) = delete;
57 // XClipboard
59 css::uno::Reference<css::datatransfer::XTransferable> SAL_CALL getContents() override;
61 void SAL_CALL setContents(
62 const css::uno::Reference<css::datatransfer::XTransferable>& xTransferable,
63 const css::uno::Reference<css::datatransfer::clipboard::XClipboardOwner>& xClipboardOwner)
64 override;
66 OUString SAL_CALL getName() override;
68 // XClipboardEx
70 sal_Int8 SAL_CALL getRenderingCapabilities() override;
72 // XClipboardNotifier
74 void SAL_CALL addClipboardListener(
75 const css::uno::Reference<css::datatransfer::clipboard::XClipboardListener>& listener)
76 override;
78 void SAL_CALL removeClipboardListener(
79 const css::uno::Reference<css::datatransfer::clipboard::XClipboardListener>& listener)
80 override;
82 // XServiceInfo
84 OUString SAL_CALL getImplementationName() override;
86 sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
88 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
90 private:
91 /* Notify the current clipboard owner that he is no longer the clipboard owner. */
92 void fireLostClipboardOwnershipEvent(
93 css::uno::Reference<css::datatransfer::clipboard::XClipboardOwner> const& oldOwner,
94 css::uno::Reference<css::datatransfer::XTransferable> const& oldContent);
96 /* Notify all registered XClipboardListener that the clipboard content has changed. */
97 void
98 fireClipboardChangedEvent(css::uno::Reference<css::datatransfer::XTransferable> xNewContents);
100 private:
101 css::uno::Reference<css::datatransfer::XMimeContentTypeFactory> mrXMimeCntFactory;
102 std::list<css::uno::Reference<css::datatransfer::clipboard::XClipboardListener>>
103 mClipboardListeners;
104 css::uno::Reference<css::datatransfer::clipboard::XClipboardOwner> mXClipboardOwner;
105 std::shared_ptr<DataFlavorMapper> mpDataFlavorMapper;
106 UIPasteboard* mPasteboard;
109 #endif // INCLUDED_VCL_IOS_CLIPBOARD_HXX
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */