From dce2d72f9fbc166ee8eed0e362ab26e1e1a33cdd Mon Sep 17 00:00:00 2001 From: Diana Gage Date: Tue, 20 Jun 2017 11:17:11 -0700 Subject: Add FORM_GetSelectedText() function. This function copies the selected text from a form text field or form combobox text field into the buffer parameter and returns the length of the selected text string. When buffer is a nullptr or buflen is less than the length of the selected text, this function does not modify the buffer and only returns the selected text length. BUG=chromium:59266 Change-Id: Ie77de38e45bbe6f9ea033826c961435304eedfc7 Reviewed-on: https://pdfium-review.googlesource.com/6413 Reviewed-by: dsinclair Reviewed-by: Lei Zhang Commit-Queue: Lei Zhang --- public/fpdf_formfill.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'public/fpdf_formfill.h') diff --git a/public/fpdf_formfill.h b/public/fpdf_formfill.h index caefad78c7..5a15cd9a02 100644 --- a/public/fpdf_formfill.h +++ b/public/fpdf_formfill.h @@ -1354,6 +1354,29 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnChar(FPDF_FORMHANDLE hHandle, int nChar, int modifier); +/** + * Function: FORM_GetSelectedText + * You can call this function to obtain selected text within + * a form text field or form combobox text field. + * 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 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. + **/ +DLLEXPORT unsigned long STDCALL FORM_GetSelectedText(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + void* buffer, + unsigned long buflen); + /** * Function: FORM_ForceToKillFocus. * You can call this member function to force to kill the focus of the -- cgit v1.2.3