目录

content_embed_proxy.h

Overview

Provides the client application with the API for querying the OE Extension information registered by the server application, the data structures for interacting with the server OE Extension object, and the related operation APIs.

File to include: <ContentEmbedKit/content_embed/content_embed_proxy.h>

Library: libcontent_embed_ndk.so

System capability: SystemCapability.ContentEmbed.ObjectEditor

Since: 24

Related module: ContentEmbed

Summary

[h2]Structs

Name typedef Keyword Description
ContentEmbed_Info ContentEmbed_Info Declares the ContentEmbed_Info struct type, which contains the ContentEmbed_Format collection information that can be obtained by the client.
ContentEmbed_Format ContentEmbed_Format Declares the ContentEmbed_Format struct type, which contains the OEID, display name, description, icon, and file extension name registered by the OE Extension of the server application.
ContentEmbed_ExtensionProxy ContentEmbed_ExtensionProxy Declares the ContentEmbed_ExtensionProxy struct type, which points to the program object that encapsulates document embedding and editing of an OE document on the client (referred to as the client OE object).
ContentEmbed_Document ContentEmbed_Document Defines the structure type of an OE document. Encapsulates the metadata, content, and storage structure of an embedded document.
ContentEmbed_Capability ContentEmbed_Capability Declares the ContentEmbed_Capability struct type.

[h2]Macros

Name Description
MAX_NAME_LENGTH (1 * 1024)

Defines the maximum character limit of the name field in ContentEmbed_Format.

Since: 24

MAX_DESCRIPTION_LENGTH (1 * 1024)

Defines the maximum character limit of the description field in ContentEmbed_Format.

Since: 24

[h2]Functions

Name typedef Keyword Description
ContentEmbed_ErrorCode OH_ContentEmbed_CreateContentEmbedInfo(ContentEmbed_Info **info) -

Creates a ContentEmbed_Info instance.

You can destroy the instance using OH_ContentEmbed_DestroyContentEmbedInfo to avoid memory leak.

ContentEmbed_ErrorCode OH_ContentEmbed_DestroyContentEmbedInfo(ContentEmbed_Info *info) - Destroys a ContentEmbed_Info instance.
ContentEmbed_ErrorCode OH_ContentEmbed_GetContentEmbedInfo(const char *locale, ContentEmbed_Info *info) - Obtains a ContentEmbed_Info instance based on the locale.
ContentEmbed_ErrorCode OH_ContentEmbed_GetFormatCountFromInfo(const ContentEmbed_Info *info, uint32_t *count) - Obtains the number of ContentEmbed_Format instances in a ContentEmbed_Info instance.
ContentEmbed_ErrorCode OH_ContentEmbed_GetFormatFromInfo(const ContentEmbed_Info *info, uint32_t index, ContentEmbed_Format **format) - Obtains the ContentEmbed_Format instance at the index position from a ContentEmbed_Info instance.
ContentEmbed_ErrorCode OH_ContentEmbed_CreateContentEmbedFormat(ContentEmbed_Format **format) -

Creates a ContentEmbed_Format instance.

You can destroy the instance using OH_ContentEmbed_DestroyContentEmbedFormat to avoid memory leak.

ContentEmbed_ErrorCode OH_ContentEmbed_DestroyContentEmbedFormat(ContentEmbed_Format *format) - Destroys a ContentEmbed_Format instance.
ContentEmbed_ErrorCode OH_ContentEmbed_GetContentEmbedFormatByOEidAndLocale(const char *oeid, const char *locale, ContentEmbed_Format *format) - Obtains a ContentEmbed_Format instance based on the OEID and locale.
ContentEmbed_ErrorCode OH_ContentEmbed_GetOEidFromFormat(const ContentEmbed_Format *format, char *oeid) - Obtains the OEID of a ContentEmbed_Format instance.
ContentEmbed_ErrorCode OH_ContentEmbed_GetNameAndDescriptionFromFormat(const ContentEmbed_Format *format, char *name, char *description) - Obtains the localized display name and description from a ContentEmbed_Format instance.
ContentEmbed_ErrorCode OH_ContentEmbed_GetIconFromFormat(const ContentEmbed_Format *format, OH_PixelmapNative **icon) - Obtains the icon of a ContentEmbed_Format instance.
char** OH_ContentEmbed_GetFileNameExtensionsFromFormat(const ContentEmbed_Format *format, unsigned int *count) - Obtains the file name extensions of a ContentEmbed_Format instance.
ContentEmbed_ErrorCode OH_ContentEmbed_CreateExtensionProxy(ContentEmbed_Document *document, ContentEmbed_ExtensionProxy **proxy, void *contextPtr) -

Creates a ContentEmbed_ExtensionProxy instance.

You can destroy the instance using OH_ContentEmbed_DestroyExtensionProxy to avoid memory leak.

ContentEmbed_ErrorCode OH_ContentEmbed_DestroyExtensionProxy(ContentEmbed_ExtensionProxy *proxy) - Destroys a ContentEmbed_ExtensionProxy instance.
typedef void (*OH_ContentEmbed_ClientCallbackOnUpdateFunc)(ContentEmbed_ExtensionProxy *proxy) OH_ContentEmbed_ClientCallbackOnUpdateFunc

This callback function is triggered to notify the client when the OE document is updated.

You need to implement this function and register it with the client OE object through OH_ContentEmbed_Proxy_RegisterOnUpdateFunc.

typedef void (*OH_ContentEmbed_ClientCallbackOnErrorFunc)(ContentEmbed_ExtensionProxy *proxy, ContentEmbed_ErrorCode error) OH_ContentEmbed_ClientCallbackOnErrorFunc

This callback function is triggered to notify the client when an error occurs in the OE document.

You need to implement this function and register it with the client OE object through OH_ContentEmbed_Proxy_RegisterOnErrorFunc.

typedef void (*OH_ContentEmbed_ClientCallbackOnEditingFinishedFunc)(ContentEmbed_ExtensionProxy *proxy, bool dataModified) OH_ContentEmbed_ClientCallbackOnEditingFinishedFunc

This callback function is triggered to notify the client when editing of the OE document is finished.

You need to implement this function and register it with the client OE object through OH_ContentEmbed_Proxy_RegisterOnEditingFinishedFunc.

typedef void (*OH_ContentEmbed_ClientCallbackOnExtensionStoppedFunc)(ContentEmbed_ExtensionProxy *proxy) OH_ContentEmbed_ClientCallbackOnExtensionStoppedFunc

This callback function is triggered when the OE Extension stops.

You need to implement this function and register it with the client OE object through OH_ContentEmbed_Proxy_RegisterOnExtensionStoppedFunc.

ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_RegisterOnUpdateFunc(ContentEmbed_ExtensionProxy *proxy, OH_ContentEmbed_ClientCallbackOnUpdateFunc onUpdateFunc) - Registers a callback function for OE document updates with the client OE object.
ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_RegisterOnErrorFunc(ContentEmbed_ExtensionProxy *proxy, OH_ContentEmbed_ClientCallbackOnErrorFunc onErrorFunc) - Registers a callback function for OE document errors with the client OE object.
ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_RegisterOnEditingFinishedFunc(ContentEmbed_ExtensionProxy *proxy, OH_ContentEmbed_ClientCallbackOnEditingFinishedFunc onEditingFinishedFunc) - Registers a callback function for OE document editing completion with the client OE object.
ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_RegisterOnExtensionStoppedFunc(ContentEmbed_ExtensionProxy *proxy, OH_ContentEmbed_ClientCallbackOnExtensionStoppedFunc onExtensionStoppedFunc) - Registers a callback function to be triggered when the OE Extension stops with the client OE object.
ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_StartWork(ContentEmbed_ExtensionProxy *proxy) - Connects to the server OE Extension and establishes a communication channel with it.
ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_StopWork(ContentEmbed_ExtensionProxy *proxy) - Disconnects from the communication channel with the OE Extension.
ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_GetSnapshot(ContentEmbed_ExtensionProxy *proxy, OH_PixelmapNative **snapshot) - Obtains the current OE document snapshot from the client OE object for preview or thumbnail display.
ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_DoEdit(ContentEmbed_ExtensionProxy *proxy) - Requests the OE Extension instance to enter editing mode by the client OE object.
ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_GetEditStatus(ContentEmbed_ExtensionProxy *proxy, bool *isEditing, bool *isModified) - Queries the current editing status and modification status of the OE document from the server OE Extension instance.
ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_GetCapability(ContentEmbed_ExtensionProxy *proxy, uint32_t *bitmask) - Obtains the capabilities of the server OE Extension instance, returned as a bitmask. For details, see ContentEmbed_CapabilityCode.
ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_GetDocument(ContentEmbed_ExtensionProxy *proxy, ContentEmbed_Document **ceDocument) -

Obtains the OE document object associated with the client OE object from the client OE object.

The OE document object is created through OH_ContentEmbed_CreateDocumentByOEid, OH_ContentEmbed_CreateDocumentByFile, or OH_ContentEmbed_LoadDocumentFromFile.

When the OE document is no longer needed, call OH_ContentEmbed_DestroyDocument to destroy it.

Function Description

[h2]OH_ContentEmbed_CreateContentEmbedInfo()

ContentEmbed_ErrorCode OH_ContentEmbed_CreateContentEmbedInfo(ContentEmbed_Info **info)

Description

Creates a ContentEmbed_Info instance.

You can destroy the instance using OH_ContentEmbed_DestroyContentEmbedInfo to avoid memory leak.

Since: 24

Parameters

Name Description
ContentEmbed_Info **info Output parameter. Pointer to the newly created ContentEmbed_Info object.

Return

Type Description
ContentEmbed_ErrorCode

Result code:

CE_ERR_OK: the operation is successful.

CE_ERR_PARAM_INVALID: the parameter check failed.

CE_ERR_NULL_POINTER: a null pointer is returned.

CE_ERR_DEVICE_NOT_SUPPORTED: the device is not supported.

[h2]OH_ContentEmbed_DestroyContentEmbedInfo()

ContentEmbed_ErrorCode OH_ContentEmbed_DestroyContentEmbedInfo(ContentEmbed_Info *info)

Description

Destroys a ContentEmbed_Info instance.

Since: 24

Parameters

Name Description
ContentEmbed_Info *info Pointer to the ContentEmbed_Info object.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: success.

CE_ERR_PARAM_INVALID: parameter check failed.

CE_ERR_DEVICE_NOT_SUPPORTED: the device is not supported.

[h2]OH_ContentEmbed_GetContentEmbedInfo()

ContentEmbed_ErrorCode OH_ContentEmbed_GetContentEmbedInfo(const char *locale, ContentEmbed_Info *info)

Description

Obtains a ContentEmbed_Info instance based on the locale.

Required permissions: ohos.permission.CONNECT_OBJECTEDITOR_EXTENSION

Since: 24

Parameters

Name Description
const char *locale Locale information, which consists of the language, script, and country/region, for example, "zh-Hans-CN". When locale is null, the system locale setting is used by default.
ContentEmbed_Info *info Output parameter. Pointer to the ContentEmbed_Info object.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: The operation is successful.

CE_PERMISSION_DENIED: The permission verification fails.

CE_ERR_PARAM_INVALID: The parameter check fails.

CE_ERR_SYSTEM_ABNORMAL: The system service works abnormally.

CE_ERR_DEVICE_NOT_SUPPORTED: This operation is not supported on the device.

[h2]OH_ContentEmbed_GetFormatCountFromInfo()

ContentEmbed_ErrorCode OH_ContentEmbed_GetFormatCountFromInfo(const ContentEmbed_Info *info, uint32_t *count)

Description

Obtains the number of ContentEmbed_Format instances in a ContentEmbed_Info instance.

Since: 24

Parameters

Name Description
const ContentEmbed_Info *info Pointer to the ContentEmbed_Info object.
uint32_t *count Output parameter. Stores the number of ContentEmbed_Format instances.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: the operation is successful.

CE_ERR_PARAM_INVALID: the parameter check failed.

CE_ERR_DEVICE_NOT_SUPPORTED: the device is not supported.

[h2]OH_ContentEmbed_GetFormatFromInfo()

ContentEmbed_ErrorCode OH_ContentEmbed_GetFormatFromInfo(const ContentEmbed_Info *info, uint32_t index, ContentEmbed_Format **format)

Description

Obtains the ContentEmbed_Format instance at the index position from a ContentEmbed_Info instance.

Since: 24

Parameters

Name Description
const ContentEmbed_Info *info Pointer to the ContentEmbed_Info object.
uint32_t index Index of the format to obtain, starting from 0.
ContentEmbed_Format **format Output parameter. Pointer to the ContentEmbed_Format object.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: the operation is successful.

CE_ERR_PARAM_INVALID: the parameter check failed.

CE_ERR_DEVICE_NOT_SUPPORTED: the device is not supported.

[h2]OH_ContentEmbed_CreateContentEmbedFormat()

ContentEmbed_ErrorCode OH_ContentEmbed_CreateContentEmbedFormat(ContentEmbed_Format **format)

Description

Creates a ContentEmbed_Format instance.

You can destroy the instance using OH_ContentEmbed_DestroyContentEmbedFormat to avoid memory leak.

Since: 24

Parameters

Name Description
ContentEmbed_Format **format Output parameter. Pointer to the newly created ContentEmbed_Format object.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: The operation is successful.

CE_ERR_PARAM_INVALID: Parameter check failed.

CE_ERR_NULL_POINTER: A null pointer is returned.

CE_ERR_DEVICE_NOT_SUPPORTED: The device is not supported.

[h2]OH_ContentEmbed_DestroyContentEmbedFormat()

ContentEmbed_ErrorCode OH_ContentEmbed_DestroyContentEmbedFormat(ContentEmbed_Format *format)

Description

Destroys a ContentEmbed_Format instance.

Since: 24

Parameters

Name Description
ContentEmbed_Format *format Pointer to the ContentEmbed_Format object.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: the operation is successful.

CE_ERR_PARAM_INVALID: the parameter check failed.

CE_ERR_DEVICE_NOT_SUPPORTED: the device does not support the operation.

[h2]OH_ContentEmbed_GetContentEmbedFormatByOEidAndLocale()

ContentEmbed_ErrorCode OH_ContentEmbed_GetContentEmbedFormatByOEidAndLocale(const char *oeid, const char *locale, ContentEmbed_Format *format)

Description

Obtains a ContentEmbed_Format instance based on the OEID and locale.

Required permissions: ohos.permission.CONNECT_OBJECTEDITOR_EXTENSION

Since: 24

Parameters

Name Description
const char *oeid Unique identifier string of the document format.
const char *locale Locale information, which consists of the language, script, and country/region, for example, zh-Hans-CN. When locale is null, the system locale setting is used by default.
ContentEmbed_Format *format Output parameter. Pointer to the ContentEmbed_Format object.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: The operation is successful.

CE_PERMISSION_DENIED: The permission verification fails.

CE_ERR_PARAM_INVALID: The parameter check fails.

CE_ERR_SYSTEM_ABNORMAL: The system service works abnormally.

CE_ERR_DEVICE_NOT_SUPPORTED: This operation is not supported on the device.

[h2]OH_ContentEmbed_GetOEidFromFormat()

ContentEmbed_ErrorCode OH_ContentEmbed_GetOEidFromFormat(const ContentEmbed_Format *format, char *oeid)

Description

Obtains the OEID of a ContentEmbed_Format instance.

Since: 24

Parameters

Name Description
const ContentEmbed_Format *format Pointer to the ContentEmbed_Format object.
char *oeid Output parameter, which is a character array used to store the OEID string. The recommended array length is MAX_OEID_LENGTH.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: the operation is successful.

CE_ERR_PARAM_INVALID: parameter check failed.

CE_ERR_DEVICE_NOT_SUPPORTED: the device does not support the operation.

[h2]OH_ContentEmbed_GetNameAndDescriptionFromFormat()

ContentEmbed_ErrorCode OH_ContentEmbed_GetNameAndDescriptionFromFormat(const ContentEmbed_Format *format, char *name, char *description)

Description

Obtains the localized display name and description from a ContentEmbed_Format instance.

Since: 24

Parameters

Name Description
const ContentEmbed_Format *format Pointer to a ContentEmbed_Format object.
char *name Output parameter, which is a character array used to store the name. The recommended array length is MAX_NAME_LENGTH.
char *description Output parameter, which is a character array used to store the description. The recommended array length is MAX_DESCRIPTION_LENGTH.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

Returns CE_ERR_OK if the operation is successful.

Returns CE_ERR_PARAM_INVALID if the parameter check failed.

Returns CE_ERR_DEVICE_NOT_SUPPORTED if the device is not supported.

[h2]OH_ContentEmbed_GetIconFromFormat()

ContentEmbed_ErrorCode OH_ContentEmbed_GetIconFromFormat(const ContentEmbed_Format *format, OH_PixelmapNative **icon)

Description

Obtains the icon of a ContentEmbed_Format instance.

Since: 24

Parameters

Name Description
const ContentEmbed_Format *format Pointer to the ContentEmbed_Format object.
OH_PixelmapNative **icon

Output parameter. Pointer to the OH_PixelmapNative instance used to store the icon.

The developer needs to call OH_PixelmapNative_Destroy to destroy it, so as to avoid memory leaks.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: success.

CE_ERR_PARAM_INVALID: parameter check failed.

CE_ERR_NULL_POINTER: null pointer returned.

CE_ERR_DEVICE_NOT_SUPPORTED: device not supported.

[h2]OH_ContentEmbed_GetFileNameExtensionsFromFormat()

char** OH_ContentEmbed_GetFileNameExtensionsFromFormat(const ContentEmbed_Format *format, unsigned int *count)

Description

Obtains the file name extensions of a ContentEmbed_Format instance.

Since: 24

Parameters

Name Description
const ContentEmbed_Format *format Pointer to the ContentEmbed_Format object.
unsigned int *count Output parameter. Stores the number of file name extensions returned.

Return

Type Description
char** Pointer to the array of file name extension strings.

[h2]OH_ContentEmbed_CreateExtensionProxy()

ContentEmbed_ErrorCode OH_ContentEmbed_CreateExtensionProxy(ContentEmbed_Document *document, ContentEmbed_ExtensionProxy **proxy, void *contextPtr)

Description

Creates a ContentEmbed_ExtensionProxy instance.

You can destroy the instance using OH_ContentEmbed_DestroyExtensionProxy to avoid memory leak.

Since: 24

Parameters

Name Description
ContentEmbed_Document *document Pointer to the OE document instance.
ContentEmbed_ExtensionProxy **proxy Output parameter. Pointer to the newly created ContentEmbed_ExtensionProxy object.
void *contextPtr Pointer to the context instance, used to pass application context information.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: The operation is successful.

CE_ERR_PARAM_INVALID: Parameter check failed.

CE_ERR_NULL_POINTER: A null pointer is returned.

CE_ERR_DEVICE_NOT_SUPPORTED: The device is not supported.

CE_ERR_IN_DLP_SANDBOX: The application is in a DLP sandbox, and this operation is not supported.

[h2]OH_ContentEmbed_DestroyExtensionProxy()

ContentEmbed_ErrorCode OH_ContentEmbed_DestroyExtensionProxy(ContentEmbed_ExtensionProxy *proxy)

Description

Destroys a ContentEmbed_ExtensionProxy instance.

Since: 24

Parameters

Name Description
ContentEmbed_ExtensionProxy *proxy Pointer to the ContentEmbed_ExtensionProxy object.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

Returns CE_ERR_OK if the operation is successful.

Returns CE_ERR_PARAM_INVALID if the parameter check fails.

Returns CE_ERR_DEVICE_NOT_SUPPORTED if the device does not support the operation.

Returns CE_ERR_IN_DLP_SANDBOX if the application is in a DLP sandbox and this operation is not supported.

[h2]OH_ContentEmbed_ClientCallbackOnUpdateFunc()

typedef void (*OH_ContentEmbed_ClientCallbackOnUpdateFunc)(ContentEmbed_ExtensionProxy *proxy)

Description

This callback function is triggered to notify the client when the OE document is updated.

You need to implement this function and register it with the client OE object through OH_ContentEmbed_Proxy_RegisterOnUpdateFunc.

Since: 24

Parameters

Name Description
ContentEmbed_ExtensionProxy *proxy Pointer to the ContentEmbed_ExtensionProxy object.

[h2]OH_ContentEmbed_ClientCallbackOnErrorFunc()

typedef void (*OH_ContentEmbed_ClientCallbackOnErrorFunc)(ContentEmbed_ExtensionProxy *proxy, ContentEmbed_ErrorCode error)

Description

This callback function is triggered to notify the client when an error occurs in the OE document.

You need to implement this function and register it with the client OE object through OH_ContentEmbed_Proxy_RegisterOnErrorFunc.

Since: 24

Parameters

Name Description
ContentEmbed_ExtensionProxy *proxy Pointer to the ContentEmbed_ExtensionProxy object.
ContentEmbed_ErrorCode error Error code that occurred. For details, see ContentEmbed_ErrorCode.

[h2]OH_ContentEmbed_ClientCallbackOnEditingFinishedFunc()

typedef void (*OH_ContentEmbed_ClientCallbackOnEditingFinishedFunc)(ContentEmbed_ExtensionProxy *proxy, bool dataModified)

Description

This callback function is triggered to notify the client when editing of the OE document is finished.

You need to implement this function and register it with the client OE object through OH_ContentEmbed_Proxy_RegisterOnEditingFinishedFunc.

Since: 24

Parameters

Name Description
ContentEmbed_ExtensionProxy *proxy Pointer to the ContentEmbed_ExtensionProxy object.
bool dataModified Whether the OE document data is modified. The value true indicates that the OE document is modified, and false indicates the opposite.

[h2]OH_ContentEmbed_ClientCallbackOnExtensionStoppedFunc()

typedef void (*OH_ContentEmbed_ClientCallbackOnExtensionStoppedFunc)(ContentEmbed_ExtensionProxy *proxy)

Description

This callback function is triggered when the OE Extension stops.

You need to implement this function and register it with the client OE object through OH_ContentEmbed_Proxy_RegisterOnExtensionStoppedFunc.

Since: 24

Parameters

Name Description
ContentEmbed_ExtensionProxy *proxy Pointer to the ContentEmbed_ExtensionProxy object.

[h2]OH_ContentEmbed_Proxy_RegisterOnUpdateFunc()

ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_RegisterOnUpdateFunc(ContentEmbed_ExtensionProxy *proxy, OH_ContentEmbed_ClientCallbackOnUpdateFunc onUpdateFunc)

Description

Registers a callback function for OE document updates with the client OE object.

Since: 24

Parameters

Name Description
ContentEmbed_ExtensionProxy *proxy Pointer to the ContentEmbed_ExtensionProxy object.
OH_ContentEmbed_ClientCallbackOnUpdateFunc onUpdateFunc OH_ContentEmbed_ClientCallbackOnUpdateFunc callback function to register.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: success.

CE_ERR_PARAM_INVALID: parameter check failed.

CE_ERR_DEVICE_NOT_SUPPORTED: the device does not support this operation.

CE_ERR_IN_DLP_SANDBOX: the application is in a DLP sandbox, and this operation is not supported.

[h2]OH_ContentEmbed_Proxy_RegisterOnErrorFunc()

ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_RegisterOnErrorFunc(ContentEmbed_ExtensionProxy *proxy, OH_ContentEmbed_ClientCallbackOnErrorFunc onErrorFunc)

Description

Registers a callback function for OE document errors with the client OE object.

Since: 24

Parameters

Name Description
ContentEmbed_ExtensionProxy *proxy Pointer to the ContentEmbed_ExtensionProxy object.
OH_ContentEmbed_ClientCallbackOnErrorFunc onErrorFunc OH_ContentEmbed_ClientCallbackOnErrorFunc callback function to register.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

Returns CE_ERR_OK if the operation is successful.

Returns CE_ERR_PARAM_INVALID if the parameter check fails.

Returns CE_ERR_DEVICE_NOT_SUPPORTED if the device does not support this operation.

Returns CE_ERR_IN_DLP_SANDBOX if the application is in a DLP sandbox and this operation is not supported.

[h2]OH_ContentEmbed_Proxy_RegisterOnEditingFinishedFunc()

ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_RegisterOnEditingFinishedFunc(ContentEmbed_ExtensionProxy *proxy, OH_ContentEmbed_ClientCallbackOnEditingFinishedFunc onEditingFinishedFunc)

Description

Registers a callback function for OE document editing completion with the client OE object.

Since: 24

Parameters

Name Description
ContentEmbed_ExtensionProxy *proxy Pointer to the ContentEmbed_ExtensionProxy object.
OH_ContentEmbed_ClientCallbackOnEditingFinishedFunc onEditingFinishedFunc Callback function to register, invoked when editing is finished.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: success.

CE_ERR_PARAM_INVALID: parameter check failed.

CE_ERR_DEVICE_NOT_SUPPORTED: device not supported.

CE_ERR_IN_DLP_SANDBOX: the application is in a DLP sandbox and this operation is not supported.

[h2]OH_ContentEmbed_Proxy_RegisterOnExtensionStoppedFunc()

ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_RegisterOnExtensionStoppedFunc(ContentEmbed_ExtensionProxy *proxy, OH_ContentEmbed_ClientCallbackOnExtensionStoppedFunc onExtensionStoppedFunc)

Description

Registers a callback function to be triggered when the OE Extension stops with the client OE object.

Since: 24

Parameters

Name Description
ContentEmbed_ExtensionProxy *proxy Pointer to the ContentEmbed_ExtensionProxy object.
OH_ContentEmbed_ClientCallbackOnExtensionStoppedFunc onExtensionStoppedFunc Callback function to register.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: success.

CE_ERR_PARAM_INVALID: parameter check failed.

CE_ERR_DEVICE_NOT_SUPPORTED: device not supported.

CE_ERR_IN_DLP_SANDBOX: the application is in a DLP sandbox, and this operation is not supported.

[h2]OH_ContentEmbed_Proxy_StartWork()

ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_StartWork(ContentEmbed_ExtensionProxy *proxy)

Description

Connects to the server OE Extension and establishes a communication channel with it.

Required permissions: ohos.permission.CONNECT_OBJECTEDITOR_EXTENSION

Since: 24

Parameters

Name Description
ContentEmbed_ExtensionProxy *proxy Pointer to the ContentEmbed_ExtensionProxy object.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: The operation is successful.

CE_PERMISSION_DENIED: The permission verification fails.

CE_ERR_PARAM_INVALID: The parameter check fails.

CE_ERR_CLIENT_CALLBACK_NOT_REGISTERED: The required client callback is not registered.

CE_ERR_SYSTEM_ABNORMAL: The system service is abnormal.

CE_ERR_DEVICE_NOT_SUPPORTED: This operation is not supported on the device.

CE_ERR_IN_DLP_SANDBOX: This operation is not supported for DLP sandbox applications.

CE_ERR_CONNECT_LIMIT_EXCEED: The number of OE Extension connections exceeds the limit.

CE_ERR_FILE_NOT_GRANT: The file is unauthorized.

CE_ERR_DISK_FULL: The disk is full.

[h2]OH_ContentEmbed_Proxy_StopWork()

ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_StopWork(ContentEmbed_ExtensionProxy *proxy)

Description

Disconnects from the communication channel with the OE Extension.

Required permissions: ohos.permission.CONNECT_OBJECTEDITOR_EXTENSION

Since: 24

Parameters

Name Description
ContentEmbed_ExtensionProxy *proxy Pointer to the ContentEmbed_ExtensionProxy object.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: The operation is successful.

CE_PERMISSION_DENIED: The permission verification fails.

CE_ERR_PARAM_INVALID: The parameter check fails.

CE_ERR_SYSTEM_ABNORMAL: The system service is abnormal.

CE_ERR_DEVICE_NOT_SUPPORTED: This operation is not supported on the device.

CE_ERR_IN_DLP_SANDBOX: This operation is not supported for DLP sandbox applications.

[h2]OH_ContentEmbed_Proxy_GetSnapshot()

ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_GetSnapshot(ContentEmbed_ExtensionProxy *proxy, OH_PixelmapNative **snapshot)

Description

Obtains the current OE document snapshot from the client OE object for preview or thumbnail display.

Since: 24

Parameters

Name Description
ContentEmbed_ExtensionProxy *proxy Pointer to the ContentEmbed_ExtensionProxy object.
OH_PixelmapNative **snapshot

Output parameter. Pointer to the OH_PixelmapNative instance used to store the document snapshot.

The developer needs to call OH_PixelmapNative_Destroy to destroy it to avoid memory leaks.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: The operation is successful.

CE_ERR_PARAM_INVALID: The parameter check fails.

CE_ERR_NULL_POINTER: A null pointer is returned.

CE_ERR_EXTENSION_ERROR: An error occurs in the OE Extension.

CE_ERR_DEVICE_NOT_SUPPORTED: This operation is not supported on the device.

CE_ERR_IN_DLP_SANDBOX: This operation is not supported for DLP sandbox applications.

CE_ERR_EXTENSION_NOT_SUPPORT: This capability is not supported by the OE Extension.

[h2]OH_ContentEmbed_Proxy_DoEdit()

ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_DoEdit(ContentEmbed_ExtensionProxy *proxy)

Description

Requests the OE Extension instance to enter editing mode by the client OE object.

Since: 24

Parameters

Name Description
ContentEmbed_ExtensionProxy *proxy Pointer to the ContentEmbed_ExtensionProxy object.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: the operation is successful.

CE_ERR_PARAM_INVALID: the parameter check failed.

CE_ERR_EXTENSION_ERROR: an error occurred in the OE Extension.

CE_ERR_DEVICE_NOT_SUPPORTED: the device does not support this operation.

CE_ERR_IN_DLP_SANDBOX: the application is in a DLP sandbox, and this operation is not supported.

CE_ERR_EXTENSION_NOT_SUPPORT: the OE Extension does not support this capability.

[h2]OH_ContentEmbed_Proxy_GetEditStatus()

ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_GetEditStatus(ContentEmbed_ExtensionProxy *proxy, bool *isEditing, bool *isModified)

Description

Queries the current editing status and modification status of the OE document from the server OE Extension instance.

Since: 24

Parameters

Name Description
ContentEmbed_ExtensionProxy *proxy Pointer to the ContentEmbed_ExtensionProxy object.
bool *isEditing Output parameter. Indicates whether the content-embedded document is being edited. The value true means it is being edited, and false means it is not.
bool *isModified Output parameter. Indicates whether the content-embedded document has been modified. The value true means it has been modified, and false means it has not.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: the operation is successful.

CE_ERR_PARAM_INVALID: the parameter check failed.

CE_ERR_EXTENSION_ERROR: an error occurred in the OE Extension.

CE_ERR_DEVICE_NOT_SUPPORTED: the device does not support this operation.

CE_ERR_IN_DLP_SANDBOX: the application is in a DLP sandbox, and this operation is not supported.

[h2]OH_ContentEmbed_Proxy_GetCapability()

ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_GetCapability(ContentEmbed_ExtensionProxy *proxy, uint32_t *bitmask)

Description

Obtains the capabilities of the server OE Extension instance, returned as a bitmask. For details, see ContentEmbed_CapabilityCode.

Since: 24

Parameters

Name Description
ContentEmbed_ExtensionProxy *proxy Pointer to the ContentEmbed_ExtensionProxy object.
uint32_t *bitmask Output parameter, which indicates the capabilities of the server OE Extension instance. This parameter includes the values in ContentEmbed_CapabilityCode.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

CE_ERR_OK: operation succeeded.

CE_ERR_PARAM_INVALID: parameter check failed.

CE_ERR_EXTENSION_ERROR: an error occurred in the OE Extension.

CE_ERR_DEVICE_NOT_SUPPORTED: the device does not support this operation.

CE_ERR_IN_DLP_SANDBOX: the application is in a DLP sandbox and does not support this operation.

[h2]OH_ContentEmbed_Proxy_GetDocument()

ContentEmbed_ErrorCode OH_ContentEmbed_Proxy_GetDocument(ContentEmbed_ExtensionProxy *proxy, ContentEmbed_Document **ceDocument)

Description

Obtains the OE document object associated with the client OE object from the client OE object.

The OE document object is created through OH_ContentEmbed_CreateDocumentByOEid, OH_ContentEmbed_CreateDocumentByFile, or OH_ContentEmbed_LoadDocumentFromFile.

When the OE document is no longer needed, call OH_ContentEmbed_DestroyDocument to destroy it.

Since: 24

Parameters

Name Description
ContentEmbed_ExtensionProxy *proxy Pointer to the ContentEmbed_ExtensionProxy object.
ContentEmbed_Document **ceDocument Output parameter. Pointer used to store the OE document instance.

Return

Type Description
ContentEmbed_ErrorCode

Result code.

Returns CE_ERR_OK if the operation is successful.

Returns CE_ERR_PARAM_INVALID if the parameter check failed.

Returns CE_ERR_DEVICE_NOT_SUPPORTED if the device does not support this operation.

Returns CE_ERR_IN_DLP_SANDBOX if the application is in a DLP sandbox and this operation is not supported.