1bc03f14fSopenharmony_ci/* 2bc03f14fSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 3bc03f14fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4bc03f14fSopenharmony_ci * you may not use this file except in compliance with the License. 5bc03f14fSopenharmony_ci * You may obtain a copy of the License at 6bc03f14fSopenharmony_ci * 7bc03f14fSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8bc03f14fSopenharmony_ci * 9bc03f14fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10bc03f14fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11bc03f14fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12bc03f14fSopenharmony_ci * See the License for the specific language governing permissions and 13bc03f14fSopenharmony_ci * limitations under the License. 14bc03f14fSopenharmony_ci */ 15bc03f14fSopenharmony_ci 16bc03f14fSopenharmony_ci#ifndef PASTEBOARD_FFI_H 17bc03f14fSopenharmony_ci#define PASTEBOARD_FFI_H 18bc03f14fSopenharmony_ci 19bc03f14fSopenharmony_ci#include "paste_data_impl.h" 20bc03f14fSopenharmony_ci#include "system_pasteboard_impl.h" 21bc03f14fSopenharmony_ci 22bc03f14fSopenharmony_ciextern "C" { 23bc03f14fSopenharmony_ci#define OUT_OF_RANGE 12900001 24bc03f14fSopenharmony_ci 25bc03f14fSopenharmony_citypedef struct { 26bc03f14fSopenharmony_ci CArrString mimeTypes; 27bc03f14fSopenharmony_ci char *tag; 28bc03f14fSopenharmony_ci int64_t timestamp; 29bc03f14fSopenharmony_ci bool localOnly; 30bc03f14fSopenharmony_ci int32_t shareOption; 31bc03f14fSopenharmony_ci} CPasteDataProperty; 32bc03f14fSopenharmony_ci 33bc03f14fSopenharmony_citypedef struct { 34bc03f14fSopenharmony_ci char *htmlText; 35bc03f14fSopenharmony_ci char *mimeType; 36bc03f14fSopenharmony_ci char *plainText; 37bc03f14fSopenharmony_ci char *uri; 38bc03f14fSopenharmony_ci int64_t pixelMap; 39bc03f14fSopenharmony_ci} CPasteDataRecord; 40bc03f14fSopenharmony_ci 41bc03f14fSopenharmony_ciFFI_EXPORT RetDataI64 FfiOHOSCreateStringPasteData(const char *mimeType, const char *value); 42bc03f14fSopenharmony_ciFFI_EXPORT RetDataI64 FfiOHOSCreatePixelMapPasteData(const char *mimeType, int64_t pixelMapId); 43bc03f14fSopenharmony_ciFFI_EXPORT RetDataI64 FfiOHOSCreateArrayBufPasteData(const char *mimeType, uint8_t *buffPtr, int64_t bufferSize); 44bc03f14fSopenharmony_ciFFI_EXPORT RetDataI64 FfiOHOSCreateStringPasteDataRecord( 45bc03f14fSopenharmony_ci const char *mimeType, const char *value, CPasteDataRecord *retPtr); 46bc03f14fSopenharmony_ciFFI_EXPORT RetDataI64 FfiOHOSCreatePixelMapPasteDataRecord( 47bc03f14fSopenharmony_ci const char *mimeType, int64_t pixelMapId, CPasteDataRecord *retPtr); 48bc03f14fSopenharmony_ciFFI_EXPORT RetDataI64 FfiOHOSCreateArrayBufPasteDataRecord( 49bc03f14fSopenharmony_ci const char *mimeType, uint8_t *buffPtr, int64_t bufferSize, CPasteDataRecord *retPtr); 50bc03f14fSopenharmony_ciFFI_EXPORT RetDataCString FfiOHOSPasteDataRecordToPlainText(int64_t id); 51bc03f14fSopenharmony_ciFFI_EXPORT RetDataCString FfiOHOSPasteDataGetPrimaryText(int64_t id); 52bc03f14fSopenharmony_ciFFI_EXPORT RetDataCString FfiOHOSPasteDataGetPrimaryHtml(int64_t id); 53bc03f14fSopenharmony_ciFFI_EXPORT RetDataCString FfiOHOSPasteDataGetPrimaryUri(int64_t id); 54bc03f14fSopenharmony_ciFFI_EXPORT RetDataI64 FfiOHOSPasteDataGetPrimaryPixelMap(int64_t id); 55bc03f14fSopenharmony_ciFFI_EXPORT RetDataCString FfiOHOSPasteDataGetPrimaryMimeType(int64_t id); 56bc03f14fSopenharmony_ciFFI_EXPORT int32_t FfiOHOSPasteDataGetProperty(int64_t id, CPasteDataProperty *retPtr); 57bc03f14fSopenharmony_ciFFI_EXPORT int32_t FfiOHOSPasteDataSetProperty( 58bc03f14fSopenharmony_ci int64_t id, CArrString mimeTypes, const char *tag, int64_t timestamp, bool localOnly, int32_t shareOption); 59bc03f14fSopenharmony_ciFFI_EXPORT RetDataCString FfiOHOSPasteDataGetTag(int64_t id); 60bc03f14fSopenharmony_ciFFI_EXPORT RetDataBool FfiOHOSPasteDataHasType(int64_t id, const char *mimeTypes); 61bc03f14fSopenharmony_ciFFI_EXPORT int32_t FfiOHOSPasteDataAddRecord(int64_t id, int64_t recordId); 62bc03f14fSopenharmony_ciFFI_EXPORT int32_t FfiOHOSPasteDataAddMimeTypeRecord(int64_t id, const char *mimeType, const char *value); 63bc03f14fSopenharmony_ciFFI_EXPORT int32_t FfiOHOSPasteDataAddPixelMapRecord(int64_t id, const char *mimeType, int64_t pixelMapId); 64bc03f14fSopenharmony_ciFFI_EXPORT int32_t FfiOHOSPasteDataAddArrayRecord( 65bc03f14fSopenharmony_ci int64_t id, const char *mimeType, uint8_t *buffPtr, int64_t bufferSize); 66bc03f14fSopenharmony_ciFFI_EXPORT RetDataCArrString FfiOHOSPasteDataGetMimeTypes(int64_t id); 67bc03f14fSopenharmony_ciFFI_EXPORT RetDataI64 FfiOHOSPasteDataGetRecord(int64_t id, int32_t index, CPasteDataRecord *retPtr); 68bc03f14fSopenharmony_ciFFI_EXPORT RetDataUI FfiOHOSPasteDataGetRecordCount(int64_t id); 69bc03f14fSopenharmony_ciFFI_EXPORT int32_t FfiOHOSPasteDataRemoveRecord(int64_t id, int32_t index); 70bc03f14fSopenharmony_ciFFI_EXPORT int32_t FfiOHOSPasteDataReplaceRecord(int64_t id, int64_t recordId, int32_t index); 71bc03f14fSopenharmony_ciFFI_EXPORT RetDataI64 FfiOHOSGetSystemPasteboard(); 72bc03f14fSopenharmony_ciFFI_EXPORT int32_t FfiOHOSSystemPasteboardSetData(int64_t id, int64_t pasteDataId); 73bc03f14fSopenharmony_ciFFI_EXPORT RetDataI64 FfiOHOSSystemPasteboardGetData(int64_t id); 74bc03f14fSopenharmony_ciFFI_EXPORT RetDataBool FfiOHOSSystemPasteboardHasData(int64_t id); 75bc03f14fSopenharmony_ciFFI_EXPORT void FfiOHOSSystemPasteboardClearData(int64_t id); 76bc03f14fSopenharmony_ciFFI_EXPORT RetDataBool FfiOHOSSystemPasteboardIsRemoteData(int64_t id); 77bc03f14fSopenharmony_ciFFI_EXPORT RetDataBool FfiOHOSSystemPasteboardHasDataType(int64_t id, const char *mimeType); 78bc03f14fSopenharmony_ciFFI_EXPORT RetDataCString FfiOHOSSystemPasteboardGetDataSource(int64_t id); 79bc03f14fSopenharmony_ci} 80bc03f14fSopenharmony_ci 81bc03f14fSopenharmony_ci#endif