diff options
Diffstat (limited to 'fpdfsdk/formfiller')
-rw-r--r-- | fpdfsdk/formfiller/cffl_formfiller.cpp | 11 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_formfiller.h | 2 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 7 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_interactiveformfiller.h | 2 |
4 files changed, 22 insertions, 0 deletions
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index 297d5b78d6..526f4b947d 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -239,6 +239,17 @@ bool CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot, return false; } +CFX_WideString CFFL_FormFiller::GetSelectedText(CPDFSDK_Annot* pAnnot) { + if (!IsValid()) + return CFX_WideString(); + + CPDFSDK_PageView* pPageView = GetCurPageView(true); + ASSERT(pPageView); + + CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false); + return pWnd ? pWnd->GetSelectedText() : CFX_WideString(); +} + void CFFL_FormFiller::SetFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag) { CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; UnderlyingPageType* pPage = pWidget->GetUnderlyingPage(); diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h index 445e86fb3c..2ddbdf2d6e 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.h +++ b/fpdfsdk/formfiller/cffl_formfiller.h @@ -74,6 +74,8 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { uint32_t nFlags); virtual bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags); + CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot); + void SetFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag); void KillFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag); diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index 7647fb19ff..69c74bc587 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -522,6 +522,13 @@ void CFFL_InteractiveFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot) { UnRegisterFormFiller(pAnnot); } +CFX_WideString CFFL_InteractiveFormFiller::GetSelectedText( + CPDFSDK_Annot* pAnnot) { + ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); + CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false); + return pFormFiller ? pFormFiller->GetSelectedText(pAnnot) : CFX_WideString(); +} + void CFFL_InteractiveFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) { auto it = m_Maps.find(pAnnot); if (it == m_Maps.end()) diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h index f72dfbcc61..b7724a32e3 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h @@ -82,6 +82,8 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { CFFL_FormFiller* GetFormFiller(CPDFSDK_Annot* pAnnot, bool bRegister); void RemoveFormFiller(CPDFSDK_Annot* pAnnot); + CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot); + static bool IsVisible(CPDFSDK_Widget* pWidget); static bool IsReadOnly(CPDFSDK_Widget* pWidget); static bool IsFillingAllowed(CPDFSDK_Widget* pWidget); |