diff options
author | Diana Gage <drgage@google.com> | 2017-06-20 11:17:11 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-06-20 21:41:22 +0000 |
commit | dce2d72f9fbc166ee8eed0e362ab26e1e1a33cdd (patch) | |
tree | 410816fa09ffea9d2db198b5138f45ea55253824 /fpdfsdk/cpdfsdk_pageview.cpp | |
parent | b5c5ec06396158232d7f6955dde7b3512df0ae6e (diff) | |
download | pdfium-dce2d72f9fbc166ee8eed0e362ab26e1e1a33cdd.tar.xz |
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 <dsinclair@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_pageview.cpp')
-rw-r--r-- | fpdfsdk/cpdfsdk_pageview.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp index 982eed1b21..aae245e298 100644 --- a/fpdfsdk/cpdfsdk_pageview.cpp +++ b/fpdfsdk/cpdfsdk_pageview.cpp @@ -241,6 +241,16 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByXFAWidget(CXFA_FFWidget* hWidget) { } #endif // PDF_ENABLE_XFA +CFX_WideString CPDFSDK_PageView::GetSelectedText() { + if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) { + CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = + m_pFormFillEnv->GetAnnotHandlerMgr(); + return pAnnotHandlerMgr->Annot_GetSelectedText(pAnnot); + } + + return CFX_WideString(); +} + bool CPDFSDK_PageView::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point)); if (!pAnnot) { |