/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef FOUNDATION_ACE_ACE_ENGINE_ADAPTER_PREVIEW_ENTRANCE_CLIPBOARD_CLIPBOARD_IMPL_H #define FOUNDATION_ACE_ACE_ENGINE_ADAPTER_PREVIEW_ENTRANCE_CLIPBOARD_CLIPBOARD_IMPL_H #include #include #include "base/memory/referenced.h" #include "base/thread/task_executor.h" #include "base/utils/macros.h" #include "core/common/clipboard/clipboard.h" #include "core/common/clipboard/clipboard_interface.h" namespace OHOS::Ace::Platform { using CallbackSetClipboardPixmapData = std::function&)>; using CallbackGetClipboardPixmapData = std::function(void)>; class ACE_FORCE_EXPORT ClipboardImpl : public Clipboard { public: explicit ClipboardImpl(const RefPtr& taskExecutor) : Clipboard(taskExecutor) {} ~ClipboardImpl() override = default; void SetData( const std::string& data, CopyOptions copyOption = CopyOptions::InApp, bool isDragData = false) override; void GetData(const std::function& callback, bool syncMode = false) override; void SetPixelMapData(const RefPtr& pixmap, CopyOptions copyOption = CopyOptions::InApp) override; void GetPixelMapData(const std::function&)>& callback, bool syncMode = false) override; void Clear() override; void HasData(const std::function& callback) override; void HasDataType( const std::function& callback, const std::vector& mimeTypes) override; void RegisterCallbackSetClipboardPixmapData(CallbackSetClipboardPixmapData callback); void RegisterCallbackGetClipboardPixmapData(CallbackGetClipboardPixmapData callback); void AddPixelMapRecord(const RefPtr& pasteData, const RefPtr& pixmap) override; void AddImageRecord(const RefPtr& pasteData, const std::string& uri) override; void AddTextRecord(const RefPtr& pasteData, const std::string& selectedStr) override; void AddSpanStringRecord(const RefPtr& pasteData, std::vector& data) override; void AddMultiTypeRecord( const RefPtr& pasteData, const RefPtr& multiTypeRecord) override; void SetData(const RefPtr& pasteData, CopyOptions copyOption) override; void GetData(const std::function& textCallback, const std::function&, bool isLastRecord)>& pixelMapCallback, const std::function& urlCallback, bool syncMode = false) override; void GetSpanStringData( const std::function>&, const std::string&, bool&)>& callback, bool syncMode = false) override; RefPtr CreatePasteDataMix() override; private: CallbackSetClipboardPixmapData callbackSetClipboardPixmapData_; CallbackGetClipboardPixmapData callbackGetClipboardPixmapData_; }; } // namespace OHOS::Ace::Platform #endif // FOUNDATION_ACE_ACE_ENGINE_ADAPTER_PREVIEW_ENTRANCE_CLIPBOARD_CLIPBOARD_IMPL_H