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

Unified Diff: fpdfsdk/fpdfformfill.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.cpp ('k') | fpdfsdk/fpdfview.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdfformfill.cpp
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp
index 8be9d5f0b7e97fafb740f8be5b8323f486cee9fa..b7dcb99a184ecd5b92d5126e0c1cf7f3944fa46e 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -38,16 +38,11 @@
namespace {
-CPDFSDK_FormFillEnvironment* HandleToCPDFSDKEnvironment(
+CPDFSDK_FormFillEnvironment* HandleToCPDFSDKFormFillEnvironment(
FPDF_FORMHANDLE handle) {
return static_cast<CPDFSDK_FormFillEnvironment*>(handle);
}
-CPDFSDK_InterForm* FormHandleToInterForm(FPDF_FORMHANDLE hHandle) {
- CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle);
- return pSDKDoc ? pSDKDoc->GetInterForm() : nullptr;
-}
-
CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page) {
UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
@@ -92,7 +87,8 @@ void FFLCommon(FPDF_FORMHANDLE hHandle,
CPDF_Document* pPDFDoc = pDocument->GetPDFDoc();
if (!pPDFDoc)
return;
- CPDFSDK_FormFillEnvironment* pEnv = HandleToCPDFSDKEnvironment(hHandle);
+ CPDFSDK_FormFillEnvironment* pEnv =
+ HandleToCPDFSDKFormFillEnvironment(hHandle);
CPDFSDK_Document* pFXDoc = pEnv->GetSDKDocument();
if (!pFXDoc)
return;
@@ -248,8 +244,8 @@ FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document,
// If the CPDFXFA_Document has a SDKDocument already then we've done this
// and can just return the old Env. Otherwise, we'll end up setting a new
// SDKDocument into the XFADocument and, that could get weird.
- if (pDocument->GetSDKDoc())
- return pDocument->GetSDKDoc()->GetEnv();
+ if (pDocument->GetFormFillEnv())
+ return pDocument->GetFormFillEnv();
#endif
CPDFSDK_FormFillEnvironment* pEnv =
@@ -268,7 +264,8 @@ FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) {
if (!hHandle)
return;
- CPDFSDK_FormFillEnvironment* pEnv = HandleToCPDFSDKEnvironment(hHandle);
+ CPDFSDK_FormFillEnvironment* pEnv =
+ HandleToCPDFSDKFormFillEnvironment(hHandle);
#ifdef PDF_ENABLE_XFA
CPDFXFA_App::GetInstance()->RemoveFormFillEnv(pEnv);
@@ -277,7 +274,7 @@ FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) {
// XFA document.
if (CPDFSDK_Document* pSDKDoc = pEnv->GetSDKDocument()) {
pSDKDoc->ClearAllFocusedAnnots();
- pSDKDoc->GetXFADocument()->SetSDKDoc(nullptr);
+ pEnv->GetXFADocument()->SetSDKDoc(nullptr);
}
#endif // PDF_ENABLE_XFA
@@ -633,18 +630,21 @@ FPDF_StringHandleAddString(FPDF_STRINGHANDLE stringHandle,
DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle,
int fieldType,
unsigned long color) {
- if (CPDFSDK_InterForm* pInterForm = FormHandleToInterForm(hHandle))
+ if (CPDFSDK_InterForm* pInterForm =
+ HandleToCPDFSDKFormFillEnvironment(hHandle)->GetInterForm())
pInterForm->SetHighlightColor(color, fieldType);
}
DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle,
unsigned char alpha) {
- if (CPDFSDK_InterForm* pInterForm = FormHandleToInterForm(hHandle))
+ if (CPDFSDK_InterForm* pInterForm =
+ HandleToCPDFSDKFormFillEnvironment(hHandle)->GetInterForm())
pInterForm->SetHighlightAlpha(alpha);
}
DLLEXPORT void STDCALL FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle) {
- if (CPDFSDK_InterForm* pInterForm = FormHandleToInterForm(hHandle))
+ if (CPDFSDK_InterForm* pInterForm =
+ HandleToCPDFSDKFormFillEnvironment(hHandle)->GetInterForm())
pInterForm->RemoveAllHighLight();
}
@@ -660,7 +660,7 @@ DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page,
return;
CPDFSDK_Document* pSDKDoc =
- HandleToCPDFSDKEnvironment(hHandle)->GetSDKDocument();
+ HandleToCPDFSDKFormFillEnvironment(hHandle)->GetSDKDocument();
if (!pSDKDoc)
return;
@@ -678,13 +678,13 @@ DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page,
DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle) {
CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle);
- if (pSDKDoc && HandleToCPDFSDKEnvironment(hHandle)->IsJSInitiated())
+ if (pSDKDoc && HandleToCPDFSDKFormFillEnvironment(hHandle)->IsJSInitiated())
pSDKDoc->ProcJavascriptFun();
}
DLLEXPORT void STDCALL FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle) {
CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle);
- if (pSDKDoc && HandleToCPDFSDKEnvironment(hHandle)->IsJSInitiated())
+ if (pSDKDoc && HandleToCPDFSDKFormFillEnvironment(hHandle)->IsJSInitiated())
pSDKDoc->ProcOpenAction();
}
@@ -703,7 +703,7 @@ DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle,
if (aa.ActionExist((CPDF_AAction::AActionType)aaType)) {
CPDF_Action action = aa.GetAction((CPDF_AAction::AActionType)aaType);
CPDFSDK_ActionHandler* pActionHandler =
- HandleToCPDFSDKEnvironment(hHandle)->GetActionHander();
+ HandleToCPDFSDKFormFillEnvironment(hHandle)->GetActionHander();
pActionHandler->DoAction_Document(action, (CPDF_AAction::AActionType)aaType,
pSDKDoc);
}
« no previous file with comments | « fpdfsdk/formfiller/cffl_interactiveformfiller.cpp ('k') | fpdfsdk/fpdfview.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698