From 14f8897509d9db8739951a90488fb1634a497db5 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Thu, 5 Apr 2018 14:54:34 +0000 Subject: Remove spellchecking code from XFA The existing code for spellchecking is non-functional and we are not planning on fixing/finishing it, so removing it, since it currently is marking everything as misspelt. BUG=pdfium:1054 Change-Id: I23aaa13c09aed483376d7d06f47fdf31d890786b Reviewed-on: https://pdfium-review.googlesource.com/29790 Reviewed-by: Henrique Nakashima Commit-Queue: Ryan Harrison --- fpdfsdk/fpdf_formfill.cpp | 102 ----------------------------------------- fpdfsdk/fpdf_view_c_api_test.c | 6 --- 2 files changed, 108 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp index ddd460da05..7185044b72 100644 --- a/fpdfsdk/fpdf_formfill.cpp +++ b/fpdfsdk/fpdf_formfill.cpp @@ -120,16 +120,6 @@ CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle, return pFormFillEnv ? pFormFillEnv->GetPageView(pPage, true) : nullptr; } -#ifdef PDF_ENABLE_XFA -std::vector* FromFPDFStringHandle(FPDF_STRINGHANDLE handle) { - return static_cast*>(handle); -} - -FPDF_STRINGHANDLE ToFPDFStringHandle(std::vector* strings) { - return static_cast(strings); -} -#endif // PDF_ENABLE_XFA - void FFLCommon(FPDF_FORMHANDLE hHandle, FPDF_BITMAP bitmap, FPDF_RECORDER recorder, @@ -619,98 +609,6 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_Paste(FPDF_DOCUMENT document, WideString wstr = WideString::FromUTF16LE(wsText, size); static_cast(hWidget)->Paste(wstr); } - -FPDF_EXPORT void FPDF_CALLCONV -FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget, - float x, - float y, - FPDF_BYTESTRING bsText) { - if (!hWidget || !document) - return; - - CPDFXFA_Context* pContext = static_cast(document); - if (!pContext->ContainsXFAForm()) - return; - - CFX_PointF ptPopup; - ptPopup.x = x; - ptPopup.y = y; - ByteStringView bs(bsText); - static_cast(hWidget)->ReplaceSpellCheckWord(ptPopup, bs); -} - -FPDF_EXPORT void FPDF_CALLCONV -FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget, - float x, - float y, - FPDF_STRINGHANDLE* stringHandle) { - if (!hWidget || !document) - return; - - auto* pContext = static_cast(document); - if (!pContext->ContainsXFAForm()) - return; - - CFX_PointF ptPopup; - ptPopup.x = x; - ptPopup.y = y; - auto sSuggestWords = pdfium::MakeUnique>(); - static_cast(hWidget)->GetSuggestWords(ptPopup, - sSuggestWords.get()); - - // Caller takes ownership. - *stringHandle = ToFPDFStringHandle(sSuggestWords.release()); -} - -FPDF_EXPORT int FPDF_CALLCONV -FPDF_StringHandleCounts(FPDF_STRINGHANDLE sHandle) { - std::vector* sSuggestWords = FromFPDFStringHandle(sHandle); - return sSuggestWords ? pdfium::CollectionSize(*sSuggestWords) : -1; -} - -FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV -FPDF_StringHandleGetStringByIndex(FPDF_STRINGHANDLE sHandle, - int index, - FPDF_BYTESTRING bsText, - FPDF_DWORD* size) { - if (!sHandle || !size) - return false; - - int count = FPDF_StringHandleCounts(sHandle); - if (index < 0 || index >= count) - return false; - - std::vector* sSuggestWords = FromFPDFStringHandle(sHandle); - uint32_t len = (*sSuggestWords)[index].GetLength(); - if (!bsText) { - *size = len; - return true; - } - - uint32_t real_size = len < *size ? len : *size; - if (real_size > 0) - memcpy((void*)bsText, (*sSuggestWords)[index].c_str(), real_size); - *size = real_size; - return true; -} - -FPDF_EXPORT void FPDF_CALLCONV -FPDF_StringHandleRelease(FPDF_STRINGHANDLE stringHandle) { - delete FromFPDFStringHandle(stringHandle); -} - -FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV -FPDF_StringHandleAddString(FPDF_STRINGHANDLE stringHandle, - FPDF_BYTESTRING bsText, - FPDF_DWORD size) { - if (!stringHandle || !bsText || size == 0) - return false; - - FromFPDFStringHandle(stringHandle)->push_back(ByteString(bsText, size)); - return true; -} #endif // PDF_ENABLE_XFA FPDF_EXPORT void FPDF_CALLCONV diff --git a/fpdfsdk/fpdf_view_c_api_test.c b/fpdfsdk/fpdf_view_c_api_test.c index d00f353db5..c352e69e37 100644 --- a/fpdfsdk/fpdf_view_c_api_test.c +++ b/fpdfsdk/fpdf_view_c_api_test.c @@ -233,12 +233,6 @@ int CheckPDFiumCApi() { CHK(FPDF_Widget_Copy); CHK(FPDF_Widget_Cut); CHK(FPDF_Widget_Paste); - CHK(FPDF_Widget_ReplaceSpellCheckWord); - CHK(FPDF_Widget_GetSpellCheckWords); - CHK(FPDF_StringHandleCounts); - CHK(FPDF_StringHandleGetStringByIndex); - CHK(FPDF_StringHandleRelease); - CHK(FPDF_StringHandleAddString); #endif // fpdf_ppo.h -- cgit v1.2.3