diff options
author | dsinclair <dsinclair@chromium.org> | 2016-10-12 11:56:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-12 11:56:23 -0700 |
commit | 7cbe68e34257b460bfa3baf0ea68fd6d50e1bc77 (patch) | |
tree | cc439488801d7a3e72a56ecd88df600e12b8a948 /fpdfsdk/fpdfxfa | |
parent | 7cc6a32693a07210e036a8d7131232231ec0fdb3 (diff) | |
download | pdfium-7cbe68e34257b460bfa3baf0ea68fd6d50e1bc77.tar.xz |
Merge CPDFSDK_Document into CPDFSDK_FormFillEnvironment
This CL merges the CPDFSDK_Document and CPDFSDK_FormFillEnvironment classes
as they always existed and always pointed at each other.
Review-Url: https://codereview.chromium.org/2410893002
Diffstat (limited to 'fpdfsdk/fpdfxfa')
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp | 50 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_document.cpp | 7 |
2 files changed, 26 insertions, 31 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp index 3d40fb24e2..7e7ee50825 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp @@ -9,7 +9,6 @@ #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_stream_acc.h" #include "core/fpdfapi/parser/cpdf_string.h" -#include "fpdfsdk/cpdfsdk_document.h" #include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "fpdfsdk/cpdfsdk_pageview.h" @@ -47,7 +46,7 @@ CPDFXFA_DocEnvironment::~CPDFXFA_DocEnvironment() { void CPDFXFA_DocEnvironment::SetChangeMark(CXFA_FFDoc* hDoc) { if (hDoc == m_pDocument->GetXFADoc() && m_pDocument->GetFormFillEnv()) - m_pDocument->GetFormFillEnv()->GetSDKDocument()->SetChangeMark(); + m_pDocument->GetFormFillEnv()->SetChangeMark(); } void CPDFXFA_DocEnvironment::InvalidateRect(CXFA_FFPageView* pPageView, @@ -279,7 +278,7 @@ void CPDFXFA_DocEnvironment::PageViewEvent(CXFA_FFPageView* pPageView, if (!pPage) continue; - m_pDocument->GetFormFillEnv()->GetSDKDocument()->RemovePageView(pPage); + m_pDocument->GetFormFillEnv()->RemovePageView(pPage); pPage->SetXFAPageView(pXFADocView->GetPageView(iPageIter)); } @@ -305,7 +304,6 @@ void CPDFXFA_DocEnvironment::WidgetPostAdd(CXFA_FFWidget* hWidget, return; m_pDocument->GetFormFillEnv() - ->GetSDKDocument() ->GetPageView(pXFAPage, true) ->AddAnnot(hWidget); } @@ -324,8 +322,7 @@ void CPDFXFA_DocEnvironment::WidgetPreRemove(CXFA_FFWidget* hWidget, return; CPDFSDK_PageView* pSdkPageView = - m_pDocument->GetFormFillEnv()->GetSDKDocument()->GetPageView(pXFAPage, - true); + m_pDocument->GetFormFillEnv()->GetPageView(pXFAPage, true); if (CPDFSDK_Annot* pAnnot = pSdkPageView->GetAnnotByXFAWidget(hWidget)) pSdkPageView->DeleteAnnot(pAnnot); } @@ -353,8 +350,7 @@ 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()->GetSDKDocument()->GetPageCount()) { + iCurPage >= m_pDocument->GetFormFillEnv()->GetPageCount()) { return; } @@ -367,11 +363,11 @@ void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc, FX_BOOL CPDFXFA_DocEnvironment::IsCalculationsEnabled(CXFA_FFDoc* hDoc) { if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) return FALSE; - if (m_pDocument->GetFormFillEnv()->GetSDKDocument()->GetInterForm()) + if (m_pDocument->GetFormFillEnv()->GetInterForm()) { return m_pDocument->GetFormFillEnv() - ->GetSDKDocument() ->GetInterForm() ->IsXfaCalculateEnabled(); + } return FALSE; } @@ -379,11 +375,11 @@ void CPDFXFA_DocEnvironment::SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) { if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) return; - if (m_pDocument->GetFormFillEnv()->GetSDKDocument()->GetInterForm()) + if (m_pDocument->GetFormFillEnv()->GetInterForm()) { m_pDocument->GetFormFillEnv() - ->GetSDKDocument() ->GetInterForm() ->XfaEnableCalculate(bEnabled); + } } void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc, @@ -416,8 +412,9 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, return; if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA && - m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA) + m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA) { return; + } CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv(); if (!pFormFillEnv) @@ -427,8 +424,9 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, CFX_ByteString bs = wsFilePath.UTF16LE_Encode(); if (wsFilePath.IsEmpty()) { if (!pFormFillEnv->GetFormFillInfo() || - !pFormFillEnv->GetFormFillInfo()->m_pJsPlatform) + !pFormFillEnv->GetFormFillInfo()->m_pJsPlatform) { return; + } CFX_WideString filepath = pFormFillEnv->JS_fieldBrowse(); bs = filepath.UTF16LE_Encode(); @@ -528,11 +526,11 @@ void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc, FX_BOOL CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) { if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) return FALSE; - if (m_pDocument->GetFormFillEnv()->GetSDKDocument()->GetInterForm()) + if (m_pDocument->GetFormFillEnv()->GetInterForm()) { return m_pDocument->GetFormFillEnv() - ->GetSDKDocument() ->GetInterForm() ->IsXfaValidationsEnabled(); + } return TRUE; } @@ -540,11 +538,11 @@ void CPDFXFA_DocEnvironment::SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) { if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) return; - if (m_pDocument->GetFormFillEnv()->GetSDKDocument()->GetInterForm()) + if (m_pDocument->GetFormFillEnv()->GetInterForm()) { m_pDocument->GetFormFillEnv() - ->GetSDKDocument() ->GetInterForm() ->XfaSetValidationsEnabled(bEnabled); + } } void CPDFXFA_DocEnvironment::SetFocusWidget(CXFA_FFDoc* hDoc, @@ -554,21 +552,19 @@ void CPDFXFA_DocEnvironment::SetFocusWidget(CXFA_FFDoc* hDoc, if (!hWidget) { CPDFSDK_Annot::ObservedPtr pNull; - m_pDocument->GetFormFillEnv()->GetSDKDocument()->SetFocusAnnot(&pNull); + m_pDocument->GetFormFillEnv()->SetFocusAnnot(&pNull); return; } - int pageViewCount = - m_pDocument->GetFormFillEnv()->GetSDKDocument()->GetPageViewCount(); + int pageViewCount = m_pDocument->GetFormFillEnv()->GetPageViewCount(); for (int i = 0; i < pageViewCount; i++) { - CPDFSDK_PageView* pPageView = - m_pDocument->GetFormFillEnv()->GetSDKDocument()->GetPageView(i); + CPDFSDK_PageView* pPageView = m_pDocument->GetFormFillEnv()->GetPageView(i); if (!pPageView) continue; CPDFSDK_Annot::ObservedPtr pAnnot(pPageView->GetAnnotByXFAWidget(hWidget)); if (pAnnot) { - m_pDocument->GetFormFillEnv()->GetSDKDocument()->SetFocusAnnot(&pAnnot); + m_pDocument->GetFormFillEnv()->SetFocusAnnot(&pAnnot); break; } } @@ -600,8 +596,7 @@ FX_ARGB CPDFXFA_DocEnvironment::GetHighlightColor(CXFA_FFDoc* hDoc) { if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) return 0; - CPDFSDK_InterForm* pInterForm = - m_pDocument->GetFormFillEnv()->GetSDKDocument()->GetInterForm(); + CPDFSDK_InterForm* pInterForm = m_pDocument->GetFormFillEnv()->GetInterForm(); if (!pInterForm) return 0; @@ -619,8 +614,9 @@ 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) + m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA) { return TRUE; + } if (!m_pDocument->GetXFADocView()) return TRUE; diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp index 472779a6d4..c768b591ba 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp @@ -7,7 +7,6 @@ #include "fpdfsdk/fpdfxfa/cpdfxfa_document.h" #include "core/fpdfapi/parser/cpdf_document.h" -#include "fpdfsdk/cpdfsdk_document.h" #include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "fpdfsdk/cpdfsdk_pageview.h" @@ -44,10 +43,10 @@ CPDFXFA_Document::~CPDFXFA_Document() { m_nLoadStatus = FXFA_LOADSTATUS_CLOSING; if (m_pFormFillEnv) { - m_pFormFillEnv->GetSDKDocument()->ClearAllFocusedAnnots(); + m_pFormFillEnv->ClearAllFocusedAnnots(); // Once we're deleted the SDKDocument will point at a bad underlying // doc so we need to reset it ... - m_pFormFillEnv->GetSDKDocument()->ResetXFADocument(); + m_pFormFillEnv->ResetXFADocument(); m_pFormFillEnv = nullptr; } @@ -202,5 +201,5 @@ void CPDFXFA_Document::RemovePage(CPDFXFA_Page* page) { void CPDFXFA_Document::ClearChangeMark() { if (m_pFormFillEnv) - m_pFormFillEnv->GetSDKDocument()->ClearChangeMark(); + m_pFormFillEnv->ClearChangeMark(); } |