summaryrefslogtreecommitdiff
path: root/fpdfsdk/formfiller
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/formfiller')
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.cpp14
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.h1
-rw-r--r--fpdfsdk/formfiller/cffl_interactiveformfiller.cpp9
-rw-r--r--fpdfsdk/formfiller/cffl_interactiveformfiller.h1
4 files changed, 25 insertions, 0 deletions
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index edbd671f29..a37a7501d0 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -245,6 +245,20 @@ CFX_WideString CFFL_FormFiller::GetSelectedText(CPDFSDK_Annot* pAnnot) {
return pWnd ? pWnd->GetSelectedText() : CFX_WideString();
}
+void CFFL_FormFiller::DeleteSelectedText(CPDFSDK_Annot* pAnnot) {
+ if (!IsValid())
+ return;
+
+ CPDFSDK_PageView* pPageView = GetCurPageView(true);
+ ASSERT(pPageView);
+
+ CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false);
+ if (!pWnd)
+ return;
+
+ pWnd->DeleteSelectedText();
+}
+
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 3eedebea47..96b7a69b29 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.h
+++ b/fpdfsdk/formfiller/cffl_formfiller.h
@@ -75,6 +75,7 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler {
virtual bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags);
CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot);
+ void DeleteSelectedText(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 8a81f4c40d..24bfd3c3b2 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -523,6 +523,15 @@ CFX_WideString CFFL_InteractiveFormFiller::GetSelectedText(
return pFormFiller ? pFormFiller->GetSelectedText(pAnnot) : CFX_WideString();
}
+void CFFL_InteractiveFormFiller::DeleteSelectedText(CPDFSDK_Annot* pAnnot) {
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
+ CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false);
+ if (!pFormFiller)
+ return;
+
+ pFormFiller->DeleteSelectedText(pAnnot);
+}
+
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 fb141e17a4..744d522fbc 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
@@ -84,6 +84,7 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify {
void RemoveFormFiller(CPDFSDK_Annot* pAnnot);
CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot);
+ void DeleteSelectedText(CPDFSDK_Annot* pAnnot);
static bool IsVisible(CPDFSDK_Widget* pWidget);
static bool IsReadOnly(CPDFSDK_Widget* pWidget);