123b3eb3cSopenharmony_ci/* 223b3eb3cSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License. 523b3eb3cSopenharmony_ci * You may obtain a copy of the License at 623b3eb3cSopenharmony_ci * 723b3eb3cSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 823b3eb3cSopenharmony_ci * 923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and 1323b3eb3cSopenharmony_ci * limitations under the License. 1423b3eb3cSopenharmony_ci */ 1523b3eb3cSopenharmony_ci 1623b3eb3cSopenharmony_ci#ifndef FOUNDATION_ACE_ACE_ENGINE_ADAPTER_PREVIEW_ENTRANCE_CLIPBOARD_CLIPBOARD_IMPL_H 1723b3eb3cSopenharmony_ci#define FOUNDATION_ACE_ACE_ENGINE_ADAPTER_PREVIEW_ENTRANCE_CLIPBOARD_CLIPBOARD_IMPL_H 1823b3eb3cSopenharmony_ci 1923b3eb3cSopenharmony_ci#include <functional> 2023b3eb3cSopenharmony_ci#include <string> 2123b3eb3cSopenharmony_ci 2223b3eb3cSopenharmony_ci#include "base/memory/referenced.h" 2323b3eb3cSopenharmony_ci#include "base/thread/task_executor.h" 2423b3eb3cSopenharmony_ci#include "base/utils/macros.h" 2523b3eb3cSopenharmony_ci#include "core/common/clipboard/clipboard.h" 2623b3eb3cSopenharmony_ci#include "core/common/clipboard/clipboard_interface.h" 2723b3eb3cSopenharmony_ci 2823b3eb3cSopenharmony_cinamespace OHOS::Ace::Platform { 2923b3eb3cSopenharmony_ci 3023b3eb3cSopenharmony_ciusing CallbackSetClipboardPixmapData = std::function<void(const RefPtr<PixelMap>&)>; 3123b3eb3cSopenharmony_ciusing CallbackGetClipboardPixmapData = std::function<const RefPtr<PixelMap>(void)>; 3223b3eb3cSopenharmony_ci 3323b3eb3cSopenharmony_ciclass ACE_FORCE_EXPORT ClipboardImpl : public Clipboard { 3423b3eb3cSopenharmony_cipublic: 3523b3eb3cSopenharmony_ci explicit ClipboardImpl(const RefPtr<TaskExecutor>& taskExecutor) : Clipboard(taskExecutor) {} 3623b3eb3cSopenharmony_ci ~ClipboardImpl() override = default; 3723b3eb3cSopenharmony_ci 3823b3eb3cSopenharmony_ci void SetData( 3923b3eb3cSopenharmony_ci const std::string& data, CopyOptions copyOption = CopyOptions::InApp, bool isDragData = false) override; 4023b3eb3cSopenharmony_ci void GetData(const std::function<void(const std::string&)>& callback, bool syncMode = false) override; 4123b3eb3cSopenharmony_ci void SetPixelMapData(const RefPtr<PixelMap>& pixmap, CopyOptions copyOption = CopyOptions::InApp) override; 4223b3eb3cSopenharmony_ci void GetPixelMapData(const std::function<void(const RefPtr<PixelMap>&)>& callback, bool syncMode = false) override; 4323b3eb3cSopenharmony_ci void Clear() override; 4423b3eb3cSopenharmony_ci void HasData(const std::function<void(bool hasData)>& callback) override; 4523b3eb3cSopenharmony_ci void HasDataType( 4623b3eb3cSopenharmony_ci const std::function<void(bool hasData)>& callback, const std::vector<std::string>& mimeTypes) override; 4723b3eb3cSopenharmony_ci void RegisterCallbackSetClipboardPixmapData(CallbackSetClipboardPixmapData callback); 4823b3eb3cSopenharmony_ci void RegisterCallbackGetClipboardPixmapData(CallbackGetClipboardPixmapData callback); 4923b3eb3cSopenharmony_ci void AddPixelMapRecord(const RefPtr<PasteDataMix>& pasteData, const RefPtr<PixelMap>& pixmap) override; 5023b3eb3cSopenharmony_ci void AddImageRecord(const RefPtr<PasteDataMix>& pasteData, const std::string& uri) override; 5123b3eb3cSopenharmony_ci void AddTextRecord(const RefPtr<PasteDataMix>& pasteData, const std::string& selectedStr) override; 5223b3eb3cSopenharmony_ci void AddSpanStringRecord(const RefPtr<PasteDataMix>& pasteData, std::vector<uint8_t>& data) override; 5323b3eb3cSopenharmony_ci void AddMultiTypeRecord( 5423b3eb3cSopenharmony_ci const RefPtr<PasteDataMix>& pasteData, const RefPtr<MultiTypeRecordMix>& multiTypeRecord) override; 5523b3eb3cSopenharmony_ci void SetData(const RefPtr<PasteDataMix>& pasteData, CopyOptions copyOption) override; 5623b3eb3cSopenharmony_ci void GetData(const std::function<void(const std::string&, bool isLastRecord)>& textCallback, 5723b3eb3cSopenharmony_ci const std::function<void(const RefPtr<PixelMap>&, bool isLastRecord)>& pixelMapCallback, 5823b3eb3cSopenharmony_ci const std::function<void(const std::string&, bool isLastRecord)>& urlCallback, bool syncMode = false) override; 5923b3eb3cSopenharmony_ci void GetSpanStringData( 6023b3eb3cSopenharmony_ci const std::function<void(std::vector<std::vector<uint8_t>>&, const std::string&, bool&)>& callback, 6123b3eb3cSopenharmony_ci bool syncMode = false) override; 6223b3eb3cSopenharmony_ci RefPtr<PasteDataMix> CreatePasteDataMix() override; 6323b3eb3cSopenharmony_ci 6423b3eb3cSopenharmony_ciprivate: 6523b3eb3cSopenharmony_ci CallbackSetClipboardPixmapData callbackSetClipboardPixmapData_; 6623b3eb3cSopenharmony_ci CallbackGetClipboardPixmapData callbackGetClipboardPixmapData_; 6723b3eb3cSopenharmony_ci}; 6823b3eb3cSopenharmony_ci} // namespace OHOS::Ace::Platform 6923b3eb3cSopenharmony_ci 7023b3eb3cSopenharmony_ci#endif // FOUNDATION_ACE_ACE_ENGINE_ADAPTER_PREVIEW_ENTRANCE_CLIPBOARD_CLIPBOARD_IMPL_H 71