summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn4
-rw-r--r--fpdfsdk/cpdfsdk_annot.cpp2
-rw-r--r--fpdfsdk/cpdfsdk_baannothandler.cpp2
-rw-r--r--fpdfsdk/cpdfsdk_formfillenvironment.h2
-rw-r--r--fpdfsdk/cpdfsdk_interform.cpp2
-rw-r--r--fpdfsdk/cpdfsdk_pageview.cpp12
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp40
-rw-r--r--fpdfsdk/cpdfsdk_widgethandler.cpp6
-rw-r--r--fpdfsdk/cpdfsdk_xfawidgethandler.cpp10
-rw-r--r--fpdfsdk/fpdf_ext.cpp2
-rw-r--r--fpdfsdk/fpdfdoc_unittest.cpp10
-rw-r--r--fpdfsdk/fpdfeditpage.cpp4
-rw-r--r--fpdfsdk/fpdfformfill.cpp64
-rw-r--r--fpdfsdk/fpdfsave.cpp56
-rw-r--r--fpdfsdk/fpdftext.cpp6
-rw-r--r--fpdfsdk/fpdfview.cpp8
-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
-rw-r--r--fpdfsdk/fsdk_define.h4
-rw-r--r--fpdfsdk/javascript/app.cpp6
-rw-r--r--xfa/fwl/core/ifwl_checkbox.cpp2
-rw-r--r--xfa/fxfa/app/xfa_ffapp.cpp2
27 files changed, 317 insertions, 320 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 6503a6c8ce..f1e95c6ad2 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1054,10 +1054,10 @@ if (pdf_enable_v8) {
if (pdf_enable_xfa) {
static_library("fpdfxfa") {
sources = [
+ "fpdfsdk/fpdfxfa/cpdfxfa_context.cpp",
+ "fpdfsdk/fpdfxfa/cpdfxfa_context.h",
"fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp",
"fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h",
- "fpdfsdk/fpdfxfa/cpdfxfa_document.cpp",
- "fpdfsdk/fpdfxfa/cpdfxfa_document.h",
"fpdfsdk/fpdfxfa/cpdfxfa_page.cpp",
"fpdfsdk/fpdfxfa/cpdfxfa_page.h",
"fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp",
diff --git a/fpdfsdk/cpdfsdk_annot.cpp b/fpdfsdk/cpdfsdk_annot.cpp
index aa545373d4..4e62d93cc1 100644
--- a/fpdfsdk/cpdfsdk_annot.cpp
+++ b/fpdfsdk/cpdfsdk_annot.cpp
@@ -12,7 +12,7 @@
#include "third_party/base/stl_util.h"
#ifdef PDF_ENABLE_XFA
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#endif // PDF_ENABLE_XFA
namespace {
diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp
index 96fa5c607e..581af1baf9 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.cpp
+++ b/fpdfsdk/cpdfsdk_baannothandler.cpp
@@ -18,7 +18,7 @@
#include "fpdfsdk/formfiller/cffl_formfiller.h"
#ifdef PDF_ENABLE_XFA
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#endif // PDF_ENABLE_XFA
namespace {
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h
index 4cdbda3f7c..283c06a7df 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.h
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.h
@@ -109,7 +109,7 @@ class CPDFSDK_FormFillEnvironment
return m_pUnderlyingDoc ? m_pUnderlyingDoc->GetPDFDoc() : nullptr;
}
- CPDFXFA_Document* GetXFADocument() const { return m_pUnderlyingDoc; }
+ CPDFXFA_Context* GetXFAContext() const { return m_pUnderlyingDoc; }
void ResetXFADocument() { m_pUnderlyingDoc = nullptr; }
int GetPageViewCount() const { return m_pageMap.size(); }
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index 81836f7923..a8024faaea 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -37,7 +37,7 @@
#ifdef PDF_ENABLE_XFA
#include "fpdfsdk/cpdfsdk_xfawidget.h"
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/xfa_ffdocview.h"
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 348f2d1fab..5a384d5f1f 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -94,7 +94,7 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
if (!pPage)
return;
- if (pPage->GetDocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) {
+ if (pPage->GetContext()->GetDocType() == DOCTYPE_DYNAMIC_XFA) {
CFX_Graphics gs;
gs.Create(pDevice);
CFX_RectF rectClip;
@@ -191,8 +191,8 @@ FX_BOOL CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) {
if (!pAnnot)
return FALSE;
CPDFXFA_Page* pPage = pAnnot->GetPDFXFAPage();
- if (!pPage || (pPage->GetDocument()->GetDocType() != DOCTYPE_STATIC_XFA &&
- pPage->GetDocument()->GetDocType() != DOCTYPE_DYNAMIC_XFA))
+ if (!pPage || (pPage->GetContext()->GetDocType() != DOCTYPE_STATIC_XFA &&
+ pPage->GetContext()->GetDocType() != DOCTYPE_DYNAMIC_XFA))
return FALSE;
if (GetFocusAnnot() == pAnnot)
@@ -214,7 +214,7 @@ FX_BOOL CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) {
CPDF_Document* CPDFSDK_PageView::GetPDFDocument() {
if (m_page) {
#ifdef PDF_ENABLE_XFA
- return m_page->GetDocument()->GetPDFDoc();
+ return m_page->GetContext()->GetPDFDoc();
#else // PDF_ENABLE_XFA
return m_page->m_pDocument;
#endif // PDF_ENABLE_XFA
@@ -398,7 +398,7 @@ void CPDFSDK_PageView::LoadFXAnnots() {
#ifdef PDF_ENABLE_XFA
CFX_RetainPtr<CPDFXFA_Page> protector(m_page);
- if (m_pFormFillEnv->GetXFADocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) {
+ if (m_pFormFillEnv->GetXFAContext()->GetDocType() == DOCTYPE_DYNAMIC_XFA) {
CXFA_FFPageView* pageView = m_page->GetXFAPageView();
std::unique_ptr<IXFA_WidgetIterator> pWidgetHander(
pageView->CreateWidgetIterator(
@@ -460,7 +460,7 @@ int CPDFSDK_PageView::GetPageIndex() const {
return -1;
#ifdef PDF_ENABLE_XFA
- int nDocType = m_page->GetDocument()->GetDocType();
+ int nDocType = m_page->GetContext()->GetDocType();
switch (nDocType) {
case DOCTYPE_DYNAMIC_XFA: {
CXFA_FFPageView* pPageView = m_page->GetXFAPageView();
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index e1624a08b5..4ef636b1e3 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -30,7 +30,7 @@
#include "fpdfsdk/pdfwindow/PWL_Utils.h"
#ifdef PDF_ENABLE_XFA
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/fxfa_widget.h"
#include "xfa/fxfa/xfa_ffdocview.h"
@@ -68,10 +68,10 @@ CPDFSDK_Widget::~CPDFSDK_Widget() {}
#ifdef PDF_ENABLE_XFA
CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const {
- CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
- if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
+ CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
+ if (pContext->GetDocType() == DOCTYPE_STATIC_XFA) {
if (!m_hMixXFAWidget) {
- if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) {
+ if (CXFA_FFDocView* pDocView = pContext->GetXFADocView()) {
CFX_WideString sName;
if (GetFieldType() == FIELDTYPE_RADIOBUTTON) {
sName = GetAnnotName();
@@ -92,9 +92,9 @@ CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const {
}
CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() {
- CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
- if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
- if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) {
+ CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
+ if (pContext->GetDocType() == DOCTYPE_STATIC_XFA) {
+ if (CXFA_FFDocView* pDocView = pContext->GetXFADocView()) {
CFX_WideString sName = GetName();
if (!sName.IsEmpty())
return pDocView->GetWidgetByName(sName, nullptr);
@@ -105,10 +105,10 @@ CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() {
}
CXFA_FFWidgetHandler* CPDFSDK_Widget::GetXFAWidgetHandler() const {
- CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
- if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
+ CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
+ if (pContext->GetDocType() == DOCTYPE_STATIC_XFA) {
if (!m_pWidgetHandler) {
- if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView())
+ if (CXFA_FFDocView* pDocView = pContext->GetXFADocView())
m_pWidgetHandler = pDocView->GetWidgetHandler();
}
return m_pWidgetHandler;
@@ -219,7 +219,7 @@ FX_BOOL CPDFSDK_Widget::HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) {
FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT,
PDFSDK_FieldAction& data,
CPDFSDK_PageView* pPageView) {
- CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
+ CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
CXFA_FFWidget* hWidget = GetMixXFAWidget();
if (!hWidget)
@@ -266,7 +266,7 @@ FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT,
param.m_pTarget = pAcc;
int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, &param);
- if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView())
+ if (CXFA_FFDocView* pDocView = pContext->GetXFADocView())
pDocView->UpdateDocView();
return nRet == XFA_EVENTERROR_Success;
@@ -322,8 +322,8 @@ void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) {
}
void CPDFSDK_Widget::SynchronizeXFAValue() {
- CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
- CXFA_FFDocView* pXFADocView = pDoc->GetXFADocView();
+ CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
+ CXFA_FFDocView* pXFADocView = pContext->GetXFADocView();
if (!pXFADocView)
return;
@@ -336,8 +336,8 @@ void CPDFSDK_Widget::SynchronizeXFAValue() {
}
void CPDFSDK_Widget::SynchronizeXFAItems() {
- CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
- CXFA_FFDocView* pXFADocView = pDoc->GetXFADocView();
+ CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
+ CXFA_FFDocView* pXFADocView = pContext->GetXFADocView();
if (!pXFADocView)
return;
@@ -502,8 +502,8 @@ int CPDFSDK_Widget::GetFieldType() const {
FX_BOOL CPDFSDK_Widget::IsAppearanceValid() {
#ifdef PDF_ENABLE_XFA
- CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
- int nDocType = pDoc->GetDocType();
+ CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
+ int nDocType = pContext->GetDocType();
if (nDocType != DOCTYPE_PDF && nDocType != DOCTYPE_STATIC_XFA)
return TRUE;
#endif // PDF_ENABLE_XFA
@@ -1826,7 +1826,7 @@ FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type,
CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv();
#ifdef PDF_ENABLE_XFA
- CPDFXFA_Document* pDoc = pFormFillEnv->GetXFADocument();
+ CPDFXFA_Context* pContext = pFormFillEnv->GetXFAContext();
if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
XFA_EVENTTYPE eEventType = GetXFAEventType(type, data.bWillCommit);
@@ -1854,7 +1854,7 @@ FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type,
param.m_pTarget = pAcc;
int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, &param);
- if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView())
+ if (CXFA_FFDocView* pDocView = pContext->GetXFADocView())
pDocView->UpdateDocView();
if (nRet == XFA_EVENTERROR_Success)
diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp
index daa97b4dba..715faa9c35 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -20,7 +20,7 @@
#include "fpdfsdk/formfiller/cffl_formfiller.h"
#ifdef PDF_ENABLE_XFA
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#endif // PDF_ENABLE_XFA
CPDFSDK_WidgetHandler::CPDFSDK_WidgetHandler(
@@ -239,8 +239,8 @@ void CPDFSDK_WidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) {
#ifdef PDF_ENABLE_XFA
CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
- CPDFXFA_Document* pDoc = pPageView->GetFormFillEnv()->GetXFADocument();
- if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
+ CPDFXFA_Context* pContext = pPageView->GetFormFillEnv()->GetXFAContext();
+ if (pContext->GetDocType() == DOCTYPE_STATIC_XFA) {
if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty())
pWidget->ResetAppearance(FALSE);
}
diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
index c20b5f4984..2262450b94 100644
--- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
@@ -12,7 +12,7 @@
#include "fpdfsdk/cpdfsdk_interform.h"
#include "fpdfsdk/cpdfsdk_pageview.h"
#include "fpdfsdk/cpdfsdk_xfawidget.h"
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "xfa/fwl/core/fwl_widgethit.h"
#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fxfa/fxfa_basic.h"
@@ -110,11 +110,11 @@ FX_BOOL CPDFSDK_XFAWidgetHandler::HitTest(CPDFSDK_PageView* pPageView,
if (!pFormFillEnv)
return FALSE;
- CPDFXFA_Document* pDoc = pFormFillEnv->GetXFADocument();
- if (!pDoc)
+ CPDFXFA_Context* pContext = pFormFillEnv->GetXFAContext();
+ if (!pContext)
return FALSE;
- CXFA_FFDocView* pDocView = pDoc->GetXFADocView();
+ CXFA_FFDocView* pDocView = pContext->GetXFADocView();
if (!pDocView)
return FALSE;
@@ -335,7 +335,7 @@ CXFA_FFWidgetHandler* CPDFSDK_XFAWidgetHandler::GetXFAWidgetHandler(
if (!pFormFillEnv)
return nullptr;
- CPDFXFA_Document* pDoc = pFormFillEnv->GetXFADocument();
+ CPDFXFA_Context* pDoc = pFormFillEnv->GetXFAContext();
if (!pDoc)
return nullptr;
diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp
index 6b0a3861f9..8f9c94d5fc 100644
--- a/fpdfsdk/fpdf_ext.cpp
+++ b/fpdfsdk/fpdf_ext.cpp
@@ -21,7 +21,7 @@
#include "third_party/base/ptr_util.h"
#ifdef PDF_ENABLE_XFA
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#endif // PDF_ENABLE_XFA
FX_BOOL FPDF_UnSupportError(int nError) {
diff --git a/fpdfsdk/fpdfdoc_unittest.cpp b/fpdfsdk/fpdfdoc_unittest.cpp
index 7ac8ce62d5..408d2fa0d8 100644
--- a/fpdfsdk/fpdfdoc_unittest.cpp
+++ b/fpdfsdk/fpdfdoc_unittest.cpp
@@ -19,7 +19,7 @@
#include "third_party/base/ptr_util.h"
#ifdef PDF_ENABLE_XFA
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#endif // PDF_ENABLE_XFA
class CPDF_TestDocument : public CPDF_Document {
@@ -31,10 +31,10 @@ class CPDF_TestDocument : public CPDF_Document {
};
#ifdef PDF_ENABLE_XFA
-class CPDF_TestXFADocument : public CPDFXFA_Document {
+class CPDF_TestXFAContext : public CPDFXFA_Context {
public:
- CPDF_TestXFADocument()
- : CPDFXFA_Document(pdfium::MakeUnique<CPDF_TestDocument>()) {}
+ CPDF_TestXFAContext()
+ : CPDFXFA_Context(pdfium::MakeUnique<CPDF_TestDocument>()) {}
void SetRoot(CPDF_Dictionary* root) {
reinterpret_cast<CPDF_TestDocument*>(GetPDFDoc())->SetRoot(root);
@@ -42,7 +42,7 @@ class CPDF_TestXFADocument : public CPDFXFA_Document {
CPDF_IndirectObjectHolder* GetHolder() { return GetPDFDoc(); }
};
-using CPDF_TestPdfDocument = CPDF_TestXFADocument;
+using CPDF_TestPdfDocument = CPDF_TestXFAContext;
#else // PDF_ENABLE_XFA
using CPDF_TestPdfDocument = CPDF_TestDocument;
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp
index 3f56d90ec0..be9ae67be4 100644
--- a/fpdfsdk/fpdfeditpage.cpp
+++ b/fpdfsdk/fpdfeditpage.cpp
@@ -29,7 +29,7 @@
#include "third_party/base/stl_util.h"
#ifdef PDF_ENABLE_XFA
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "fpdfsdk/fpdfxfa/cpdfxfa_page.h"
#endif // PDF_ENABLE_XFA
@@ -121,7 +121,7 @@ DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document,
#ifdef PDF_ENABLE_XFA
CPDFXFA_Page* pPage =
- new CPDFXFA_Page((CPDFXFA_Document*)document, page_index);
+ new CPDFXFA_Page(static_cast<CPDFXFA_Context*>(document), page_index);
pPage->LoadPDFPage(pPageDict);
#else // PDF_ENABLE_XFA
CPDF_Page* pPage = new CPDF_Page(pDoc, pPageDict, true);
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp
index 7a884c719d..25324e3855 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -27,7 +27,7 @@
#include "third_party/base/stl_util.h"
#ifdef PDF_ENABLE_XFA
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "fpdfsdk/fpdfxfa/cpdfxfa_page.h"
#include "xfa/fxfa/xfa_ffdocview.h"
#include "xfa/fxfa/xfa_ffpageview.h"
@@ -86,10 +86,10 @@ void FFLCommon(FPDF_FORMHANDLE hHandle,
return;
#ifdef PDF_ENABLE_XFA
- CPDFXFA_Document* pDocument = pPage->GetDocument();
- if (!pDocument)
+ CPDFXFA_Context* pContext = pPage->GetContext();
+ if (!pContext)
return;
- CPDF_Document* pPDFDoc = pDocument->GetPDFDoc();
+ CPDF_Document* pPDFDoc = pContext->GetPDFDoc();
if (!pPDFDoc)
return;
CPDFSDK_FormFillEnvironment* pFormFillEnv =
@@ -245,7 +245,7 @@ FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document,
return nullptr;
#ifdef PDF_ENABLE_XFA
- // If the CPDFXFA_Document has a FormFillEnvironment already then we've done
+ // If the CPDFXFA_Context has a FormFillEnvironment already then we've done
// this and can just return the old Env. Otherwise, we'll end up setting a new
// environment into the XFADocument and, that could get weird.
if (pDocument->GetFormFillEnv())
@@ -276,8 +276,8 @@ FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) {
pFormFillEnv->ClearAllFocusedAnnots();
// If the document was closed first, it's possible the XFA document
// is now a nullptr.
- if (pFormFillEnv->GetXFADocument())
- pFormFillEnv->GetXFADocument()->SetFormFillEnv(nullptr);
+ if (pFormFillEnv->GetXFAContext())
+ pFormFillEnv->GetXFAContext()->SetFormFillEnv(nullptr);
#endif // PDF_ENABLE_XFA
delete pFormFillEnv;
@@ -425,21 +425,22 @@ DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document,
if (!hWidget || !document)
return;
- CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
- if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic &&
- pDocument->GetDocType() != XFA_DOCTYPE_Static)
+ CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
+ if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic &&
+ pContext->GetDocType() != XFA_DOCTYPE_Static)
return;
static_cast<CXFA_FFWidget*>(hWidget)->Undo();
}
+
DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document,
FPDF_WIDGET hWidget) {
if (!hWidget || !document)
return;
- CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
- if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic &&
- pDocument->GetDocType() != XFA_DOCTYPE_Static)
+ CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
+ if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic &&
+ pContext->GetDocType() != XFA_DOCTYPE_Static)
return;
static_cast<CXFA_FFWidget*>(hWidget)->Redo();
@@ -450,13 +451,14 @@ DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document,
if (!hWidget || !document)
return;
- CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
- if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic &&
- pDocument->GetDocType() != XFA_DOCTYPE_Static)
+ CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
+ if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic &&
+ pContext->GetDocType() != XFA_DOCTYPE_Static)
return;
static_cast<CXFA_FFWidget*>(hWidget)->SelectAll();
}
+
DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document,
FPDF_WIDGET hWidget,
FPDF_WIDESTRING wsText,
@@ -464,9 +466,9 @@ DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document,
if (!hWidget || !document)
return;
- CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
- if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic &&
- pDocument->GetDocType() != XFA_DOCTYPE_Static)
+ CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
+ if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic &&
+ pContext->GetDocType() != XFA_DOCTYPE_Static)
return;
CFX_WideString wsCpText;
@@ -496,9 +498,9 @@ DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document,
if (!hWidget || !document)
return;
- CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
- if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic &&
- pDocument->GetDocType() != XFA_DOCTYPE_Static)
+ CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
+ if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic &&
+ pContext->GetDocType() != XFA_DOCTYPE_Static)
return;
CFX_WideString wsCpText;
@@ -528,9 +530,9 @@ DLLEXPORT void STDCALL FPDF_Widget_Paste(FPDF_DOCUMENT document,
if (!hWidget || !document)
return;
- CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
- if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic &&
- pDocument->GetDocType() != XFA_DOCTYPE_Static)
+ CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
+ if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic &&
+ pContext->GetDocType() != XFA_DOCTYPE_Static)
return;
CFX_WideString wstr = CFX_WideString::FromUTF16LE(wsText, size);
@@ -546,9 +548,9 @@ FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document,
if (!hWidget || !document)
return;
- CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
- if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic &&
- pDocument->GetDocType() != XFA_DOCTYPE_Static)
+ CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
+ if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic &&
+ pContext->GetDocType() != XFA_DOCTYPE_Static)
return;
CFX_PointF ptPopup;
@@ -567,9 +569,9 @@ FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document,
if (!hWidget || !document)
return;
- CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
- if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic &&
- pDocument->GetDocType() != XFA_DOCTYPE_Static)
+ CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
+ if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic &&
+ pContext->GetDocType() != XFA_DOCTYPE_Static)
return;
std::vector<CFX_ByteString>* sSuggestWords = new std::vector<CFX_ByteString>;
diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp
index 9676e4473e..257f1fc0fc 100644
--- a/fpdfsdk/fpdfsave.cpp
+++ b/fpdfsdk/fpdfsave.cpp
@@ -19,7 +19,7 @@
#include "public/fpdf_edit.h"
#ifdef PDF_ENABLE_XFA
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h"
#include "public/fpdf_formfill.h"
#include "xfa/fxfa/cxfa_eventparam.h"
@@ -75,21 +75,21 @@ void CFX_IFileWrite::Release() {
namespace {
#ifdef PDF_ENABLE_XFA
-bool SaveXFADocumentData(CPDFXFA_Document* pDocument,
+bool SaveXFADocumentData(CPDFXFA_Context* pContext,
std::vector<ScopedFileStream>* fileList) {
- if (!pDocument)
+ if (!pContext)
return false;
- if (pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
- pDocument->GetDocType() != DOCTYPE_STATIC_XFA)
+ if (pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
+ pContext->GetDocType() != DOCTYPE_STATIC_XFA)
return true;
- CXFA_FFDocView* pXFADocView = pDocument->GetXFADocView();
+ CXFA_FFDocView* pXFADocView = pContext->GetXFADocView();
if (!pXFADocView)
return true;
- CPDF_Document* pPDFDocument = pDocument->GetPDFDoc();
- if (!pDocument)
+ CPDF_Document* pPDFDocument = pContext->GetPDFDoc();
+ if (!pPDFDocument)
return false;
CPDF_Dictionary* pRoot = pPDFDocument->GetRoot();
@@ -124,8 +124,8 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument,
else if (pPDFObj->GetString() == "template")
iTemplate = i + 1;
}
- std::unique_ptr<CXFA_ChecksumContext> pContext(new CXFA_ChecksumContext);
- pContext->StartChecksum();
+ std::unique_ptr<CXFA_ChecksumContext> pChecksum(new CXFA_ChecksumContext);
+ pChecksum->StartChecksum();
// template
if (iTemplate > -1) {
@@ -135,7 +135,7 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument,
uint8_t* pData = (uint8_t*)streamAcc.GetData();
uint32_t dwSize2 = streamAcc.GetSize();
ScopedFileStream pTemplate(FX_CreateMemoryStream(pData, dwSize2));
- pContext->UpdateChecksum(pTemplate.get());
+ pChecksum->UpdateChecksum(pTemplate.get());
}
CPDF_Stream* pFormStream = nullptr;
CPDF_Stream* pDataSetsStream = nullptr;
@@ -172,8 +172,8 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument,
pDsfileWrite.get(), nullptr) &&
pDsfileWrite->GetSize() > 0) {
// Datasets
- pContext->UpdateChecksum(pDsfileWrite.get());
- pContext->FinishChecksum();
+ pChecksum->UpdateChecksum(pDsfileWrite.get());
+ pChecksum->FinishChecksum();
CPDF_Dictionary* pDataDict =
new CPDF_Dictionary(pPDFDocument->GetByteStringPool());
if (iDataSetsIndex != -1) {
@@ -196,7 +196,7 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument,
{
ScopedFileStream pfileWrite(FX_CreateMemoryStream());
if (pXFADocView->GetDoc()->SavePackage(XFA_HASHCODE_Form, pfileWrite.get(),
- pContext.get()) &&
+ pChecksum.get()) &&
pfileWrite->GetSize() > 0) {
CPDF_Dictionary* pDataDict =
new CPDF_Dictionary(pPDFDocument->GetByteStringPool());
@@ -219,15 +219,15 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument,
return true;
}
-bool SendPostSaveToXFADoc(CPDFXFA_Document* pDocument) {
- if (!pDocument)
+bool SendPostSaveToXFADoc(CPDFXFA_Context* pContext) {
+ if (!pContext)
return false;
- if (pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
- pDocument->GetDocType() != DOCTYPE_STATIC_XFA)
+ if (pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
+ pContext->GetDocType() != DOCTYPE_STATIC_XFA)
return true;
- CXFA_FFDocView* pXFADocView = pDocument->GetXFADocView();
+ CXFA_FFDocView* pXFADocView = pContext->GetXFADocView();
if (!pXFADocView)
return false;
@@ -240,17 +240,17 @@ bool SendPostSaveToXFADoc(CPDFXFA_Document* pDocument) {
pWidgetHander->ProcessEvent(pWidgetAcc, &preParam);
}
pXFADocView->UpdateDocView();
- pDocument->ClearChangeMark();
+ pContext->ClearChangeMark();
return true;
}
-bool SendPreSaveToXFADoc(CPDFXFA_Document* pDocument,
+bool SendPreSaveToXFADoc(CPDFXFA_Context* pContext,
std::vector<ScopedFileStream>* fileList) {
- if (pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
- pDocument->GetDocType() != DOCTYPE_STATIC_XFA)
+ if (pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
+ pContext->GetDocType() != DOCTYPE_STATIC_XFA)
return true;
- CXFA_FFDocView* pXFADocView = pDocument->GetXFADocView();
+ CXFA_FFDocView* pXFADocView = pContext->GetXFADocView();
if (!pXFADocView)
return true;
@@ -263,7 +263,7 @@ bool SendPreSaveToXFADoc(CPDFXFA_Document* pDocument,
pWidgetHander->ProcessEvent(pWidgetAcc, &preParam);
}
pXFADocView->UpdateDocView();
- return SaveXFADocumentData(pDocument, fileList);
+ return SaveXFADocumentData(pContext, fileList);
}
#endif // PDF_ENABLE_XFA
@@ -277,9 +277,9 @@ bool FPDF_Doc_Save(FPDF_DOCUMENT document,
return 0;
#ifdef PDF_ENABLE_XFA
- CPDFXFA_Document* pDoc = static_cast<CPDFXFA_Document*>(document);
+ CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
std::vector<ScopedFileStream> fileList;
- SendPreSaveToXFADoc(pDoc, &fileList);
+ SendPreSaveToXFADoc(pContext, &fileList);
#endif // PDF_ENABLE_XFA
if (flags < FPDF_INCREMENTAL || flags > FPDF_REMOVE_SECURITY)
@@ -297,7 +297,7 @@ bool FPDF_Doc_Save(FPDF_DOCUMENT document,
pStreamWrite->Init(pFileWrite);
bool bRet = FileMaker.Create(pStreamWrite, flags);
#ifdef PDF_ENABLE_XFA
- SendPostSaveToXFADoc(pDoc);
+ SendPostSaveToXFADoc(pContext);
#endif // PDF_ENABLE_XFA
pStreamWrite->Release();
return bRet;
diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp
index 4282350786..6f3f45329e 100644
--- a/fpdfsdk/fpdftext.cpp
+++ b/fpdfsdk/fpdftext.cpp
@@ -16,7 +16,7 @@
#include "third_party/base/stl_util.h"
#ifdef PDF_ENABLE_XFA
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "fpdfsdk/fpdfxfa/cpdfxfa_page.h"
#endif // PDF_ENABLE_XFA
@@ -47,8 +47,8 @@ DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page) {
#ifdef PDF_ENABLE_XFA
CPDFXFA_Page* pPage = (CPDFXFA_Page*)page;
- CPDFXFA_Document* pDoc = pPage->GetDocument();
- CPDF_ViewerPreferences viewRef(pDoc->GetPDFDoc());
+ CPDFXFA_Context* pContext = pPage->GetContext();
+ CPDF_ViewerPreferences viewRef(pContext->GetPDFDoc());
#else // PDF_ENABLE_XFA
CPDF_ViewerPreferences viewRef(pPDFPage->m_pDocument);
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index d7ddab8a97..5d3dfd824a 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -37,7 +37,7 @@
#include "third_party/base/ptr_util.h"
#ifdef PDF_ENABLE_XFA
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "fpdfsdk/fpdfxfa/cpdfxfa_page.h"
#include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h"
#include "public/fpdf_formfill.h"
@@ -71,7 +71,7 @@ CPDF_Document* CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc) {
FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc) {
#ifdef PDF_ENABLE_XFA
return doc ? FPDFDocumentFromUnderlying(
- new CPDFXFA_Document(pdfium::WrapUnique(doc)))
+ new CPDFXFA_Context(pdfium::WrapUnique(doc)))
: nullptr;
#else // PDF_ENABLE_XFA
return FPDFDocumentFromUnderlying(doc);
@@ -352,7 +352,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document,
return FALSE;
CPDF_Document* pdfDoc =
- (static_cast<CPDFXFA_Document*>(document))->GetPDFDoc();
+ (static_cast<CPDFXFA_Context*>(document))->GetPDFDoc();
if (!pdfDoc)
return FALSE;
@@ -374,7 +374,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document,
}
DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document) {
- return document && (static_cast<CPDFXFA_Document*>(document))->LoadXFADoc();
+ return document && (static_cast<CPDFXFA_Context*>(document))->LoadXFADoc();
}
#endif // PDF_ENABLE_XFA
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;
diff --git a/fpdfsdk/fsdk_define.h b/fpdfsdk/fsdk_define.h
index aeb42d2d11..e5a287fac6 100644
--- a/fpdfsdk/fsdk_define.h
+++ b/fpdfsdk/fsdk_define.h
@@ -12,7 +12,7 @@
#include "public/fpdfview.h"
#ifdef PDF_ENABLE_XFA
-#include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#endif // PDF_ENABLE_XFA
#ifdef _WIN32
@@ -71,7 +71,7 @@ class CFPDF_FileStream : public IFX_SeekableStream {
using UnderlyingDocumentType = CPDF_Document;
using UnderlyingPageType = CPDF_Page;
#else // PDF_ENABLE_XFA
-using UnderlyingDocumentType = CPDFXFA_Document;
+using UnderlyingDocumentType = CPDFXFA_Context;
using UnderlyingPageType = CPDFXFA_Page;
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp
index 394f49e143..4d79e41f7a 100644
--- a/fpdfsdk/javascript/app.cpp
+++ b/fpdfsdk/javascript/app.cpp
@@ -291,9 +291,9 @@ FX_BOOL app::viewerVersion(IJS_Context* cc,
if (!vp.IsGetting())
return FALSE;
#ifdef PDF_ENABLE_XFA
- CJS_Context* pContext = (CJS_Context*)cc;
- CPDFXFA_Document* pDoc = pContext->GetFormFillEnv()->GetXFADocument();
- if (pDoc->GetDocType() == 1 || pDoc->GetDocType() == 2) {
+ CJS_Context* pJSContext = static_cast<CJS_Context*>(cc);
+ CPDFXFA_Context* pXFAContext = pJSContext->GetFormFillEnv()->GetXFAContext();
+ if (pXFAContext->GetDocType() == 1 || pXFAContext->GetDocType() == 2) {
vp << JS_NUM_VIEWERVERSION_XFA;
return TRUE;
}
diff --git a/xfa/fwl/core/ifwl_checkbox.cpp b/xfa/fwl/core/ifwl_checkbox.cpp
index d62b3bafeb..23edbd7907 100644
--- a/xfa/fwl/core/ifwl_checkbox.cpp
+++ b/xfa/fwl/core/ifwl_checkbox.cpp
@@ -14,8 +14,8 @@
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/cfwl_themetext.h"
#include "xfa/fwl/core/cfwl_widgetmgr.h"
-#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fwl/core/fwl_noteimp.h"
+#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fwl/core/ifwl_checkbox.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp
index 0924fb9e05..db97c6371a 100644
--- a/xfa/fxfa/app/xfa_ffapp.cpp
+++ b/xfa/fxfa/app/xfa_ffapp.cpp
@@ -10,8 +10,8 @@
#include <utility>
#include "xfa/fgas/font/fgas_stdfontmgr.h"
-#include "xfa/fwl/core/fwl_noteimp.h"
#include "xfa/fwl/core/cfwl_widgetmgr.h"
+#include "xfa/fwl/core/fwl_noteimp.h"
#include "xfa/fxfa/app/xfa_fwladapter.h"
#include "xfa/fxfa/app/xfa_fwltheme.h"
#include "xfa/fxfa/xfa_ffdoc.h"