diff options
Diffstat (limited to 'xfa/fxfa')
27 files changed, 68 insertions, 57 deletions
diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp index 9837e0aa7b..76531cecdd 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp +++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp @@ -320,7 +320,7 @@ void CXFA_FFCheckButton::OnProcessEvent(CFWL_Event* pEvent) { m_pDocView->AddCalculateWidgetAcc(pFFExclGroup); pFFExclGroup->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); } - eParam.m_pTarget = m_pDataAcc; + eParam.m_pTarget = m_pDataAcc.Get(); m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); } else { SetFWLCheckState(m_pDataAcc->GetCheckState()); @@ -329,7 +329,7 @@ void CXFA_FFCheckButton::OnProcessEvent(CFWL_Event* pEvent) { eParam.m_pTarget = pFFExclGroup; pFFExclGroup->ProcessEvent(XFA_ATTRIBUTEENUM_Click, &eParam); } - eParam.m_pTarget = m_pDataAcc; + eParam.m_pTarget = m_pDataAcc.Get(); m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Click, &eParam); break; } diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index b191f838ce..e24e7f77b7 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -166,7 +166,7 @@ bool CXFA_FFListBox::UpdateFWLData() { void CXFA_FFListBox::OnSelectChanged(CFWL_Widget* pWidget) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Change; - eParam.m_pTarget = m_pDataAcc; + eParam.m_pTarget = m_pDataAcc.Get(); m_pDataAcc->GetValue(eParam.m_wsPrevText, XFA_VALUEPICTURE_Raw); auto* pListBox = ToListBox(m_pNormalWidget.get()); @@ -342,7 +342,7 @@ bool CXFA_FFComboBox::IsDataChanged() { void CXFA_FFComboBox::FWLEventSelChange(CXFA_EventParam* pParam) { pParam->m_eType = XFA_EVENT_Change; - pParam->m_pTarget = m_pDataAcc; + pParam->m_pTarget = m_pDataAcc.Get(); pParam->m_wsNewText = ToComboBox(m_pNormalWidget.get())->GetEditText(); m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, pParam); } @@ -514,14 +514,14 @@ void CXFA_FFComboBox::OnSelectChanged(CFWL_Widget* pWidget, bool bLButtonUp) { void CXFA_FFComboBox::OnPreOpen(CFWL_Widget* pWidget) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_PreOpen; - eParam.m_pTarget = m_pDataAcc; + eParam.m_pTarget = m_pDataAcc.Get(); m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_PreOpen, &eParam); } void CXFA_FFComboBox::OnPostOpen(CFWL_Widget* pWidget) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_PostOpen; - eParam.m_pTarget = m_pDataAcc; + eParam.m_pTarget = m_pDataAcc.Get(); m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_PostOpen, &eParam); } diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index 186f573182..425ba30843 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -639,14 +639,14 @@ bool CXFA_FFField::ProcessCommittedData() { return false; m_pDocView->SetChangeMark(); - m_pDocView->AddValidateWidget(m_pDataAcc); + m_pDocView->AddValidateWidget(m_pDataAcc.Get()); return true; } int32_t CXFA_FFField::CalculateOverride() { CXFA_WidgetAcc* pAcc = m_pDataAcc->GetExclGroup(); if (!pAcc) - return CalculateWidgetAcc(m_pDataAcc); + return CalculateWidgetAcc(m_pDataAcc.Get()); if (CalculateWidgetAcc(pAcc) == 0) return 0; @@ -745,26 +745,26 @@ void CXFA_FFField::OnProcessMessage(CFWL_Message* pMessage) {} void CXFA_FFField::OnProcessEvent(CFWL_Event* pEvent) { switch (pEvent->GetType()) { case CFWL_Event::Type::Mouse: { - CFWL_EventMouse* event = (CFWL_EventMouse*)pEvent; + CFWL_EventMouse* event = static_cast<CFWL_EventMouse*>(pEvent); if (event->m_dwCmd == FWL_MouseCommand::Enter) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_MouseEnter; - eParam.m_pTarget = m_pDataAcc; + eParam.m_pTarget = m_pDataAcc.Get(); m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_MouseEnter, &eParam); } else if (event->m_dwCmd == FWL_MouseCommand::Leave) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_MouseExit; - eParam.m_pTarget = m_pDataAcc; + eParam.m_pTarget = m_pDataAcc.Get(); m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_MouseExit, &eParam); } else if (event->m_dwCmd == FWL_MouseCommand::LeftButtonDown) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_MouseDown; - eParam.m_pTarget = m_pDataAcc; + eParam.m_pTarget = m_pDataAcc.Get(); m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_MouseDown, &eParam); } else if (event->m_dwCmd == FWL_MouseCommand::LeftButtonUp) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_MouseUp; - eParam.m_pTarget = m_pDataAcc; + eParam.m_pTarget = m_pDataAcc.Get(); m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_MouseUp, &eParam); } break; @@ -772,7 +772,7 @@ void CXFA_FFField::OnProcessEvent(CFWL_Event* pEvent) { case CFWL_Event::Type::Click: { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Click; - eParam.m_pTarget = m_pDataAcc; + eParam.m_pTarget = m_pDataAcc.Get(); m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Click, &eParam); break; } diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp index 475fa09eda..b07b625538 100644 --- a/xfa/fxfa/app/xfa_ffnotify.cpp +++ b/xfa/fxfa/app/xfa_ffnotify.cpp @@ -251,7 +251,7 @@ void CXFA_FFNotify::AddCalcValidate(CXFA_Node* pNode) { } CXFA_FFDoc* CXFA_FFNotify::GetHDOC() { - return m_pDoc; + return m_pDoc.Get(); } IXFA_DocEnvironment* CXFA_FFNotify::GetDocEnvironment() const { @@ -468,7 +468,7 @@ void CXFA_FFNotify::OnChildAdded(CXFA_Node* pSender) { !(pDocView->m_bInLayoutStatus) && (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End); if (bLayoutReady) - m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc); + m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc.Get()); } void CXFA_FFNotify::OnChildRemoved() { @@ -480,7 +480,7 @@ void CXFA_FFNotify::OnChildRemoved() { !(pDocView->m_bInLayoutStatus) && (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End); if (bLayoutReady) - m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc); + m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc.Get()); } void CXFA_FFNotify::OnLayoutItemAdded(CXFA_LayoutProcessor* pLayout, diff --git a/xfa/fxfa/app/xfa_ffnotify.h b/xfa/fxfa/app/xfa_ffnotify.h index c002ed4c15..930d3b6a90 100644 --- a/xfa/fxfa/app/xfa_ffnotify.h +++ b/xfa/fxfa/app/xfa_ffnotify.h @@ -71,7 +71,7 @@ class CXFA_FFNotify { void SetFocusWidgetNode(CXFA_Node* pNode); private: - CXFA_FFDoc* const m_pDoc; + CFX_UnownedPtr<CXFA_FFDoc> const m_pDoc; }; #endif // XFA_FXFA_APP_XFA_FFNOTIFY_H_ diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp index 9d9cf070b4..b596996b6c 100644 --- a/xfa/fxfa/app/xfa_ffpushbutton.cpp +++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp @@ -141,7 +141,7 @@ void CXFA_FFPushButton::LoadHighlightCaption() { if (m_pDataAcc->GetButtonRollover(wsRollover, bRichText)) { if (!m_pRollProvider) { m_pRollProvider = pdfium::MakeUnique<CXFA_TextProvider>( - m_pDataAcc, XFA_TEXTPROVIDERTYPE_Rollover); + m_pDataAcc.Get(), XFA_TEXTPROVIDERTYPE_Rollover); } m_pRolloverTextLayout = pdfium::MakeUnique<CXFA_TextLayout>(m_pRollProvider.get()); @@ -150,7 +150,7 @@ void CXFA_FFPushButton::LoadHighlightCaption() { if (m_pDataAcc->GetButtonDown(wsDown, bRichText)) { if (!m_pDownProvider) { m_pDownProvider = pdfium::MakeUnique<CXFA_TextProvider>( - m_pDataAcc, XFA_TEXTPROVIDERTYPE_Down); + m_pDataAcc.Get(), XFA_TEXTPROVIDERTYPE_Down); } m_pDownTextLayout = pdfium::MakeUnique<CXFA_TextLayout>(m_pDownProvider.get()); diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index a1030f538a..41305efcc8 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -307,7 +307,7 @@ void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget, CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Change; eParam.m_wsChange = wsChanged; - eParam.m_pTarget = m_pDataAcc; + eParam.m_pTarget = m_pDataAcc.Get(); eParam.m_wsPrevText = wsPrevText; CFWL_Edit* pEdit = static_cast<CFWL_Edit*>(m_pNormalWidget.get()); if (m_pDataAcc->GetUIType() == XFA_Element::DateTimeEdit) { @@ -328,7 +328,7 @@ void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget, void CXFA_FFTextEdit::OnTextFull(CFWL_Widget* pWidget) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Full; - eParam.m_pTarget = m_pDataAcc; + eParam.m_pTarget = m_pDataAcc.Get(); m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Full, &eParam); } @@ -450,7 +450,7 @@ bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget, m_pDataAcc->GetFracDigits(iFracs); CFX_WideString wsFormat; - CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(m_pDataAcc); + CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(m_pDataAcc.Get()); widgetValue.GetNumbericFormat(wsFormat, iLeads, iFracs); return widgetValue.ValidateNumericTemp(wsText, wsFormat, m_pDataAcc->GetLocal()); @@ -545,7 +545,7 @@ bool CXFA_FFDateTimeEdit::LoadWidget() { switch (value.GetChildValueClassID()) { case XFA_Element::Date: { if (!wsText.IsEmpty()) { - CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc); + CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc.Get()); CFX_DateTime date = lcValue.GetDate(); if (date.IsSet()) pWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay()); @@ -647,7 +647,7 @@ bool CXFA_FFDateTimeEdit::UpdateFWLData() { auto* normalWidget = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get()); normalWidget->SetEditText(wsText); if (IsFocused() && !wsText.IsEmpty()) { - CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc); + CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc.Get()); CFX_DateTime date = lcValue.GetDate(); if (lcValue.IsValid()) { if (date.IsSet()) @@ -690,7 +690,7 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget, CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Change; - eParam.m_pTarget = m_pDataAcc; + eParam.m_pTarget = m_pDataAcc.Get(); m_pDataAcc->GetValue(eParam.m_wsNewText, XFA_VALUEPICTURE_Raw); m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); } diff --git a/xfa/fxfa/app/xfa_fwltheme.h b/xfa/fxfa/app/xfa_fwltheme.h index 33ea8e80a5..7563c69ed9 100644 --- a/xfa/fxfa/app/xfa_fwltheme.h +++ b/xfa/fxfa/app/xfa_fwltheme.h @@ -61,7 +61,7 @@ class CXFA_FWLTheme final : public IFWL_ThemeProvider { std::unique_ptr<CFDE_TextOut> m_pTextOut; CFX_RetainPtr<CFGAS_GEFont> m_pCalendarFont; CFX_WideString m_wsResource; - CXFA_FFApp* const m_pApp; + CFX_UnownedPtr<CXFA_FFApp> const m_pApp; CFX_RectF m_Rect; }; diff --git a/xfa/fxfa/cxfa_ffapp.h b/xfa/fxfa/cxfa_ffapp.h index 1ae2073d82..0da4e79173 100644 --- a/xfa/fxfa/cxfa_ffapp.h +++ b/xfa/fxfa/cxfa_ffapp.h @@ -40,7 +40,7 @@ class CXFA_FFApp { CFGAS_FontMgr* GetFDEFontMgr(); CXFA_FWLTheme* GetFWLTheme(); - IXFA_AppProvider* GetAppProvider() const { return m_pProvider; } + IXFA_AppProvider* GetAppProvider() const { return m_pProvider.Get(); } const CFWL_App* GetFWLApp() const { return m_pFWLApp.get(); } IFWL_AdapterTimerMgr* GetTimerMgr() const; CXFA_FontMgr* GetXFAFontMgr() const; @@ -52,7 +52,7 @@ class CXFA_FFApp { private: std::unique_ptr<CXFA_FFDocHandler> m_pDocHandler; - IXFA_AppProvider* const m_pProvider; + CFX_UnownedPtr<IXFA_AppProvider> const m_pProvider; // The fonts stored in the font manager may have been created by the default // font manager. The GEFont::LoadFont call takes the manager as a param and diff --git a/xfa/fxfa/cxfa_ffpageview.cpp b/xfa/fxfa/cxfa_ffpageview.cpp index d027a83ce1..c83ffaea7e 100644 --- a/xfa/fxfa/cxfa_ffpageview.cpp +++ b/xfa/fxfa/cxfa_ffpageview.cpp @@ -115,7 +115,7 @@ CXFA_FFPageView::CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea) CXFA_FFPageView::~CXFA_FFPageView() {} CXFA_FFDocView* CXFA_FFPageView::GetDocView() const { - return m_pDocView; + return m_pDocView.Get(); } CFX_RectF CXFA_FFPageView::GetPageViewRect() const { diff --git a/xfa/fxfa/cxfa_ffpageview.h b/xfa/fxfa/cxfa_ffpageview.h index 01409f3403..f2451fbd26 100644 --- a/xfa/fxfa/cxfa_ffpageview.h +++ b/xfa/fxfa/cxfa_ffpageview.h @@ -31,7 +31,7 @@ class CXFA_FFPageView : public CXFA_ContainerLayoutItem { uint32_t dwWidgetFilter); protected: - CXFA_FFDocView* const m_pDocView; + CFX_UnownedPtr<CXFA_FFDocView> const m_pDocView; }; using CXFA_LayoutItemIterator = @@ -68,11 +68,11 @@ class CXFA_TabParam { void AppendTabParam(CXFA_TabParam* pParam); void ClearChildren(); - CXFA_FFWidget* GetWidget() { return m_pWidget; } + CXFA_FFWidget* GetWidget() const { return m_pWidget.Get(); } const std::vector<CXFA_FFWidget*>& GetChildren() const { return m_Children; } private: - CXFA_FFWidget* const m_pWidget; + CFX_UnownedPtr<CXFA_FFWidget> const m_pWidget; std::vector<CXFA_FFWidget*> m_Children; }; diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index 78bc5ed598..9de99255ab 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -98,7 +98,7 @@ CFX_RectF CXFA_FFWidget::GetBBox(uint32_t dwStatus, bool bDrawFocus) { } CXFA_WidgetAcc* CXFA_FFWidget::GetDataAcc() { - return m_pDataAcc; + return m_pDataAcc.Get(); } bool CXFA_FFWidget::GetToolTip(CFX_WideString& wsToolTip) { @@ -238,7 +238,7 @@ bool CXFA_FFWidget::OnSetFocus(CXFA_FFWidget* pOldWidget) { m_dwStatus |= XFA_WidgetStatus_Focused; CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Enter; - eParam.m_pTarget = m_pDataAcc; + eParam.m_pTarget = m_pDataAcc.Get(); m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Enter, &eParam); return true; } @@ -490,7 +490,7 @@ void CXFA_FFWidget::EventKillFocus() { } CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Exit; - eParam.m_pTarget = m_pDataAcc; + eParam.m_pTarget = m_pDataAcc.Get(); m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Exit, &eParam); } bool CXFA_FFWidget::IsButtonDown() { diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h index 2ca27c1303..b7bb123bda 100644 --- a/xfa/fxfa/cxfa_ffwidget.h +++ b/xfa/fxfa/cxfa_ffwidget.h @@ -185,7 +185,7 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { CXFA_FFDocView* m_pDocView; CXFA_FFPageView* m_pPageView; - CXFA_WidgetAcc* const m_pDataAcc; + CFX_UnownedPtr<CXFA_WidgetAcc> const m_pDataAcc; mutable CFX_RectF m_rtWidget; }; diff --git a/xfa/fxfa/cxfa_pdffontmgr.h b/xfa/fxfa/cxfa_pdffontmgr.h index d0a824067a..df8ab28e08 100644 --- a/xfa/fxfa/cxfa_pdffontmgr.h +++ b/xfa/fxfa/cxfa_pdffontmgr.h @@ -50,7 +50,7 @@ class CXFA_PDFFontMgr : public CFX_Observable<CXFA_PDFFontMgr> { const CFX_ByteString& bsDRFontName, bool bStrictMatch); - CXFA_FFDoc* const m_pDoc; + CFX_UnownedPtr<CXFA_FFDoc> const m_pDoc; std::map<CFX_RetainPtr<CFGAS_GEFont>, CPDF_Font*> m_FDE2PDFFont; std::map<CFX_ByteString, CFX_RetainPtr<CFGAS_GEFont>> m_FontMap; }; diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext.h b/xfa/fxfa/fm2js/cxfa_fm2jscontext.h index 0de3cc74b5..63fc0f42bd 100644 --- a/xfa/fxfa/fm2js/cxfa_fm2jscontext.h +++ b/xfa/fxfa/fm2js/cxfa_fm2jscontext.h @@ -434,7 +434,7 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { private: v8::Isolate* GetScriptRuntime() const { return m_pIsolate; } - CXFA_Document* GetDocument() const { return m_pDocument; } + CXFA_Document* GetDocument() const { return m_pDocument.Get(); } void ThrowNoDefaultPropertyException(const CFX_ByteStringC& name) const; void ThrowCompilerErrorException() const; @@ -449,7 +449,7 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { v8::Isolate* m_pIsolate; CFXJSE_Class* m_pFMClass; std::unique_ptr<CFXJSE_Value> m_pValue; - CXFA_Document* const m_pDocument; + CFX_UnownedPtr<CXFA_Document> const m_pDocument; }; #endif // XFA_FXFA_FM2JS_CXFA_FM2JSCONTEXT_H_ diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp index 693d4029a3..6e6a1086ff 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp @@ -368,7 +368,8 @@ void CScript_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) { if (!pDocLayout) return; - auto pArrayNodeList = pdfium::MakeUnique<CXFA_ArrayNodeList>(m_pDocument); + auto pArrayNodeList = + pdfium::MakeUnique<CXFA_ArrayNodeList>(m_pDocument.Get()); pArrayNodeList->SetArrayNodeList( GetObjArray(pDocLayout, iIndex, wsType, bOnPageArea)); pArguments->GetReturnValue()->SetObject( diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp index dda93a36fc..49a1f5857b 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp @@ -458,6 +458,8 @@ CXFA_DataExporter::CXFA_DataExporter(CXFA_Document* pDocument) ASSERT(m_pDocument); } +CXFA_DataExporter::~CXFA_DataExporter() {} + bool CXFA_DataExporter::Export( const CFX_RetainPtr<IFX_SeekableStream>& pWrite) { return Export(pWrite, m_pDocument->GetRoot(), 0, nullptr); diff --git a/xfa/fxfa/parser/cxfa_dataexporter.h b/xfa/fxfa/parser/cxfa_dataexporter.h index cd949be964..4c0d90af9e 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.h +++ b/xfa/fxfa/parser/cxfa_dataexporter.h @@ -18,6 +18,7 @@ class CFX_SeekableStreamProxy; class CXFA_DataExporter { public: explicit CXFA_DataExporter(CXFA_Document* pDocument); + ~CXFA_DataExporter(); bool Export(const CFX_RetainPtr<IFX_SeekableStream>& pWrite); bool Export(const CFX_RetainPtr<IFX_SeekableStream>& pWrite, @@ -31,7 +32,7 @@ class CXFA_DataExporter { uint32_t dwFlag, const char* pChecksum); - CXFA_Document* const m_pDocument; + CFX_UnownedPtr<CXFA_Document> const m_pDocument; }; #endif // XFA_FXFA_PARSER_CXFA_DATAEXPORTER_H_ diff --git a/xfa/fxfa/parser/cxfa_dataimporter.cpp b/xfa/fxfa/parser/cxfa_dataimporter.cpp index d83b92b08d..e4ae3d0796 100644 --- a/xfa/fxfa/parser/cxfa_dataimporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataimporter.cpp @@ -22,10 +22,12 @@ CXFA_DataImporter::CXFA_DataImporter(CXFA_Document* pDocument) ASSERT(m_pDocument); } +CXFA_DataImporter::~CXFA_DataImporter() {} + bool CXFA_DataImporter::ImportData( const CFX_RetainPtr<IFX_SeekableStream>& pDataDocument) { auto pDataDocumentParser = - pdfium::MakeUnique<CXFA_SimpleParser>(m_pDocument, false); + pdfium::MakeUnique<CXFA_SimpleParser>(m_pDocument.Get(), false); if (pDataDocumentParser->StartParse(pDataDocument, XFA_XDPPACKET_Datasets) != XFA_PARSESTATUS_Ready) { return false; diff --git a/xfa/fxfa/parser/cxfa_dataimporter.h b/xfa/fxfa/parser/cxfa_dataimporter.h index e76475cd1e..d3af1de517 100644 --- a/xfa/fxfa/parser/cxfa_dataimporter.h +++ b/xfa/fxfa/parser/cxfa_dataimporter.h @@ -8,6 +8,7 @@ #define XFA_FXFA_PARSER_CXFA_DATAIMPORTER_H_ #include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_system.h" class CXFA_Document; @@ -16,11 +17,12 @@ class IFX_SeekableStream; class CXFA_DataImporter { public: explicit CXFA_DataImporter(CXFA_Document* pDocument); + ~CXFA_DataImporter(); bool ImportData(const CFX_RetainPtr<IFX_SeekableStream>& pDataDocument); private: - CXFA_Document* const m_pDocument; + CFX_UnownedPtr<CXFA_Document> const m_pDocument; }; #endif // XFA_FXFA_PARSER_CXFA_DATAIMPORTER_H_ diff --git a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp index 0fbae9e368..765f8b2fe7 100644 --- a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp @@ -24,7 +24,7 @@ CXFA_LayoutProcessor::CXFA_LayoutProcessor(CXFA_Document* pDocument) CXFA_LayoutProcessor::~CXFA_LayoutProcessor() {} CXFA_Document* CXFA_LayoutProcessor::GetDocument() const { - return m_pDocument; + return m_pDocument.Get(); } int32_t CXFA_LayoutProcessor::StartLayout(bool bForceRestart) { diff --git a/xfa/fxfa/parser/cxfa_layoutprocessor.h b/xfa/fxfa/parser/cxfa_layoutprocessor.h index 5a48560f26..360a9df685 100644 --- a/xfa/fxfa/parser/cxfa_layoutprocessor.h +++ b/xfa/fxfa/parser/cxfa_layoutprocessor.h @@ -10,6 +10,7 @@ #include <memory> #include <vector> +#include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_system.h" class CXFA_ContainerLayoutItem; @@ -44,7 +45,7 @@ class CXFA_LayoutProcessor { private: bool IsNeedLayout(); - CXFA_Document* const m_pDocument; + CFX_UnownedPtr<CXFA_Document> const m_pDocument; std::unique_ptr<CXFA_ItemLayoutProcessor> m_pRootItemLayoutProcessor; std::unique_ptr<CXFA_LayoutPageMgr> m_pLayoutPageMgr; std::vector<CXFA_Node*> m_rgChangedContainers; diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index e7ec4cf890..2daa49e066 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -1040,7 +1040,7 @@ void CXFA_Node::Script_Som_ResolveNodeList(CFXJSE_Value* pValue, refNode = this; pScriptContext->ResolveObjects(refNode, wsExpression.AsStringC(), resoveNodeRS, dwFlag); - CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument); + CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument.Get()); if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { for (CXFA_Object* pObject : resoveNodeRS.objects) { if (pObject->IsNode()) @@ -1083,7 +1083,8 @@ void CXFA_Node::Script_TreeClass_Nodes(CFXJSE_Value* pValue, CFX_WideString wsMessage = L"Unable to set "; FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringC()); } else { - CXFA_AttachNodeList* pNodeList = new CXFA_AttachNodeList(m_pDocument, this); + CXFA_AttachNodeList* pNodeList = + new CXFA_AttachNodeList(m_pDocument.Get(), this); pValue->SetObject(pNodeList, pScriptContext->GetJseNormalClass()); } } @@ -1282,7 +1283,8 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { bIgnoreRoot = !!pArguments->GetInt32(1); if (iLength >= 3) bOverwrite = !!pArguments->GetInt32(2); - auto pParser = pdfium::MakeUnique<CXFA_SimpleParser>(m_pDocument, false); + auto pParser = + pdfium::MakeUnique<CXFA_SimpleParser>(m_pDocument.Get(), false); if (!pParser) return; CFX_XMLNode* pXMLNode = pParser->ParseXMLData(wsExpression); @@ -1524,7 +1526,7 @@ void CXFA_Node::Script_NodeClass_OneOfChild(CFXJSE_Value* pValue, void CXFA_Node::Script_ContainerClass_GetDelta(CFXJSE_Arguments* pArguments) {} void CXFA_Node::Script_ContainerClass_GetDeltas(CFXJSE_Arguments* pArguments) { - CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument); + CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument.Get()); pArguments->GetReturnValue()->SetObject( pFormNodes, m_pDocument->GetScriptContext()->GetJseNormalClass()); } @@ -3269,7 +3271,7 @@ void CXFA_Node::Script_Form_FormNodes(CFXJSE_Arguments* pArguments) { } std::vector<CXFA_Node*> formItems; - CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument); + CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument.Get()); pFormNodes->SetArrayNodeList(formItems); pArguments->GetReturnValue()->SetObject( pFormNodes, m_pDocument->GetScriptContext()->GetJseNormalClass()); diff --git a/xfa/fxfa/parser/cxfa_nodelocale.h b/xfa/fxfa/parser/cxfa_nodelocale.h index 2465650b47..e051bb6ac3 100644 --- a/xfa/fxfa/parser/cxfa_nodelocale.h +++ b/xfa/fxfa/parser/cxfa_nodelocale.h @@ -47,7 +47,7 @@ class CXFA_NodeLocale : public IFX_Locale { int index, bool bAbbr) const; - CXFA_Node* const m_pLocale; + CFX_UnownedPtr<CXFA_Node> const m_pLocale; }; #endif // XFA_FXFA_PARSER_CXFA_NODELOCALE_H_ diff --git a/xfa/fxfa/parser/cxfa_object.h b/xfa/fxfa/parser/cxfa_object.h index 9596453712..4f1850f14c 100644 --- a/xfa/fxfa/parser/cxfa_object.h +++ b/xfa/fxfa/parser/cxfa_object.h @@ -38,7 +38,7 @@ class CXFA_Object : public CFXJSE_HostObject { const CFX_WideStringC& elementName); ~CXFA_Object() override; - CXFA_Document* GetDocument() const { return m_pDocument; } + CXFA_Document* GetDocument() const { return m_pDocument.Get(); } XFA_ObjectType GetObjectType() const { return m_objectType; } bool IsNode() const { @@ -86,7 +86,7 @@ class CXFA_Object : public CFXJSE_HostObject { protected: void ThrowException(const wchar_t* str, ...) const; - CXFA_Document* const m_pDocument; + CFX_UnownedPtr<CXFA_Document> const m_pDocument; const XFA_ObjectType m_objectType; const XFA_Element m_elementType; diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp index cf6467e240..49da63eee3 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp +++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp @@ -150,7 +150,7 @@ bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, if (eScriptType == XFA_SCRIPTLANGTYPE_Formcalc) { if (!m_FM2JSContext) { m_FM2JSContext = pdfium::MakeUnique<CXFA_FM2JSContext>( - m_pIsolate, m_JsContext.get(), m_pDocument); + m_pIsolate, m_JsContext.get(), m_pDocument.Get()); } CFX_WideTextBuf wsJavaScript; if (!CXFA_FM2JSContext::Translate(wsScript, &wsJavaScript)) { diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.h b/xfa/fxfa/parser/cxfa_scriptcontext.h index d3a9609769..45e6897a4c 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.h +++ b/xfa/fxfa/parser/cxfa_scriptcontext.h @@ -92,7 +92,7 @@ class CXFA_ScriptContext { bool IsStrictScopeInJavaScript(); XFA_SCRIPTLANGTYPE GetType(); std::vector<CXFA_Node*>* GetUpObjectArray() { return &m_upObjectArray; } - CXFA_Document* GetDocument() const { return m_pDocument; } + CXFA_Document* GetDocument() const { return m_pDocument.Get(); } static CXFA_Object* ToObject(CFXJSE_Value* pValue, CFXJSE_Class* pClass); @@ -103,7 +103,7 @@ class CXFA_ScriptContext { void DefineJsClass(); void RemoveBuiltInObjs(CFXJSE_Context* pContext) const; - CXFA_Document* const m_pDocument; + CFX_UnownedPtr<CXFA_Document> const m_pDocument; std::unique_ptr<CFXJSE_Context> m_JsContext; v8::Isolate* m_pIsolate; CFXJSE_Class* m_pJsClass; |