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 --- 2 files changed, 121 deletions(-) (limited to 'fpdfsdk') 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 -- cgit v1.2.3