From b948046fe797880295d0706f80831d279db75b5a Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Thu, 5 Apr 2018 18:19:45 +0000 Subject: Remove unused XFA Widget API methods Keeping the internal widget details, since they are likely needed for wiring up XFA with the other form APIs. BUG=pdfium:1056 Change-Id: I000468e27bbb59346c4288f1c4f0fe96ed5f3603 Reviewed-on: https://pdfium-review.googlesource.com/29870 Reviewed-by: dsinclair Commit-Queue: Ryan Harrison --- fpdfsdk/fpdf_formfill.cpp | 115 ----------------------------------------- fpdfsdk/fpdf_view_c_api_test.c | 6 --- public/fpdf_formfill.h | 93 --------------------------------- 3 files changed, 214 deletions(-) diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp index 7185044b72..7b47259a12 100644 --- a/fpdfsdk/fpdf_formfill.cpp +++ b/fpdfsdk/fpdf_formfill.cpp @@ -496,121 +496,6 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLRecord(FPDF_FORMHANDLE hHandle, } #endif -#ifdef PDF_ENABLE_XFA -FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_Undo(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget) { - if (!hWidget || !document) - return; - - CPDFXFA_Context* pContext = static_cast(document); - if (!pContext->ContainsXFAForm()) - return; - - static_cast(hWidget)->Undo(); -} - -FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_Redo(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget) { - if (!hWidget || !document) - return; - - CPDFXFA_Context* pContext = static_cast(document); - if (!pContext->ContainsXFAForm()) - return; - - static_cast(hWidget)->Redo(); -} - -FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_SelectAll(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget) { - if (!hWidget || !document) - return; - - CPDFXFA_Context* pContext = static_cast(document); - if (!pContext->ContainsXFAForm()) - return; - - static_cast(hWidget)->SelectAll(); -} - -FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_Copy(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget, - FPDF_WIDESTRING wsText, - FPDF_DWORD* size) { - if (!hWidget || !document) - return; - - CPDFXFA_Context* pContext = static_cast(document); - if (!pContext->ContainsXFAForm()) - return; - - WideString wsCpText = - static_cast(hWidget)->Copy().value_or(WideString()); - - ByteString bsCpText = wsCpText.UTF16LE_Encode(); - uint32_t len = bsCpText.GetLength() / sizeof(unsigned short); - if (!wsText) { - *size = len; - return; - } - - uint32_t real_size = len < *size ? len : *size; - if (real_size > 0) { - memcpy((void*)wsText, - bsCpText.GetBuffer(real_size * sizeof(unsigned short)), - real_size * sizeof(unsigned short)); - bsCpText.ReleaseBuffer(real_size * sizeof(unsigned short)); - } - *size = real_size; -} - -FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_Cut(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget, - FPDF_WIDESTRING wsText, - FPDF_DWORD* size) { - if (!hWidget || !document) - return; - - CPDFXFA_Context* pContext = static_cast(document); - if (!pContext->ContainsXFAForm()) - return; - - WideString wsCpText = - static_cast(hWidget)->Cut().value_or(WideString()); - - ByteString bsCpText = wsCpText.UTF16LE_Encode(); - uint32_t len = bsCpText.GetLength() / sizeof(unsigned short); - if (!wsText) { - *size = len; - return; - } - - uint32_t real_size = len < *size ? len : *size; - if (real_size > 0) { - memcpy((void*)wsText, - bsCpText.GetBuffer(real_size * sizeof(unsigned short)), - real_size * sizeof(unsigned short)); - bsCpText.ReleaseBuffer(real_size * sizeof(unsigned short)); - } - *size = real_size; -} - -FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_Paste(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget, - FPDF_WIDESTRING wsText, - FPDF_DWORD size) { - if (!hWidget || !document) - return; - - CPDFXFA_Context* pContext = static_cast(document); - if (!pContext->ContainsXFAForm()) - return; - - WideString wstr = WideString::FromUTF16LE(wsText, size); - static_cast(hWidget)->Paste(wstr); -} -#endif // PDF_ENABLE_XFA - FPDF_EXPORT void FPDF_CALLCONV FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, int fieldType, diff --git a/fpdfsdk/fpdf_view_c_api_test.c b/fpdfsdk/fpdf_view_c_api_test.c index c352e69e37..1942b73957 100644 --- a/fpdfsdk/fpdf_view_c_api_test.c +++ b/fpdfsdk/fpdf_view_c_api_test.c @@ -227,12 +227,6 @@ int CheckPDFiumCApi() { CHK(FPDF_GetFormType); #ifdef PDF_ENABLE_XFA CHK(FPDF_LoadXFA); - CHK(FPDF_Widget_Undo); - CHK(FPDF_Widget_Redo); - CHK(FPDF_Widget_SelectAll); - CHK(FPDF_Widget_Copy); - CHK(FPDF_Widget_Cut); - CHK(FPDF_Widget_Paste); #endif // fpdf_ppo.h diff --git a/public/fpdf_formfill.h b/public/fpdf_formfill.h index 33701ef9c1..6cf2fcea0c 100644 --- a/public/fpdf_formfill.h +++ b/public/fpdf_formfill.h @@ -1663,99 +1663,6 @@ FPDF_EXPORT int FPDF_CALLCONV FPDF_GetFormType(FPDF_DOCUMENT document); * TRUE indicates success,otherwise FALSE. **/ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_LoadXFA(FPDF_DOCUMENT document); - -/** - * Function: FPDF_Widget_Undo - * This method will implement the undo feature for the specified xfa - *field. - * Parameters: - * document - Handle to document. Returned by - *FPDF_LoadDocument function. - * hWidget - Handle to the xfa field. - * Return Value: - * None. - **/ -FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_Undo(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget); -/** - * Function: FPDF_Widget_Redo - * This method will implement the redo feature for the specified xfa - *field. - * Parameters: - * document - Handle to document. Returned by - *FPDF_LoadDocument function. - * hWidget - Handle to the xfa field. - * Return Value: - * None. - **/ -FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_Redo(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget); -/** - * Function: FPDF_Widget_SelectAll - * This method will implement the select all feature for the specified - *xfa field. - * Parameters: - * document - Handle to document. Returned by - *FPDF_LoadDocument function. - * hWidget - Handle to the xfa field. - * Return Value: - * None. - **/ -FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_SelectAll(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget); -/** - * Function: FPDF_Widget_Copy - * This method will implement the copy feature for the specified xfa - *field. - * Parameters: - * document - Handle to document. Returned by - *FPDF_LoadDocument function. - * hWidget - Handle to the xfa field. - * wsText - Pointer to data buffer to receive the copied - *data, in UTF-16LE format. - * size - The data buffer size. - * Return Value: - * None. - **/ -FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_Copy(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget, - FPDF_WIDESTRING wsText, - FPDF_DWORD* size); -/** - * Function: FPDF_Widget_Cut - * This method will implement the cut feature for the specified xfa - *field. - * Parameters: - * document - Handle to document. Returned by - *FPDF_LoadDocument function. - * hWidget - Handle to the xfa field. - * wsText - Pointer to data buffer to receive the cut - *data,in UTF-16LE format. - * size - The data buffer size,not the byte number. - * Return Value: - * None. - **/ -FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_Cut(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget, - FPDF_WIDESTRING wsText, - FPDF_DWORD* size); -/** - * Function: FPDF_Widget_Paste - * This method will implement the paste feature for the specified xfa - *field. - * Parameters: - * document - Handle to document. Returned by - *FPDF_LoadDocument function. - * hWidget - Handle to the xfa field. - * wsText - The paste text buffer, in UTF-16LE format. - * size - The data buffer size,not the byte number. - * Return Value: - * None. - **/ -FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_Paste(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget, - FPDF_WIDESTRING wsText, - FPDF_DWORD size); #endif // PDF_ENABLE_XFA #ifdef __cplusplus -- cgit v1.2.3