Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: fpdfsdk/formfiller/cffl_interactiveformfiller.cpp

Issue 2400473002: Start proxying CPDFSDK_Document methods through CPDFSDK_FormFillEnvironment (Closed)
Patch Set: Rebase to master Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/formfiller/cffl_interactiveformfiller.h ('k') | fpdfsdk/fpdfformfill.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index 12c55d37b30aeb7e6b32e830e6ccbb02da96fe4f..50e63a5f1be8d62aa3280b2d22ddec19b2046b20 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -28,8 +28,8 @@
#define FFL_MAXLISTBOXHEIGHT 140.0f
CFFL_InteractiveFormFiller::CFFL_InteractiveFormFiller(
- CPDFSDK_FormFillEnvironment* pEnv)
- : m_pEnv(pEnv), m_bNotifying(FALSE) {}
+ CPDFSDK_FormFillEnvironment* pFormFillEnv)
+ : m_pFormFillEnv(pFormFillEnv), m_bNotifying(FALSE) {}
CFFL_InteractiveFormFiller::~CFFL_InteractiveFormFiller() {}
@@ -67,7 +67,7 @@ void CFFL_InteractiveFormFiller::OnDraw(CPDFSDK_PageView* pPageView,
pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device);
pAnnot->GetPDFPage();
- CPDFSDK_Document* pDocument = m_pEnv->GetSDKDocument();
+ CPDFSDK_Document* pDocument = m_pFormFillEnv->GetSDKDocument();
if (pDocument->GetFocusAnnot() == pAnnot) {
CFX_FloatRect rcFocus = pFormFiller->GetFocusBox(pPageView);
if (!rcFocus.IsEmpty()) {
@@ -137,8 +137,8 @@ void CFFL_InteractiveFormFiller::OnMouseEnter(
ASSERT(pPageView);
PDFSDK_FieldAction fa;
- fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView);
m_bNotifying = FALSE;
if (!(*pAnnot))
@@ -171,8 +171,8 @@ void CFFL_InteractiveFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView,
ASSERT(pPageView);
PDFSDK_FieldAction fa;
- fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView);
m_bNotifying = FALSE;
if (!(*pAnnot))
@@ -208,8 +208,8 @@ FX_BOOL CFFL_InteractiveFormFiller::OnLButtonDown(
ASSERT(pPageView);
PDFSDK_FieldAction fa;
- fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlags);
- fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlags);
+ fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlags);
+ fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlags);
pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView);
m_bNotifying = FALSE;
if (!(*pAnnot))
@@ -239,7 +239,7 @@ FX_BOOL CFFL_InteractiveFormFiller::OnLButtonUp(
const CFX_FloatPoint& point) {
ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get());
- CPDFSDK_Document* pDocument = m_pEnv->GetSDKDocument();
+ CPDFSDK_Document* pDocument = m_pFormFillEnv->GetSDKDocument();
switch (pWidget->GetFieldType()) {
case FIELDTYPE_PUSHBUTTON:
@@ -288,8 +288,8 @@ void CFFL_InteractiveFormFiller::OnButtonUp(CPDFSDK_Annot::ObservedPtr* pAnnot,
ASSERT(pPageView);
PDFSDK_FieldAction fa;
- fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView);
m_bNotifying = FALSE;
if (!(*pAnnot) || !IsValidAnnot(pPageView, pWidget)) {
@@ -413,8 +413,8 @@ FX_BOOL CFFL_InteractiveFormFiller::OnSetFocus(
ASSERT(pPageView);
PDFSDK_FieldAction fa;
- fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa);
pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView);
m_bNotifying = FALSE;
@@ -455,8 +455,8 @@ FX_BOOL CFFL_InteractiveFormFiller::OnKillFocus(
ASSERT(pPageView);
PDFSDK_FieldAction fa;
- fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa);
pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView);
m_bNotifying = FALSE;
@@ -504,22 +504,22 @@ CFFL_FormFiller* CFFL_InteractiveFormFiller::GetFormFiller(
CFFL_FormFiller* pFormFiller;
switch (nFieldType) {
case FIELDTYPE_PUSHBUTTON:
- pFormFiller = new CFFL_PushButton(m_pEnv, pWidget);
+ pFormFiller = new CFFL_PushButton(m_pFormFillEnv, pWidget);
break;
case FIELDTYPE_CHECKBOX:
- pFormFiller = new CFFL_CheckBox(m_pEnv, pWidget);
+ pFormFiller = new CFFL_CheckBox(m_pFormFillEnv, pWidget);
break;
case FIELDTYPE_RADIOBUTTON:
- pFormFiller = new CFFL_RadioButton(m_pEnv, pWidget);
+ pFormFiller = new CFFL_RadioButton(m_pFormFillEnv, pWidget);
break;
case FIELDTYPE_TEXTFIELD:
- pFormFiller = new CFFL_TextField(m_pEnv, pWidget);
+ pFormFiller = new CFFL_TextField(m_pFormFillEnv, pWidget);
break;
case FIELDTYPE_LISTBOX:
- pFormFiller = new CFFL_ListBox(m_pEnv, pWidget);
+ pFormFiller = new CFFL_ListBox(m_pFormFillEnv, pWidget);
break;
case FIELDTYPE_COMBOBOX:
- pFormFiller = new CFFL_ComboBox(m_pEnv, pWidget);
+ pFormFiller = new CFFL_ComboBox(m_pFormFillEnv, pWidget);
break;
case FIELDTYPE_UNKNOWN:
default:
@@ -635,8 +635,8 @@ void CFFL_InteractiveFormFiller::OnKeyStrokeCommit(
pWidget->ClearAppModified();
PDFSDK_FieldAction fa;
- fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
fa.bWillCommit = TRUE;
fa.bKeyDown = TRUE;
fa.bRC = TRUE;
@@ -667,8 +667,8 @@ void CFFL_InteractiveFormFiller::OnValidate(CPDFSDK_Annot::ObservedPtr* pAnnot,
pWidget->ClearAppModified();
PDFSDK_FieldAction fa;
- fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
fa.bKeyDown = TRUE;
fa.bRC = TRUE;
@@ -691,9 +691,8 @@ void CFFL_InteractiveFormFiller::OnCalculate(CPDFSDK_Widget* pWidget,
uint32_t nFlag) {
if (!m_bNotifying) {
ASSERT(pWidget);
- CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
- CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm();
- pInterForm->OnCalculate(pWidget->GetFormField());
+ pPageView->GetFormFillEnv()->GetInterForm()->OnCalculate(
+ pWidget->GetFormField());
m_bNotifying = FALSE;
}
}
@@ -704,8 +703,7 @@ void CFFL_InteractiveFormFiller::OnFormat(CPDFSDK_Widget* pWidget,
uint32_t nFlag) {
if (!m_bNotifying) {
ASSERT(pWidget);
- CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
- CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm();
+ CPDFSDK_InterForm* pInterForm = pPageView->GetFormFillEnv()->GetInterForm();
FX_BOOL bFormatted = FALSE;
CFX_WideString sValue =
@@ -736,8 +734,8 @@ void CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Widget* pWidget,
int nValueAge = pWidget->GetValueAge();
PDFSDK_FieldAction fa;
- fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
pWidget->OnXFAAAction(PDFSDK_XFA_Click, fa, pPageView);
m_bNotifying = FALSE;
@@ -771,8 +769,8 @@ void CFFL_InteractiveFormFiller::OnFull(CPDFSDK_Widget* pWidget,
int nValueAge = pWidget->GetValueAge();
PDFSDK_FieldAction fa;
- fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
pWidget->OnXFAAAction(PDFSDK_XFA_Full, fa, pPageView);
m_bNotifying = FALSE;
@@ -834,8 +832,8 @@ void CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Widget* pWidget,
int nValueAge = pWidget->GetValueAge();
PDFSDK_FieldAction fa;
- fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
pWidget->OnXFAAAction(PDFSDK_XFA_PreOpen, fa, pPageView);
m_bNotifying = FALSE;
@@ -869,8 +867,8 @@ void CFFL_InteractiveFormFiller::OnPostOpen(CPDFSDK_Widget* pWidget,
int nValueAge = pWidget->GetValueAge();
PDFSDK_FieldAction fa;
- fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
pWidget->OnXFAAAction(PDFSDK_XFA_PostOpen, fa, pPageView);
m_bNotifying = FALSE;
@@ -932,11 +930,12 @@ void CFFL_InteractiveFormFiller::OnBeforeKeyStroke(
int nAge = pData->pWidget->GetAppearanceAge();
int nValueAge = pData->pWidget->GetValueAge();
- CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument();
+ CPDFSDK_Document* pDocument =
+ pData->pPageView->GetFormFillEnv()->GetSDKDocument();
PDFSDK_FieldAction fa;
- fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
- fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
+ fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag);
fa.sChange = strChange;
fa.sChangeEx = strChangeEx;
fa.bKeyDown = bKeyDown;
« no previous file with comments | « fpdfsdk/formfiller/cffl_interactiveformfiller.h ('k') | fpdfsdk/fpdfformfill.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698