From 414cc9c9676b01587010ec5475d495eef6e05ba3 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 23 Jan 2018 21:17:43 +0000 Subject: Remove GetWidgetAcc calls This CL removes the calls to CXFA_Node::GetWidgetAcc() as they redundantly return the node they were called upon. Change-Id: I46e66cf98137a1dee7cd3fa8bc7d379eb97fded5 Reviewed-on: https://pdfium-review.googlesource.com/23630 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- xfa/fxfa/cxfa_ffbarcode.cpp | 3 +- xfa/fxfa/cxfa_ffcheckbutton.cpp | 30 +++++++------- xfa/fxfa/cxfa_ffcombobox.cpp | 53 +++++++++++-------------- xfa/fxfa/cxfa_ffdatetimeedit.cpp | 22 +++++----- xfa/fxfa/cxfa_ffdocview.cpp | 8 ++-- xfa/fxfa/cxfa_fffield.cpp | 15 +++---- xfa/fxfa/cxfa_ffimage.cpp | 16 ++++---- xfa/fxfa/cxfa_ffimageedit.cpp | 13 +++--- xfa/fxfa/cxfa_fflistbox.cpp | 14 +++---- xfa/fxfa/cxfa_ffnotify.cpp | 45 +++++---------------- xfa/fxfa/cxfa_ffnotify.h | 3 -- xfa/fxfa/cxfa_ffnumericedit.cpp | 14 +++---- xfa/fxfa/cxfa_ffpasswordedit.cpp | 6 +-- xfa/fxfa/cxfa_ffpushbutton.cpp | 9 ++--- xfa/fxfa/cxfa_fftext.cpp | 8 ++-- xfa/fxfa/cxfa_fftextedit.cpp | 23 +++++------ xfa/fxfa/cxfa_fwltheme.cpp | 8 ++-- xfa/fxfa/cxfa_textprovider.cpp | 2 +- xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp | 5 ++- xfa/fxfa/parser/cxfa_node.cpp | 45 +++++++++------------ xfa/fxfa/parser/cxfa_node.h | 5 --- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 37 +++++++---------- 22 files changed, 158 insertions(+), 226 deletions(-) (limited to 'xfa') diff --git a/xfa/fxfa/cxfa_ffbarcode.cpp b/xfa/fxfa/cxfa_ffbarcode.cpp index 86b06185e4..ce3ca6b791 100644 --- a/xfa/fxfa/cxfa_ffbarcode.cpp +++ b/xfa/fxfa/cxfa_ffbarcode.cpp @@ -129,8 +129,7 @@ bool CXFA_FFBarcode::LoadWidget() { m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); - pFWLBarcode->SetText( - m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Display)); + pFWLBarcode->SetText(m_pNode->GetValue(XFA_VALUEPICTURE_Display)); UpdateWidgetProperty(); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp index a52bcb7d14..6902966470 100644 --- a/xfa/fxfa/cxfa_ffcheckbutton.cpp +++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp @@ -40,12 +40,12 @@ bool CXFA_FFCheckButton::LoadWidget() { m_pNormalWidget.get()); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); - if (m_pNode->GetWidgetAcc()->IsRadioButton()) + if (m_pNode->IsRadioButton()) pCheckBox->ModifyStylesEx(FWL_STYLEEXT_CKB_RadioButton, 0xFFFFFFFF); m_pNormalWidget->LockUpdate(); UpdateWidgetProperty(); - SetFWLCheckState(m_pNode->GetWidgetAcc()->GetCheckState()); + SetFWLCheckState(m_pNode->GetCheckState()); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); } @@ -55,9 +55,9 @@ void CXFA_FFCheckButton::UpdateWidgetProperty() { if (!pCheckBox) return; - pCheckBox->SetBoxSize(m_pNode->GetWidgetAcc()->GetCheckButtonSize()); + pCheckBox->SetBoxSize(m_pNode->GetCheckButtonSize()); uint32_t dwStyleEx = FWL_STYLEEXT_CKB_SignShapeCross; - switch (m_pNode->GetWidgetAcc()->GetCheckButtonMark()) { + switch (m_pNode->GetCheckButtonMark()) { case XFA_AttributeEnum::Check: dwStyleEx = FWL_STYLEEXT_CKB_SignShapeCheck; break; @@ -76,11 +76,11 @@ void CXFA_FFCheckButton::UpdateWidgetProperty() { dwStyleEx = FWL_STYLEEXT_CKB_SignShapeStar; break; default: { - if (m_pNode->GetWidgetAcc()->IsCheckButtonRound()) + if (m_pNode->IsCheckButtonRound()) dwStyleEx = FWL_STYLEEXT_CKB_SignShapeCircle; } break; } - if (m_pNode->GetWidgetAcc()->IsAllowNeutral()) + if (m_pNode->IsAllowNeutral()) dwStyleEx |= FWL_STYLEEXT_CKB_3State; pCheckBox->ModifyStylesEx( @@ -90,7 +90,7 @@ void CXFA_FFCheckButton::UpdateWidgetProperty() { bool CXFA_FFCheckButton::PerformLayout() { CXFA_FFWidget::PerformLayout(); - float fCheckSize = m_pNode->GetWidgetAcc()->GetCheckButtonSize(); + float fCheckSize = m_pNode->GetCheckButtonSize(); CXFA_Margin* margin = m_pNode->GetMarginIfExists(); CFX_RectF rtWidget = GetRectWithoutRotate(); if (margin) @@ -235,10 +235,9 @@ void CXFA_FFCheckButton::RenderWidget(CXFA_Graphics* pGS, CXFA_FFWidget::RenderWidget(pGS, mtRotate, dwStatus); DrawBorderWithFlag(pGS, m_pNode->GetUIBorder(), m_rtUI, mtRotate, - m_pNode->GetWidgetAcc()->IsCheckButtonRound()); + m_pNode->IsCheckButtonRound()); RenderCaption(pGS, &mtRotate); - DrawHighlight(pGS, &mtRotate, dwStatus, - m_pNode->GetWidgetAcc()->IsCheckButtonRound()); + DrawHighlight(pGS, &mtRotate, dwStatus, m_pNode->IsCheckButtonRound()); CFX_Matrix mt(1, 0, 0, 1, m_rtCheckBox.left, m_rtCheckBox.top); mt.Concat(mtRotate); GetApp()->GetFWLWidgetMgr()->OnDrawWidget(m_pNormalWidget.get(), pGS, mt); @@ -269,13 +268,13 @@ XFA_CHECKSTATE CXFA_FFCheckButton::FWLState2XFAState() { bool CXFA_FFCheckButton::CommitData() { XFA_CHECKSTATE eCheckState = FWLState2XFAState(); - m_pNode->GetWidgetAcc()->SetCheckState(eCheckState, true); + m_pNode->SetCheckState(eCheckState, true); return true; } bool CXFA_FFCheckButton::IsDataChanged() { XFA_CHECKSTATE eCheckState = FWLState2XFAState(); - return m_pNode->GetWidgetAcc()->GetCheckState() != eCheckState; + return m_pNode->GetCheckState() != eCheckState; } void CXFA_FFCheckButton::SetFWLCheckState(XFA_CHECKSTATE eCheckState) { @@ -291,7 +290,7 @@ bool CXFA_FFCheckButton::UpdateFWLData() { if (!m_pNormalWidget) return false; - XFA_CHECKSTATE eState = m_pNode->GetWidgetAcc()->GetCheckState(); + XFA_CHECKSTATE eState = m_pNode->GetCheckState(); SetFWLCheckState(eState); m_pNormalWidget->Update(); return true; @@ -307,8 +306,7 @@ void CXFA_FFCheckButton::OnProcessEvent(CFWL_Event* pEvent) { case CFWL_Event::Type::CheckStateChanged: { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Change; - eParam.m_wsNewText = - m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw); + eParam.m_wsNewText = m_pNode->GetValue(XFA_VALUEPICTURE_Raw); CXFA_Node* exclNode = m_pNode->GetExclGroupIfExists(); if (ProcessCommittedData()) { @@ -322,7 +320,7 @@ void CXFA_FFCheckButton::OnProcessEvent(CFWL_Event* pEvent) { eParam.m_pTarget = m_pNode.Get(); m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::Change, &eParam); } else { - SetFWLCheckState(m_pNode->GetWidgetAcc()->GetCheckState()); + SetFWLCheckState(m_pNode->GetCheckState()); } if (exclNode) { eParam.m_pTarget = exclNode; diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp index 7e9a855b16..45ba63ccf8 100644 --- a/xfa/fxfa/cxfa_ffcombobox.cpp +++ b/xfa/fxfa/cxfa_ffcombobox.cpp @@ -52,16 +52,14 @@ bool CXFA_FFComboBox::LoadWidget() { m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); - for (const auto& label : m_pNode->GetWidgetAcc()->GetChoiceListItems(false)) + for (const auto& label : m_pNode->GetChoiceListItems(false)) pComboBox->AddString(label.AsStringView()); - std::vector iSelArray = m_pNode->GetWidgetAcc()->GetSelectedItems(); - if (iSelArray.empty()) { - pComboBox->SetEditText( - m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw)); - } else { + std::vector iSelArray = m_pNode->GetSelectedItems(); + if (iSelArray.empty()) + pComboBox->SetEditText(m_pNode->GetValue(XFA_VALUEPICTURE_Raw)); + else pComboBox->SetCurSel(iSelArray.front()); - } UpdateWidgetProperty(); m_pNormalWidget->UnlockUpdate(); @@ -76,7 +74,7 @@ void CXFA_FFComboBox::UpdateWidgetProperty() { uint32_t dwExtendedStyle = 0; uint32_t dwEditStyles = FWL_STYLEEXT_EDT_ReadOnly; dwExtendedStyle |= UpdateUIProperty(); - if (m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry()) { + if (m_pNode->IsChoiceListAllowTextEntry()) { dwEditStyles &= ~FWL_STYLEEXT_EDT_ReadOnly; dwExtendedStyle |= FWL_STYLEEXT_CMB_DropDown; } @@ -87,7 +85,7 @@ void CXFA_FFComboBox::UpdateWidgetProperty() { dwExtendedStyle |= GetAlignment(); m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); - if (!m_pNode->GetWidgetAcc()->IsHorizontalScrollPolicyOff()) + if (!m_pNode->IsHorizontalScrollPolicyOff()) dwEditStyles |= FWL_STYLEEXT_EDT_AutoHScroll; pComboBox->EditModifyStylesEx(dwEditStyles, 0xFFFFFFFF); @@ -114,7 +112,7 @@ void CXFA_FFComboBox::OpenDropDownList() { } bool CXFA_FFComboBox::CommitData() { - return m_pNode->GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Raw, m_wsNewValue); + return m_pNode->SetValue(XFA_VALUEPICTURE_Raw, m_wsNewValue); } bool CXFA_FFComboBox::IsDataChanged() { @@ -124,11 +122,9 @@ bool CXFA_FFComboBox::IsDataChanged() { if (iCursel >= 0) { WideString wsSel = pFWLcombobox->GetTextByIndex(iCursel); if (wsSel == wsText) - wsText = m_pNode->GetWidgetAcc() - ->GetChoiceListItem(iCursel, true) - .value_or(L""); + wsText = m_pNode->GetChoiceListItem(iCursel, true).value_or(L""); } - if (m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw) == wsText) + if (m_pNode->GetValue(XFA_VALUEPICTURE_Raw) == wsText) return false; m_wsNewValue = wsText; @@ -187,35 +183,34 @@ bool CXFA_FFComboBox::UpdateFWLData() { if (!pComboBox) return false; - std::vector iSelArray = m_pNode->GetWidgetAcc()->GetSelectedItems(); + std::vector iSelArray = m_pNode->GetSelectedItems(); if (!iSelArray.empty()) { pComboBox->SetCurSel(iSelArray.front()); } else { pComboBox->SetCurSel(-1); - pComboBox->SetEditText( - m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw)); + pComboBox->SetEditText(m_pNode->GetValue(XFA_VALUEPICTURE_Raw)); } pComboBox->Update(); return true; } bool CXFA_FFComboBox::CanUndo() { - return m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry() && + return m_pNode->IsChoiceListAllowTextEntry() && ToComboBox(m_pNormalWidget.get())->EditCanUndo(); } bool CXFA_FFComboBox::CanRedo() { - return m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry() && + return m_pNode->IsChoiceListAllowTextEntry() && ToComboBox(m_pNormalWidget.get())->EditCanRedo(); } bool CXFA_FFComboBox::Undo() { - return m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry() && + return m_pNode->IsChoiceListAllowTextEntry() && ToComboBox(m_pNormalWidget.get())->EditUndo(); } bool CXFA_FFComboBox::Redo() { - return m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry() && + return m_pNode->IsChoiceListAllowTextEntry() && ToComboBox(m_pNormalWidget.get())->EditRedo(); } @@ -224,14 +219,12 @@ bool CXFA_FFComboBox::CanCopy() { } bool CXFA_FFComboBox::CanCut() { - return m_pNode->IsOpenAccess() && - m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry() && + return m_pNode->IsOpenAccess() && m_pNode->IsChoiceListAllowTextEntry() && ToComboBox(m_pNormalWidget.get())->EditCanCut(); } bool CXFA_FFComboBox::CanPaste() { - return m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry() && - m_pNode->IsOpenAccess(); + return m_pNode->IsChoiceListAllowTextEntry() && m_pNode->IsOpenAccess(); } bool CXFA_FFComboBox::CanSelectAll() { @@ -243,14 +236,14 @@ Optional CXFA_FFComboBox::Copy() { } Optional CXFA_FFComboBox::Cut() { - if (!m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry()) + if (!m_pNode->IsChoiceListAllowTextEntry()) return {}; return ToComboBox(m_pNormalWidget.get())->EditCut(); } bool CXFA_FFComboBox::Paste(const WideString& wsPaste) { - return m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry() && + return m_pNode->IsChoiceListAllowTextEntry() && ToComboBox(m_pNormalWidget.get())->EditPaste(wsPaste); } @@ -296,16 +289,16 @@ void CXFA_FFComboBox::DeleteItem(int32_t nIndex) { void CXFA_FFComboBox::OnTextChanged(CFWL_Widget* pWidget, const WideString& wsChanged) { CXFA_EventParam eParam; - eParam.m_wsPrevText = m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw); + eParam.m_wsPrevText = m_pNode->GetValue(XFA_VALUEPICTURE_Raw); eParam.m_wsChange = wsChanged; FWLEventSelChange(&eParam); } void CXFA_FFComboBox::OnSelectChanged(CFWL_Widget* pWidget, bool bLButtonUp) { CXFA_EventParam eParam; - eParam.m_wsPrevText = m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw); + eParam.m_wsPrevText = m_pNode->GetValue(XFA_VALUEPICTURE_Raw); FWLEventSelChange(&eParam); - if (m_pNode->GetWidgetAcc()->IsChoiceListCommitOnSelect() && bLButtonUp) + if (m_pNode->IsChoiceListCommitOnSelect() && bLButtonUp) m_pDocView->SetFocusNode(nullptr); } diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/cxfa_ffdatetimeedit.cpp index 8576e3938f..632924f1ab 100644 --- a/xfa/fxfa/cxfa_ffdatetimeedit.cpp +++ b/xfa/fxfa/cxfa_ffdatetimeedit.cpp @@ -49,8 +49,7 @@ bool CXFA_FFDateTimeEdit::LoadWidget() { m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); - WideString wsText = - m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Display); + WideString wsText = m_pNode->GetValue(XFA_VALUEPICTURE_Display); pWidget->SetEditText(wsText); CXFA_Value* value = m_pNode->GetFormValueIfExists(); @@ -85,14 +84,14 @@ void CXFA_FFDateTimeEdit::UpdateWidgetProperty() { m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); uint32_t dwEditStyles = 0; - Optional numCells = m_pNode->GetWidgetAcc()->GetNumberOfCells(); + Optional numCells = m_pNode->GetNumberOfCells(); if (numCells && *numCells > 0) { dwEditStyles |= FWL_STYLEEXT_EDT_CombText; pWidget->SetEditLimit(*numCells); } if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) dwEditStyles |= FWL_STYLEEXT_EDT_ReadOnly; - if (!m_pNode->GetWidgetAcc()->IsHorizontalScrollPolicyOff()) + if (!m_pNode->IsHorizontalScrollPolicyOff()) dwEditStyles |= FWL_STYLEEXT_EDT_AutoHScroll; pWidget->ModifyEditStylesEx(dwEditStyles, 0xFFFFFFFF); @@ -138,12 +137,10 @@ uint32_t CXFA_FFDateTimeEdit::GetAlignment() { bool CXFA_FFDateTimeEdit::CommitData() { auto* pPicker = static_cast(m_pNormalWidget.get()); - if (!m_pNode->GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Edit, - pPicker->GetEditText())) { + if (!m_pNode->SetValue(XFA_VALUEPICTURE_Edit, pPicker->GetEditText())) return false; - } - m_pNode->GetWidgetAcc()->UpdateUIDisplay(GetDoc()->GetDocView(), this); + m_pNode->UpdateUIDisplay(GetDoc()->GetDocView(), this); return true; } @@ -155,7 +152,7 @@ bool CXFA_FFDateTimeEdit::UpdateFWLData() { if (IsFocused()) eType = XFA_VALUEPICTURE_Edit; - WideString wsText = m_pNode->GetWidgetAcc()->GetValue(eType); + WideString wsText = m_pNode->GetValue(eType); auto* normalWidget = static_cast(m_pNormalWidget.get()); normalWidget->SetEditText(wsText); if (IsFocused() && !wsText.IsEmpty()) { @@ -176,15 +173,14 @@ bool CXFA_FFDateTimeEdit::IsDataChanged() { WideString wsText = static_cast(m_pNormalWidget.get())->GetEditText(); - return m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Edit) != wsText; + return m_pNode->GetValue(XFA_VALUEPICTURE_Edit) != wsText; } void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget, int32_t iYear, int32_t iMonth, int32_t iDay) { - WideString wsPicture = - m_pNode->GetWidgetAcc()->GetPictureContent(XFA_VALUEPICTURE_Edit); + WideString wsPicture = m_pNode->GetPictureContent(XFA_VALUEPICTURE_Edit); CXFA_LocaleValue date(XFA_VT_DATE, GetDoc()->GetXFADoc()->GetLocalMgr()); date.SetDate(CFX_DateTime(iYear, iMonth, iDay, 0, 0, 0, 0)); @@ -201,7 +197,7 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget, CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Change; eParam.m_pTarget = m_pNode.Get(); - eParam.m_wsNewText = m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw); + eParam.m_wsNewText = m_pNode->GetValue(XFA_VALUEPICTURE_Raw); m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::Change, &eParam); } diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp index 376f2d412d..5e3ef01e7c 100644 --- a/xfa/fxfa/cxfa_ffdocview.cpp +++ b/xfa/fxfa/cxfa_ffdocview.cpp @@ -210,8 +210,8 @@ bool CXFA_FFDocView::ResetSingleNodeData(CXFA_Node* pNode) { if (eType != XFA_Element::Field && eType != XFA_Element::ExclGroup) return false; - pNode->GetWidgetAcc()->ResetData(); - pNode->GetWidgetAcc()->UpdateUIDisplay(this, nullptr); + pNode->ResetData(); + pNode->UpdateUIDisplay(this, nullptr); CXFA_Validate* validate = pNode->GetValidateIfExists(); if (!validate) return true; @@ -630,7 +630,7 @@ void CXFA_FFDocView::RunBindItems() { XFA_RESOLVENODE_RS rs; pScriptContext->ResolveObjects(pWidgetNode, wsRef.AsStringView(), &rs, dwStyle, nullptr); - pWidgetNode->GetWidgetAcc()->DeleteItem(-1, false, false); + pWidgetNode->DeleteItem(-1, false, false); if (rs.dwFlags != XFA_ResolveNode_RSType_Nodes || rs.objects.empty()) continue; @@ -667,7 +667,7 @@ void CXFA_FFDocView::RunBindItems() { } else { wsLabel = wsValue; } - pWidgetNode->GetWidgetAcc()->InsertItem(wsLabel, wsValue, false); + pWidgetNode->InsertItem(wsLabel, wsValue, false); } } m_BindItems.clear(); diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp index 8ac287641d..05319b3dc9 100644 --- a/xfa/fxfa/cxfa_fffield.cpp +++ b/xfa/fxfa/cxfa_fffield.cpp @@ -126,7 +126,7 @@ bool CXFA_FFField::IsLoaded() { bool CXFA_FFField::LoadWidget() { SetFWLThemeProvider(); - m_pNode->GetWidgetAcc()->LoadCaption(GetDoc()); + m_pNode->LoadCaption(GetDoc()); PerformLayout(); return true; } @@ -212,8 +212,7 @@ void CXFA_FFField::CapPlacement() { XFA_RectWithoutMargin(m_rtCaption, margin); } - CXFA_TextLayout* pCapTextLayout = - m_pNode->GetWidgetAcc()->GetCaptionTextLayout(); + CXFA_TextLayout* pCapTextLayout = m_pNode->GetCaptionTextLayout(); if (fCapReserve <= 0 && pCapTextLayout) { CFX_SizeF minSize; CFX_SizeF maxSize; @@ -583,8 +582,7 @@ bool CXFA_FFField::PtInActiveRect(const CFX_PointF& point) { } void CXFA_FFField::LayoutCaption() { - CXFA_TextLayout* pCapTextLayout = - m_pNode->GetWidgetAcc()->GetCaptionTextLayout(); + CXFA_TextLayout* pCapTextLayout = m_pNode->GetCaptionTextLayout(); if (!pCapTextLayout) return; @@ -595,8 +593,7 @@ void CXFA_FFField::LayoutCaption() { } void CXFA_FFField::RenderCaption(CXFA_Graphics* pGS, CFX_Matrix* pMatrix) { - CXFA_TextLayout* pCapTextLayout = - m_pNode->GetWidgetAcc()->GetCaptionTextLayout(); + CXFA_TextLayout* pCapTextLayout = m_pNode->GetCaptionTextLayout(); if (!pCapTextLayout) return; @@ -640,7 +637,7 @@ int32_t CXFA_FFField::CalculateOverride() { if (CalculateNode(exclNode) == 0) return 0; - CXFA_Node* pNode = exclNode->GetWidgetAcc()->GetExclGroupFirstMember(); + CXFA_Node* pNode = exclNode->GetExclGroupFirstMember(); if (!pNode) return 1; @@ -650,7 +647,7 @@ int32_t CXFA_FFField::CalculateOverride() { if (CalculateNode(pNode) == 0) return 0; - pNode = pNode->GetWidgetAcc()->GetExclGroupNextMember(pNode); + pNode = pNode->GetExclGroupNextMember(pNode); } return 1; } diff --git a/xfa/fxfa/cxfa_ffimage.cpp b/xfa/fxfa/cxfa_ffimage.cpp index a5a2ee7464..da3b7b5c5b 100644 --- a/xfa/fxfa/cxfa_ffimage.cpp +++ b/xfa/fxfa/cxfa_ffimage.cpp @@ -23,20 +23,19 @@ CXFA_FFImage::~CXFA_FFImage() { } bool CXFA_FFImage::IsLoaded() { - return !!GetNode()->GetWidgetAcc()->GetImageImage(); + return !!GetNode()->GetImageImage(); } bool CXFA_FFImage::LoadWidget() { - if (GetNode()->GetWidgetAcc()->GetImageImage()) + if (GetNode()->GetImageImage()) return true; - return GetNode()->GetWidgetAcc()->LoadImageImage(GetDoc()) - ? CXFA_FFDraw::LoadWidget() - : false; + return GetNode()->LoadImageImage(GetDoc()) ? CXFA_FFDraw::LoadWidget() + : false; } void CXFA_FFImage::UnloadWidget() { - GetNode()->GetWidgetAcc()->SetImageImage(nullptr); + GetNode()->SetImageImage(nullptr); } void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS, @@ -50,8 +49,7 @@ void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS, CXFA_FFWidget::RenderWidget(pGS, mtRotate, dwStatus); - RetainPtr pDIBitmap = - GetNode()->GetWidgetAcc()->GetImageImage(); + RetainPtr pDIBitmap = GetNode()->GetImageImage(); if (!pDIBitmap) return; @@ -70,7 +68,7 @@ void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS, int32_t iImageXDpi = 0; int32_t iImageYDpi = 0; - m_pNode->GetWidgetAcc()->GetImageDpi(iImageXDpi, iImageYDpi); + m_pNode->GetImageDpi(iImageXDpi, iImageYDpi); auto* value = m_pNode->GetFormValueIfExists(); CXFA_Image* image = value ? value->GetImageIfExists() : nullptr; diff --git a/xfa/fxfa/cxfa_ffimageedit.cpp b/xfa/fxfa/cxfa_ffimageedit.cpp index 8b97c2b3be..df47493cca 100644 --- a/xfa/fxfa/cxfa_ffimageedit.cpp +++ b/xfa/fxfa/cxfa_ffimageedit.cpp @@ -45,14 +45,14 @@ bool CXFA_FFImageEdit::LoadWidget() { pPictureBox->SetDelegate(this); CXFA_FFField::LoadWidget(); - if (!m_pNode->GetWidgetAcc()->GetImageEditImage()) + if (!m_pNode->GetImageEditImage()) UpdateFWLData(); return true; } void CXFA_FFImageEdit::UnloadWidget() { - m_pNode->GetWidgetAcc()->SetImageEditImage(nullptr); + m_pNode->SetImageEditImage(nullptr); CXFA_FFField::UnloadWidget(); } @@ -68,8 +68,7 @@ void CXFA_FFImageEdit::RenderWidget(CXFA_Graphics* pGS, CXFA_FFWidget::RenderWidget(pGS, mtRotate, dwStatus); DrawBorder(pGS, m_pNode->GetUIBorder(), m_rtUI, mtRotate); RenderCaption(pGS, &mtRotate); - RetainPtr pDIBitmap = - m_pNode->GetWidgetAcc()->GetImageEditImage(); + RetainPtr pDIBitmap = m_pNode->GetImageEditImage(); if (!pDIBitmap) return; @@ -92,7 +91,7 @@ void CXFA_FFImageEdit::RenderWidget(CXFA_Graphics* pGS, int32_t iImageXDpi = 0; int32_t iImageYDpi = 0; - m_pNode->GetWidgetAcc()->GetImageEditDpi(iImageXDpi, iImageYDpi); + m_pNode->GetImageEditDpi(iImageXDpi, iImageYDpi); XFA_DrawImage(pGS, rtImage, mtRotate, pDIBitmap, iAspect, iImageXDpi, iImageYDpi, iHorzAlign, iVertAlign); } @@ -130,8 +129,8 @@ bool CXFA_FFImageEdit::CommitData() { } bool CXFA_FFImageEdit::UpdateFWLData() { - m_pNode->GetWidgetAcc()->SetImageEditImage(nullptr); - m_pNode->GetWidgetAcc()->LoadImageEditImage(GetDoc()); + m_pNode->SetImageEditImage(nullptr); + m_pNode->LoadImageEditImage(GetDoc()); return true; } diff --git a/xfa/fxfa/cxfa_fflistbox.cpp b/xfa/fxfa/cxfa_fflistbox.cpp index 64fb8e58a4..f4e7a5e6c4 100644 --- a/xfa/fxfa/cxfa_fflistbox.cpp +++ b/xfa/fxfa/cxfa_fflistbox.cpp @@ -53,16 +53,16 @@ bool CXFA_FFListBox::LoadWidget() { m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); - for (const auto& label : m_pNode->GetWidgetAcc()->GetChoiceListItems(false)) + for (const auto& label : m_pNode->GetChoiceListItems(false)) pListBox->AddString(label.AsStringView()); uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; - if (m_pNode->GetWidgetAcc()->IsChoiceListMultiSelect()) + if (m_pNode->IsChoiceListMultiSelect()) dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection; dwExtendedStyle |= GetAlignment(); m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); - for (int32_t selected : m_pNode->GetWidgetAcc()->GetSelectedItems()) + for (int32_t selected : m_pNode->GetSelectedItems()) pListBox->SetSelItem(pListBox->GetItem(nullptr, selected), true); m_pNormalWidget->UnlockUpdate(); @@ -84,12 +84,12 @@ bool CXFA_FFListBox::CommitData() { for (int32_t i = 0; i < iSels; ++i) iSelArray.push_back(pListBox->GetSelIndex(i)); - m_pNode->GetWidgetAcc()->SetSelectedItems(iSelArray, true, false, true); + m_pNode->SetSelectedItems(iSelArray, true, false, true); return true; } bool CXFA_FFListBox::IsDataChanged() { - std::vector iSelArray = m_pNode->GetWidgetAcc()->GetSelectedItems(); + std::vector iSelArray = m_pNode->GetSelectedItems(); int32_t iOldSels = pdfium::CollectionSize(iSelArray); auto* pListBox = ToListBox(m_pNormalWidget.get()); int32_t iSels = pListBox->CountSelItems(); @@ -135,7 +135,7 @@ bool CXFA_FFListBox::UpdateFWLData() { return false; auto* pListBox = ToListBox(m_pNormalWidget.get()); - std::vector iSelArray = m_pNode->GetWidgetAcc()->GetSelectedItems(); + std::vector iSelArray = m_pNode->GetSelectedItems(); std::vector selItemArray(iSelArray.size()); std::transform(iSelArray.begin(), iSelArray.end(), selItemArray.begin(), [pListBox](int32_t val) { return pListBox->GetSelItem(val); }); @@ -152,7 +152,7 @@ void CXFA_FFListBox::OnSelectChanged(CFWL_Widget* pWidget) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Change; eParam.m_pTarget = m_pNode.Get(); - eParam.m_wsPrevText = m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw); + eParam.m_wsPrevText = m_pNode->GetValue(XFA_VALUEPICTURE_Raw); auto* pListBox = ToListBox(m_pNormalWidget.get()); int32_t iSels = pListBox->CountSelItems(); diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp index 91d1a65997..3fd06a18be 100644 --- a/xfa/fxfa/cxfa_ffnotify.cpp +++ b/xfa/fxfa/cxfa_ffnotify.cpp @@ -71,9 +71,9 @@ void CXFA_FFNotify::OnWidgetListItemAdded(CXFA_Node* pSender, return; CXFA_FFWidget* pWidget = m_pDoc->GetDocView()->GetWidgetForNode(pSender); - for (; pWidget; pWidget = pSender->GetWidgetAcc()->GetNextWidget(pWidget)) { + for (; pWidget; pWidget = pSender->GetNextWidget(pWidget)) { if (pWidget->IsLoaded()) { - if (pSender->GetWidgetAcc()->IsListBox()) + if (pSender->IsListBox()) ToListBox(pWidget)->InsertItem(pLabel, iIndex); else ToComboBox(pWidget)->InsertItem(pLabel, iIndex); @@ -87,9 +87,9 @@ void CXFA_FFNotify::OnWidgetListItemRemoved(CXFA_Node* pSender, return; CXFA_FFWidget* pWidget = m_pDoc->GetDocView()->GetWidgetForNode(pSender); - for (; pWidget; pWidget = pSender->GetWidgetAcc()->GetNextWidget(pWidget)) { + for (; pWidget; pWidget = pSender->GetNextWidget(pWidget)) { if (pWidget->IsLoaded()) { - if (pSender->GetWidgetAcc()->IsListBox()) + if (pSender->IsListBox()) ToListBox(pWidget)->DeleteItem(iIndex); else ToComboBox(pWidget)->DeleteItem(iIndex); @@ -130,7 +130,7 @@ CXFA_ContentLayoutItem* CXFA_FFNotify::OnCreateContentLayoutItem( pWidget = new CXFA_FFCheckButton(pNode); break; case XFA_Element::ChoiceList: { - if (pNode->GetWidgetAcc()->IsListBox()) + if (pNode->IsListBox()) pWidget = new CXFA_FFListBox(pNode); else pWidget = new CXFA_FFComboBox(pNode); @@ -193,19 +193,7 @@ CXFA_ContentLayoutItem* CXFA_FFNotify::OnCreateContentLayoutItem( void CXFA_FFNotify::StartFieldDrawLayout(CXFA_Node* pItem, float& fCalcWidth, float& fCalcHeight) { - if (!pItem->GetWidgetAcc()) - return; - - pItem->GetWidgetAcc()->StartWidgetLayout(m_pDoc.Get(), fCalcWidth, - fCalcHeight); -} - -bool CXFA_FFNotify::FindSplitPos(CXFA_Node* pItem, - int32_t iBlockIndex, - float& fCalcHeightPos) { - return pItem->GetWidgetAcc() && - pItem->GetWidgetAcc()->FindSplitPos(m_pDoc->GetDocView(), iBlockIndex, - fCalcHeightPos); + pItem->StartWidgetLayout(m_pDoc.Get(), fCalcWidth, fCalcHeight); } bool CXFA_FFNotify::RunScript(CXFA_Script* script, CXFA_Node* item) { @@ -237,8 +225,6 @@ void CXFA_FFNotify::AddCalcValidate(CXFA_Node* pNode) { CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); if (!pDocView) return; - if (!pNode->GetWidgetAcc()) - return; pDocView->AddCalculateNode(pNode); pDocView->AddValidateNode(pNode); @@ -360,11 +346,9 @@ void CXFA_FFNotify::OnValueChanging(CXFA_Node* pSender, XFA_Attribute eAttr) { return; if (pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End) return; - if (!pSender->GetWidgetAcc()) - return; CXFA_FFWidget* pWidget = m_pDoc->GetDocView()->GetWidgetForNode(pSender); - for (; pWidget; pWidget = pSender->GetWidgetAcc()->GetNextWidget(pWidget)) { + for (; pWidget; pWidget = pSender->GetNextWidget(pWidget)) { if (pWidget->IsLoaded()) pWidget->AddInvalidateRect(); } @@ -386,15 +370,11 @@ void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender, XFA_Element eType = pParentNode->GetElementType(); bool bIsContainerNode = pParentNode->IsContainerNode(); - if (!pWidgetNode->GetWidgetAcc()) - return; - bool bUpdateProperty = false; pDocView->SetChangeMark(); switch (eType) { case XFA_Element::Caption: { - CXFA_TextLayout* pCapOut = - pWidgetNode->GetWidgetAcc()->GetCaptionTextLayout(); + CXFA_TextLayout* pCapOut = pWidgetNode->GetCaptionTextLayout(); if (!pCapOut) return; @@ -415,22 +395,19 @@ void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender, pDocView->AddCalculateNodeNotify(pSender); if (eType == XFA_Element::Value || bIsContainerNode) { if (bIsContainerNode) { - pWidgetNode->GetWidgetAcc()->UpdateUIDisplay(m_pDoc->GetDocView(), - nullptr); + pWidgetNode->UpdateUIDisplay(m_pDoc->GetDocView(), nullptr); pDocView->AddCalculateNode(pWidgetNode); pDocView->AddValidateNode(pWidgetNode); } else if (pWidgetNode->GetParent()->GetElementType() == XFA_Element::ExclGroup) { - pWidgetNode->GetWidgetAcc()->UpdateUIDisplay(m_pDoc->GetDocView(), - nullptr); + pWidgetNode->UpdateUIDisplay(m_pDoc->GetDocView(), nullptr); } return; } } CXFA_FFWidget* pWidget = m_pDoc->GetDocView()->GetWidgetForNode(pWidgetNode); - for (; pWidget; - pWidget = pWidgetNode->GetWidgetAcc()->GetNextWidget(pWidget)) { + for (; pWidget; pWidget = pWidgetNode->GetNextWidget(pWidget)) { if (!pWidget->IsLoaded()) continue; diff --git a/xfa/fxfa/cxfa_ffnotify.h b/xfa/fxfa/cxfa_ffnotify.h index 94d8ebd552..2395748328 100644 --- a/xfa/fxfa/cxfa_ffnotify.h +++ b/xfa/fxfa/cxfa_ffnotify.h @@ -51,9 +51,6 @@ class CXFA_FFNotify { void StartFieldDrawLayout(CXFA_Node* pItem, float& fCalcWidth, float& fCalcHeight); - bool FindSplitPos(CXFA_Node* pItem, - int32_t iBlockIndex, - float& fCalcHeightPos); bool RunScript(CXFA_Script* pScript, CXFA_Node* pFormItem); int32_t ExecEventByDeepFirst(CXFA_Node* pFormNode, XFA_EVENTTYPE eEventType, diff --git a/xfa/fxfa/cxfa_ffnumericedit.cpp b/xfa/fxfa/cxfa_ffnumericedit.cpp index b437bc2b2a..d0321e8ca5 100644 --- a/xfa/fxfa/cxfa_ffnumericedit.cpp +++ b/xfa/fxfa/cxfa_ffnumericedit.cpp @@ -36,7 +36,7 @@ bool CXFA_FFNumericEdit::LoadWidget() { m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); - pWidget->SetText(m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Display)); + pWidget->SetText(m_pNode->GetValue(XFA_VALUEPICTURE_Display)); UpdateWidgetProperty(); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); @@ -51,10 +51,10 @@ void CXFA_FFNumericEdit::UpdateWidgetProperty() { FWL_STYLEEXT_EDT_ShowScrollbarFocus | FWL_STYLEEXT_EDT_OuterScrollbar | FWL_STYLEEXT_EDT_Validate | FWL_STYLEEXT_EDT_Number; dwExtendedStyle |= UpdateUIProperty(); - if (!m_pNode->GetWidgetAcc()->IsHorizontalScrollPolicyOff()) + if (!m_pNode->IsHorizontalScrollPolicyOff()) dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll; - Optional numCells = m_pNode->GetWidgetAcc()->GetNumberOfCells(); + Optional numCells = m_pNode->GetNumberOfCells(); if (numCells && *numCells > 0) { dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText; pWidget->SetLimit(*numCells); @@ -76,16 +76,14 @@ void CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) { } bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget, WideString& wsText) { - WideString wsPattern = - m_pNode->GetWidgetAcc()->GetPictureContent(XFA_VALUEPICTURE_Edit); + WideString wsPattern = m_pNode->GetPictureContent(XFA_VALUEPICTURE_Edit); if (!wsPattern.IsEmpty()) return true; WideString wsFormat; CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(m_pNode.Get()); - widgetValue.GetNumericFormat(wsFormat, - m_pNode->GetWidgetAcc()->GetLeadDigits(), - m_pNode->GetWidgetAcc()->GetFracDigits()); + widgetValue.GetNumericFormat(wsFormat, m_pNode->GetLeadDigits(), + m_pNode->GetFracDigits()); return widgetValue.ValidateNumericTemp(wsText, wsFormat, m_pNode->GetLocale()); } diff --git a/xfa/fxfa/cxfa_ffpasswordedit.cpp b/xfa/fxfa/cxfa_ffpasswordedit.cpp index 15bd5faaae..4dc46c6dda 100644 --- a/xfa/fxfa/cxfa_ffpasswordedit.cpp +++ b/xfa/fxfa/cxfa_ffpasswordedit.cpp @@ -33,7 +33,7 @@ bool CXFA_FFPasswordEdit::LoadWidget() { m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); - pWidget->SetText(m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Display)); + pWidget->SetText(m_pNode->GetValue(XFA_VALUEPICTURE_Display)); UpdateWidgetProperty(); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); @@ -49,10 +49,10 @@ void CXFA_FFPasswordEdit::UpdateWidgetProperty() { FWL_STYLEEXT_EDT_Password; dwExtendedStyle |= UpdateUIProperty(); - WideString password = m_pNode->GetWidgetAcc()->GetPasswordChar(); + WideString password = m_pNode->GetPasswordChar(); if (!password.IsEmpty()) pWidget->SetAliasChar(password[0]); - if (!m_pNode->GetWidgetAcc()->IsHorizontalScrollPolicyOff()) + if (!m_pNode->IsHorizontalScrollPolicyOff()) dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll; if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly; diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp index d4d591f87a..d0611bbd8c 100644 --- a/xfa/fxfa/cxfa_ffpushbutton.cpp +++ b/xfa/fxfa/cxfa_ffpushbutton.cpp @@ -71,7 +71,7 @@ bool CXFA_FFPushButton::LoadWidget() { void CXFA_FFPushButton::UpdateWidgetProperty() { uint32_t dwStyleEx = 0; - switch (m_pNode->GetWidgetAcc()->GetButtonHighlight()) { + switch (m_pNode->GetButtonHighlight()) { case XFA_AttributeEnum::Inverted: dwStyleEx = XFA_FWL_PSBSTYLEEXT_HiliteInverted; break; @@ -141,7 +141,7 @@ void CXFA_FFPushButton::LoadHighlightCaption() { if (!caption || caption->IsHidden()) return; - if (m_pNode->GetWidgetAcc()->HasButtonRollover()) { + if (m_pNode->HasButtonRollover()) { if (!m_pRollProvider) { m_pRollProvider = pdfium::MakeUnique( m_pNode.Get(), XFA_TEXTPROVIDERTYPE_Rollover); @@ -150,7 +150,7 @@ void CXFA_FFPushButton::LoadHighlightCaption() { pdfium::MakeUnique(GetDoc(), m_pRollProvider.get()); } - if (m_pNode->GetWidgetAcc()->HasButtonDown()) { + if (m_pNode->HasButtonDown()) { if (!m_pDownProvider) { m_pDownProvider = pdfium::MakeUnique( m_pNode.Get(), XFA_TEXTPROVIDERTYPE_Down); @@ -171,8 +171,7 @@ void CXFA_FFPushButton::LayoutHighlightCaption() { void CXFA_FFPushButton::RenderHighlightCaption(CXFA_Graphics* pGS, CFX_Matrix* pMatrix) { - CXFA_TextLayout* pCapTextLayout = - m_pNode->GetWidgetAcc()->GetCaptionTextLayout(); + CXFA_TextLayout* pCapTextLayout = m_pNode->GetCaptionTextLayout(); CXFA_Caption* caption = m_pNode->GetCaptionIfExists(); if (!caption || !caption->IsVisible()) return; diff --git a/xfa/fxfa/cxfa_fftext.cpp b/xfa/fxfa/cxfa_fftext.cpp index 7ae3cb6f5c..702de64216 100644 --- a/xfa/fxfa/cxfa_fftext.cpp +++ b/xfa/fxfa/cxfa_fftext.cpp @@ -35,7 +35,7 @@ void CXFA_FFText::RenderWidget(CXFA_Graphics* pGS, CXFA_FFWidget::RenderWidget(pGS, mtRotate, dwStatus); - CXFA_TextLayout* pTextLayout = m_pNode->GetWidgetAcc()->GetTextLayout(); + CXFA_TextLayout* pTextLayout = m_pNode->GetTextLayout(); if (!pTextLayout) return; @@ -66,13 +66,13 @@ void CXFA_FFText::RenderWidget(CXFA_Graphics* pGS, } bool CXFA_FFText::IsLoaded() { - CXFA_TextLayout* pTextLayout = m_pNode->GetWidgetAcc()->GetTextLayout(); + CXFA_TextLayout* pTextLayout = m_pNode->GetTextLayout(); return pTextLayout && !pTextLayout->m_bHasBlock; } bool CXFA_FFText::PerformLayout() { CXFA_FFDraw::PerformLayout(); - CXFA_TextLayout* pTextLayout = m_pNode->GetWidgetAcc()->GetTextLayout(); + CXFA_TextLayout* pTextLayout = m_pNode->GetTextLayout(); if (!pTextLayout) return false; if (!pTextLayout->m_bHasBlock) @@ -139,7 +139,7 @@ FWL_WidgetHit CXFA_FFText::OnHitTest(const CFX_PointF& point) { } const wchar_t* CXFA_FFText::GetLinkURLAtPoint(const CFX_PointF& point) { - CXFA_TextLayout* pTextLayout = m_pNode->GetWidgetAcc()->GetTextLayout(); + CXFA_TextLayout* pTextLayout = m_pNode->GetTextLayout(); if (!pTextLayout) return nullptr; diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp index 89a7c90155..d3c6fa6ad6 100644 --- a/xfa/fxfa/cxfa_fftextedit.cpp +++ b/xfa/fxfa/cxfa_fftextedit.cpp @@ -57,8 +57,7 @@ bool CXFA_FFTextEdit::LoadWidget() { m_pNormalWidget->LockUpdate(); UpdateWidgetProperty(); - pFWLEdit->SetText( - m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Display)); + pFWLEdit->SetText(m_pNode->GetValue(XFA_VALUEPICTURE_Display)); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); } @@ -72,13 +71,13 @@ void CXFA_FFTextEdit::UpdateWidgetProperty() { uint32_t dwExtendedStyle = FWL_STYLEEXT_EDT_ShowScrollbarFocus | FWL_STYLEEXT_EDT_OuterScrollbar; dwExtendedStyle |= UpdateUIProperty(); - if (m_pNode->GetWidgetAcc()->IsMultiLine()) { + if (m_pNode->IsMultiLine()) { dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine | FWL_STYLEEXT_EDT_WantReturn; - if (!m_pNode->GetWidgetAcc()->IsVerticalScrollPolicyOff()) { + if (!m_pNode->IsVerticalScrollPolicyOff()) { dwStyle |= FWL_WGTSTYLE_VScroll; dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoVScroll; } - } else if (!m_pNode->GetWidgetAcc()->IsHorizontalScrollPolicyOff()) { + } else if (!m_pNode->IsHorizontalScrollPolicyOff()) { dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll; } if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) { @@ -88,11 +87,11 @@ void CXFA_FFTextEdit::UpdateWidgetProperty() { XFA_Element eType; int32_t iMaxChars; - std::tie(eType, iMaxChars) = m_pNode->GetWidgetAcc()->GetMaxChars(); + std::tie(eType, iMaxChars) = m_pNode->GetMaxChars(); if (eType == XFA_Element::ExData) iMaxChars = 0; - Optional numCells = m_pNode->GetWidgetAcc()->GetNumberOfCells(); + Optional numCells = m_pNode->GetNumberOfCells(); if (!numCells) { pWidget->SetLimit(iMaxChars); } else if (*numCells == 0) { @@ -184,8 +183,8 @@ bool CXFA_FFTextEdit::OnKillFocus(CXFA_FFWidget* pNewWidget) { bool CXFA_FFTextEdit::CommitData() { WideString wsText = static_cast(m_pNormalWidget.get())->GetText(); - if (m_pNode->GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Edit, wsText)) { - m_pNode->GetWidgetAcc()->UpdateUIDisplay(GetDoc()->GetDocView(), this); + if (m_pNode->SetValue(XFA_VALUEPICTURE_Edit, wsText)) { + m_pNode->UpdateUIDisplay(GetDoc()->GetDocView(), this); return true; } ValidateNumberField(wsText); @@ -260,10 +259,10 @@ bool CXFA_FFTextEdit::UpdateFWLData() { bool bUpdate = false; if (m_pNode->GetUIType() == XFA_Element::TextEdit && - !m_pNode->GetWidgetAcc()->GetNumberOfCells()) { + !m_pNode->GetNumberOfCells()) { XFA_Element elementType; int32_t iMaxChars; - std::tie(elementType, iMaxChars) = m_pNode->GetWidgetAcc()->GetMaxChars(); + std::tie(elementType, iMaxChars) = m_pNode->GetMaxChars(); if (elementType == XFA_Element::ExData) iMaxChars = eType == XFA_VALUEPICTURE_Edit ? iMaxChars : 0; if (pEdit->GetLimit() != iMaxChars) { @@ -279,7 +278,7 @@ bool CXFA_FFTextEdit::UpdateFWLData() { bUpdate = true; } - WideString wsText = m_pNode->GetWidgetAcc()->GetValue(eType); + WideString wsText = m_pNode->GetValue(eType); WideString wsOldText = pEdit->GetText(); if (wsText != wsOldText || (eType == XFA_VALUEPICTURE_Edit && bUpdate)) { pEdit->SetText(wsText); diff --git a/xfa/fxfa/cxfa_fwltheme.cpp b/xfa/fxfa/cxfa_fwltheme.cpp index c7c521ea66..0f41052d3b 100644 --- a/xfa/fxfa/cxfa_fwltheme.cpp +++ b/xfa/fxfa/cxfa_fwltheme.cpp @@ -133,7 +133,7 @@ void CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { m_pTextOut->SetStyles(pParams->m_dwTTOStyles); m_pTextOut->SetAlignment(pParams->m_iTTOAlign); - m_pTextOut->SetFont(pNode->GetWidgetAcc()->GetFDEFont(pWidget->GetDoc())); + m_pTextOut->SetFont(pNode->GetFDEFont(pWidget->GetDoc())); m_pTextOut->SetFontSize(pNode->GetFontSize()); m_pTextOut->SetTextColor(pNode->GetTextColor()); CFX_Matrix mtPart = pParams->m_matrix; @@ -157,7 +157,7 @@ CFX_RectF CXFA_FWLTheme::GetUIMargin(CFWL_ThemePart* pThemePart) const { CXFA_Para* para = pNode->GetParaIfExists(); if (para) { rect.left += para->GetMarginLeft(); - if (pNode->GetWidgetAcc()->IsMultiLine()) + if (pNode->IsMultiLine()) rect.width += para->GetMarginRight(); } if (!pItem->GetPrev()) { @@ -189,7 +189,7 @@ float CXFA_FWLTheme::GetFontSize(CFWL_ThemePart* pThemePart) const { RetainPtr CXFA_FWLTheme::GetFont( CFWL_ThemePart* pThemePart) const { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) - return pWidget->GetNode()->GetWidgetAcc()->GetFDEFont(pWidget->GetDoc()); + return pWidget->GetNode()->GetFDEFont(pWidget->GetDoc()); return GetTheme(pThemePart->m_pWidget)->GetFont(); } @@ -240,7 +240,7 @@ void CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { return; CXFA_Node* pNode = pWidget->GetNode(); - m_pTextOut->SetFont(pNode->GetWidgetAcc()->GetFDEFont(pWidget->GetDoc())); + m_pTextOut->SetFont(pNode->GetFDEFont(pWidget->GetDoc())); m_pTextOut->SetFontSize(pNode->GetFontSize()); m_pTextOut->SetTextColor(pNode->GetTextColor()); if (!pParams) diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp index d1f9256d34..0d3c777154 100644 --- a/xfa/fxfa/cxfa_textprovider.cpp +++ b/xfa/fxfa/cxfa_textprovider.cpp @@ -164,6 +164,6 @@ bool CXFA_TextProvider::GetEmbbedObj(bool bURI, if (!pIDNode || !pIDNode->IsWidgetReady()) return false; - wsValue = pIDNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Display); + wsValue = pIDNode->GetValue(XFA_VALUEPICTURE_Display); return true; } diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp index 434d7ed892..98e3234e40 100644 --- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp @@ -15,6 +15,7 @@ #include "third_party/base/logging.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" +#include "xfa/fxfa/cxfa_ffdoc.h" #include "xfa/fxfa/cxfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_containerlayoutitem.h" #include "xfa/fxfa/parser/cxfa_contentlayoutitem.h" @@ -1015,8 +1016,8 @@ bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem, bChanged = false; { float fRelSplitPos = *fProposedSplitPos - fCurVerticalOffset; - if (pNotify->FindSplitPos(pFormNode, pLayoutItem->GetIndex(), - fRelSplitPos)) { + if (pFormNode->FindSplitPos(pNotify->GetHDOC()->GetDocView(), + pLayoutItem->GetIndex(), fRelSplitPos)) { bAnyChanged = true; bChanged = true; *fProposedSplitPos = fCurVerticalOffset + fRelSplitPos; diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 988d1e2ee5..46342a883d 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -1038,35 +1038,30 @@ CXFA_Node* CXFA_Node::GetContainerNode() { return nullptr; if (eType == XFA_Element::Field) { - CXFA_Node* pFieldWidgetAcc = GetWidgetAcc(); - if (pFieldWidgetAcc && pFieldWidgetAcc->IsChoiceListMultiSelect()) + if (IsChoiceListMultiSelect()) return nullptr; - WideString wsPicture; - if (pFieldWidgetAcc) { - wsPicture = pFieldWidgetAcc->GetPictureContent(XFA_VALUEPICTURE_DataBind); - } + WideString wsPicture = GetPictureContent(XFA_VALUEPICTURE_DataBind); if (!wsPicture.IsEmpty()) return this; CXFA_Node* pDataNode = GetBindData(); if (!pDataNode) return nullptr; - pFieldWidgetAcc = nullptr; + + CXFA_Node* pFieldNode = nullptr; for (const auto& pFormNode : *(pDataNode->GetBindItems())) { if (!pFormNode || pFormNode->HasRemovedChildren()) continue; - pFieldWidgetAcc = - pFormNode->IsWidgetReady() ? pFormNode->GetWidgetAcc() : nullptr; - if (pFieldWidgetAcc) { - wsPicture = - pFieldWidgetAcc->GetPictureContent(XFA_VALUEPICTURE_DataBind); - } + pFieldNode = pFormNode->IsWidgetReady() ? pFormNode.Get() : nullptr; + if (pFieldNode) + wsPicture = pFieldNode->GetPictureContent(XFA_VALUEPICTURE_DataBind); if (!wsPicture.IsEmpty()) break; - pFieldWidgetAcc = nullptr; + + pFieldNode = nullptr; } - return pFieldWidgetAcc ? pFieldWidgetAcc->GetNode() : nullptr; + return pFieldNode; } CXFA_Node* pGrandNode = pParentNode ? pParentNode->GetParent() : nullptr; @@ -1998,8 +1993,8 @@ void CXFA_Node::SendAttributeChangeMessage(XFA_Attribute eAttribute, void CXFA_Node::SyncValue(const WideString& wsValue, bool bNotify) { WideString wsFormatValue = wsValue; CXFA_Node* pContainerNode = GetContainerNode(); - if (pContainerNode && pContainerNode->GetWidgetAcc()) - wsFormatValue = pContainerNode->GetWidgetAcc()->GetFormatDataValue(wsValue); + if (pContainerNode) + wsFormatValue = pContainerNode->GetFormatDataValue(wsValue); JSObject()->SetContent(wsValue, wsFormatValue, bNotify, false, true); } @@ -2194,8 +2189,8 @@ int32_t CXFA_Node::ProcessCalculate(CXFA_FFDocView* docView) { return iRet; if (GetRawValue() != EventParam.m_wsResult) { - GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Raw, EventParam.m_wsResult); - GetWidgetAcc()->UpdateUIDisplay(docView, nullptr); + SetValue(XFA_VALUEPICTURE_Raw, EventParam.m_wsResult); + UpdateUIDisplay(docView, nullptr); } return XFA_EVENTERROR_Success; } @@ -2292,7 +2287,7 @@ int32_t CXFA_Node::ProcessNullTestValidate(CXFA_FFDocView* docView, CXFA_Validate* validate, int32_t iFlags, bool bVersionFlag) { - if (!GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw).IsEmpty()) + if (!GetValue(XFA_VALUEPICTURE_Raw).IsEmpty()) return XFA_EVENTERROR_Success; if (m_bIsNull && m_bPreNull) return XFA_EVENTERROR_Success; @@ -2502,8 +2497,7 @@ std::pair CXFA_Node::ExecuteBoolScript( if (pEventParam->m_eType == XFA_EVENT_InitCalculate) { if ((iRet == XFA_EVENTERROR_Success) && (GetRawValue() != pEventParam->m_wsResult)) { - GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Raw, - pEventParam->m_wsResult); + SetValue(XFA_VALUEPICTURE_Raw, pEventParam->m_wsResult); docView->AddValidateNode(this); } } @@ -2778,14 +2772,13 @@ void CXFA_Node::ResetData() { if (!pChild->IsWidgetReady()) continue; - CXFA_Node* pAcc = pChild->GetWidgetAcc(); bool done = false; if (wsValue.IsEmpty()) { - CXFA_Value* defValue = pAcc->GetNode()->GetDefaultValueIfExists(); + CXFA_Value* defValue = pChild->GetDefaultValueIfExists(); if (defValue) { wsValue = defValue->GetChildValueContent(); SetValue(XFA_VALUEPICTURE_Raw, wsValue); - pAcc->SetValue(XFA_VALUEPICTURE_Raw, wsValue); + pChild->SetValue(XFA_VALUEPICTURE_Raw, wsValue); done = true; } } @@ -2802,7 +2795,7 @@ void CXFA_Node::ResetData() { ->JSObject() ->GetContent(false); } - pAcc->SetValue(XFA_VALUEPICTURE_Raw, itemText); + pChild->SetValue(XFA_VALUEPICTURE_Raw, itemText); } pNextChild = pChild->GetNextContainerSibling(); } diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h index 6b6e865353..47fd30bc8e 100644 --- a/xfa/fxfa/parser/cxfa_node.h +++ b/xfa/fxfa/parser/cxfa_node.h @@ -324,11 +324,6 @@ class CXFA_Node : public CXFA_Object { void SetWidgetReady() { is_widget_ready_ = true; } bool IsWidgetReady() const { return is_widget_ready_; } - // TODO(dsinclair): Remove post WidgetAcc merge. - CXFA_Node* GetWidgetAcc() { - ASSERT(IsWidgetReady()); - return this; - } std::vector GetEventByActivity(XFA_AttributeEnum iActivity, bool bIsFormReady); diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 8b0fa40250..7875ff89d1 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -152,8 +152,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, ASSERT(pXMLDataElement); pDataNode->JSObject()->SetAttributeValue( - wsValue, pFormNode->GetWidgetAcc()->GetFormatDataValue(wsValue), - false, false); + wsValue, pFormNode->GetFormatDataValue(wsValue), false, false); pDataNode->JSObject()->SetCData(XFA_Attribute::ContentType, wsContentType, false, false); if (!wsHref.IsEmpty()) @@ -163,9 +162,9 @@ void CreateDataBinding(CXFA_Node* pFormNode, } case XFA_Element::ChoiceList: wsValue = defValue ? defValue->GetChildValueContent() : L""; - if (pFormNode->GetWidgetAcc()->IsChoiceListMultiSelect()) { + if (pFormNode->IsChoiceListMultiSelect()) { std::vector wsSelTextArray = - pFormNode->GetWidgetAcc()->GetSelectedItemsValue(); + pFormNode->GetSelectedItemsValue(); if (!wsSelTextArray.empty()) { for (const auto& text : wsSelTextArray) { CXFA_Node* pValue = @@ -185,8 +184,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, } } else if (!wsValue.IsEmpty()) { pDataNode->JSObject()->SetAttributeValue( - wsValue, pFormNode->GetWidgetAcc()->GetFormatDataValue(wsValue), - false, false); + wsValue, pFormNode->GetFormatDataValue(wsValue), false, false); } break; case XFA_Element::CheckButton: @@ -195,8 +193,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, break; pDataNode->JSObject()->SetAttributeValue( - wsValue, pFormNode->GetWidgetAcc()->GetFormatDataValue(wsValue), - false, false); + wsValue, pFormNode->GetFormatDataValue(wsValue), false, false); break; case XFA_Element::ExclGroup: { CXFA_Node* pChecked = nullptr; @@ -265,10 +262,9 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (wsValue.IsEmpty()) break; - wsValue = pFormNode->GetWidgetAcc()->NormalizeNumStr(wsValue); + wsValue = pFormNode->NormalizeNumStr(wsValue); pDataNode->JSObject()->SetAttributeValue( - wsValue, pFormNode->GetWidgetAcc()->GetFormatDataValue(wsValue), - false, false); + wsValue, pFormNode->GetFormatDataValue(wsValue), false, false); CXFA_Value* pValue = pFormNode->JSObject()->GetOrCreateProperty( 0, XFA_Element::Value); @@ -281,16 +277,14 @@ void CreateDataBinding(CXFA_Node* pFormNode, break; pDataNode->JSObject()->SetAttributeValue( - wsValue, pFormNode->GetWidgetAcc()->GetFormatDataValue(wsValue), - false, false); + wsValue, pFormNode->GetFormatDataValue(wsValue), false, false); break; } return; } WideString wsXMLValue = pDataNode->JSObject()->GetContent(false); - WideString wsNormalizeValue = - pFormNode->GetWidgetAcc()->GetNormalizeDataValue(wsXMLValue); + WideString wsNormalizeValue = pFormNode->GetNormalizeDataValue(wsXMLValue); pDataNode->JSObject()->SetAttributeValue(wsNormalizeValue, wsXMLValue, false, false); @@ -319,7 +313,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, break; } case XFA_Element::ChoiceList: - if (pFormNode->GetWidgetAcc()->IsChoiceListMultiSelect()) { + if (pFormNode->IsChoiceListMultiSelect()) { std::vector items = pDataNode->GetNodeList( XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties, XFA_Element::Unknown); @@ -352,8 +346,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, XFA_Element::Text); break; case XFA_Element::ExclGroup: { - pFormNode->GetWidgetAcc()->SetSelectedMemberByValue( - wsNormalizeValue.AsStringView(), false, false, false); + pFormNode->SetSelectedMemberByValue(wsNormalizeValue.AsStringView(), + false, false, false); break; } case XFA_Element::DateTimeEdit: @@ -361,11 +355,10 @@ void CreateDataBinding(CXFA_Node* pFormNode, XFA_Element::DateTime); break; case XFA_Element::NumericEdit: { - WideString wsPicture = pFormNode->GetWidgetAcc()->GetPictureContent( - XFA_VALUEPICTURE_DataBind); + WideString wsPicture = + pFormNode->GetPictureContent(XFA_VALUEPICTURE_DataBind); if (wsPicture.IsEmpty()) - wsNormalizeValue = - pFormNode->GetWidgetAcc()->NormalizeNumStr(wsNormalizeValue); + wsNormalizeValue = pFormNode->NormalizeNumStr(wsNormalizeValue); FormValueNode_SetChildContent(defValue, wsNormalizeValue, XFA_Element::Float); -- cgit v1.2.3