summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-07-21 17:42:19 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-07-22 00:54:57 +0000
commit60fa2fce1f6fc02b3039166d84ed8ec152312566 (patch)
treea5fe7c1263ccb1620b16b549787e390bb1814dd4
parentd2be646ae1655ac702c5f304d546a2eb32ad2c54 (diff)
downloadpdfium-chromium/3165.tar.xz
Simplify code in CPDFSDK_FormFillEnvironment.chromium/3165
This makes various IsFooKeyDown() methods static. Transitively apply that to callers too. Change-Id: Ia43b1fd62889c1943e0d8407e9696225b05125a8 Reviewed-on: https://pdfium-review.googlesource.com/7190 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
-rw-r--r--fpdfsdk/cfx_systemhandler.cpp12
-rw-r--r--fpdfsdk/cfx_systemhandler.h3
-rw-r--r--fpdfsdk/cpdfsdk_annothandlermgr.cpp16
-rw-r--r--fpdfsdk/cpdfsdk_annothandlermgr.h2
-rw-r--r--fpdfsdk/cpdfsdk_formfillenvironment.cpp27
-rw-r--r--fpdfsdk/cpdfsdk_formfillenvironment.h18
-rw-r--r--fpdfsdk/cpdfsdk_interform.cpp8
-rw-r--r--fpdfsdk/cpdfsdk_widgethandler.cpp3
-rw-r--r--fpdfsdk/cpdfsdk_widgethandler.h5
-rw-r--r--fpdfsdk/formfiller/cffl_interactiveformfiller.cpp52
-rw-r--r--fpdfsdk/pdfwindow/cpwl_wnd.cpp15
-rw-r--r--fpdfsdk/pdfwindow/cpwl_wnd.h13
12 files changed, 68 insertions, 106 deletions
diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp
index 882351145e..6281b1be91 100644
--- a/fpdfsdk/cfx_systemhandler.cpp
+++ b/fpdfsdk/cfx_systemhandler.cpp
@@ -132,15 +132,3 @@ int32_t CFX_SystemHandler::SetTimer(int32_t uElapse,
void CFX_SystemHandler::KillTimer(int32_t nID) {
m_pFormFillEnv->KillTimer(nID);
}
-
-bool CFX_SystemHandler::IsSHIFTKeyDown(uint32_t nFlag) const {
- return !!m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
-}
-
-bool CFX_SystemHandler::IsCTRLKeyDown(uint32_t nFlag) const {
- return !!m_pFormFillEnv->IsCTRLKeyDown(nFlag);
-}
-
-bool CFX_SystemHandler::IsALTKeyDown(uint32_t nFlag) const {
- return !!m_pFormFillEnv->IsALTKeyDown(nFlag);
-}
diff --git a/fpdfsdk/cfx_systemhandler.h b/fpdfsdk/cfx_systemhandler.h
index aa243c0e11..7402ac3c4f 100644
--- a/fpdfsdk/cfx_systemhandler.h
+++ b/fpdfsdk/cfx_systemhandler.h
@@ -64,9 +64,6 @@ class CFX_SystemHandler {
int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc);
void KillTimer(int32_t nID);
- bool IsSHIFTKeyDown(uint32_t nFlag) const;
- bool IsCTRLKeyDown(uint32_t nFlag) const;
- bool IsALTKeyDown(uint32_t nFlag) const;
private:
CFX_UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
index 2b089e5185..9e649f6dc6 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -29,13 +29,13 @@
CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr(
CPDFSDK_FormFillEnvironment* pFormFillEnv)
: m_pBAAnnotHandler(pdfium::MakeUnique<CPDFSDK_BAAnnotHandler>()),
- m_pWidgetHandler(pdfium::MakeUnique<CPDFSDK_WidgetHandler>(pFormFillEnv)),
+ m_pWidgetHandler(pdfium::MakeUnique<CPDFSDK_WidgetHandler>(pFormFillEnv))
#ifdef PDF_ENABLE_XFA
+ ,
m_pXFAWidgetHandler(
- pdfium::MakeUnique<CPDFSDK_XFAWidgetHandler>(pFormFillEnv)),
+ pdfium::MakeUnique<CPDFSDK_XFAWidgetHandler>(pFormFillEnv))
#endif // PDF_ENABLE_XFA
- m_pFormFillEnv(pFormFillEnv) {
- m_pWidgetHandler->SetFormFiller(m_pFormFillEnv->GetInteractiveFormFiller());
+{
}
CPDFSDK_AnnotHandlerMgr::~CPDFSDK_AnnotHandlerMgr() {}
@@ -205,16 +205,16 @@ bool CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot,
bool CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot,
int nKeyCode,
int nFlag) {
- if (m_pFormFillEnv->IsCTRLKeyDown(nFlag) ||
- m_pFormFillEnv->IsALTKeyDown(nFlag)) {
+ if (CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag) ||
+ CPDFSDK_FormFillEnvironment::IsALTKeyDown(nFlag)) {
return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag);
}
CPDFSDK_PageView* pPage = pAnnot->GetPageView();
CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot();
if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) {
- CPDFSDK_Annot::ObservedPtr pNext(
- GetNextAnnot(pFocusAnnot, !m_pFormFillEnv->IsSHIFTKeyDown(nFlag)));
+ CPDFSDK_Annot::ObservedPtr pNext(GetNextAnnot(
+ pFocusAnnot, !CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag)));
if (pNext && pNext.Get() != pFocusAnnot) {
pPage->GetFormFillEnv()->SetFocusAnnot(&pNext);
return true;
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.h b/fpdfsdk/cpdfsdk_annothandlermgr.h
index 5f6ff94b40..ff2556f9dc 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.h
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.h
@@ -114,8 +114,6 @@ class CPDFSDK_AnnotHandlerMgr {
#ifdef PDF_ENABLE_XFA
std::unique_ptr<CPDFSDK_XFAWidgetHandler> m_pXFAWidgetHandler;
#endif // PDF_ENABLE_XFA
-
- CFX_UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
};
#endif // FPDFSDK_CPDFSDK_ANNOTHANDLERMGR_H_
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index de7947556d..5c847fc1df 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -289,25 +289,6 @@ void CPDFSDK_FormFillEnvironment::OnChange() {
m_pInfo->FFI_OnChange(m_pInfo);
}
-bool CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(uint32_t nFlag) const {
- return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0;
-}
-
-bool CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(uint32_t nFlag) const {
- return (nFlag & FWL_EVENTFLAG_ControlKey) != 0;
-}
-
-bool CPDFSDK_FormFillEnvironment::IsALTKeyDown(uint32_t nFlag) const {
- return (nFlag & FWL_EVENTFLAG_AltKey) != 0;
-}
-
-FPDF_PAGE CPDFSDK_FormFillEnvironment::GetPage(UnderlyingDocumentType* document,
- int nPageIndex) {
- if (m_pInfo && m_pInfo->FFI_GetPage)
- return m_pInfo->FFI_GetPage(m_pInfo, document, nPageIndex);
- return nullptr;
-}
-
FPDF_PAGE CPDFSDK_FormFillEnvironment::GetCurrentPage(
UnderlyingDocumentType* document) {
if (m_pInfo && m_pInfo->FFI_GetCurrentPage)
@@ -589,8 +570,7 @@ CPDFSDK_PageView* CPDFSDK_FormFillEnvironment::GetCurrentView() {
}
CPDFSDK_PageView* CPDFSDK_FormFillEnvironment::GetPageView(int nIndex) {
- UnderlyingPageType* pTempPage =
- UnderlyingFromFPDFPage(GetPage(m_pUnderlyingDoc.Get(), nIndex));
+ UnderlyingPageType* pTempPage = GetPage(nIndex);
if (!pTempPage)
return nullptr;
@@ -663,7 +643,10 @@ void CPDFSDK_FormFillEnvironment::RemovePageView(
}
UnderlyingPageType* CPDFSDK_FormFillEnvironment::GetPage(int nIndex) {
- return UnderlyingFromFPDFPage(GetPage(m_pUnderlyingDoc.Get(), nIndex));
+ if (!m_pInfo || !m_pInfo->FFI_GetPage)
+ return nullptr;
+ return UnderlyingFromFPDFPage(
+ m_pInfo->FFI_GetPage(m_pInfo, m_pUnderlyingDoc.Get(), nIndex));
}
CPDFSDK_InterForm* CPDFSDK_FormFillEnvironment::GetInterForm() {
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h
index b1e095a0c2..c9937405bb 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.h
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.h
@@ -47,6 +47,16 @@ class CPDFSDK_FormFillEnvironment
FPDF_FORMFILLINFO* pFFinfo);
~CPDFSDK_FormFillEnvironment();
+ static bool IsSHIFTKeyDown(uint32_t nFlag) {
+ return !!(nFlag & FWL_EVENTFLAG_ShiftKey);
+ }
+ static bool IsCTRLKeyDown(uint32_t nFlag) {
+ return !!(nFlag & FWL_EVENTFLAG_ControlKey);
+ }
+ static bool IsALTKeyDown(uint32_t nFlag) {
+ return !!(nFlag & FWL_EVENTFLAG_AltKey);
+ }
+
CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPage, bool renew);
CPDFSDK_PageView* GetPageView(int nIndex);
CPDFSDK_PageView* GetCurrentView();
@@ -74,8 +84,6 @@ class CPDFSDK_FormFillEnvironment
void SetChangeMark() { m_bChangeMask = true; }
void ClearChangeMark() { m_bChangeMask = false; }
- UnderlyingPageType* GetPage(int nIndex);
-
void ProcJavascriptFun();
bool ProcOpenAction();
@@ -88,11 +96,7 @@ class CPDFSDK_FormFillEnvironment
FX_SYSTEMTIME GetLocalTime() const;
void OnChange();
- bool IsSHIFTKeyDown(uint32_t nFlag) const;
- bool IsCTRLKeyDown(uint32_t nFlag) const;
- bool IsALTKeyDown(uint32_t nFlag) const;
- FPDF_PAGE GetPage(UnderlyingDocumentType* document, int nPageIndex);
FPDF_PAGE GetCurrentPage(UnderlyingDocumentType* document);
void ExecuteNamedAction(const char* namedAction);
@@ -214,6 +218,8 @@ class CPDFSDK_FormFillEnvironment
CPDFSDK_InterForm* GetInterForm(); // Creates if not present.
private:
+ UnderlyingPageType* GetPage(int nIndex);
+
FPDF_FORMFILLINFO* const m_pInfo;
std::unique_ptr<CPDFSDK_AnnotHandlerMgr> m_pAnnotHandlerMgr;
std::unique_ptr<CPDFSDK_ActionHandler> m_pActionHandler;
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index ebbe02c29b..9ae2aa44f4 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -347,8 +347,8 @@ bool CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField,
CPDFSDK_ActionHandler* pActionHandler = m_pFormFillEnv->GetActionHandler();
PDFSDK_FieldAction fa;
- fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(0);
- fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(0);
+ fa.bModifier = false;
+ fa.bShift = false;
fa.sValue = csValue;
pActionHandler->DoAction_FieldJavaScript(
action, CPDF_AAction::KeyStroke, m_pFormFillEnv.Get(), pFormField, fa);
@@ -367,8 +367,8 @@ bool CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField,
CPDFSDK_ActionHandler* pActionHandler = m_pFormFillEnv->GetActionHandler();
PDFSDK_FieldAction fa;
- fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(0);
- fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(0);
+ fa.bModifier = false;
+ fa.bShift = false;
fa.sValue = csValue;
pActionHandler->DoAction_FieldJavaScript(
action, CPDF_AAction::Validate, m_pFormFillEnv.Get(), pFormField, fa);
diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp
index 6092500526..d916567bdd 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -25,7 +25,8 @@
CPDFSDK_WidgetHandler::CPDFSDK_WidgetHandler(
CPDFSDK_FormFillEnvironment* pFormFillEnv)
- : m_pFormFillEnv(pFormFillEnv), m_pFormFiller(nullptr) {}
+ : m_pFormFillEnv(pFormFillEnv),
+ m_pFormFiller(pFormFillEnv->GetInteractiveFormFiller()) {}
CPDFSDK_WidgetHandler::~CPDFSDK_WidgetHandler() {}
diff --git a/fpdfsdk/cpdfsdk_widgethandler.h b/fpdfsdk/cpdfsdk_widgethandler.h
index 9ef190f54d..aac3619a44 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.h
+++ b/fpdfsdk/cpdfsdk_widgethandler.h
@@ -98,16 +98,13 @@ class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler {
CPDFSDK_Annot::ObservedPtr* pNewAnnot) override;
#endif // PDF_ENABLE_XFA
- void SetFormFiller(CFFL_InteractiveFormFiller* pFiller) {
- m_pFormFiller = pFiller;
- }
CFFL_InteractiveFormFiller* GetFormFiller() const {
return m_pFormFiller.Get();
}
private:
CFX_UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
- CFX_UnownedPtr<CFFL_InteractiveFormFiller> m_pFormFiller;
+ CFX_UnownedPtr<CFFL_InteractiveFormFiller> const m_pFormFiller;
};
#endif // FPDFSDK_CPDFSDK_WIDGETHANDLER_H_
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index ee74b9928b..8a81f4c40d 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -124,8 +124,8 @@ void CFFL_InteractiveFormFiller::OnMouseEnter(
ASSERT(pPageView);
PDFSDK_FieldAction fa;
- fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag);
+ fa.bShift = CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag);
pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView);
m_bNotifying = false;
if (!(*pAnnot))
@@ -158,8 +158,8 @@ void CFFL_InteractiveFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView,
ASSERT(pPageView);
PDFSDK_FieldAction fa;
- fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag);
+ fa.bShift = CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag);
pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView);
m_bNotifying = false;
if (!(*pAnnot))
@@ -195,8 +195,8 @@ bool CFFL_InteractiveFormFiller::OnLButtonDown(
ASSERT(pPageView);
PDFSDK_FieldAction fa;
- fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlags);
- fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlags);
+ fa.bModifier = CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlags);
+ fa.bShift = CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlags);
pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView);
m_bNotifying = false;
if (!(*pAnnot))
@@ -273,8 +273,8 @@ bool CFFL_InteractiveFormFiller::OnButtonUp(CPDFSDK_Annot::ObservedPtr* pAnnot,
ASSERT(pPageView);
PDFSDK_FieldAction fa;
- fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag);
+ fa.bShift = CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag);
pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView);
m_bNotifying = false;
if (!(*pAnnot) || !IsValidAnnot(pPageView, pWidget))
@@ -386,8 +386,8 @@ bool CFFL_InteractiveFormFiller::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
ASSERT(pPageView);
PDFSDK_FieldAction fa;
- fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag);
+ fa.bShift = CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag);
pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa);
pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView);
m_bNotifying = false;
@@ -437,8 +437,8 @@ bool CFFL_InteractiveFormFiller::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
ASSERT(pPageView);
PDFSDK_FieldAction fa;
- fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag);
+ fa.bShift = CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag);
pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa);
pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView);
m_bNotifying = false;
@@ -607,8 +607,8 @@ bool CFFL_InteractiveFormFiller::OnKeyStrokeCommit(
pWidget->ClearAppModified();
PDFSDK_FieldAction fa;
- fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag);
+ fa.bShift = CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag);
fa.bWillCommit = true;
fa.bKeyDown = true;
fa.bRC = true;
@@ -639,8 +639,8 @@ bool CFFL_InteractiveFormFiller::OnValidate(CPDFSDK_Annot::ObservedPtr* pAnnot,
pWidget->ClearAppModified();
PDFSDK_FieldAction fa;
- fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag);
+ fa.bShift = CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag);
fa.bKeyDown = true;
fa.bRC = true;
@@ -708,8 +708,8 @@ bool CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Annot::ObservedPtr* pAnnot,
int nValueAge = pWidget->GetValueAge();
PDFSDK_FieldAction fa;
- fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag);
+ fa.bShift = CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag);
pWidget->OnXFAAAction(PDFSDK_XFA_Click, fa, pPageView);
m_bNotifying = false;
@@ -738,8 +738,8 @@ bool CFFL_InteractiveFormFiller::OnFull(CPDFSDK_Annot::ObservedPtr* pAnnot,
int nValueAge = pWidget->GetValueAge();
PDFSDK_FieldAction fa;
- fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag);
+ fa.bShift = CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag);
pWidget->OnXFAAAction(PDFSDK_XFA_Full, fa, pPageView);
m_bNotifying = false;
@@ -789,8 +789,8 @@ bool CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Annot::ObservedPtr* pAnnot,
int nValueAge = pWidget->GetValueAge();
PDFSDK_FieldAction fa;
- fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag);
+ fa.bShift = CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag);
pWidget->OnXFAAAction(PDFSDK_XFA_PreOpen, fa, pPageView);
m_bNotifying = false;
@@ -820,8 +820,8 @@ bool CFFL_InteractiveFormFiller::OnPostOpen(CPDFSDK_Annot::ObservedPtr* pAnnot,
int nValueAge = pWidget->GetValueAge();
PDFSDK_FieldAction fa;
- fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag);
+ fa.bShift = CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag);
pWidget->OnXFAAAction(PDFSDK_XFA_PostOpen, fa, pPageView);
m_bNotifying = false;
@@ -879,8 +879,8 @@ std::pair<bool, bool> CFFL_InteractiveFormFiller::OnBeforeKeyStroke(
pData->pPageView->GetFormFillEnv();
PDFSDK_FieldAction fa;
- fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag);
+ fa.bShift = CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag);
fa.sChange = strChange;
fa.sChangeEx = strChangeEx;
fa.bKeyDown = bKeyDown;
diff --git a/fpdfsdk/pdfwindow/cpwl_wnd.cpp b/fpdfsdk/pdfwindow/cpwl_wnd.cpp
index ce5f4ee598..663a763e3c 100644
--- a/fpdfsdk/pdfwindow/cpwl_wnd.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_wnd.cpp
@@ -802,18 +802,3 @@ void CPWL_Wnd::EnableWindow(bool bEnable) {
}
m_bEnabled = bEnable;
}
-
-bool CPWL_Wnd::IsCTRLpressed(uint32_t nFlag) const {
- CFX_SystemHandler* pSystemHandler = GetSystemHandler();
- return pSystemHandler && pSystemHandler->IsCTRLKeyDown(nFlag);
-}
-
-bool CPWL_Wnd::IsSHIFTpressed(uint32_t nFlag) const {
- CFX_SystemHandler* pSystemHandler = GetSystemHandler();
- return pSystemHandler && pSystemHandler->IsSHIFTKeyDown(nFlag);
-}
-
-bool CPWL_Wnd::IsALTpressed(uint32_t nFlag) const {
- CFX_SystemHandler* pSystemHandler = GetSystemHandler();
- return pSystemHandler && pSystemHandler->IsALTKeyDown(nFlag);
-}
diff --git a/fpdfsdk/pdfwindow/cpwl_wnd.h b/fpdfsdk/pdfwindow/cpwl_wnd.h
index 56fbb21baa..b22c5dba21 100644
--- a/fpdfsdk/pdfwindow/cpwl_wnd.h
+++ b/fpdfsdk/pdfwindow/cpwl_wnd.h
@@ -15,6 +15,7 @@
#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_basic.h"
#include "core/fxge/cfx_color.h"
+#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include "fpdfsdk/cpdfsdk_widget.h"
#include "fpdfsdk/pdfwindow/cpwl_timer.h"
#include "fpdfsdk/pdfwindow/cpwl_timer_handler.h"
@@ -298,9 +299,15 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
bool IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const;
const CPWL_Wnd* GetRootWnd() const;
- bool IsCTRLpressed(uint32_t nFlag) const;
- bool IsSHIFTpressed(uint32_t nFlag) const;
- bool IsALTpressed(uint32_t nFlag) const;
+ static bool IsCTRLpressed(uint32_t nFlag) {
+ return CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag);
+ }
+ static bool IsSHIFTpressed(uint32_t nFlag) {
+ return CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag);
+ }
+ static bool IsALTpressed(uint32_t nFlag) {
+ return CPDFSDK_FormFillEnvironment::IsALTKeyDown(nFlag);
+ }
private:
CFX_PointF ParentToChild(const CFX_PointF& point) const;