Rename CPDFDoc_Environment to CPDFSDK_Environment
CPDFDoc_Environment does not fit with the general naming scheme of the rest of
the files in fpdfsdk. This CL updates the naming to CPDFSDK_Environment to
better fit with the surrounding files.
Review-Url: https://codereview.chromium.org/2333413003
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp
index 8658584..bf44b5e 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -17,8 +17,8 @@
#include "core/fpdfdoc/include/cpdf_interform.h"
#include "core/fpdfdoc/include/cpdf_occontext.h"
#include "core/fxge/include/cfx_fxgedevice.h"
-#include "fpdfsdk/include/cpdfdoc_environment.h"
#include "fpdfsdk/include/cpdfsdk_document.h"
+#include "fpdfsdk/include/cpdfsdk_environment.h"
#include "fpdfsdk/include/cpdfsdk_interform.h"
#include "fpdfsdk/include/cpdfsdk_pageview.h"
#include "fpdfsdk/include/fsdk_actionhandler.h"
@@ -37,6 +37,10 @@
namespace {
+CPDFSDK_Environment* HandleToCPDFSDKEnvironment(FPDF_FORMHANDLE handle) {
+ return static_cast<CPDFSDK_Environment*>(handle);
+}
+
CPDFSDK_InterForm* FormHandleToInterForm(FPDF_FORMHANDLE hHandle) {
CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle);
return pSDKDoc ? pSDKDoc->GetInterForm() : nullptr;
@@ -86,7 +90,7 @@
CPDF_Document* pPDFDoc = pDocument->GetPDFDoc();
if (!pPDFDoc)
return;
- CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle;
+ CPDFSDK_Environment* pEnv = HandleToCPDFSDKEnvironment(hHandle);
CPDFSDK_Document* pFXDoc = pEnv->GetSDKDocument();
if (!pFXDoc)
return;
@@ -238,7 +242,7 @@
if (!pDocument)
return nullptr;
- CPDFDoc_Environment* pEnv = new CPDFDoc_Environment(pDocument, formInfo);
+ CPDFSDK_Environment* pEnv = new CPDFSDK_Environment(pDocument, formInfo);
#ifdef PDF_ENABLE_XFA
pEnv->SetSDKDocument(pDocument->GetSDKDocument(pEnv));
CPDFXFA_App* pApp = CPDFXFA_App::GetInstance();
@@ -253,7 +257,7 @@
FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) {
if (!hHandle)
return;
- CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle;
+ CPDFSDK_Environment* pEnv = HandleToCPDFSDKEnvironment(hHandle);
#ifdef PDF_ENABLE_XFA
CPDFXFA_App* pApp = CPDFXFA_App::GetInstance();
pApp->RemoveFormFillEnv(pEnv);
@@ -641,7 +645,8 @@
if (!hHandle)
return;
- CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetSDKDocument();
+ CPDFSDK_Document* pSDKDoc =
+ HandleToCPDFSDKEnvironment(hHandle)->GetSDKDocument();
if (!pSDKDoc)
return;
@@ -659,13 +664,13 @@
DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle) {
CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle);
- if (pSDKDoc && ((CPDFDoc_Environment*)hHandle)->IsJSInitiated())
+ if (pSDKDoc && HandleToCPDFSDKEnvironment(hHandle)->IsJSInitiated())
pSDKDoc->ProcJavascriptFun();
}
DLLEXPORT void STDCALL FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle) {
CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle);
- if (pSDKDoc && ((CPDFDoc_Environment*)hHandle)->IsJSInitiated())
+ if (pSDKDoc && HandleToCPDFSDKEnvironment(hHandle)->IsJSInitiated())
pSDKDoc->ProcOpenAction();
}
@@ -684,7 +689,7 @@
if (aa.ActionExist((CPDF_AAction::AActionType)aaType)) {
CPDF_Action action = aa.GetAction((CPDF_AAction::AActionType)aaType);
CPDFSDK_ActionHandler* pActionHandler =
- ((CPDFDoc_Environment*)hHandle)->GetActionHander();
+ HandleToCPDFSDKEnvironment(hHandle)->GetActionHander();
pActionHandler->DoAction_Document(action, (CPDF_AAction::AActionType)aaType,
pSDKDoc);
}
@@ -708,7 +713,7 @@
if (!pSDKDoc->GetPageView(pPage, false))
return;
- CPDFDoc_Environment* pEnv = pSDKDoc->GetEnv();
+ CPDFSDK_Environment* pEnv = pSDKDoc->GetEnv();
CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander();
CPDF_Dictionary* pPageDict = pPDFPage->m_pFormDict;
CPDF_AAction aa(pPageDict->GetDictBy("AA"));