summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfxfa
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-02 13:02:28 -0700
committerCommit bot <commit-bot@chromium.org>2016-11-02 13:02:28 -0700
commit521b7508dfe8ab93975eeb9f4ef8068012c4dbd8 (patch)
treed51fec17bafc8c4ac70a7f80932749551ee6e5ff /fpdfsdk/fpdfxfa
parent25ec646b2c128a6beaa961ec2b2eeb673ed034ca (diff)
downloadpdfium-521b7508dfe8ab93975eeb9f4ef8068012c4dbd8.tar.xz
Rename CPDFXFA_Document to CPDFXFA_Context
The CPDFXFA_Document class isn't a document, it contains documents. Renamed to make the purpose a bit clearer. Review-Url: https://codereview.chromium.org/2469813004
Diffstat (limited to 'fpdfsdk/fpdfxfa')
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_context.cpp (renamed from fpdfsdk/fpdfxfa/cpdfxfa_document.cpp)74
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_context.h (renamed from fpdfsdk/fpdfxfa/cpdfxfa_document.h)14
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp255
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h6
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_page.cpp34
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_page.h8
-rw-r--r--fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h2
7 files changed, 194 insertions, 199 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index 0b840e4641..739e16959f 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "core/fpdfapi/parser/cpdf_document.h"
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
@@ -30,7 +30,7 @@ extern void SetLastError(int err);
extern int GetLastError();
#endif
-CPDFXFA_Document::CPDFXFA_Document(std::unique_ptr<CPDF_Document> pPDFDoc)
+CPDFXFA_Context::CPDFXFA_Context(std::unique_ptr<CPDF_Document> pPDFDoc)
: m_iDocType(DOCTYPE_PDF),
m_pPDFDoc(std::move(pPDFDoc)),
m_pFormFillEnv(nullptr),
@@ -42,7 +42,7 @@ CPDFXFA_Document::CPDFXFA_Document(std::unique_ptr<CPDF_Document> pPDFDoc)
m_pXFAApp->SetDefaultFontMgr(pdfium::MakeUnique<CXFA_DefFontMgr>());
}
-CPDFXFA_Document::~CPDFXFA_Document() {
+CPDFXFA_Context::~CPDFXFA_Context() {
m_nLoadStatus = FXFA_LOADSTATUS_CLOSING;
// Must happen before we remove the form fill environment.
@@ -59,7 +59,7 @@ CPDFXFA_Document::~CPDFXFA_Document() {
m_nLoadStatus = FXFA_LOADSTATUS_CLOSED;
}
-void CPDFXFA_Document::CloseXFADoc() {
+void CPDFXFA_Context::CloseXFADoc() {
if (!m_pXFADoc)
return;
m_pXFADoc->CloseDoc();
@@ -67,7 +67,7 @@ void CPDFXFA_Document::CloseXFADoc() {
m_pXFADocView = nullptr;
}
-void CPDFXFA_Document::SetFormFillEnv(
+void CPDFXFA_Context::SetFormFillEnv(
CPDFSDK_FormFillEnvironment* pFormFillEnv) {
// The layout data can have pointers back into the script context. That
// context will be different if the form fill environment closes, so, force
@@ -78,7 +78,7 @@ void CPDFXFA_Document::SetFormFillEnv(
m_pFormFillEnv = pFormFillEnv;
}
-FX_BOOL CPDFXFA_Document::LoadXFADoc() {
+FX_BOOL CPDFXFA_Context::LoadXFADoc() {
m_nLoadStatus = FXFA_LOADSTATUS_LOADING;
if (!m_pPDFDoc)
@@ -131,7 +131,7 @@ FX_BOOL CPDFXFA_Document::LoadXFADoc() {
return TRUE;
}
-int CPDFXFA_Document::GetPageCount() const {
+int CPDFXFA_Context::GetPageCount() const {
if (!m_pPDFDoc && !m_pXFADoc)
return 0;
@@ -148,7 +148,7 @@ int CPDFXFA_Document::GetPageCount() const {
}
}
-CPDFXFA_Page* CPDFXFA_Document::GetXFAPage(int page_index) {
+CPDFXFA_Page* CPDFXFA_Context::GetXFAPage(int page_index) {
if (page_index < 0)
return nullptr;
@@ -174,7 +174,7 @@ CPDFXFA_Page* CPDFXFA_Document::GetXFAPage(int page_index) {
return pPage;
}
-CPDFXFA_Page* CPDFXFA_Document::GetXFAPage(CXFA_FFPageView* pPage) const {
+CPDFXFA_Page* CPDFXFA_Context::GetXFAPage(CXFA_FFPageView* pPage) const {
if (!pPage)
return nullptr;
@@ -196,7 +196,7 @@ CPDFXFA_Page* CPDFXFA_Document::GetXFAPage(CXFA_FFPageView* pPage) const {
return nullptr;
}
-void CPDFXFA_Document::DeletePage(int page_index) {
+void CPDFXFA_Context::DeletePage(int page_index) {
// Delete from the document first because, if GetPage was never called for
// this |page_index| then |m_XFAPageList| may have size < |page_index| even
// if it's a valid page in the document.
@@ -210,16 +210,16 @@ void CPDFXFA_Document::DeletePage(int page_index) {
pPage->Release();
}
-void CPDFXFA_Document::RemovePage(CPDFXFA_Page* page) {
+void CPDFXFA_Context::RemovePage(CPDFXFA_Page* page) {
m_XFAPageList.SetAt(page->GetPageIndex(), nullptr);
}
-void CPDFXFA_Document::ClearChangeMark() {
+void CPDFXFA_Context::ClearChangeMark() {
if (m_pFormFillEnv)
m_pFormFillEnv->ClearChangeMark();
}
-v8::Isolate* CPDFXFA_Document::GetJSERuntime() const {
+v8::Isolate* CPDFXFA_Context::GetJSERuntime() const {
if (!m_pFormFillEnv)
return nullptr;
@@ -229,30 +229,30 @@ v8::Isolate* CPDFXFA_Document::GetJSERuntime() const {
return runtime->GetIsolate();
}
-void CPDFXFA_Document::GetAppName(CFX_WideString& wsName) {
+void CPDFXFA_Context::GetAppName(CFX_WideString& wsName) {
if (m_pFormFillEnv)
wsName = m_pFormFillEnv->FFI_GetAppName();
}
-void CPDFXFA_Document::GetLanguage(CFX_WideString& wsLanguage) {
+void CPDFXFA_Context::GetLanguage(CFX_WideString& wsLanguage) {
if (m_pFormFillEnv)
wsLanguage = m_pFormFillEnv->GetLanguage();
}
-void CPDFXFA_Document::GetPlatform(CFX_WideString& wsPlatform) {
+void CPDFXFA_Context::GetPlatform(CFX_WideString& wsPlatform) {
if (m_pFormFillEnv)
wsPlatform = m_pFormFillEnv->GetPlatform();
}
-void CPDFXFA_Document::Beep(uint32_t dwType) {
+void CPDFXFA_Context::Beep(uint32_t dwType) {
if (m_pFormFillEnv)
m_pFormFillEnv->JS_appBeep(dwType);
}
-int32_t CPDFXFA_Document::MsgBox(const CFX_WideString& wsMessage,
- const CFX_WideString& wsTitle,
- uint32_t dwIconType,
- uint32_t dwButtonType) {
+int32_t CPDFXFA_Context::MsgBox(const CFX_WideString& wsMessage,
+ const CFX_WideString& wsTitle,
+ uint32_t dwIconType,
+ uint32_t dwButtonType) {
if (!m_pFormFillEnv)
return -1;
@@ -301,10 +301,10 @@ int32_t CPDFXFA_Document::MsgBox(const CFX_WideString& wsMessage,
return XFA_IDYes;
}
-CFX_WideString CPDFXFA_Document::Response(const CFX_WideString& wsQuestion,
- const CFX_WideString& wsTitle,
- const CFX_WideString& wsDefaultAnswer,
- FX_BOOL bMark) {
+CFX_WideString CPDFXFA_Context::Response(const CFX_WideString& wsQuestion,
+ const CFX_WideString& wsTitle,
+ const CFX_WideString& wsDefaultAnswer,
+ FX_BOOL bMark) {
CFX_WideString wsAnswer;
if (!m_pFormFillEnv)
return wsAnswer;
@@ -326,18 +326,18 @@ CFX_WideString CPDFXFA_Document::Response(const CFX_WideString& wsQuestion,
return wsAnswer;
}
-IFX_SeekableReadStream* CPDFXFA_Document::DownloadURL(
+IFX_SeekableReadStream* CPDFXFA_Context::DownloadURL(
const CFX_WideString& wsURL) {
return m_pFormFillEnv ? m_pFormFillEnv->DownloadFromURL(wsURL.c_str())
: nullptr;
}
-FX_BOOL CPDFXFA_Document::PostRequestURL(const CFX_WideString& wsURL,
- const CFX_WideString& wsData,
- const CFX_WideString& wsContentType,
- const CFX_WideString& wsEncode,
- const CFX_WideString& wsHeader,
- CFX_WideString& wsResponse) {
+FX_BOOL CPDFXFA_Context::PostRequestURL(const CFX_WideString& wsURL,
+ const CFX_WideString& wsData,
+ const CFX_WideString& wsContentType,
+ const CFX_WideString& wsEncode,
+ const CFX_WideString& wsHeader,
+ CFX_WideString& wsResponse) {
if (!m_pFormFillEnv)
return FALSE;
@@ -347,15 +347,15 @@ FX_BOOL CPDFXFA_Document::PostRequestURL(const CFX_WideString& wsURL,
return TRUE;
}
-FX_BOOL CPDFXFA_Document::PutRequestURL(const CFX_WideString& wsURL,
- const CFX_WideString& wsData,
- const CFX_WideString& wsEncode) {
+FX_BOOL CPDFXFA_Context::PutRequestURL(const CFX_WideString& wsURL,
+ const CFX_WideString& wsData,
+ const CFX_WideString& wsEncode) {
return m_pFormFillEnv &&
m_pFormFillEnv->PutRequestURL(wsURL.c_str(), wsData.c_str(),
wsEncode.c_str());
}
-void CPDFXFA_Document::LoadString(int32_t iStringID, CFX_WideString& wsString) {
+void CPDFXFA_Context::LoadString(int32_t iStringID, CFX_WideString& wsString) {
switch (iStringID) {
case XFA_IDS_ValidateFailed:
wsString = L"%s validation failed";
@@ -452,7 +452,7 @@ void CPDFXFA_Document::LoadString(int32_t iStringID, CFX_WideString& wsString) {
}
}
-IFWL_AdapterTimerMgr* CPDFXFA_Document::GetTimerMgr() {
+IFWL_AdapterTimerMgr* CPDFXFA_Context::GetTimerMgr() {
CXFA_FWLAdapterTimerMgr* pAdapter = nullptr;
if (m_pFormFillEnv)
pAdapter = new CXFA_FWLAdapterTimerMgr(m_pFormFillEnv);
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_document.h b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
index ab0d757e71..02588e3fad 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_document.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef FPDFSDK_FPDFXFA_CPDFXFA_DOCUMENT_H_
-#define FPDFSDK_FPDFXFA_CPDFXFA_DOCUMENT_H_
+#ifndef FPDFSDK_FPDFXFA_CPDFXFA_CONTEXT_H_
+#define FPDFSDK_FPDFXFA_CPDFXFA_CONTEXT_H_
#include <memory>
@@ -27,10 +27,10 @@ enum LoadStatus {
FXFA_LOADSTATUS_CLOSED
};
-class CPDFXFA_Document : public IXFA_AppProvider {
+class CPDFXFA_Context : public IXFA_AppProvider {
public:
- CPDFXFA_Document(std::unique_ptr<CPDF_Document> pPDFDoc);
- ~CPDFXFA_Document() override;
+ CPDFXFA_Context(std::unique_ptr<CPDF_Document> pPDFDoc);
+ ~CPDFXFA_Context() override;
FX_BOOL LoadXFADoc();
CPDF_Document* GetPDFDoc() { return m_pPDFDoc.get(); }
@@ -102,7 +102,7 @@ class CPDFXFA_Document : public IXFA_AppProvider {
std::unique_ptr<CPDF_Document> m_pPDFDoc;
std::unique_ptr<CXFA_FFDoc> m_pXFADoc;
CPDFSDK_FormFillEnvironment* m_pFormFillEnv; // not owned.
- CXFA_FFDocView* m_pXFADocView; // not owned.
+ CXFA_FFDocView* m_pXFADocView; // not owned.
std::unique_ptr<CXFA_FFApp> m_pXFAApp;
std::unique_ptr<CJS_Runtime> m_pRuntime;
CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList;
@@ -113,4 +113,4 @@ class CPDFXFA_Document : public IXFA_AppProvider {
CPDFXFA_DocEnvironment m_DocEnv;
};
-#endif // FPDFSDK_FPDFXFA_CPDFXFA_DOCUMENT_H_
+#endif // FPDFSDK_FPDFXFA_CPDFXFA_CONTEXT_H_
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index a5efd50adb..34a0a56364 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -12,7 +12,7 @@
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include "fpdfsdk/cpdfsdk_interform.h"
#include "fpdfsdk/cpdfsdk_pageview.h"
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "fpdfsdk/fpdfxfa/cpdfxfa_page.h"
#include "fpdfsdk/javascript/ijs_runtime.h"
#include "xfa/fxfa/xfa_ffdocview.h"
@@ -34,35 +34,35 @@
#define FXFA_PDF 0x10000000
#define FXFA_XFA_ALL 0x01111111
-CPDFXFA_DocEnvironment::CPDFXFA_DocEnvironment(CPDFXFA_Document* doc)
- : m_pDocument(doc), m_pJSContext(nullptr) {
- ASSERT(m_pDocument);
+CPDFXFA_DocEnvironment::CPDFXFA_DocEnvironment(CPDFXFA_Context* pContext)
+ : m_pContext(pContext), m_pJSContext(nullptr) {
+ ASSERT(m_pContext);
}
CPDFXFA_DocEnvironment::~CPDFXFA_DocEnvironment() {
- if (m_pJSContext && m_pDocument->GetFormFillEnv())
- m_pDocument->GetFormFillEnv()->GetJSRuntime()->ReleaseContext(m_pJSContext);
+ if (m_pJSContext && m_pContext->GetFormFillEnv())
+ m_pContext->GetFormFillEnv()->GetJSRuntime()->ReleaseContext(m_pJSContext);
}
void CPDFXFA_DocEnvironment::SetChangeMark(CXFA_FFDoc* hDoc) {
- if (hDoc == m_pDocument->GetXFADoc() && m_pDocument->GetFormFillEnv())
- m_pDocument->GetFormFillEnv()->SetChangeMark();
+ if (hDoc == m_pContext->GetXFADoc() && m_pContext->GetFormFillEnv())
+ m_pContext->GetFormFillEnv()->SetChangeMark();
}
void CPDFXFA_DocEnvironment::InvalidateRect(CXFA_FFPageView* pPageView,
const CFX_RectF& rt,
uint32_t dwFlags /* = 0 */) {
- if (!m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv())
+ if (!m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
return;
- if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA)
+ if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA)
return;
- CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pPageView);
+ CPDFXFA_Page* pPage = m_pContext->GetXFAPage(pPageView);
if (!pPage)
return;
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return;
@@ -74,15 +74,15 @@ void CPDFXFA_DocEnvironment::InvalidateRect(CXFA_FFPageView* pPageView,
void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget,
FX_BOOL bVisible,
const CFX_RectF* pRtAnchor) {
- if (!hWidget || !pRtAnchor || !m_pDocument->GetXFADoc() ||
- !m_pDocument->GetFormFillEnv() || !m_pDocument->GetXFADocView())
+ if (!hWidget || !pRtAnchor || !m_pContext->GetXFADoc() ||
+ !m_pContext->GetFormFillEnv() || !m_pContext->GetXFADocView())
return;
- if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA)
+ if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA)
return;
CXFA_FFWidgetHandler* pWidgetHandler =
- m_pDocument->GetXFADocView()->GetWidgetHandler();
+ m_pContext->GetXFADocView()->GetWidgetHandler();
if (!pWidgetHandler)
return;
@@ -90,11 +90,11 @@ void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget,
if (!pPageView)
return;
- CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pPageView);
+ CPDFXFA_Page* pPage = m_pContext->GetXFAPage(pPageView);
if (!pPage)
return;
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return;
@@ -115,13 +115,13 @@ FX_BOOL CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget,
if (!pXFAPageView)
return FALSE;
- CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pXFAPageView);
+ CPDFXFA_Page* pPage = m_pContext->GetXFAPage(pXFAPageView);
if (!pPage)
return FALSE;
CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc();
int nRotate = pWidgetAcc->GetRotate();
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return FALSE;
@@ -228,11 +228,11 @@ FX_BOOL CPDFXFA_DocEnvironment::PopupMenu(CXFA_FFWidget* hWidget,
if (!pXFAPageView)
return FALSE;
- CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pXFAPageView);
+ CPDFXFA_Page* pPage = m_pContext->GetXFAPage(pXFAPageView);
if (!pPage)
return FALSE;
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return FALSE;
@@ -255,91 +255,89 @@ FX_BOOL CPDFXFA_DocEnvironment::PopupMenu(CXFA_FFWidget* hWidget,
void CPDFXFA_DocEnvironment::PageViewEvent(CXFA_FFPageView* pPageView,
uint32_t dwFlags) {
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return;
- if (m_pDocument->GetLoadStatus() == FXFA_LOADSTATUS_LOADING ||
- m_pDocument->GetLoadStatus() == FXFA_LOADSTATUS_CLOSING ||
+ if (m_pContext->GetLoadStatus() == FXFA_LOADSTATUS_LOADING ||
+ m_pContext->GetLoadStatus() == FXFA_LOADSTATUS_CLOSING ||
XFA_PAGEVIEWEVENT_StopLayout != dwFlags)
return;
- int nNewCount = m_pDocument->GetPageCount();
- if (nNewCount == m_pDocument->GetOriginalPageCount())
+ int nNewCount = m_pContext->GetPageCount();
+ if (nNewCount == m_pContext->GetOriginalPageCount())
return;
- CXFA_FFDocView* pXFADocView = m_pDocument->GetXFADocView();
+ CXFA_FFDocView* pXFADocView = m_pContext->GetXFADocView();
if (!pXFADocView)
return;
- for (int iPageIter = 0; iPageIter < m_pDocument->GetOriginalPageCount();
+ for (int iPageIter = 0; iPageIter < m_pContext->GetOriginalPageCount();
iPageIter++) {
- CPDFXFA_Page* pPage = m_pDocument->GetXFAPageList()->GetAt(iPageIter);
+ CPDFXFA_Page* pPage = m_pContext->GetXFAPageList()->GetAt(iPageIter);
if (!pPage)
continue;
- m_pDocument->GetFormFillEnv()->RemovePageView(pPage);
+ m_pContext->GetFormFillEnv()->RemovePageView(pPage);
pPage->SetXFAPageView(pXFADocView->GetPageView(iPageIter));
}
- int flag = (nNewCount < m_pDocument->GetOriginalPageCount())
+ int flag = (nNewCount < m_pContext->GetOriginalPageCount())
? FXFA_PAGEVIEWEVENT_POSTREMOVED
: FXFA_PAGEVIEWEVENT_POSTADDED;
- int count = FXSYS_abs(nNewCount - m_pDocument->GetOriginalPageCount());
- m_pDocument->SetOriginalPageCount(nNewCount);
+ int count = FXSYS_abs(nNewCount - m_pContext->GetOriginalPageCount());
+ m_pContext->SetOriginalPageCount(nNewCount);
pFormFillEnv->PageEvent(count, flag);
}
void CPDFXFA_DocEnvironment::WidgetPostAdd(CXFA_FFWidget* hWidget,
CXFA_WidgetAcc* pWidgetData) {
- if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || !hWidget)
+ if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA || !hWidget)
return;
CXFA_FFPageView* pPageView = hWidget->GetPageView();
if (!pPageView)
return;
- CPDFXFA_Page* pXFAPage = m_pDocument->GetXFAPage(pPageView);
+ CPDFXFA_Page* pXFAPage = m_pContext->GetXFAPage(pPageView);
if (!pXFAPage)
return;
- m_pDocument->GetFormFillEnv()
- ->GetPageView(pXFAPage, true)
- ->AddAnnot(hWidget);
+ m_pContext->GetFormFillEnv()->GetPageView(pXFAPage, true)->AddAnnot(hWidget);
}
void CPDFXFA_DocEnvironment::WidgetPreRemove(CXFA_FFWidget* hWidget,
CXFA_WidgetAcc* pWidgetData) {
- if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || !hWidget)
+ if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA || !hWidget)
return;
CXFA_FFPageView* pPageView = hWidget->GetPageView();
if (!pPageView)
return;
- CPDFXFA_Page* pXFAPage = m_pDocument->GetXFAPage(pPageView);
+ CPDFXFA_Page* pXFAPage = m_pContext->GetXFAPage(pPageView);
if (!pXFAPage)
return;
CPDFSDK_PageView* pSdkPageView =
- m_pDocument->GetFormFillEnv()->GetPageView(pXFAPage, true);
+ m_pContext->GetFormFillEnv()->GetPageView(pXFAPage, true);
if (CPDFSDK_Annot* pAnnot = pSdkPageView->GetAnnotByXFAWidget(hWidget))
pSdkPageView->DeleteAnnot(pAnnot);
}
int32_t CPDFXFA_DocEnvironment::CountPages(CXFA_FFDoc* hDoc) {
- if (hDoc == m_pDocument->GetXFADoc() && m_pDocument->GetFormFillEnv())
- return m_pDocument->GetPageCount();
+ if (hDoc == m_pContext->GetXFADoc() && m_pContext->GetFormFillEnv())
+ return m_pContext->GetPageCount();
return 0;
}
int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) {
- if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv())
+ if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
return -1;
- if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA)
+ if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA)
return -1;
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return -1;
@@ -348,23 +346,23 @@ int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) {
void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc,
int32_t iCurPage) {
- if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv() ||
- m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || iCurPage < 0 ||
- iCurPage >= m_pDocument->GetFormFillEnv()->GetPageCount()) {
+ if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv() ||
+ m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA || iCurPage < 0 ||
+ iCurPage >= m_pContext->GetFormFillEnv()->GetPageCount()) {
return;
}
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return;
pFormFillEnv->SetCurrentPage(this, iCurPage);
}
FX_BOOL CPDFXFA_DocEnvironment::IsCalculationsEnabled(CXFA_FFDoc* hDoc) {
- if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv())
+ if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
return FALSE;
- if (m_pDocument->GetFormFillEnv()->GetInterForm()) {
- return m_pDocument->GetFormFillEnv()
+ if (m_pContext->GetFormFillEnv()->GetInterForm()) {
+ return m_pContext->GetFormFillEnv()
->GetInterForm()
->IsXfaCalculateEnabled();
}
@@ -373,21 +371,19 @@ FX_BOOL CPDFXFA_DocEnvironment::IsCalculationsEnabled(CXFA_FFDoc* hDoc) {
void CPDFXFA_DocEnvironment::SetCalculationsEnabled(CXFA_FFDoc* hDoc,
FX_BOOL bEnabled) {
- if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv())
+ if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
return;
- if (m_pDocument->GetFormFillEnv()->GetInterForm()) {
- m_pDocument->GetFormFillEnv()
- ->GetInterForm()
- ->XfaEnableCalculate(bEnabled);
+ if (m_pContext->GetFormFillEnv()->GetInterForm()) {
+ m_pContext->GetFormFillEnv()->GetInterForm()->XfaEnableCalculate(bEnabled);
}
}
void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc,
CFX_WideString& wsTitle) {
- if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetPDFDoc())
+ if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc())
return;
- CPDF_Dictionary* pInfoDict = m_pDocument->GetPDFDoc()->GetInfo();
+ CPDF_Dictionary* pInfoDict = m_pContext->GetPDFDoc()->GetInfo();
if (!pInfoDict)
return;
@@ -398,25 +394,25 @@ void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc,
void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc,
const CFX_WideString& wsTitle) {
- if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetPDFDoc())
+ if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc())
return;
- if (CPDF_Dictionary* pInfoDict = m_pDocument->GetPDFDoc()->GetInfo())
+ if (CPDF_Dictionary* pInfoDict = m_pContext->GetPDFDoc()->GetInfo())
pInfoDict->SetFor("Title", new CPDF_String(wsTitle));
}
void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
const CFX_WideString& wsFilePath,
FX_BOOL bXDP) {
- if (hDoc != m_pDocument->GetXFADoc())
+ if (hDoc != m_pContext->GetXFADoc())
return;
- if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
- m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA) {
+ if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
+ m_pContext->GetDocType() != DOCTYPE_STATIC_XFA) {
return;
}
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return;
@@ -445,13 +441,13 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
fileWrite.WriteBlock(content.c_str(), fileWrite.GetSize(),
content.GetLength());
- m_pDocument->GetXFADocView()->GetDoc()->SavePackage(XFA_HASHCODE_Data,
- &fileWrite, nullptr);
+ m_pContext->GetXFADocView()->GetDoc()->SavePackage(XFA_HASHCODE_Data,
+ &fileWrite, nullptr);
} else if (fileType == FXFA_SAVEAS_XDP) {
- if (!m_pDocument->GetPDFDoc())
+ if (!m_pContext->GetPDFDoc())
return;
- CPDF_Dictionary* pRoot = m_pDocument->GetPDFDoc()->GetRoot();
+ CPDF_Dictionary* pRoot = m_pContext->GetPDFDoc()->GetRoot();
if (!pRoot)
return;
@@ -476,12 +472,12 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
if (!pStream)
continue;
if (pPrePDFObj->GetString() == "form") {
- m_pDocument->GetXFADocView()->GetDoc()->SavePackage(
- XFA_HASHCODE_Form, &fileWrite, nullptr);
+ m_pContext->GetXFADocView()->GetDoc()->SavePackage(XFA_HASHCODE_Form,
+ &fileWrite, nullptr);
continue;
}
if (pPrePDFObj->GetString() == "datasets") {
- m_pDocument->GetXFADocView()->GetDoc()->SavePackage(
+ m_pContext->GetXFADocView()->GetDoc()->SavePackage(
XFA_HASHCODE_Datasets, &fileWrite, nullptr);
continue;
}
@@ -509,13 +505,13 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc,
const CFX_WideString& bsURL) {
- if (hDoc != m_pDocument->GetXFADoc())
+ if (hDoc != m_pContext->GetXFADoc())
return;
- if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA)
+ if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA)
return;
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return;
@@ -524,10 +520,10 @@ void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc,
}
FX_BOOL CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) {
- if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv())
+ if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
return FALSE;
- if (m_pDocument->GetFormFillEnv()->GetInterForm()) {
- return m_pDocument->GetFormFillEnv()
+ if (m_pContext->GetFormFillEnv()->GetInterForm()) {
+ return m_pContext->GetFormFillEnv()
->GetInterForm()
->IsXfaValidationsEnabled();
}
@@ -536,35 +532,34 @@ FX_BOOL CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) {
void CPDFXFA_DocEnvironment::SetValidationsEnabled(CXFA_FFDoc* hDoc,
FX_BOOL bEnabled) {
- if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv())
+ if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
return;
- if (m_pDocument->GetFormFillEnv()->GetInterForm()) {
- m_pDocument->GetFormFillEnv()
- ->GetInterForm()
- ->XfaSetValidationsEnabled(bEnabled);
+ if (m_pContext->GetFormFillEnv()->GetInterForm()) {
+ m_pContext->GetFormFillEnv()->GetInterForm()->XfaSetValidationsEnabled(
+ bEnabled);
}
}
void CPDFXFA_DocEnvironment::SetFocusWidget(CXFA_FFDoc* hDoc,
CXFA_FFWidget* hWidget) {
- if (hDoc != m_pDocument->GetXFADoc())
+ if (hDoc != m_pContext->GetXFADoc())
return;
if (!hWidget) {
CPDFSDK_Annot::ObservedPtr pNull;
- m_pDocument->GetFormFillEnv()->SetFocusAnnot(&pNull);
+ m_pContext->GetFormFillEnv()->SetFocusAnnot(&pNull);
return;
}
- int pageViewCount = m_pDocument->GetFormFillEnv()->GetPageViewCount();
+ int pageViewCount = m_pContext->GetFormFillEnv()->GetPageViewCount();
for (int i = 0; i < pageViewCount; i++) {
- CPDFSDK_PageView* pPageView = m_pDocument->GetFormFillEnv()->GetPageView(i);
+ CPDFSDK_PageView* pPageView = m_pContext->GetFormFillEnv()->GetPageView(i);
if (!pPageView)
continue;
CPDFSDK_Annot::ObservedPtr pAnnot(pPageView->GetAnnotByXFAWidget(hWidget));
if (pAnnot) {
- m_pDocument->GetFormFillEnv()->SetFocusAnnot(&pAnnot);
+ m_pContext->GetFormFillEnv()->SetFocusAnnot(&pAnnot);
break;
}
}
@@ -574,10 +569,10 @@ void CPDFXFA_DocEnvironment::Print(CXFA_FFDoc* hDoc,
int32_t nStartPage,
int32_t nEndPage,
uint32_t dwOptions) {
- if (hDoc != m_pDocument->GetXFADoc())
+ if (hDoc != m_pContext->GetXFADoc())
return;
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv || !pFormFillEnv->GetFormFillInfo() ||
!pFormFillEnv->GetFormFillInfo()->m_pJsPlatform ||
!pFormFillEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print) {
@@ -593,10 +588,10 @@ void CPDFXFA_DocEnvironment::Print(CXFA_FFDoc* hDoc,
}
FX_ARGB CPDFXFA_DocEnvironment::GetHighlightColor(CXFA_FFDoc* hDoc) {
- if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv())
+ if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
return 0;
- CPDFSDK_InterForm* pInterForm = m_pDocument->GetFormFillEnv()->GetInterForm();
+ CPDFSDK_InterForm* pInterForm = m_pContext->GetFormFillEnv()->GetInterForm();
if (!pInterForm)
return 0;
@@ -613,21 +608,21 @@ FX_BOOL CPDFXFA_DocEnvironment::NotifySubmit(FX_BOOL bPrevOrPost) {
}
FX_BOOL CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
- if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
- m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA) {
+ if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
+ m_pContext->GetDocType() != DOCTYPE_STATIC_XFA) {
return TRUE;
}
- if (!m_pDocument->GetXFADocView())
+ if (!m_pContext->GetXFADocView())
return TRUE;
CXFA_FFWidgetHandler* pWidgetHandler =
- m_pDocument->GetXFADocView()->GetWidgetHandler();
+ m_pContext->GetXFADocView()->GetWidgetHandler();
if (!pWidgetHandler)
return TRUE;
std::unique_ptr<CXFA_WidgetAccIterator> pWidgetAccIterator(
- m_pDocument->GetXFADocView()->CreateWidgetAccIterator());
+ m_pContext->GetXFADocView()->CreateWidgetAccIterator());
if (pWidgetAccIterator) {
CXFA_EventParam Param;
Param.m_eType = XFA_EVENT_PreSubmit;
@@ -636,7 +631,7 @@ FX_BOOL CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
}
pWidgetAccIterator.reset(
- m_pDocument->GetXFADocView()->CreateWidgetAccIterator());
+ m_pContext->GetXFADocView()->CreateWidgetAccIterator());
if (!pWidgetAccIterator)
return TRUE;
@@ -645,7 +640,7 @@ FX_BOOL CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
while (pWidgetAcc) {
int fRet = pWidgetAcc->ProcessValidate(-1);
if (fRet == XFA_EVENTERROR_Error) {
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return FALSE;
@@ -660,26 +655,26 @@ FX_BOOL CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
}
pWidgetAcc = pWidgetAccIterator->MoveToNext();
}
- m_pDocument->GetXFADocView()->UpdateDocView();
+ m_pContext->GetXFADocView()->UpdateDocView();
return TRUE;
}
void CPDFXFA_DocEnvironment::OnAfterNotifySubmit() {
- if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
- m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA)
+ if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
+ m_pContext->GetDocType() != DOCTYPE_STATIC_XFA)
return;
- if (!m_pDocument->GetXFADocView())
+ if (!m_pContext->GetXFADocView())
return;
CXFA_FFWidgetHandler* pWidgetHandler =
- m_pDocument->GetXFADocView()->GetWidgetHandler();
+ m_pContext->GetXFADocView()->GetWidgetHandler();
if (!pWidgetHandler)
return;
std::unique_ptr<CXFA_WidgetAccIterator> pWidgetAccIterator(
- m_pDocument->GetXFADocView()->CreateWidgetAccIterator());
+ m_pContext->GetXFADocView()->CreateWidgetAccIterator());
if (!pWidgetAccIterator)
return;
@@ -690,15 +685,15 @@ void CPDFXFA_DocEnvironment::OnAfterNotifySubmit() {
pWidgetHandler->ProcessEvent(pWidgetAcc, &Param);
pWidgetAcc = pWidgetAccIterator->MoveToNext();
}
- m_pDocument->GetXFADocView()->UpdateDocView();
+ m_pContext->GetXFADocView()->UpdateDocView();
}
FX_BOOL CPDFXFA_DocEnvironment::SubmitData(CXFA_FFDoc* hDoc,
CXFA_Submit submit) {
- if (!NotifySubmit(TRUE) || !m_pDocument->GetXFADocView())
+ if (!NotifySubmit(TRUE) || !m_pContext->GetXFADocView())
return FALSE;
- m_pDocument->GetXFADocView()->UpdateDocView();
+ m_pContext->GetXFADocView()->UpdateDocView();
FX_BOOL ret = SubmitDataInternal(hDoc, submit);
NotifySubmit(FALSE);
return ret;
@@ -707,7 +702,7 @@ FX_BOOL CPDFXFA_DocEnvironment::SubmitData(CXFA_FFDoc* hDoc,
IFX_SeekableReadStream* CPDFXFA_DocEnvironment::OpenLinkedFile(
CXFA_FFDoc* hDoc,
const CFX_WideString& wsLink) {
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return nullptr;
@@ -726,11 +721,11 @@ FX_BOOL CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
int fileType,
FPDF_DWORD encodeType,
FPDF_DWORD flag) {
- if (!m_pDocument->GetXFADocView())
+ if (!m_pContext->GetXFADocView())
return FALSE;
CFX_ByteString content;
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return FALSE;
@@ -738,8 +733,8 @@ FX_BOOL CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
if (fileType == FXFA_SAVEAS_XML) {
const char kContent[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
fileStream.WriteBlock(kContent, 0, strlen(kContent));
- m_pDocument->GetXFADoc()->SavePackage(XFA_HASHCODE_Data, &fileStream,
- nullptr);
+ m_pContext->GetXFADoc()->SavePackage(XFA_HASHCODE_Data, &fileStream,
+ nullptr);
return TRUE;
}
@@ -750,12 +745,12 @@ FX_BOOL CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
flag = FXFA_CONFIG | FXFA_TEMPLATE | FXFA_LOCALESET | FXFA_DATASETS |
FXFA_XMPMETA | FXFA_XFDF | FXFA_FORM;
}
- if (!m_pDocument->GetPDFDoc()) {
+ if (!m_pContext->GetPDFDoc()) {
fileStream.Flush();
return FALSE;
}
- CPDF_Dictionary* pRoot = m_pDocument->GetPDFDoc()->GetRoot();
+ CPDF_Dictionary* pRoot = m_pContext->GetPDFDoc()->GetRoot();
if (!pRoot) {
fileStream.Flush();
return FALSE;
@@ -800,11 +795,11 @@ FX_BOOL CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
if (pPrePDFObj->GetString() == "form" && !(flag & FXFA_FORM))
continue;
if (pPrePDFObj->GetString() == "form") {
- m_pDocument->GetXFADoc()->SavePackage(XFA_HASHCODE_Form, &fileStream,
- nullptr);
+ m_pContext->GetXFADoc()->SavePackage(XFA_HASHCODE_Form, &fileStream,
+ nullptr);
} else if (pPrePDFObj->GetString() == "datasets") {
- m_pDocument->GetXFADoc()->SavePackage(XFA_HASHCODE_Datasets, &fileStream,
- nullptr);
+ m_pContext->GetXFADoc()->SavePackage(XFA_HASHCODE_Datasets, &fileStream,
+ nullptr);
} else {
// PDF,creator.
}
@@ -901,7 +896,7 @@ FX_BOOL CPDFXFA_DocEnvironment::MailToInfo(CFX_WideString& csURL,
FX_BOOL CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
CXFA_Submit submit) {
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return FALSE;
@@ -1002,12 +997,12 @@ FX_BOOL CPDFXFA_DocEnvironment::SetGlobalProperty(
CXFA_FFDoc* hDoc,
const CFX_ByteStringC& szPropName,
CFXJSE_Value* pValue) {
- if (hDoc != m_pDocument->GetXFADoc())
+ if (hDoc != m_pContext->GetXFADoc())
return FALSE;
- if (m_pDocument->GetFormFillEnv() &&
- m_pDocument->GetFormFillEnv()->GetJSRuntime()) {
- return m_pDocument->GetFormFillEnv()->GetJSRuntime()->SetValueByName(
+ if (m_pContext->GetFormFillEnv() &&
+ m_pContext->GetFormFillEnv()->GetJSRuntime()) {
+ return m_pContext->GetFormFillEnv()->GetJSRuntime()->SetValueByName(
szPropName, pValue);
}
return FALSE;
@@ -1017,14 +1012,14 @@ FX_BOOL CPDFXFA_DocEnvironment::GetGlobalProperty(
CXFA_FFDoc* hDoc,
const CFX_ByteStringC& szPropName,
CFXJSE_Value* pValue) {
- if (hDoc != m_pDocument->GetXFADoc())
+ if (hDoc != m_pContext->GetXFADoc())
return FALSE;
- if (!m_pDocument->GetFormFillEnv() ||
- !m_pDocument->GetFormFillEnv()->GetJSRuntime()) {
+ if (!m_pContext->GetFormFillEnv() ||
+ !m_pContext->GetFormFillEnv()->GetJSRuntime()) {
return FALSE;
}
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!m_pJSContext)
m_pJSContext = pFormFillEnv->GetJSRuntime()->NewContext();
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
index 999d44586c..6056e22b79 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
@@ -10,12 +10,12 @@
#include "public/fpdfview.h"
#include "xfa/fxfa/fxfa.h"
-class CPDFXFA_Document;
+class CPDFXFA_Context;
class IJS_Context;
class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment {
public:
- CPDFXFA_DocEnvironment(CPDFXFA_Document*);
+ CPDFXFA_DocEnvironment(CPDFXFA_Context*);
~CPDFXFA_DocEnvironment() override;
// IXFA_DocEnvironment
@@ -105,7 +105,7 @@ class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment {
FPDF_DWORD flag);
void ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag);
- CPDFXFA_Document* const m_pDocument; // Not owned;
+ CPDFXFA_Context* const m_pContext; // Not owned;
IJS_Context* m_pJSContext;
};
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index 00cff3e28a..96ffd0b90e 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -8,7 +8,7 @@
#include "core/fpdfapi/page/cpdf_page.h"
#include "core/fpdfapi/parser/cpdf_document.h"
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h"
#include "fpdfsdk/fsdk_define.h"
#include "public/fpdf_formfill.h"
@@ -16,22 +16,22 @@
#include "xfa/fxfa/xfa_ffdocview.h"
#include "xfa/fxfa/xfa_ffpageview.h"
-CPDFXFA_Page::CPDFXFA_Page(CPDFXFA_Document* pDoc, int page_index)
+CPDFXFA_Page::CPDFXFA_Page(CPDFXFA_Context* pContext, int page_index)
: m_pXFAPageView(nullptr),
- m_pDocument(pDoc),
+ m_pContext(pContext),
m_iPageIndex(page_index),
m_iRef(1) {}
CPDFXFA_Page::~CPDFXFA_Page() {
- if (m_pDocument)
- m_pDocument->RemovePage(this);
+ if (m_pContext)
+ m_pContext->RemovePage(this);
}
FX_BOOL CPDFXFA_Page::LoadPDFPage() {
- if (!m_pDocument)
+ if (!m_pContext)
return FALSE;
- CPDF_Document* pPDFDoc = m_pDocument->GetPDFDoc();
+ CPDF_Document* pPDFDoc = m_pContext->GetPDFDoc();
if (!pPDFDoc)
return FALSE;
@@ -47,14 +47,14 @@ FX_BOOL CPDFXFA_Page::LoadPDFPage() {
}
FX_BOOL CPDFXFA_Page::LoadXFAPageView() {
- if (!m_pDocument)
+ if (!m_pContext)
return FALSE;
- CXFA_FFDoc* pXFADoc = m_pDocument->GetXFADoc();
+ CXFA_FFDoc* pXFADoc = m_pContext->GetXFADoc();
if (!pXFADoc)
return FALSE;
- CXFA_FFDocView* pXFADocView = m_pDocument->GetXFADocView();
+ CXFA_FFDocView* pXFADocView = m_pContext->GetXFADocView();
if (!pXFADocView)
return FALSE;
@@ -67,10 +67,10 @@ FX_BOOL CPDFXFA_Page::LoadXFAPageView() {
}
FX_BOOL CPDFXFA_Page::LoadPage() {
- if (!m_pDocument || m_iPageIndex < 0)
+ if (!m_pContext || m_iPageIndex < 0)
return FALSE;
- int iDocType = m_pDocument->GetDocType();
+ int iDocType = m_pContext->GetDocType();
switch (iDocType) {
case DOCTYPE_PDF:
case DOCTYPE_STATIC_XFA: {
@@ -85,11 +85,11 @@ FX_BOOL CPDFXFA_Page::LoadPage() {
}
FX_BOOL CPDFXFA_Page::LoadPDFPage(CPDF_Dictionary* pageDict) {
- if (!m_pDocument || m_iPageIndex < 0 || !pageDict)
+ if (!m_pContext || m_iPageIndex < 0 || !pageDict)
return FALSE;
m_pPDFPage =
- pdfium::MakeUnique<CPDF_Page>(m_pDocument->GetPDFDoc(), pageDict, true);
+ pdfium::MakeUnique<CPDF_Page>(m_pContext->GetPDFDoc(), pageDict, true);
m_pPDFPage->ParseContent();
return TRUE;
}
@@ -98,7 +98,7 @@ FX_FLOAT CPDFXFA_Page::GetPageWidth() const {
if (!m_pPDFPage && !m_pXFAPageView)
return 0.0f;
- int nDocType = m_pDocument->GetDocType();
+ int nDocType = m_pContext->GetDocType();
switch (nDocType) {
case DOCTYPE_DYNAMIC_XFA: {
if (m_pXFAPageView) {
@@ -123,7 +123,7 @@ FX_FLOAT CPDFXFA_Page::GetPageHeight() const {
if (!m_pPDFPage && !m_pXFAPageView)
return 0.0f;
- int nDocType = m_pDocument->GetDocType();
+ int nDocType = m_pContext->GetDocType();
switch (nDocType) {
case DOCTYPE_PDF:
case DOCTYPE_STATIC_XFA: {
@@ -203,7 +203,7 @@ void CPDFXFA_Page::GetDisplayMatrix(CFX_Matrix& matrix,
if (!m_pPDFPage && !m_pXFAPageView)
return;
- int nDocType = m_pDocument->GetDocType();
+ int nDocType = m_pContext->GetDocType();
switch (nDocType) {
case DOCTYPE_DYNAMIC_XFA: {
if (m_pXFAPageView) {
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.h b/fpdfsdk/fpdfxfa/cpdfxfa_page.h
index 80a183f807..81f0a305c9 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.h
@@ -12,14 +12,14 @@
#include "core/fxcrt/fx_system.h"
class CFX_Matrix;
-class CPDFXFA_Document;
+class CPDFXFA_Context;
class CPDF_Dictionary;
class CPDF_Page;
class CXFA_FFPageView;
class CPDFXFA_Page {
public:
- CPDFXFA_Page(CPDFXFA_Document* pDoc, int page_index);
+ CPDFXFA_Page(CPDFXFA_Context* pContext, int page_index);
void Retain() { m_iRef++; }
void Release() {
@@ -29,7 +29,7 @@ class CPDFXFA_Page {
FX_BOOL LoadPage();
FX_BOOL LoadPDFPage(CPDF_Dictionary* pageDict);
- CPDFXFA_Document* GetDocument() const { return m_pDocument; }
+ CPDFXFA_Context* GetContext() const { return m_pContext; }
int GetPageIndex() const { return m_iPageIndex; }
CPDF_Page* GetPDFPage() const { return m_pPDFPage.get(); }
CXFA_FFPageView* GetXFAPageView() const { return m_pXFAPageView; }
@@ -77,7 +77,7 @@ class CPDFXFA_Page {
private:
std::unique_ptr<CPDF_Page> m_pPDFPage;
CXFA_FFPageView* m_pXFAPageView;
- CPDFXFA_Document* const m_pDocument;
+ CPDFXFA_Context* const m_pContext;
const int m_iPageIndex;
int m_iRef;
};
diff --git a/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h b/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h
index 092148f4f2..ee4b404a5c 100644
--- a/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h
+++ b/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h
@@ -9,7 +9,7 @@
#include <vector>
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "xfa/fwl/core/ifwl_adaptertimermgr.h"
struct CFWL_TimerInfo;