From a4c7ac479d291fc3373b9c2f8f25302ecd53b0d5 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 17 Apr 2018 15:12:58 +0000 Subject: Implement FORM_GetFocusedText() API. If there is a focused form field, get its text. BUG=chromium:753216 Change-Id: I05294f14d05c1c86769055f6c9eaf9177787d9fd Reviewed-on: https://pdfium-review.googlesource.com/12072 Commit-Queue: Lei Zhang Reviewed-by: dsinclair --- public/fpdf_formfill.h | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'public/fpdf_formfill.h') diff --git a/public/fpdf_formfill.h b/public/fpdf_formfill.h index 6cf2fcea0c..ff87d99ab5 100644 --- a/public/fpdf_formfill.h +++ b/public/fpdf_formfill.h @@ -1383,6 +1383,30 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnChar(FPDF_FORMHANDLE hHandle, int nChar, int modifier); +/** + * Experimental API + * Function: FORM_GetFocusedText + * You can call this function to obtain the text within the current + * focused field, if any. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + * function. + * buffer - Buffer for holding the form text, encoded in + * UTF16-LE. If NULL, |buffer| is not modified. + * buflen - Length of |buffer| in bytes. If |buflen| is less + than the length of the form text string, |buffer| is + not modified. + * Return Value: + * Length in bytes for the text in the focused field. + **/ +FPDF_EXPORT unsigned long FPDF_CALLCONV +FORM_GetFocusedText(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + void* buffer, + unsigned long buflen); + /** * Function: FORM_GetSelectedText * You can call this function to obtain selected text within @@ -1392,11 +1416,11 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnChar(FPDF_FORMHANDLE hHandle, * FPDFDOC_InitFormFillEnvironment. * page - Handle to the page. Returned by FPDF_LoadPage * function. - * buffer - Buffer for holding the selected text, encoded - * in UTF16-LE. If NULL, |buffer| is not modified. - * buflen - Length of |buffer| in bytes. If |buflen| - is less than the length of the selected text - string, |buffer| is not modified. + * buffer - Buffer for holding the selected text, encoded in + * UTF16-LE. If NULL, |buffer| is not modified. + * buflen - Length of |buffer| in bytes. If |buflen| is less + than the length of the selected text string, + |buffer| is not modified. * Return Value: * Length in bytes of selected text in form text field or form combobox * text field. -- cgit v1.2.3