diff options
author | Tor Lillqvist <tml@collabora.com> | 2021-01-13 00:31:43 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2021-03-23 10:39:51 +0100 |
commit | b01aab7c5b13ce04caa426e3b85ee19b2ef06c4f (patch) | |
tree | f328c73b31d7f0ec9e704bdc24bac5f8307229de /vcl | |
parent | e6efc0e309a1a715febec1e830efb1d06e3831de (diff) |
We only use the systemwide general pasteboard
Simplify code to explicitly use it then instead of using variables.
Change-Id: I915a44cf7275fbf2140671a2edf1da29f1bf4e40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109202
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112948
Tested-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/ios/DataFlavorMapping.cxx | 8 | ||||
-rw-r--r-- | vcl/ios/DataFlavorMapping.hxx | 2 | ||||
-rw-r--r-- | vcl/ios/clipboard.cxx | 7 | ||||
-rw-r--r-- | vcl/ios/clipboard.hxx | 1 | ||||
-rw-r--r-- | vcl/ios/iOSTransferable.cxx | 14 | ||||
-rw-r--r-- | vcl/ios/iOSTransferable.hxx | 3 |
6 files changed, 13 insertions, 22 deletions
diff --git a/vcl/ios/DataFlavorMapping.cxx b/vcl/ios/DataFlavorMapping.cxx index 9d2ade8b513e..4ccbe374de87 100644 --- a/vcl/ios/DataFlavorMapping.cxx +++ b/vcl/ios/DataFlavorMapping.cxx @@ -434,13 +434,13 @@ NSString* DataFlavorMapper::openOfficeToSystemFlavor(const DataFlavor& oOOFlavor return sysFlavor; } -NSString* DataFlavorMapper::openOfficeImageToSystemFlavor(UIPasteboard* pPasteboard) +NSString* DataFlavorMapper::openOfficeImageToSystemFlavor() { - if ([pPasteboard containsPasteboardTypes:@[ PBTYPE_PNG ]]) + if ([[UIPasteboard generalPasteboard] containsPasteboardTypes:@[ PBTYPE_PNG ]]) return PBTYPE_PNG; - else if ([pPasteboard containsPasteboardTypes:@[ PBTYPE_JPEG ]]) + else if ([[UIPasteboard generalPasteboard] containsPasteboardTypes:@[ PBTYPE_JPEG ]]) return PBTYPE_JPEG; - else if ([pPasteboard containsPasteboardTypes:@[ PBTYPE_PDF ]]) + else if ([[UIPasteboard generalPasteboard] containsPasteboardTypes:@[ PBTYPE_PDF ]]) return PBTYPE_PDF; return @""; } diff --git a/vcl/ios/DataFlavorMapping.hxx b/vcl/ios/DataFlavorMapping.hxx index 7e527dc09c34..fa45be243e9e 100644 --- a/vcl/ios/DataFlavorMapping.hxx +++ b/vcl/ios/DataFlavorMapping.hxx @@ -80,7 +80,7 @@ public: If there is no suitable mapping available NULL will be returned. */ - static NSString* openOfficeImageToSystemFlavor(UIPasteboard* pPasteboard); + static NSString* openOfficeImageToSystemFlavor(); /* Get a data provider which is able to provide the data 'rTransferable' offers in a format that can be put on to the system clipboard. diff --git a/vcl/ios/clipboard.cxx b/vcl/ios/clipboard.cxx index ad0af57e3995..46dfa92bfcd7 100644 --- a/vcl/ios/clipboard.cxx +++ b/vcl/ios/clipboard.cxx @@ -36,9 +36,6 @@ iOSClipboard::iOSClipboard() mrXMimeCntFactory = css::datatransfer::MimeContentTypeFactory::create(xContext); mpDataFlavorMapper.reset(new DataFlavorMapper()); - - mPasteboard = [UIPasteboard generalPasteboard]; - assert(mPasteboard != nil); } iOSClipboard::~iOSClipboard() {} @@ -48,7 +45,7 @@ css::uno::Reference<css::datatransfer::XTransferable> SAL_CALL iOSClipboard::get osl::MutexGuard aGuard(m_aMutex); return css::uno::Reference<css::datatransfer::XTransferable>( - new iOSTransferable(mrXMimeCntFactory, mpDataFlavorMapper, mPasteboard)); + new iOSTransferable(mrXMimeCntFactory, mpDataFlavorMapper)); } void SAL_CALL iOSClipboard::setContents( @@ -75,7 +72,7 @@ void SAL_CALL iOSClipboard::setContents( } } SAL_INFO("vcl.ios.clipboard", "Setting pasteboard items: " << NSDictionaryKeysToOUString(dict)); - [mPasteboard setItems:array options:@{}]; + [[UIPasteboard generalPasteboard] setItems:array options:@{}]; // We don't keep a copy of the clipboard contents around in-process, so fire the lost clipboard // ownership event right away. diff --git a/vcl/ios/clipboard.hxx b/vcl/ios/clipboard.hxx index 144e9c3acdee..66a4dd1b5591 100644 --- a/vcl/ios/clipboard.hxx +++ b/vcl/ios/clipboard.hxx @@ -103,7 +103,6 @@ private: mClipboardListeners; css::uno::Reference<css::datatransfer::clipboard::XClipboardOwner> mXClipboardOwner; std::shared_ptr<DataFlavorMapper> mpDataFlavorMapper; - UIPasteboard* mPasteboard; }; #endif // INCLUDED_VCL_IOS_CLIPBOARD_HXX diff --git a/vcl/ios/iOSTransferable.cxx b/vcl/ios/iOSTransferable.cxx index 1ae2277014b6..6e1bd00b3a97 100644 --- a/vcl/ios/iOSTransferable.cxx +++ b/vcl/ios/iOSTransferable.cxx @@ -86,18 +86,14 @@ bool cmpAllContentTypeParameter(const Reference<XMimeContentType>& xLhs, } // unnamed namespace iOSTransferable::iOSTransferable(const Reference<XMimeContentTypeFactory>& rXMimeCntFactory, - std::shared_ptr<DataFlavorMapper> pDataFlavorMapper, - UIPasteboard* pasteboard) + std::shared_ptr<DataFlavorMapper> pDataFlavorMapper) : mrXMimeCntFactory(rXMimeCntFactory) , mDataFlavorMapper(pDataFlavorMapper) - , mPasteboard(pasteboard) { - [mPasteboard retain]; - initClipboardItemList(); } -iOSTransferable::~iOSTransferable() { [mPasteboard release]; } +iOSTransferable::~iOSTransferable() {} Any SAL_CALL iOSTransferable::getTransferData(const DataFlavor& aFlavor) { @@ -109,11 +105,11 @@ Any SAL_CALL iOSTransferable::getTransferData(const DataFlavor& aFlavor) bool bInternal(false); NSString* sysFormat = (aFlavor.MimeType.startsWith("image/png")) - ? DataFlavorMapper::openOfficeImageToSystemFlavor(mPasteboard) + ? DataFlavorMapper::openOfficeImageToSystemFlavor() : mDataFlavorMapper->openOfficeToSystemFlavor(aFlavor, bInternal); DataProviderPtr_t dp; - NSData* sysData = [mPasteboard dataForPasteboardType:sysFormat]; + NSData* sysData = [[UIPasteboard generalPasteboard] dataForPasteboardType:sysFormat]; dp = DataFlavorMapper::getDataProvider(sysFormat, sysData); if (dp.get() == nullptr) @@ -138,7 +134,7 @@ sal_Bool SAL_CALL iOSTransferable::isDataFlavorSupported(const DataFlavor& aFlav void iOSTransferable::initClipboardItemList() { - NSArray* pboardFormats = [mPasteboard pasteboardTypes]; + NSArray* pboardFormats = [[UIPasteboard generalPasteboard] pasteboardTypes]; if (pboardFormats == nullptr) { diff --git a/vcl/ios/iOSTransferable.hxx b/vcl/ios/iOSTransferable.hxx index 5c685dba8949..b76bcf6c0d06 100644 --- a/vcl/ios/iOSTransferable.hxx +++ b/vcl/ios/iOSTransferable.hxx @@ -39,7 +39,7 @@ class iOSTransferable : public ::cppu::WeakImplHelper<css::datatransfer::XTransf public: explicit iOSTransferable( css::uno::Reference<css::datatransfer::XMimeContentTypeFactory> const& rXMimeCntFactory, - std::shared_ptr<DataFlavorMapper> pDataFlavorMapper, UIPasteboard* pasteboard); + std::shared_ptr<DataFlavorMapper> pDataFlavorMapper); virtual ~iOSTransferable() override; iOSTransferable(const iOSTransferable&) = delete; @@ -65,7 +65,6 @@ private: css::uno::Sequence<css::datatransfer::DataFlavor> mFlavorList; css::uno::Reference<css::datatransfer::XMimeContentTypeFactory> mrXMimeCntFactory; std::shared_ptr<DataFlavorMapper> mDataFlavorMapper; - UIPasteboard* mPasteboard; }; #endif |