From a440bb3f11f42b7a22624e9771dd8d9c57075f06 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 14 Sep 2016 07:01:54 -0700 Subject: Split CPDFXFA_Document apart [DO NOT COMMIT] This CL renames IXFA_DocProvider to IXFA_DocEnvironment to better describe the purpose. Then, CPDFXFA_Document has all of the IXFA_DocEnvironment methods removed and placed in CPDFXFA_DocEnvironment. The CPDFXFA_Document then has a CPDFXFA_DocEnvironment. This splits the code related to the document apart from the XFA callback methods to work with that document. Review-Url: https://codereview.chromium.org/2328573002 --- xfa/fwl/basewidget/fwl_editimp.cpp | 9 ++++--- xfa/fxfa/app/xfa_ffapp.cpp | 8 +++--- xfa/fxfa/app/xfa_ffchoicelist.cpp | 2 +- xfa/fxfa/app/xfa_ffdoc.cpp | 4 +-- xfa/fxfa/app/xfa_ffdocview.cpp | 26 +++++++++---------- xfa/fxfa/app/xfa_fffield.cpp | 2 +- xfa/fxfa/app/xfa_ffnotify.cpp | 12 ++++----- xfa/fxfa/app/xfa_ffnotify.h | 2 +- xfa/fxfa/app/xfa_fftext.cpp | 2 +- xfa/fxfa/app/xfa_fftextedit.cpp | 4 +-- xfa/fxfa/app/xfa_ffwidget.cpp | 10 ++++---- xfa/fxfa/app/xfa_ffwidgetacc.cpp | 2 +- xfa/fxfa/app/xfa_ffwidgethandler.cpp | 10 ++++---- xfa/fxfa/app/xfa_fwladapter.cpp | 2 +- xfa/fxfa/include/fxfa.h | 6 ++--- xfa/fxfa/include/xfa_ffapp.h | 5 ++-- xfa/fxfa/include/xfa_ffdoc.h | 6 ++--- xfa/fxfa/parser/cscript_hostpseudomodel.cpp | 39 +++++++++++++++-------------- xfa/fxfa/parser/cxfa_scriptcontext.cpp | 8 +++--- 19 files changed, 81 insertions(+), 78 deletions(-) (limited to 'xfa') diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp index 104054f4e1..93f5dd8ac6 100644 --- a/xfa/fwl/basewidget/fwl_editimp.cpp +++ b/xfa/fwl/basewidget/fwl_editimp.cpp @@ -1640,8 +1640,9 @@ FX_BOOL FWL_ShowCaret(IFWL_Widget* pWidget, if (!pXFAWidget) return FALSE; - IXFA_DocProvider* pDocProvider = pXFAWidget->GetDoc()->GetDocProvider(); - if (!pDocProvider) + IXFA_DocEnvironment* pDocEnvironment = + pXFAWidget->GetDoc()->GetDocEnvironment(); + if (!pDocEnvironment) return FALSE; if (bVisible) { @@ -1649,10 +1650,10 @@ FX_BOOL FWL_ShowCaret(IFWL_Widget* pWidget, pXFAWidget->GetRotateMatrix(mt); CFX_RectF rt(*pRtAnchor); mt.TransformRect(rt); - pDocProvider->DisplayCaret(pXFAWidget, bVisible, &rt); + pDocEnvironment->DisplayCaret(pXFAWidget, bVisible, &rt); return TRUE; } - pDocProvider->DisplayCaret(pXFAWidget, bVisible, pRtAnchor); + pDocEnvironment->DisplayCaret(pXFAWidget, bVisible, pRtAnchor); return TRUE; } diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp index 18e2d76552..9e86c3aa68 100644 --- a/xfa/fxfa/app/xfa_ffapp.cpp +++ b/xfa/fxfa/app/xfa_ffapp.cpp @@ -96,20 +96,20 @@ CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() { return m_pDocHandler.get(); } -CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, +CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocEnvironment* pDocEnvironment, IFX_FileRead* pStream, FX_BOOL bTakeOverFile) { - std::unique_ptr pDoc(new CXFA_FFDoc(this, pProvider)); + std::unique_ptr pDoc(new CXFA_FFDoc(this, pDocEnvironment)); FX_BOOL bSuccess = pDoc->OpenDoc(pStream, bTakeOverFile); return bSuccess ? pDoc.release() : nullptr; } -CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, +CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocEnvironment* pDocEnvironment, CPDF_Document* pPDFDoc) { if (!pPDFDoc) return nullptr; - std::unique_ptr pDoc(new CXFA_FFDoc(this, pProvider)); + std::unique_ptr pDoc(new CXFA_FFDoc(this, pDocEnvironment)); FX_BOOL bSuccess = pDoc->OpenDoc(pPDFDoc); return bSuccess ? pDoc.release() : nullptr; } diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index e6cb1090ad..94090d6123 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -287,7 +287,7 @@ FX_BOOL CXFA_FFComboBox::OnRButtonUp(uint32_t dwFlags, if (!CXFA_FFField::OnRButtonUp(dwFlags, fx, fy)) return FALSE; - GetDoc()->GetDocProvider()->PopupMenu(this, CFX_PointF(fx, fy)); + GetDoc()->GetDocEnvironment()->PopupMenu(this, CFX_PointF(fx, fy)); return TRUE; } FX_BOOL CXFA_FFComboBox::OnKillFocus(CXFA_FFWidget* pNewWidget) { diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index 1aed9c640e..14c4f2d2b4 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -147,8 +147,8 @@ int32_t Base64DecodeW(const FX_WCHAR* pSrc, int32_t iSrcLen, uint8_t* pDst) { } // namespace -CXFA_FFDoc::CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocProvider* pDocProvider) - : m_pDocProvider(pDocProvider), +CXFA_FFDoc::CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocEnvironment* pDocEnvironment) + : m_pDocEnvironment(pDocEnvironment), m_pDocumentParser(nullptr), m_pStream(nullptr), m_pApp(pApp), diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index 0efdef6db1..7dff9d44f4 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -250,7 +250,7 @@ void CXFA_FFDocView::ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc) { } } if (bChanged) { - m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); + m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc); } } int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam, @@ -387,7 +387,7 @@ void CXFA_FFDocView::SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) { if (SetFocus(pNewFocus)) { m_pFocusAcc = pWidgetAcc; if (m_iStatus == XFA_DOCVIEW_LAYOUTSTATUS_End) { - m_pDoc->GetDocProvider()->SetFocusWidget(m_pDoc, m_pFocusWidget); + m_pDoc->GetDocEnvironment()->SetFocusWidget(m_pDoc, m_pFocusWidget); } } } @@ -412,7 +412,7 @@ static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView, return pWidgetAcc->ProcessCalculate(); case XFA_EVENT_Validate: if (((CXFA_FFDoc*)pDocView->GetDoc()) - ->GetDocProvider() + ->GetDocEnvironment() ->IsValidationsEnabled(pDocView->GetDoc())) { return pWidgetAcc->ProcessValidate(0x01); } @@ -526,7 +526,7 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( void CXFA_FFDocView::OnPageEvent(CXFA_ContainerLayoutItem* pSender, uint32_t dwEvent) { CXFA_FFPageView* pFFPageView = static_cast(pSender); - m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView, dwEvent); + m_pDoc->GetDocEnvironment()->PageViewEvent(pFFPageView, dwEvent); } void CXFA_FFDocView::LockUpdate() { @@ -560,7 +560,7 @@ void CXFA_FFDocView::AddInvalidateRect(CXFA_FFPageView* pPageView, void CXFA_FFDocView::RunInvalidate() { for (const auto& pair : m_mapPageInvalidate) - m_pDoc->GetDocProvider()->InvalidateRect(pair.first, *pair.second, 0); + m_pDoc->GetDocEnvironment()->InvalidateRect(pair.first, *pair.second, 0); m_mapPageInvalidate.clear(); } @@ -572,13 +572,13 @@ FX_BOOL CXFA_FFDocView::RunLayout() { m_pXFADocLayout->DoLayout(); UnlockUpdate(); m_bInLayoutStatus = FALSE; - m_pDoc->GetDocProvider()->PageViewEvent(nullptr, - XFA_PAGEVIEWEVENT_StopLayout); + m_pDoc->GetDocEnvironment()->PageViewEvent(nullptr, + XFA_PAGEVIEWEVENT_StopLayout); return TRUE; } m_bInLayoutStatus = FALSE; - m_pDoc->GetDocProvider()->PageViewEvent(nullptr, - XFA_PAGEVIEWEVENT_StopLayout); + m_pDoc->GetDocEnvironment()->PageViewEvent(nullptr, + XFA_PAGEVIEWEVENT_StopLayout); UnlockUpdate(); return FALSE; } @@ -671,7 +671,7 @@ void CXFA_FFDocView::RunCalculateRecursive(int32_t& iIndex) { } } int32_t CXFA_FFDocView::RunCalculateWidgets() { - if (!m_pDoc->GetDocProvider()->IsCalculationsEnabled(m_pDoc)) { + if (!m_pDoc->GetDocEnvironment()->IsCalculationsEnabled(m_pDoc)) { return XFA_EVENTERROR_Disabled; } int32_t iCounts = m_CalculateAccs.GetSize(); @@ -696,7 +696,7 @@ FX_BOOL CXFA_FFDocView::InitCalculate(CXFA_Node* pNode) { return TRUE; } FX_BOOL CXFA_FFDocView::InitValidate(CXFA_Node* pNode) { - if (!m_pDoc->GetDocProvider()->IsValidationsEnabled(m_pDoc)) { + if (!m_pDoc->GetDocEnvironment()->IsValidationsEnabled(m_pDoc)) { return FALSE; } ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Validate, FALSE, TRUE, nullptr); @@ -704,7 +704,7 @@ FX_BOOL CXFA_FFDocView::InitValidate(CXFA_Node* pNode) { return TRUE; } FX_BOOL CXFA_FFDocView::RunValidate() { - if (!m_pDoc->GetDocProvider()->IsValidationsEnabled(m_pDoc)) { + if (!m_pDoc->GetDocEnvironment()->IsValidationsEnabled(m_pDoc)) { return FALSE; } int32_t iCounts = m_ValidateAccs.GetSize(); @@ -798,7 +798,7 @@ void CXFA_FFDocView::SetChangeMark() { if (m_iStatus < XFA_DOCVIEW_LAYOUTSTATUS_End) { return; } - m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); + m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc); } CXFA_Node* CXFA_FFDocView::GetRootSubform() { CXFA_Node* pFormPacketNode = diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index 3274477005..b1a6b5f915 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -83,7 +83,7 @@ void CXFA_FFField::DrawHighlight(CFX_Graphics* pGS, if ((dwStatus & XFA_WidgetStatus_Highlight) && m_pDataAcc->GetAccess() == XFA_ATTRIBUTEENUM_Open) { CXFA_FFDoc* pDoc = GetDoc(); - CFX_Color crHighlight(pDoc->GetDocProvider()->GetHighlightColor(pDoc)); + CFX_Color crHighlight(pDoc->GetDocEnvironment()->GetHighlightColor(pDoc)); pGS->SetFillColor(&crHighlight); CFX_Path path; path.Create(); diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp index 09003f023c..859de5ca39 100644 --- a/xfa/fxfa/app/xfa_ffnotify.cpp +++ b/xfa/fxfa/app/xfa_ffnotify.cpp @@ -238,8 +238,8 @@ void CXFA_FFNotify::AddCalcValidate(CXFA_Node* pNode) { CXFA_FFDoc* CXFA_FFNotify::GetHDOC() { return m_pDoc; } -IXFA_DocProvider* CXFA_FFNotify::GetDocProvider() { - return m_pDoc->GetDocProvider(); +IXFA_DocEnvironment* CXFA_FFNotify::GetDocEnvironment() const { + return m_pDoc->GetDocEnvironment(); } IXFA_AppProvider* CXFA_FFNotify::GetAppProvider() { return m_pDoc->GetApp()->GetAppProvider(); @@ -444,7 +444,7 @@ void CXFA_FFNotify::OnChildAdded(CXFA_Node* pSender) { !(pDocView->m_bInLayoutStatus) && (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End); if (bLayoutReady) - m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); + m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc); } void CXFA_FFNotify::OnChildRemoved() { @@ -456,7 +456,7 @@ void CXFA_FFNotify::OnChildRemoved() { !(pDocView->m_bInLayoutStatus) && (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End); if (bLayoutReady) - m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); + m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc); } void CXFA_FFNotify::OnLayoutItemAdded(CXFA_LayoutProcessor* pLayout, @@ -480,7 +480,7 @@ void CXFA_FFNotify::OnLayoutItemAdded(CXFA_LayoutProcessor* pLayout, (dwStatus & (XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable)) == (XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable)) { pWidget->SetPageView(pNewPageView); - m_pDoc->GetDocProvider()->WidgetPostAdd(pWidget, pWidget->GetDataAcc()); + m_pDoc->GetDocEnvironment()->WidgetPostAdd(pWidget, pWidget->GetDataAcc()); } if (pDocView->GetLayoutStatus() != XFA_DOCVIEW_LAYOUTSTATUS_End || !(dwStatus & XFA_WidgetStatus_Visible)) { @@ -508,6 +508,6 @@ void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_LayoutProcessor* pLayout, return; pDocView->DeleteLayoutItem(pWidget); - m_pDoc->GetDocProvider()->WidgetPreRemove(pWidget, pWidget->GetDataAcc()); + m_pDoc->GetDocEnvironment()->WidgetPreRemove(pWidget, pWidget->GetDataAcc()); pWidget->AddInvalidateRect(nullptr); } diff --git a/xfa/fxfa/app/xfa_ffnotify.h b/xfa/fxfa/app/xfa_ffnotify.h index ef34afb7b8..fae683c29e 100644 --- a/xfa/fxfa/app/xfa_ffnotify.h +++ b/xfa/fxfa/app/xfa_ffnotify.h @@ -57,7 +57,7 @@ class CXFA_FFNotify { CXFA_WidgetAcc* pExclude = nullptr); void AddCalcValidate(CXFA_Node* pNode); CXFA_FFDoc* GetHDOC(); - IXFA_DocProvider* GetDocProvider(); + IXFA_DocEnvironment* GetDocEnvironment() const; IXFA_AppProvider* GetAppProvider(); CXFA_FFWidgetHandler* GetWidgetHandler(); CXFA_FFWidget* GetHWidget(CXFA_LayoutItem* pLayoutItem); diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp index 3e5b3df8e9..2e5bb6420d 100644 --- a/xfa/fxfa/app/xfa_fftext.cpp +++ b/xfa/fxfa/app/xfa_fftext.cpp @@ -135,7 +135,7 @@ FX_BOOL CXFA_FFText::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { return FALSE; } CXFA_FFDoc* pDoc = GetDoc(); - pDoc->GetDocProvider()->GotoURL(pDoc, wsURLContent, FALSE); + pDoc->GetDocEnvironment()->GotoURL(pDoc, wsURLContent, FALSE); return TRUE; } FWL_WidgetHit CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index 8418da4a81..1dc11adbef 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -146,7 +146,7 @@ FX_BOOL CXFA_FFTextEdit::OnRButtonUp(uint32_t dwFlags, if (!CXFA_FFField::OnRButtonUp(dwFlags, fx, fy)) return FALSE; - GetDoc()->GetDocProvider()->PopupMenu(this, CFX_PointF(fx, fy)); + GetDoc()->GetDocEnvironment()->PopupMenu(this, CFX_PointF(fx, fy)); return TRUE; } FX_BOOL CXFA_FFTextEdit::OnSetFocus(CXFA_FFWidget* pOldWidget) { @@ -772,7 +772,7 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(IFWL_Widget* pWidget, CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)m_pNormalWidget; pDateTime->SetEditText(wsDate); pDateTime->Update(); - GetDoc()->GetDocProvider()->SetFocusWidget(GetDoc(), nullptr); + GetDoc()->GetDocEnvironment()->SetFocusWidget(GetDoc(), nullptr); CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Change; eParam.m_pTarget = m_pDataAcc; diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index e8de02d7bd..d71783b275 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -153,11 +153,11 @@ void CXFA_FFWidget::InvalidateWidget(const CFX_RectF* pRect) { CFX_RectF rtWidget; GetBBox(rtWidget, XFA_WidgetStatus_Focused); rtWidget.Inflate(2, 2); - GetDoc()->GetDocProvider()->InvalidateRect(m_pPageView, rtWidget, - XFA_INVALIDATE_CurrentPage); + GetDoc()->GetDocEnvironment()->InvalidateRect(m_pPageView, rtWidget, + XFA_INVALIDATE_CurrentPage); } else { - GetDoc()->GetDocProvider()->InvalidateRect(m_pPageView, *pRect, - XFA_INVALIDATE_CurrentPage); + GetDoc()->GetDocEnvironment()->InvalidateRect(m_pPageView, *pRect, + XFA_INVALIDATE_CurrentPage); } } void CXFA_FFWidget::AddInvalidateRect(const CFX_RectF* pRect) { @@ -1083,7 +1083,7 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc, return pBitmap; } } - pImageFileRead = pDoc->GetDocProvider()->OpenLinkedFile(pDoc, wsURL); + pImageFileRead = pDoc->GetDocEnvironment()->OpenLinkedFile(pDoc, wsURL); } if (!pImageFileRead) { FX_Free(pImageBuffer); diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 075f2aa548..592074f916 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -334,7 +334,7 @@ int32_t CXFA_WidgetAcc::ProcessEvent(CXFA_Event& event, break; case XFA_Element::Submit: { CXFA_Submit submit = event.GetSubmit(); - return GetDoc()->GetDocProvider()->SubmitData(GetDoc(), submit); + return GetDoc()->GetDocEnvironment()->SubmitData(GetDoc(), submit); } default: break; diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/xfa/fxfa/app/xfa_ffwidgethandler.cpp index 7d3da448bf..1c8e5f793b 100644 --- a/xfa/fxfa/app/xfa_ffwidgethandler.cpp +++ b/xfa/fxfa/app/xfa_ffwidgethandler.cpp @@ -46,8 +46,8 @@ FX_BOOL CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget, hWidget->Rotate2Normal(fx, fy); FX_BOOL bRet = hWidget->OnLButtonDown(dwFlags, fx, fy); if (bRet && m_pDocView->SetFocus(hWidget)) { - m_pDocView->GetDoc()->GetDocProvider()->SetFocusWidget(m_pDocView->GetDoc(), - hWidget); + m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget( + m_pDocView->GetDoc(), hWidget); } m_pDocView->UnlockUpdate(); m_pDocView->UpdateDocView(); @@ -105,8 +105,8 @@ FX_BOOL CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget, hWidget->Rotate2Normal(fx, fy); FX_BOOL bRet = hWidget->OnRButtonDown(dwFlags, fx, fy); if (bRet && m_pDocView->SetFocus(hWidget)) { - m_pDocView->GetDoc()->GetDocProvider()->SetFocusWidget(m_pDocView->GetDoc(), - hWidget); + m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget( + m_pDocView->GetDoc(), hWidget); } m_pDocView->RunInvalidate(); return bRet; @@ -225,7 +225,7 @@ int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, case XFA_EVENT_Calculate: return pWidgetAcc->ProcessCalculate(); case XFA_EVENT_Validate: - if (m_pDocView->GetDoc()->GetDocProvider()->IsValidationsEnabled( + if (m_pDocView->GetDoc()->GetDocEnvironment()->IsValidationsEnabled( m_pDocView->GetDoc())) { return pWidgetAcc->ProcessValidate(); } diff --git a/xfa/fxfa/app/xfa_fwladapter.cpp b/xfa/fxfa/app/xfa_fwladapter.cpp index ea63d84dfb..b0b5f4bc32 100644 --- a/xfa/fxfa/app/xfa_fwladapter.cpp +++ b/xfa/fxfa/app/xfa_fwladapter.cpp @@ -38,7 +38,7 @@ FX_BOOL CXFA_FWLAdapterWidgetMgr::GetPopupPos(IFWL_Widget* pWidget, pFFWidget->GetRotateMatrix(mt); CFX_RectF rtRotateAnchor(rtAnchor); mt.TransformRect(rtRotateAnchor); - pFFWidget->GetDoc()->GetDocProvider()->GetPopupPos( + pFFWidget->GetDoc()->GetDocEnvironment()->GetPopupPos( pFFWidget, fMinHeight, fMaxHeight, rtRotateAnchor, rtPopup); return TRUE; } diff --git a/xfa/fxfa/include/fxfa.h b/xfa/fxfa/include/fxfa.h index e7579e23fd..fde8d0f6c6 100644 --- a/xfa/fxfa/include/fxfa.h +++ b/xfa/fxfa/include/fxfa.h @@ -21,7 +21,7 @@ class CXFA_NodeList; class CXFA_WidgetAcc; class IFWL_AdapterTimerMgr; class IXFA_AppProvider; -class IXFA_DocProvider; +class IXFA_DocEnvironment; class IXFA_WidgetAccIterator; class IXFA_WidgetIterator; @@ -291,9 +291,9 @@ class IXFA_AppProvider { virtual IFWL_AdapterTimerMgr* GetTimerMgr() = 0; }; -class IXFA_DocProvider { +class IXFA_DocEnvironment { public: - virtual ~IXFA_DocProvider() {} + virtual ~IXFA_DocEnvironment() {} virtual void SetChangeMark(CXFA_FFDoc* hDoc) = 0; virtual void InvalidateRect(CXFA_FFPageView* pPageView, diff --git a/xfa/fxfa/include/xfa_ffapp.h b/xfa/fxfa/include/xfa_ffapp.h index 90bfcc0240..8a60ce6195 100644 --- a/xfa/fxfa/include/xfa_ffapp.h +++ b/xfa/fxfa/include/xfa_ffapp.h @@ -42,10 +42,11 @@ class CXFA_FFApp { explicit CXFA_FFApp(IXFA_AppProvider* pProvider); ~CXFA_FFApp(); - CXFA_FFDoc* CreateDoc(IXFA_DocProvider* pProvider, + CXFA_FFDoc* CreateDoc(IXFA_DocEnvironment* pDocEnvironment, IFX_FileRead* pStream, FX_BOOL bTakeOverFile); - CXFA_FFDoc* CreateDoc(IXFA_DocProvider* pProvider, CPDF_Document* pPDFDoc); + CXFA_FFDoc* CreateDoc(IXFA_DocEnvironment* pDocEnvironment, + CPDF_Document* pPDFDoc); void SetDefaultFontMgr(std::unique_ptr pFontMgr); CXFA_FFDocHandler* GetDocHandler(); diff --git a/xfa/fxfa/include/xfa_ffdoc.h b/xfa/fxfa/include/xfa_ffdoc.h index ddbc0049f1..927301893b 100644 --- a/xfa/fxfa/include/xfa_ffdoc.h +++ b/xfa/fxfa/include/xfa_ffdoc.h @@ -27,9 +27,9 @@ struct FX_IMAGEDIB_AND_DPI { class CXFA_FFDoc { public: - CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocProvider* pDocProvider); + CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocEnvironment* pDocEnvironment); ~CXFA_FFDoc(); - IXFA_DocProvider* GetDocProvider() { return m_pDocProvider; } + IXFA_DocEnvironment* GetDocEnvironment() const { return m_pDocEnvironment; } uint32_t GetDocType(); int32_t StartLoad(); int32_t DoLoad(IFX_Pause* pPause = nullptr); @@ -54,7 +54,7 @@ class CXFA_FFDoc { FX_BOOL ImportData(IFX_FileRead* pStream, FX_BOOL bXDP = TRUE); protected: - IXFA_DocProvider* m_pDocProvider; + IXFA_DocEnvironment* const m_pDocEnvironment; std::unique_ptr m_pDocumentParser; IFX_FileRead* m_pStream; CXFA_FFApp* m_pApp; diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp index 15f175cd49..680defc0b6 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp @@ -65,11 +65,11 @@ void CScript_HostPseudoModel::CalculationsEnabled(CFXJSE_Value* pValue, } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { - pNotify->GetDocProvider()->SetCalculationsEnabled(hDoc, - pValue->ToBoolean()); + pNotify->GetDocEnvironment()->SetCalculationsEnabled(hDoc, + pValue->ToBoolean()); return; } - pValue->SetBoolean(pNotify->GetDocProvider()->IsCalculationsEnabled(hDoc)); + pValue->SetBoolean(pNotify->GetDocEnvironment()->IsCalculationsEnabled(hDoc)); } void CScript_HostPseudoModel::CurrentPage(CFXJSE_Value* pValue, @@ -81,10 +81,10 @@ void CScript_HostPseudoModel::CurrentPage(CFXJSE_Value* pValue, } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { - pNotify->GetDocProvider()->SetCurrentPage(hDoc, pValue->ToInteger()); + pNotify->GetDocEnvironment()->SetCurrentPage(hDoc, pValue->ToInteger()); return; } - pValue->SetInteger(pNotify->GetDocProvider()->GetCurrentPage(hDoc)); + pValue->SetInteger(pNotify->GetDocEnvironment()->GetCurrentPage(hDoc)); } void CScript_HostPseudoModel::Language(CFXJSE_Value* pValue, @@ -115,7 +115,7 @@ void CScript_HostPseudoModel::NumPages(CFXJSE_Value* pValue, ThrowException(XFA_IDS_UNABLE_SET_NUMPAGES); return; } - pValue->SetInteger(pNotify->GetDocProvider()->CountPages(hDoc)); + pValue->SetInteger(pNotify->GetDocEnvironment()->CountPages(hDoc)); } void CScript_HostPseudoModel::Platform(CFXJSE_Value* pValue, @@ -145,11 +145,11 @@ void CScript_HostPseudoModel::Title(CFXJSE_Value* pValue, } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { - pNotify->GetDocProvider()->SetTitle(hDoc, pValue->ToWideString()); + pNotify->GetDocEnvironment()->SetTitle(hDoc, pValue->ToWideString()); return; } CFX_WideString wsTitle; - pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle); + pNotify->GetDocEnvironment()->GetTitle(hDoc, wsTitle); pValue->SetString(FX_UTF8Encode(wsTitle).AsStringC()); } @@ -162,10 +162,11 @@ void CScript_HostPseudoModel::ValidationsEnabled(CFXJSE_Value* pValue, } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { - pNotify->GetDocProvider()->SetValidationsEnabled(hDoc, pValue->ToBoolean()); + pNotify->GetDocEnvironment()->SetValidationsEnabled(hDoc, + pValue->ToBoolean()); return; } - FX_BOOL bEnabled = pNotify->GetDocProvider()->IsValidationsEnabled(hDoc); + FX_BOOL bEnabled = pNotify->GetDocEnvironment()->IsValidationsEnabled(hDoc); pValue->SetBoolean(bEnabled); } void CScript_HostPseudoModel::Variation(CFXJSE_Value* pValue, @@ -238,7 +239,7 @@ void CScript_HostPseudoModel::GotoURL(CFXJSE_Arguments* pArguments) { CFX_ByteString bsURL = pArguments->GetUTF8String(0); wsURL = CFX_WideString::FromUTF8(bsURL.AsStringC()); } - pNotify->GetDocProvider()->GotoURL(hDoc, wsURL, TRUE); + pNotify->GetDocEnvironment()->GotoURL(hDoc, wsURL, TRUE); } void CScript_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { @@ -287,7 +288,7 @@ void CScript_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) { if (!hWidget) { return; } - pNotify->GetDocProvider()->SetFocusWidget(pNotify->GetHDOC(), hWidget); + pNotify->GetDocEnvironment()->SetFocusWidget(pNotify->GetHDOC(), hWidget); pNotify->OpenDropDownList(hWidget); } void CScript_HostPseudoModel::Response(CFXJSE_Arguments* pArguments) { @@ -626,7 +627,7 @@ void CScript_HostPseudoModel::Print(CFXJSE_Arguments* pArguments) { if (bPrintAnnot) { dwOptions |= XFA_PRINTOPT_PrintAnnot; } - pNotify->GetDocProvider()->Print(hDoc, nStartPage, nEndPage, dwOptions); + pNotify->GetDocEnvironment()->Print(hDoc, nStartPage, nEndPage, dwOptions); } void CScript_HostPseudoModel::ImportData(CFXJSE_Arguments* pArguments) { @@ -658,7 +659,7 @@ void CScript_HostPseudoModel::ExportData(CFXJSE_Arguments* pArguments) { if (iLength >= 2) { bXDP = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; } - pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath, bXDP); + pNotify->GetDocEnvironment()->ExportData(hDoc, wsFilePath, bXDP); } void CScript_HostPseudoModel::PageUp(CFXJSE_Arguments* pArguments) { @@ -667,13 +668,13 @@ void CScript_HostPseudoModel::PageUp(CFXJSE_Arguments* pArguments) { return; } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); + int32_t nCurPage = pNotify->GetDocEnvironment()->GetCurrentPage(hDoc); int32_t nNewPage = 0; if (nCurPage <= 1) { return; } nNewPage = nCurPage - 1; - pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage); + pNotify->GetDocEnvironment()->SetCurrentPage(hDoc, nNewPage); } void CScript_HostPseudoModel::PageDown(CFXJSE_Arguments* pArguments) { @@ -682,8 +683,8 @@ void CScript_HostPseudoModel::PageDown(CFXJSE_Arguments* pArguments) { return; } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); - int32_t nPageCount = pNotify->GetDocProvider()->CountPages(hDoc); + int32_t nCurPage = pNotify->GetDocEnvironment()->GetCurrentPage(hDoc); + int32_t nPageCount = pNotify->GetDocEnvironment()->CountPages(hDoc); if (!nPageCount || nCurPage == nPageCount) { return; } @@ -693,7 +694,7 @@ void CScript_HostPseudoModel::PageDown(CFXJSE_Arguments* pArguments) { } else { nNewPage = nCurPage + 1; } - pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage); + pNotify->GetDocEnvironment()->SetCurrentPage(hDoc, nNewPage); } void CScript_HostPseudoModel::CurrentDateTime(CFXJSE_Arguments* pArguments) { diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp index e91e350d32..22e24c5445 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp +++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp @@ -203,8 +203,8 @@ void CXFA_ScriptContext::GlobalPropertySetter(CFXJSE_Value* pObject, if (!pNotify) { return; } - pNotify->GetDocProvider()->SetGlobalProperty(pNotify->GetHDOC(), szPropName, - pValue); + pNotify->GetDocEnvironment()->SetGlobalProperty(pNotify->GetHDOC(), + szPropName, pValue); } FX_BOOL CXFA_ScriptContext::QueryNodeByFlag(CXFA_Node* refNode, const CFX_WideStringC& propname, @@ -279,8 +279,8 @@ void CXFA_ScriptContext::GlobalPropertyGetter(CFXJSE_Value* pObject, if (!pNotify) { return; } - pNotify->GetDocProvider()->GetGlobalProperty(pNotify->GetHDOC(), szPropName, - pValue); + pNotify->GetDocEnvironment()->GetGlobalProperty(pNotify->GetHDOC(), + szPropName, pValue); } void CXFA_ScriptContext::NormalPropertyGetter(CFXJSE_Value* pOriginalValue, const CFX_ByteStringC& szPropName, -- cgit v1.2.3