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

Unified Diff: fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp

Issue 2328573002: Split CPDFXFA_Document apart (Closed)
Patch Set: Fix merge Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « BUILD.gn ('k') | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
similarity index 56%
copy from fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
copy to fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index 57de222e1c420b4bacb154d8d3f94be597147d48..56eb3fccc626ac9142689cf6462b8902318c7cbf 100644
--- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -1,30 +1,22 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2016 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h"
+#include "fpdfsdk/fpdfxfa/include/cpdfxfa_docenvironment.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
-#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
-#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h"
-#include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h"
+#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h"
#include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h"
-#include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h"
#include "fpdfsdk/include/cpdfdoc_environment.h"
#include "fpdfsdk/include/cpdfsdk_document.h"
#include "fpdfsdk/include/cpdfsdk_interform.h"
#include "fpdfsdk/include/cpdfsdk_pageview.h"
-#include "fpdfsdk/include/fsdk_define.h"
#include "fpdfsdk/javascript/ijs_runtime.h"
-#include "public/fpdf_formfill.h"
-#include "xfa/fxfa/include/cxfa_eventparam.h"
-#include "xfa/fxfa/include/xfa_ffapp.h"
-#include "xfa/fxfa/include/xfa_ffdoc.h"
#include "xfa/fxfa/include/xfa_ffdocview.h"
-#include "xfa/fxfa/include/xfa_ffpageview.h"
#include "xfa/fxfa/include/xfa_ffwidget.h"
#include "xfa/fxfa/include/xfa_ffwidgethandler.h"
@@ -43,201 +35,37 @@
#define FXFA_PDF 0x10000000
#define FXFA_XFA_ALL 0x01111111
-#ifndef _WIN32
-extern void SetLastError(int err);
-extern int GetLastError();
-#endif
-
-CPDFXFA_Document::CPDFXFA_Document(std::unique_ptr<CPDF_Document> pPDFDoc,
- CPDFXFA_App* pProvider)
- : m_iDocType(DOCTYPE_PDF),
- m_pPDFDoc(std::move(pPDFDoc)),
- m_pXFADocView(nullptr),
- m_pApp(pProvider),
- m_pJSContext(nullptr),
- m_nLoadStatus(FXFA_LOADSTATUS_PRELOAD),
- m_nPageCount(0) {}
-
-CPDFXFA_Document::~CPDFXFA_Document() {
- m_nLoadStatus = FXFA_LOADSTATUS_CLOSING;
-
- if (m_pXFADoc) {
- CXFA_FFApp* pApp = m_pApp->GetXFAApp();
- if (pApp) {
- CXFA_FFDocHandler* pDocHandler = pApp->GetDocHandler();
- if (pDocHandler)
- CloseXFADoc(pDocHandler);
- }
- m_pXFADoc.reset();
- }
- if (m_pJSContext && m_pSDKDoc && m_pSDKDoc->GetEnv())
- m_pSDKDoc->GetEnv()->GetJSRuntime()->ReleaseContext(m_pJSContext);
-
- m_nLoadStatus = FXFA_LOADSTATUS_CLOSED;
+CPDFXFA_DocEnvironment::CPDFXFA_DocEnvironment(CPDFXFA_Document* doc)
+ : m_pDocument(doc), m_pJSContext(nullptr) {
+ ASSERT(m_pDocument);
}
-FX_BOOL CPDFXFA_Document::LoadXFADoc() {
- m_nLoadStatus = FXFA_LOADSTATUS_LOADING;
-
- if (!m_pPDFDoc)
- return FALSE;
-
- m_XFAPageList.RemoveAll();
-
- CXFA_FFApp* pApp = m_pApp->GetXFAApp();
- if (!pApp)
- return FALSE;
-
- m_pXFADoc.reset(pApp->CreateDoc(this, m_pPDFDoc.get()));
- if (!m_pXFADoc) {
- SetLastError(FPDF_ERR_XFALOAD);
- return FALSE;
- }
-
- CXFA_FFDocHandler* pDocHandler = pApp->GetDocHandler();
- if (!pDocHandler) {
- SetLastError(FPDF_ERR_XFALOAD);
- return FALSE;
- }
-
- m_pXFADoc->StartLoad();
- int iStatus = m_pXFADoc->DoLoad(nullptr);
- if (iStatus != XFA_PARSESTATUS_Done) {
- CloseXFADoc(pDocHandler);
- SetLastError(FPDF_ERR_XFALOAD);
- return FALSE;
- }
- m_pXFADoc->StopLoad();
- m_pXFADoc->GetXFADoc()->InitScriptContext(m_pApp->GetJSERuntime());
-
- if (m_pXFADoc->GetDocType() == XFA_DOCTYPE_Dynamic)
- m_iDocType = DOCTYPE_DYNAMIC_XFA;
- else
- m_iDocType = DOCTYPE_STATIC_XFA;
-
- m_pXFADocView = m_pXFADoc->CreateDocView(XFA_DOCVIEW_View);
- if (m_pXFADocView->StartLayout() < 0) {
- CloseXFADoc(pDocHandler);
- SetLastError(FPDF_ERR_XFALAYOUT);
- return FALSE;
- }
-
- m_pXFADocView->DoLayout(nullptr);
- m_pXFADocView->StopLayout();
- m_nLoadStatus = FXFA_LOADSTATUS_LOADED;
-
- return TRUE;
+CPDFXFA_DocEnvironment::~CPDFXFA_DocEnvironment() {
+ if (m_pJSContext && m_pDocument->GetSDKDoc() &&
+ m_pDocument->GetSDKDoc()->GetEnv())
+ m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->ReleaseContext(
+ m_pJSContext);
}
-int CPDFXFA_Document::GetPageCount() {
- if (!m_pPDFDoc && !m_pXFADoc)
- return 0;
-
- switch (m_iDocType) {
- case DOCTYPE_PDF:
- case DOCTYPE_STATIC_XFA:
- if (m_pPDFDoc)
- return m_pPDFDoc->GetPageCount();
- case DOCTYPE_DYNAMIC_XFA:
- if (m_pXFADoc)
- return m_pXFADocView->CountPageViews();
- default:
- return 0;
- }
+void CPDFXFA_DocEnvironment::SetChangeMark(CXFA_FFDoc* hDoc) {
+ if (hDoc == m_pDocument->GetXFADoc() && m_pDocument->GetSDKDoc())
+ m_pDocument->GetSDKDoc()->SetChangeMark();
}
-CPDFXFA_Page* CPDFXFA_Document::GetPage(int page_index) {
- if (page_index < 0)
- return nullptr;
-
- CPDFXFA_Page* pPage = nullptr;
- int nCount = m_XFAPageList.GetSize();
- if (nCount > 0 && page_index < nCount) {
- pPage = m_XFAPageList.GetAt(page_index);
- if (pPage)
- pPage->Retain();
- } else {
- m_nPageCount = GetPageCount();
- m_XFAPageList.SetSize(m_nPageCount);
- }
- if (pPage)
- return pPage;
-
- pPage = new CPDFXFA_Page(this, page_index);
- if (!pPage->LoadPage()) {
- pPage->Release();
- return nullptr;
- }
- m_XFAPageList.SetAt(page_index, pPage);
- return pPage;
-}
-
-CPDFXFA_Page* CPDFXFA_Document::GetPage(CXFA_FFPageView* pPage) {
- if (!pPage)
- return nullptr;
-
- if (!m_pXFADoc)
- return nullptr;
-
- if (m_iDocType != DOCTYPE_DYNAMIC_XFA)
- return nullptr;
-
- int nSize = m_XFAPageList.GetSize();
- for (int i = 0; i < nSize; i++) {
- CPDFXFA_Page* pTempPage = m_XFAPageList.GetAt(i);
- if (!pTempPage)
- continue;
- if (pTempPage->GetXFAPageView() && pTempPage->GetXFAPageView() == pPage)
- return pTempPage;
- }
-
- return nullptr;
-}
-
-void CPDFXFA_Document::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.
- if (m_pPDFDoc)
- m_pPDFDoc->DeletePage(page_index);
-
- if (page_index < 0 || page_index >= m_XFAPageList.GetSize())
- return;
-
- if (CPDFXFA_Page* pPage = m_XFAPageList.GetAt(page_index))
- pPage->Release();
-}
-
-void CPDFXFA_Document::RemovePage(CPDFXFA_Page* page) {
- m_XFAPageList.SetAt(page->GetPageIndex(), nullptr);
-}
-
-CPDFSDK_Document* CPDFXFA_Document::GetSDKDocument(
- CPDFDoc_Environment* pFormFillEnv) {
- if (!m_pSDKDoc && pFormFillEnv)
- m_pSDKDoc.reset(new CPDFSDK_Document(this, pFormFillEnv));
- return m_pSDKDoc.get();
-}
-
-void CPDFXFA_Document::SetChangeMark(CXFA_FFDoc* hDoc) {
- if (hDoc == m_pXFADoc.get() && m_pSDKDoc)
- m_pSDKDoc->SetChangeMark();
-}
-
-void CPDFXFA_Document::InvalidateRect(CXFA_FFPageView* pPageView,
- const CFX_RectF& rt,
- uint32_t dwFlags /* = 0 */) {
- if (!m_pXFADoc || !m_pSDKDoc)
+void CPDFXFA_DocEnvironment::InvalidateRect(CXFA_FFPageView* pPageView,
+ const CFX_RectF& rt,
+ uint32_t dwFlags /* = 0 */) {
+ if (!m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc())
return;
- if (m_iDocType != DOCTYPE_DYNAMIC_XFA)
+ if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA)
return;
- CPDFXFA_Page* pPage = GetPage(pPageView);
+ CPDFXFA_Page* pPage = m_pDocument->GetPage(pPageView);
if (!pPage)
return;
- CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
+ CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv();
if (!pEnv)
return;
@@ -246,16 +74,18 @@ void CPDFXFA_Document::InvalidateRect(CXFA_FFPageView* pPageView,
rcPage.right, rcPage.top);
}
-void CPDFXFA_Document::DisplayCaret(CXFA_FFWidget* hWidget,
- FX_BOOL bVisible,
- const CFX_RectF* pRtAnchor) {
- if (!hWidget || !pRtAnchor || !m_pXFADoc || !m_pSDKDoc || !m_pXFADocView)
+void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget,
+ FX_BOOL bVisible,
+ const CFX_RectF* pRtAnchor) {
+ if (!hWidget || !pRtAnchor || !m_pDocument->GetXFADoc() ||
+ !m_pDocument->GetSDKDoc() || !m_pDocument->GetXFADocView())
return;
- if (m_iDocType != DOCTYPE_DYNAMIC_XFA)
+ if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA)
return;
- CXFA_FFWidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler();
+ CXFA_FFWidgetHandler* pWidgetHandler =
+ m_pDocument->GetXFADocView()->GetWidgetHandler();
if (!pWidgetHandler)
return;
@@ -263,11 +93,11 @@ void CPDFXFA_Document::DisplayCaret(CXFA_FFWidget* hWidget,
if (!pPageView)
return;
- CPDFXFA_Page* pPage = GetPage(pPageView);
+ CPDFXFA_Page* pPage = m_pDocument->GetPage(pPageView);
if (!pPage)
return;
- CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
+ CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv();
if (!pEnv)
return;
@@ -276,11 +106,11 @@ void CPDFXFA_Document::DisplayCaret(CXFA_FFWidget* hWidget,
rcCaret.right, rcCaret.bottom);
}
-FX_BOOL CPDFXFA_Document::GetPopupPos(CXFA_FFWidget* hWidget,
- FX_FLOAT fMinPopup,
- FX_FLOAT fMaxPopup,
- const CFX_RectF& rtAnchor,
- CFX_RectF& rtPopup) {
+FX_BOOL CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget,
+ FX_FLOAT fMinPopup,
+ FX_FLOAT fMaxPopup,
+ const CFX_RectF& rtAnchor,
+ CFX_RectF& rtPopup) {
if (!hWidget)
return FALSE;
@@ -288,13 +118,13 @@ FX_BOOL CPDFXFA_Document::GetPopupPos(CXFA_FFWidget* hWidget,
if (!pXFAPageView)
return FALSE;
- CPDFXFA_Page* pPage = GetPage(pXFAPageView);
+ CPDFXFA_Page* pPage = m_pDocument->GetPage(pXFAPageView);
if (!pPage)
return FALSE;
CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc();
int nRotate = pWidgetAcc->GetRotate();
- CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
+ CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv();
if (!pEnv)
return FALSE;
@@ -392,8 +222,8 @@ FX_BOOL CPDFXFA_Document::GetPopupPos(CXFA_FFWidget* hWidget,
return TRUE;
}
-FX_BOOL CPDFXFA_Document::PopupMenu(CXFA_FFWidget* hWidget,
- CFX_PointF ptPopup) {
+FX_BOOL CPDFXFA_DocEnvironment::PopupMenu(CXFA_FFWidget* hWidget,
+ CFX_PointF ptPopup) {
if (!hWidget)
return FALSE;
@@ -401,11 +231,11 @@ FX_BOOL CPDFXFA_Document::PopupMenu(CXFA_FFWidget* hWidget,
if (!pXFAPageView)
return FALSE;
- CPDFXFA_Page* pPage = GetPage(pXFAPageView);
+ CPDFXFA_Page* pPage = m_pDocument->GetPage(pXFAPageView);
if (!pPage)
return FALSE;
- CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
+ CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv();
if (!pEnv)
return FALSE;
@@ -426,129 +256,133 @@ FX_BOOL CPDFXFA_Document::PopupMenu(CXFA_FFWidget* hWidget,
return pEnv->FFI_PopupMenu(pPage, hWidget, menuFlag, ptPopup, nullptr);
}
-void CPDFXFA_Document::PageViewEvent(CXFA_FFPageView* pPageView,
- uint32_t dwFlags) {
- CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
+void CPDFXFA_DocEnvironment::PageViewEvent(CXFA_FFPageView* pPageView,
+ uint32_t dwFlags) {
+ CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv();
if (!pEnv)
return;
- if (m_nLoadStatus == FXFA_LOADSTATUS_LOADING ||
- m_nLoadStatus == FXFA_LOADSTATUS_CLOSING ||
+ if (m_pDocument->GetLoadStatus() == FXFA_LOADSTATUS_LOADING ||
+ m_pDocument->GetLoadStatus() == FXFA_LOADSTATUS_CLOSING ||
XFA_PAGEVIEWEVENT_StopLayout != dwFlags)
return;
- int nNewCount = GetPageCount();
- if (nNewCount == m_nPageCount)
+ int nNewCount = m_pDocument->GetPageCount();
+ if (nNewCount == m_pDocument->GetOriginalPageCount())
return;
- CXFA_FFDocView* pXFADocView = GetXFADocView();
+ CXFA_FFDocView* pXFADocView = m_pDocument->GetXFADocView();
if (!pXFADocView)
return;
- for (int iPageIter = 0; iPageIter < m_nPageCount; iPageIter++) {
- CPDFXFA_Page* pPage = m_XFAPageList.GetAt(iPageIter);
+ for (int iPageIter = 0; iPageIter < m_pDocument->GetOriginalPageCount();
+ iPageIter++) {
+ CPDFXFA_Page* pPage = m_pDocument->GetXFAPageList()->GetAt(iPageIter);
if (!pPage)
continue;
- m_pSDKDoc->RemovePageView(pPage);
+ m_pDocument->GetSDKDoc()->RemovePageView(pPage);
pPage->SetXFAPageView(pXFADocView->GetPageView(iPageIter));
}
- int flag = (nNewCount < m_nPageCount) ? FXFA_PAGEVIEWEVENT_POSTREMOVED
- : FXFA_PAGEVIEWEVENT_POSTADDED;
- int count = FXSYS_abs(nNewCount - m_nPageCount);
- m_nPageCount = nNewCount;
- m_XFAPageList.SetSize(nNewCount);
+ int flag = (nNewCount < m_pDocument->GetOriginalPageCount())
+ ? FXFA_PAGEVIEWEVENT_POSTREMOVED
+ : FXFA_PAGEVIEWEVENT_POSTADDED;
+ int count = FXSYS_abs(nNewCount - m_pDocument->GetOriginalPageCount());
+ m_pDocument->SetOriginalPageCount(nNewCount);
pEnv->FFI_PageEvent(count, flag);
}
-void CPDFXFA_Document::WidgetPostAdd(CXFA_FFWidget* hWidget,
- CXFA_WidgetAcc* pWidgetData) {
- if (m_iDocType != DOCTYPE_DYNAMIC_XFA || !hWidget)
+void CPDFXFA_DocEnvironment::WidgetPostAdd(CXFA_FFWidget* hWidget,
+ CXFA_WidgetAcc* pWidgetData) {
+ if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || !hWidget)
return;
CXFA_FFPageView* pPageView = hWidget->GetPageView();
if (!pPageView)
return;
- CPDFXFA_Page* pXFAPage = GetPage(pPageView);
+ CPDFXFA_Page* pXFAPage = m_pDocument->GetPage(pPageView);
if (!pXFAPage)
return;
- m_pSDKDoc->GetPageView(pXFAPage, true)->AddAnnot(hWidget);
+ m_pDocument->GetSDKDoc()->GetPageView(pXFAPage, true)->AddAnnot(hWidget);
}
-void CPDFXFA_Document::WidgetPreRemove(CXFA_FFWidget* hWidget,
- CXFA_WidgetAcc* pWidgetData) {
- if (m_iDocType != DOCTYPE_DYNAMIC_XFA || !hWidget)
+void CPDFXFA_DocEnvironment::WidgetPreRemove(CXFA_FFWidget* hWidget,
+ CXFA_WidgetAcc* pWidgetData) {
+ if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || !hWidget)
return;
CXFA_FFPageView* pPageView = hWidget->GetPageView();
if (!pPageView)
return;
- CPDFXFA_Page* pXFAPage = GetPage(pPageView);
+ CPDFXFA_Page* pXFAPage = m_pDocument->GetPage(pPageView);
if (!pXFAPage)
return;
- CPDFSDK_PageView* pSdkPageView = m_pSDKDoc->GetPageView(pXFAPage, true);
+ CPDFSDK_PageView* pSdkPageView =
+ m_pDocument->GetSDKDoc()->GetPageView(pXFAPage, true);
if (CPDFSDK_Annot* pAnnot = pSdkPageView->GetAnnotByXFAWidget(hWidget))
pSdkPageView->DeleteAnnot(pAnnot);
}
-int32_t CPDFXFA_Document::CountPages(CXFA_FFDoc* hDoc) {
- if (hDoc == m_pXFADoc.get() && m_pSDKDoc)
- return GetPageCount();
+int32_t CPDFXFA_DocEnvironment::CountPages(CXFA_FFDoc* hDoc) {
+ if (hDoc == m_pDocument->GetXFADoc() && m_pDocument->GetSDKDoc())
+ return m_pDocument->GetPageCount();
return 0;
}
-int32_t CPDFXFA_Document::GetCurrentPage(CXFA_FFDoc* hDoc) {
- if (hDoc != m_pXFADoc.get() || !m_pSDKDoc)
+int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) {
+ if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc())
return -1;
- if (m_iDocType != DOCTYPE_DYNAMIC_XFA)
+ if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA)
return -1;
- CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
+ CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv();
if (!pEnv)
return -1;
return pEnv->FFI_GetCurrentPageIndex(this);
}
-void CPDFXFA_Document::SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) {
- if (hDoc != m_pXFADoc.get() || !m_pSDKDoc ||
- m_iDocType != DOCTYPE_DYNAMIC_XFA || iCurPage < 0 ||
- iCurPage >= m_pSDKDoc->GetPageCount()) {
+void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc,
+ int32_t iCurPage) {
+ if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc() ||
+ m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || iCurPage < 0 ||
+ iCurPage >= m_pDocument->GetSDKDoc()->GetPageCount()) {
return;
}
- CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
+ CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv();
if (!pEnv)
return;
pEnv->FFI_SetCurrentPage(this, iCurPage);
}
-FX_BOOL CPDFXFA_Document::IsCalculationsEnabled(CXFA_FFDoc* hDoc) {
- if (hDoc != m_pXFADoc.get() || !m_pSDKDoc)
+FX_BOOL CPDFXFA_DocEnvironment::IsCalculationsEnabled(CXFA_FFDoc* hDoc) {
+ if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc())
return FALSE;
- if (m_pSDKDoc->GetInterForm())
- return m_pSDKDoc->GetInterForm()->IsXfaCalculateEnabled();
+ if (m_pDocument->GetSDKDoc()->GetInterForm())
+ return m_pDocument->GetSDKDoc()->GetInterForm()->IsXfaCalculateEnabled();
return FALSE;
}
-void CPDFXFA_Document::SetCalculationsEnabled(CXFA_FFDoc* hDoc,
- FX_BOOL bEnabled) {
- if (hDoc != m_pXFADoc.get() || !m_pSDKDoc)
+void CPDFXFA_DocEnvironment::SetCalculationsEnabled(CXFA_FFDoc* hDoc,
+ FX_BOOL bEnabled) {
+ if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc())
return;
- if (m_pSDKDoc->GetInterForm())
- m_pSDKDoc->GetInterForm()->XfaEnableCalculate(bEnabled);
+ if (m_pDocument->GetSDKDoc()->GetInterForm())
+ m_pDocument->GetSDKDoc()->GetInterForm()->XfaEnableCalculate(bEnabled);
}
-void CPDFXFA_Document::GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) {
- if (hDoc != m_pXFADoc.get() || !m_pPDFDoc)
+void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc,
+ CFX_WideString& wsTitle) {
+ if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetPDFDoc())
return;
- CPDF_Dictionary* pInfoDict = m_pPDFDoc->GetInfo();
+ CPDF_Dictionary* pInfoDict = m_pDocument->GetPDFDoc()->GetInfo();
if (!pInfoDict)
return;
@@ -557,25 +391,26 @@ void CPDFXFA_Document::GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) {
csTitle.ReleaseBuffer(csTitle.GetLength());
}
-void CPDFXFA_Document::SetTitle(CXFA_FFDoc* hDoc,
- const CFX_WideString& wsTitle) {
- if (hDoc != m_pXFADoc.get() || !m_pPDFDoc)
+void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc,
+ const CFX_WideString& wsTitle) {
+ if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetPDFDoc())
return;
- if (CPDF_Dictionary* pInfoDict = m_pPDFDoc->GetInfo())
+ if (CPDF_Dictionary* pInfoDict = m_pDocument->GetPDFDoc()->GetInfo())
pInfoDict->SetAt("Title", new CPDF_String(wsTitle));
}
-void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc,
- const CFX_WideString& wsFilePath,
- FX_BOOL bXDP) {
- if (hDoc != m_pXFADoc.get())
+void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
+ const CFX_WideString& wsFilePath,
+ FX_BOOL bXDP) {
+ if (hDoc != m_pDocument->GetXFADoc())
return;
- if (m_iDocType != DOCTYPE_DYNAMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA)
+ if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
+ m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA)
return;
- CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
+ CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv();
if (!pEnv)
return;
@@ -602,13 +437,13 @@ void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc,
content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
fileWrite.WriteBlock(content.c_str(), fileWrite.GetSize(),
content.GetLength());
- m_pXFADocView->GetDoc()->SavePackage(XFA_HASHCODE_Data, &fileWrite,
- nullptr);
+ m_pDocument->GetXFADocView()->GetDoc()->SavePackage(XFA_HASHCODE_Data,
+ &fileWrite, nullptr);
} else if (fileType == FXFA_SAVEAS_XDP) {
- if (!m_pPDFDoc)
+ if (!m_pDocument->GetPDFDoc())
return;
- CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot();
+ CPDF_Dictionary* pRoot = m_pDocument->GetPDFDoc()->GetRoot();
if (!pRoot)
return;
@@ -633,13 +468,13 @@ void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc,
if (!pStream)
continue;
if (pPrePDFObj->GetString() == "form") {
- m_pXFADocView->GetDoc()->SavePackage(XFA_HASHCODE_Form, &fileWrite,
- nullptr);
+ m_pDocument->GetXFADocView()->GetDoc()->SavePackage(
+ XFA_HASHCODE_Form, &fileWrite, nullptr);
continue;
}
if (pPrePDFObj->GetString() == "datasets") {
- m_pXFADocView->GetDoc()->SavePackage(XFA_HASHCODE_Datasets, &fileWrite,
- nullptr);
+ m_pDocument->GetXFADocView()->GetDoc()->SavePackage(
+ XFA_HASHCODE_Datasets, &fileWrite, nullptr);
continue;
}
if (i == size - 1) {
@@ -664,16 +499,16 @@ void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc,
}
}
-void CPDFXFA_Document::GotoURL(CXFA_FFDoc* hDoc,
- const CFX_WideString& bsURL,
- FX_BOOL bAppend) {
- if (hDoc != m_pXFADoc.get())
+void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc,
+ const CFX_WideString& bsURL,
+ FX_BOOL bAppend) {
+ if (hDoc != m_pDocument->GetXFADoc())
return;
- if (m_iDocType != DOCTYPE_DYNAMIC_XFA)
+ if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA)
return;
- CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
+ CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv();
if (!pEnv)
return;
@@ -682,54 +517,55 @@ void CPDFXFA_Document::GotoURL(CXFA_FFDoc* hDoc,
pEnv->FFI_GotoURL(this, str, bAppend);
}
-FX_BOOL CPDFXFA_Document::IsValidationsEnabled(CXFA_FFDoc* hDoc) {
- if (hDoc != m_pXFADoc.get() || !m_pSDKDoc)
+FX_BOOL CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) {
+ if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc())
return FALSE;
- if (m_pSDKDoc->GetInterForm())
- return m_pSDKDoc->GetInterForm()->IsXfaValidationsEnabled();
+ if (m_pDocument->GetSDKDoc()->GetInterForm())
+ return m_pDocument->GetSDKDoc()->GetInterForm()->IsXfaValidationsEnabled();
return TRUE;
}
-void CPDFXFA_Document::SetValidationsEnabled(CXFA_FFDoc* hDoc,
- FX_BOOL bEnabled) {
- if (hDoc != m_pXFADoc.get() || !m_pSDKDoc)
+void CPDFXFA_DocEnvironment::SetValidationsEnabled(CXFA_FFDoc* hDoc,
+ FX_BOOL bEnabled) {
+ if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc())
return;
- if (m_pSDKDoc->GetInterForm())
- m_pSDKDoc->GetInterForm()->XfaSetValidationsEnabled(bEnabled);
+ if (m_pDocument->GetSDKDoc()->GetInterForm())
+ m_pDocument->GetSDKDoc()->GetInterForm()->XfaSetValidationsEnabled(
+ bEnabled);
}
-void CPDFXFA_Document::SetFocusWidget(CXFA_FFDoc* hDoc,
- CXFA_FFWidget* hWidget) {
- if (hDoc != m_pXFADoc.get())
+void CPDFXFA_DocEnvironment::SetFocusWidget(CXFA_FFDoc* hDoc,
+ CXFA_FFWidget* hWidget) {
+ if (hDoc != m_pDocument->GetXFADoc())
return;
if (!hWidget) {
- m_pSDKDoc->SetFocusAnnot(nullptr);
+ m_pDocument->GetSDKDoc()->SetFocusAnnot(nullptr);
return;
}
- int pageViewCount = m_pSDKDoc->GetPageViewCount();
+ int pageViewCount = m_pDocument->GetSDKDoc()->GetPageViewCount();
for (int i = 0; i < pageViewCount; i++) {
- CPDFSDK_PageView* pPageView = m_pSDKDoc->GetPageView(i);
+ CPDFSDK_PageView* pPageView = m_pDocument->GetSDKDoc()->GetPageView(i);
if (!pPageView)
continue;
CPDFSDK_Annot* pAnnot = pPageView->GetAnnotByXFAWidget(hWidget);
if (pAnnot) {
- m_pSDKDoc->SetFocusAnnot(pAnnot);
+ m_pDocument->GetSDKDoc()->SetFocusAnnot(pAnnot);
break;
}
}
}
-void CPDFXFA_Document::Print(CXFA_FFDoc* hDoc,
- int32_t nStartPage,
- int32_t nEndPage,
- uint32_t dwOptions) {
- if (hDoc != m_pXFADoc.get())
+void CPDFXFA_DocEnvironment::Print(CXFA_FFDoc* hDoc,
+ int32_t nStartPage,
+ int32_t nEndPage,
+ uint32_t dwOptions) {
+ if (hDoc != m_pDocument->GetXFADoc())
return;
- CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
+ CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv();
if (!pEnv || !pEnv->GetFormFillInfo() ||
!pEnv->GetFormFillInfo()->m_pJsPlatform ||
!pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print) {
@@ -744,11 +580,11 @@ void CPDFXFA_Document::Print(CXFA_FFDoc* hDoc,
dwOptions & XFA_PRINTOPT_PrintAnnot);
}
-FX_ARGB CPDFXFA_Document::GetHighlightColor(CXFA_FFDoc* hDoc) {
- if (hDoc != m_pXFADoc.get() || !m_pSDKDoc)
+FX_ARGB CPDFXFA_DocEnvironment::GetHighlightColor(CXFA_FFDoc* hDoc) {
+ if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc())
return 0;
- CPDFSDK_InterForm* pInterForm = m_pSDKDoc->GetInterForm();
+ CPDFSDK_InterForm* pInterForm = m_pDocument->GetSDKDoc()->GetInterForm();
if (!pInterForm)
return 0;
@@ -756,7 +592,7 @@ FX_ARGB CPDFXFA_Document::GetHighlightColor(CXFA_FFDoc* hDoc) {
pInterForm->GetHighlightColor(FPDF_FORMFIELD_XFA));
}
-FX_BOOL CPDFXFA_Document::NotifySubmit(FX_BOOL bPrevOrPost) {
+FX_BOOL CPDFXFA_DocEnvironment::NotifySubmit(FX_BOOL bPrevOrPost) {
if (bPrevOrPost)
return OnBeforeNotifySubmit();
@@ -764,19 +600,21 @@ FX_BOOL CPDFXFA_Document::NotifySubmit(FX_BOOL bPrevOrPost) {
return TRUE;
}
-FX_BOOL CPDFXFA_Document::OnBeforeNotifySubmit() {
- if (m_iDocType != DOCTYPE_DYNAMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA)
+FX_BOOL CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
+ if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
+ m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA)
return TRUE;
- if (!m_pXFADocView)
+ if (!m_pDocument->GetXFADocView())
return TRUE;
- CXFA_FFWidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler();
+ CXFA_FFWidgetHandler* pWidgetHandler =
+ m_pDocument->GetXFADocView()->GetWidgetHandler();
if (!pWidgetHandler)
return TRUE;
std::unique_ptr<CXFA_WidgetAccIterator> pWidgetAccIterator(
- m_pXFADocView->CreateWidgetAccIterator());
+ m_pDocument->GetXFADocView()->CreateWidgetAccIterator());
if (pWidgetAccIterator) {
CXFA_EventParam Param;
Param.m_eType = XFA_EVENT_PreSubmit;
@@ -784,7 +622,8 @@ FX_BOOL CPDFXFA_Document::OnBeforeNotifySubmit() {
pWidgetHandler->ProcessEvent(pWidgetAcc, &Param);
}
- pWidgetAccIterator.reset(m_pXFADocView->CreateWidgetAccIterator());
+ pWidgetAccIterator.reset(
+ m_pDocument->GetXFADocView()->CreateWidgetAccIterator());
if (!pWidgetAccIterator)
return TRUE;
@@ -793,7 +632,7 @@ FX_BOOL CPDFXFA_Document::OnBeforeNotifySubmit() {
while (pWidgetAcc) {
int fRet = pWidgetAcc->ProcessValidate(-1);
if (fRet == XFA_EVENTERROR_Error) {
- CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
+ CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv();
if (!pEnv)
return FALSE;
@@ -808,24 +647,26 @@ FX_BOOL CPDFXFA_Document::OnBeforeNotifySubmit() {
}
pWidgetAcc = pWidgetAccIterator->MoveToNext();
}
- m_pXFADocView->UpdateDocView();
+ m_pDocument->GetXFADocView()->UpdateDocView();
return TRUE;
}
-void CPDFXFA_Document::OnAfterNotifySubmit() {
- if (m_iDocType != DOCTYPE_DYNAMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA)
+void CPDFXFA_DocEnvironment::OnAfterNotifySubmit() {
+ if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
+ m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA)
return;
- if (!m_pXFADocView)
+ if (!m_pDocument->GetXFADocView())
return;
- CXFA_FFWidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler();
+ CXFA_FFWidgetHandler* pWidgetHandler =
+ m_pDocument->GetXFADocView()->GetWidgetHandler();
if (!pWidgetHandler)
return;
std::unique_ptr<CXFA_WidgetAccIterator> pWidgetAccIterator(
- m_pXFADocView->CreateWidgetAccIterator());
+ m_pDocument->GetXFADocView()->CreateWidgetAccIterator());
if (!pWidgetAccIterator)
return;
@@ -836,22 +677,24 @@ void CPDFXFA_Document::OnAfterNotifySubmit() {
pWidgetHandler->ProcessEvent(pWidgetAcc, &Param);
pWidgetAcc = pWidgetAccIterator->MoveToNext();
}
- m_pXFADocView->UpdateDocView();
+ m_pDocument->GetXFADocView()->UpdateDocView();
}
-FX_BOOL CPDFXFA_Document::SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) {
- if (!NotifySubmit(TRUE) || !m_pXFADocView)
+FX_BOOL CPDFXFA_DocEnvironment::SubmitData(CXFA_FFDoc* hDoc,
+ CXFA_Submit submit) {
+ if (!NotifySubmit(TRUE) || !m_pDocument->GetXFADocView())
return FALSE;
- m_pXFADocView->UpdateDocView();
+ m_pDocument->GetXFADocView()->UpdateDocView();
FX_BOOL ret = SubmitDataInternal(hDoc, submit);
NotifySubmit(FALSE);
return ret;
}
-IFX_FileRead* CPDFXFA_Document::OpenLinkedFile(CXFA_FFDoc* hDoc,
- const CFX_WideString& wsLink) {
- CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
+IFX_FileRead* CPDFXFA_DocEnvironment::OpenLinkedFile(
+ CXFA_FFDoc* hDoc,
+ const CFX_WideString& wsLink) {
+ CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv();
if (!pEnv)
return FALSE;
@@ -866,15 +709,15 @@ IFX_FileRead* CPDFXFA_Document::OpenLinkedFile(CXFA_FFDoc* hDoc,
return new CFPDF_FileStream(pFileHandler);
}
-FX_BOOL CPDFXFA_Document::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
- int fileType,
- FPDF_DWORD encodeType,
- FPDF_DWORD flag) {
- if (!m_pXFADocView)
+FX_BOOL CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
+ int fileType,
+ FPDF_DWORD encodeType,
+ FPDF_DWORD flag) {
+ if (!m_pDocument->GetXFADocView())
return FALSE;
CFX_ByteString content;
- CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
+ CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv();
if (!pEnv)
return FALSE;
@@ -882,7 +725,8 @@ FX_BOOL CPDFXFA_Document::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_pXFADoc->SavePackage(XFA_HASHCODE_Data, &fileStream, nullptr);
+ m_pDocument->GetXFADoc()->SavePackage(XFA_HASHCODE_Data, &fileStream,
+ nullptr);
return TRUE;
}
@@ -893,12 +737,12 @@ FX_BOOL CPDFXFA_Document::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
flag = FXFA_CONFIG | FXFA_TEMPLATE | FXFA_LOCALESET | FXFA_DATASETS |
FXFA_XMPMETA | FXFA_XFDF | FXFA_FORM;
}
- if (!m_pPDFDoc) {
+ if (!m_pDocument->GetPDFDoc()) {
fileStream.Flush();
return FALSE;
}
- CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot();
+ CPDF_Dictionary* pRoot = m_pDocument->GetPDFDoc()->GetRoot();
if (!pRoot) {
fileStream.Flush();
return FALSE;
@@ -943,9 +787,11 @@ FX_BOOL CPDFXFA_Document::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
if (pPrePDFObj->GetString() == "form" && !(flag & FXFA_FORM))
continue;
if (pPrePDFObj->GetString() == "form") {
- m_pXFADoc->SavePackage(XFA_HASHCODE_Form, &fileStream, nullptr);
+ m_pDocument->GetXFADoc()->SavePackage(XFA_HASHCODE_Form, &fileStream,
+ nullptr);
} else if (pPrePDFObj->GetString() == "datasets") {
- m_pXFADoc->SavePackage(XFA_HASHCODE_Datasets, &fileStream, nullptr);
+ m_pDocument->GetXFADoc()->SavePackage(XFA_HASHCODE_Datasets, &fileStream,
+ nullptr);
} else {
// PDF,creator.
}
@@ -953,13 +799,8 @@ FX_BOOL CPDFXFA_Document::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
return TRUE;
}
-void CPDFXFA_Document::ClearChangeMark() {
- if (m_pSDKDoc)
- m_pSDKDoc->ClearChangeMark();
-}
-
-void CPDFXFA_Document::ToXFAContentFlags(CFX_WideString csSrcContent,
- FPDF_DWORD& flag) {
+void CPDFXFA_DocEnvironment::ToXFAContentFlags(CFX_WideString csSrcContent,
+ FPDF_DWORD& flag) {
if (csSrcContent.Find(L" config ", 0) != -1)
flag |= FXFA_CONFIG;
if (csSrcContent.Find(L" template ", 0) != -1)
@@ -980,12 +821,12 @@ void CPDFXFA_Document::ToXFAContentFlags(CFX_WideString csSrcContent,
}
}
-FX_BOOL CPDFXFA_Document::MailToInfo(CFX_WideString& csURL,
- CFX_WideString& csToAddress,
- CFX_WideString& csCCAddress,
- CFX_WideString& csBCCAddress,
- CFX_WideString& csSubject,
- CFX_WideString& csMsg) {
+FX_BOOL CPDFXFA_DocEnvironment::MailToInfo(CFX_WideString& csURL,
+ CFX_WideString& csToAddress,
+ CFX_WideString& csCCAddress,
+ CFX_WideString& csBCCAddress,
+ CFX_WideString& csSubject,
+ CFX_WideString& csMsg) {
CFX_WideString srcURL = csURL;
srcURL.TrimLeft();
if (srcURL.Left(7).CompareNoCase(L"mailto:") != 0)
@@ -1045,9 +886,9 @@ FX_BOOL CPDFXFA_Document::MailToInfo(CFX_WideString& csURL,
return TRUE;
}
-FX_BOOL CPDFXFA_Document::SubmitDataInternal(CXFA_FFDoc* hDoc,
- CXFA_Submit submit) {
- CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
+FX_BOOL CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
+ CXFA_Submit submit) {
+ CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv();
if (!pEnv)
return FALSE;
@@ -1146,31 +987,37 @@ FX_BOOL CPDFXFA_Document::SubmitDataInternal(CXFA_FFDoc* hDoc,
return bRet;
}
-FX_BOOL CPDFXFA_Document::SetGlobalProperty(CXFA_FFDoc* hDoc,
- const CFX_ByteStringC& szPropName,
- CFXJSE_Value* pValue) {
- if (hDoc != m_pXFADoc.get())
+FX_BOOL CPDFXFA_DocEnvironment::SetGlobalProperty(
+ CXFA_FFDoc* hDoc,
+ const CFX_ByteStringC& szPropName,
+ CFXJSE_Value* pValue) {
+ if (hDoc != m_pDocument->GetXFADoc())
return FALSE;
- if (m_pSDKDoc && m_pSDKDoc->GetEnv()->GetJSRuntime())
- return m_pSDKDoc->GetEnv()->GetJSRuntime()->SetValueByName(szPropName,
- pValue);
+ if (m_pDocument->GetSDKDoc() &&
+ m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime())
+ return m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->SetValueByName(
+ szPropName, pValue);
return FALSE;
}
-FX_BOOL CPDFXFA_Document::GetGlobalProperty(CXFA_FFDoc* hDoc,
- const CFX_ByteStringC& szPropName,
- CFXJSE_Value* pValue) {
- if (hDoc != m_pXFADoc.get())
+FX_BOOL CPDFXFA_DocEnvironment::GetGlobalProperty(
+ CXFA_FFDoc* hDoc,
+ const CFX_ByteStringC& szPropName,
+ CFXJSE_Value* pValue) {
+ if (hDoc != m_pDocument->GetXFADoc())
return FALSE;
- if (!m_pSDKDoc || !m_pSDKDoc->GetEnv()->GetJSRuntime())
+ if (!m_pDocument->GetSDKDoc() ||
+ !m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime())
return FALSE;
if (!m_pJSContext) {
- m_pSDKDoc->GetEnv()->GetJSRuntime()->SetReaderDocument(m_pSDKDoc.get());
- m_pJSContext = m_pSDKDoc->GetEnv()->GetJSRuntime()->NewContext();
+ m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->SetReaderDocument(
+ m_pDocument->GetSDKDoc());
+ m_pJSContext =
+ m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->NewContext();
}
- return m_pSDKDoc->GetEnv()->GetJSRuntime()->GetValueByName(szPropName,
- pValue);
+ return m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->GetValueByName(
+ szPropName, pValue);
}
« no previous file with comments | « BUILD.gn ('k') | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698