diff options
Diffstat (limited to 'xfa')
49 files changed, 383 insertions, 357 deletions
diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp index 59a2ff07d9..a1df805df0 100644 --- a/xfa/fwl/theme/cfwl_edittp.cpp +++ b/xfa/fwl/theme/cfwl_edittp.cpp @@ -23,7 +23,7 @@ CFWL_EditTP::~CFWL_EditTP() {} void CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (CFWL_Part::CombTextLine == pParams->m_iPart) { CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); - CXFA_Border* borderUI = pWidget->GetDataAcc()->GetUIBorder(); + CXFA_Border* borderUI = pWidget->GetNode()->GetWidgetAcc()->GetUIBorder(); FX_ARGB cr = 0xFF000000; float fWidth = 1.0f; if (borderUI) { diff --git a/xfa/fxfa/cxfa_ffarc.cpp b/xfa/fxfa/cxfa_ffarc.cpp index 34bac00702..0f6d69ead5 100644 --- a/xfa/fxfa/cxfa_ffarc.cpp +++ b/xfa/fxfa/cxfa_ffarc.cpp @@ -9,7 +9,7 @@ #include "xfa/fxfa/parser/cxfa_arc.h" #include "xfa/fxfa/parser/cxfa_value.h" -CXFA_FFArc::CXFA_FFArc(CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pDataAcc) {} +CXFA_FFArc::CXFA_FFArc(CXFA_Node* pNode) : CXFA_FFDraw(pNode) {} CXFA_FFArc::~CXFA_FFArc() {} @@ -19,12 +19,12 @@ void CXFA_FFArc::RenderWidget(CXFA_Graphics* pGS, if (!IsMatchVisibleStatus(dwStatus)) return; - CXFA_Value* value = m_pDataAcc->GetNode()->GetFormValue(); + CXFA_Value* value = m_pNode->GetFormValue(); if (!value) return; CFX_RectF rtArc = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMargin(); if (margin) XFA_RectWidthoutMargin(rtArc, margin); diff --git a/xfa/fxfa/cxfa_ffarc.h b/xfa/fxfa/cxfa_ffarc.h index cc34352362..f76511995d 100644 --- a/xfa/fxfa/cxfa_ffarc.h +++ b/xfa/fxfa/cxfa_ffarc.h @@ -11,7 +11,7 @@ class CXFA_FFArc : public CXFA_FFDraw { public: - explicit CXFA_FFArc(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFArc(CXFA_Node* pnode); ~CXFA_FFArc() override; // CXFA_FFWidget diff --git a/xfa/fxfa/cxfa_ffbarcode.cpp b/xfa/fxfa/cxfa_ffbarcode.cpp index 6aac5dd7f2..c18344f3d4 100644 --- a/xfa/fxfa/cxfa_ffbarcode.cpp +++ b/xfa/fxfa/cxfa_ffbarcode.cpp @@ -111,8 +111,7 @@ const BarCodeInfo* CXFA_FFBarcode::GetBarcodeTypeByName( return nullptr; } -CXFA_FFBarcode::CXFA_FFBarcode(CXFA_WidgetAcc* pDataAcc) - : CXFA_FFTextEdit(pDataAcc) {} +CXFA_FFBarcode::CXFA_FFBarcode(CXFA_Node* pNode) : CXFA_FFTextEdit(pNode) {} CXFA_FFBarcode::~CXFA_FFBarcode() {} @@ -130,7 +129,8 @@ bool CXFA_FFBarcode::LoadWidget() { m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); - pFWLBarcode->SetText(m_pDataAcc->GetValue(XFA_VALUEPICTURE_Display)); + pFWLBarcode->SetText( + m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Display)); UpdateWidgetProperty(); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); @@ -146,7 +146,7 @@ void CXFA_FFBarcode::RenderWidget(CXFA_Graphics* pGS, mtRotate.Concat(matrix); CXFA_FFWidget::RenderWidget(pGS, mtRotate, dwStatus); - DrawBorder(pGS, m_pDataAcc->GetUIBorder(), m_rtUI, mtRotate); + DrawBorder(pGS, m_pNode->GetWidgetAcc()->GetUIBorder(), m_rtUI, mtRotate); RenderCaption(pGS, &mtRotate); CFX_RectF rtWidget = m_pNormalWidget->GetWidgetRect(); @@ -159,14 +159,14 @@ void CXFA_FFBarcode::UpdateWidgetProperty() { CXFA_FFTextEdit::UpdateWidgetProperty(); auto* pBarCodeWidget = static_cast<CFWL_Barcode*>(m_pNormalWidget.get()); - WideString wsType = GetDataAcc()->GetBarcodeType(); + WideString wsType = GetNode()->GetWidgetAcc()->GetBarcodeType(); const BarCodeInfo* pBarcodeInfo = GetBarcodeTypeByName(wsType.AsStringView()); if (!pBarcodeInfo) return; pBarCodeWidget->SetType(pBarcodeInfo->eBCType); - CXFA_WidgetAcc* pAcc = GetDataAcc(); + CXFA_WidgetAcc* pAcc = GetNode()->GetWidgetAcc(); Optional<BC_CHAR_ENCODING> encoding = pAcc->GetBarcodeAttribute_CharEncoding(); if (encoding) @@ -228,7 +228,7 @@ bool CXFA_FFBarcode::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { auto* pBarCodeWidget = static_cast<CFWL_Barcode*>(m_pNormalWidget.get()); if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) return false; - if (!m_pDataAcc->IsOpenAccess()) + if (!m_pNode->IsOpenAccess()) return false; return CXFA_FFTextEdit::OnLButtonDown(dwFlags, point); } diff --git a/xfa/fxfa/cxfa_ffbarcode.h b/xfa/fxfa/cxfa_ffbarcode.h index f03246d18e..85140a10bf 100644 --- a/xfa/fxfa/cxfa_ffbarcode.h +++ b/xfa/fxfa/cxfa_ffbarcode.h @@ -87,7 +87,7 @@ class CXFA_FFBarcode : public CXFA_FFTextEdit { public: static const BarCodeInfo* GetBarcodeTypeByName(const WideStringView& wsName); - explicit CXFA_FFBarcode(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFBarcode(CXFA_Node* pNode); ~CXFA_FFBarcode() override; // CXFA_FFTextEdit diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp index 8d4a235cfb..5e8c8e5841 100644 --- a/xfa/fxfa/cxfa_ffcheckbutton.cpp +++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp @@ -23,8 +23,8 @@ #include "xfa/fxfa/parser/cxfa_caption.h" #include "xfa/fxfa/parser/cxfa_para.h" -CXFA_FFCheckButton::CXFA_FFCheckButton(CXFA_WidgetAcc* pDataAcc) - : CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {} +CXFA_FFCheckButton::CXFA_FFCheckButton(CXFA_Node* pNode) + : CXFA_FFField(pNode), m_pOldDelegate(nullptr) {} CXFA_FFCheckButton::~CXFA_FFCheckButton() {} @@ -40,12 +40,12 @@ bool CXFA_FFCheckButton::LoadWidget() { m_pNormalWidget.get()); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); - if (m_pDataAcc->IsRadioButton()) + if (m_pNode->GetWidgetAcc()->IsRadioButton()) pCheckBox->ModifyStylesEx(FWL_STYLEEXT_CKB_RadioButton, 0xFFFFFFFF); m_pNormalWidget->LockUpdate(); UpdateWidgetProperty(); - SetFWLCheckState(m_pDataAcc->GetCheckState()); + SetFWLCheckState(m_pNode->GetWidgetAcc()->GetCheckState()); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); } @@ -55,9 +55,9 @@ void CXFA_FFCheckButton::UpdateWidgetProperty() { if (!pCheckBox) return; - pCheckBox->SetBoxSize(m_pDataAcc->GetCheckButtonSize()); + pCheckBox->SetBoxSize(m_pNode->GetWidgetAcc()->GetCheckButtonSize()); uint32_t dwStyleEx = FWL_STYLEEXT_CKB_SignShapeCross; - switch (m_pDataAcc->GetCheckButtonMark()) { + switch (m_pNode->GetWidgetAcc()->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_pDataAcc->IsCheckButtonRound()) + if (m_pNode->GetWidgetAcc()->IsCheckButtonRound()) dwStyleEx = FWL_STYLEEXT_CKB_SignShapeCircle; } break; } - if (m_pDataAcc->IsAllowNeutral()) + if (m_pNode->GetWidgetAcc()->IsAllowNeutral()) dwStyleEx |= FWL_STYLEEXT_CKB_3State; pCheckBox->ModifyStylesEx( @@ -90,15 +90,15 @@ void CXFA_FFCheckButton::UpdateWidgetProperty() { bool CXFA_FFCheckButton::PerformLayout() { CXFA_FFWidget::PerformLayout(); - float fCheckSize = m_pDataAcc->GetCheckButtonSize(); - CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); + float fCheckSize = m_pNode->GetWidgetAcc()->GetCheckButtonSize(); + CXFA_Margin* margin = m_pNode->GetMargin(); CFX_RectF rtWidget = GetRectWithoutRotate(); if (margin) XFA_RectWidthoutMargin(rtWidget, margin); XFA_AttributeEnum iCapPlacement = XFA_AttributeEnum::Unknown; float fCapReserve = 0; - CXFA_Caption* caption = m_pDataAcc->GetNode()->GetCaption(); + CXFA_Caption* caption = m_pNode->GetCaption(); if (caption && caption->IsVisible()) { m_rtCaption = rtWidget; iCapPlacement = caption->GetPlacementType(); @@ -115,7 +115,7 @@ bool CXFA_FFCheckButton::PerformLayout() { XFA_AttributeEnum iHorzAlign = XFA_AttributeEnum::Left; XFA_AttributeEnum iVertAlign = XFA_AttributeEnum::Top; - CXFA_Para* para = m_pDataAcc->GetNode()->GetPara(); + CXFA_Para* para = m_pNode->GetPara(); if (para) { iHorzAlign = para->GetHorizontalAlign(); iVertAlign = para->GetVerticalAlign(); @@ -173,7 +173,7 @@ bool CXFA_FFCheckButton::PerformLayout() { m_rtUI.height = fCheckSize; AddUIMargin(iCapPlacement); m_rtCheckBox = m_rtUI; - CXFA_Border* borderUI = m_pDataAcc->GetUIBorder(); + CXFA_Border* borderUI = m_pNode->GetWidgetAcc()->GetUIBorder(); if (borderUI) { CXFA_Margin* borderMargin = borderUI->GetMargin(); if (borderMargin) @@ -201,7 +201,7 @@ void CXFA_FFCheckButton::CapLeftRightPlacement( } void CXFA_FFCheckButton::AddUIMargin(XFA_AttributeEnum iCapPlacement) { - CFX_RectF rtUIMargin = m_pDataAcc->GetUIMargin(); + CFX_RectF rtUIMargin = m_pNode->GetWidgetAcc()->GetUIMargin(); m_rtUI.top -= rtUIMargin.top / 2 - rtUIMargin.height / 2; float fLeftAddRight = rtUIMargin.left + rtUIMargin.width; @@ -235,10 +235,12 @@ void CXFA_FFCheckButton::RenderWidget(CXFA_Graphics* pGS, CXFA_FFWidget::RenderWidget(pGS, mtRotate, dwStatus); DrawBorderWithFlags( - pGS, m_pDataAcc->GetUIBorder(), m_rtUI, mtRotate, - m_pDataAcc->IsCheckButtonRound() ? XFA_DRAWBOX_ForceRound : 0); + pGS, m_pNode->GetWidgetAcc()->GetUIBorder(), m_rtUI, mtRotate, + m_pNode->GetWidgetAcc()->IsCheckButtonRound() ? XFA_DRAWBOX_ForceRound + : 0); RenderCaption(pGS, &mtRotate); - DrawHighlight(pGS, &mtRotate, dwStatus, m_pDataAcc->IsCheckButtonRound()); + DrawHighlight(pGS, &mtRotate, dwStatus, + m_pNode->GetWidgetAcc()->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 +271,13 @@ XFA_CHECKSTATE CXFA_FFCheckButton::FWLState2XFAState() { bool CXFA_FFCheckButton::CommitData() { XFA_CHECKSTATE eCheckState = FWLState2XFAState(); - m_pDataAcc->SetCheckState(eCheckState, true); + m_pNode->GetWidgetAcc()->SetCheckState(eCheckState, true); return true; } bool CXFA_FFCheckButton::IsDataChanged() { XFA_CHECKSTATE eCheckState = FWLState2XFAState(); - return m_pDataAcc->GetCheckState() != eCheckState; + return m_pNode->GetWidgetAcc()->GetCheckState() != eCheckState; } void CXFA_FFCheckButton::SetFWLCheckState(XFA_CHECKSTATE eCheckState) { @@ -291,7 +293,7 @@ bool CXFA_FFCheckButton::UpdateFWLData() { if (!m_pNormalWidget) return false; - XFA_CHECKSTATE eState = m_pDataAcc->GetCheckState(); + XFA_CHECKSTATE eState = m_pNode->GetWidgetAcc()->GetCheckState(); SetFWLCheckState(eState); m_pNormalWidget->Update(); return true; @@ -307,9 +309,10 @@ 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_pDataAcc->GetValue(XFA_VALUEPICTURE_Raw); + eParam.m_wsNewText = + m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw); - CXFA_Node* exclNode = m_pDataAcc->GetNode()->GetExclGroup(); + CXFA_Node* exclNode = m_pNode->GetExclGroup(); CXFA_WidgetAcc* pFFExclGroup = exclNode ? exclNode->GetWidgetAcc() : nullptr; if (ProcessCommittedData()) { @@ -320,19 +323,20 @@ void CXFA_FFCheckButton::OnProcessEvent(CFWL_Event* pEvent) { pFFExclGroup->ProcessEvent(GetDocView(), XFA_AttributeEnum::Change, &eParam); } - eParam.m_pTarget = m_pDataAcc.Get(); - m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::Change, - &eParam); + eParam.m_pTarget = m_pNode->GetWidgetAcc(); + m_pNode->GetWidgetAcc()->ProcessEvent( + GetDocView(), XFA_AttributeEnum::Change, &eParam); } else { - SetFWLCheckState(m_pDataAcc->GetCheckState()); + SetFWLCheckState(m_pNode->GetWidgetAcc()->GetCheckState()); } if (pFFExclGroup) { eParam.m_pTarget = pFFExclGroup; pFFExclGroup->ProcessEvent(GetDocView(), XFA_AttributeEnum::Click, &eParam); } - eParam.m_pTarget = m_pDataAcc.Get(); - m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::Click, &eParam); + eParam.m_pTarget = m_pNode->GetWidgetAcc(); + m_pNode->GetWidgetAcc()->ProcessEvent(GetDocView(), + XFA_AttributeEnum::Click, &eParam); break; } default: diff --git a/xfa/fxfa/cxfa_ffcheckbutton.h b/xfa/fxfa/cxfa_ffcheckbutton.h index 56fd1c9d7b..9b469bd7c3 100644 --- a/xfa/fxfa/cxfa_ffcheckbutton.h +++ b/xfa/fxfa/cxfa_ffcheckbutton.h @@ -12,7 +12,7 @@ class CXFA_FFCheckButton : public CXFA_FFField { public: - explicit CXFA_FFCheckButton(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFCheckButton(CXFA_Node* pNode); ~CXFA_FFCheckButton() override; // CXFA_FFField diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp index 729dae58fb..7d5a3e35f5 100644 --- a/xfa/fxfa/cxfa_ffcombobox.cpp +++ b/xfa/fxfa/cxfa_ffcombobox.cpp @@ -24,8 +24,8 @@ CFWL_ComboBox* ToComboBox(CFWL_Widget* widget) { } // namespace -CXFA_FFComboBox::CXFA_FFComboBox(CXFA_WidgetAcc* pDataAcc) - : CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {} +CXFA_FFComboBox::CXFA_FFComboBox(CXFA_Node* pNode) + : CXFA_FFField(pNode), m_pOldDelegate(nullptr) {} CXFA_FFComboBox::~CXFA_FFComboBox() {} @@ -52,14 +52,16 @@ bool CXFA_FFComboBox::LoadWidget() { m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); - for (const auto& label : m_pDataAcc->GetChoiceListItems(false)) + for (const auto& label : m_pNode->GetWidgetAcc()->GetChoiceListItems(false)) pComboBox->AddString(label.AsStringView()); - std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems(); - if (iSelArray.empty()) - pComboBox->SetEditText(m_pDataAcc->GetValue(XFA_VALUEPICTURE_Raw)); - else + std::vector<int32_t> iSelArray = m_pNode->GetWidgetAcc()->GetSelectedItems(); + if (iSelArray.empty()) { + pComboBox->SetEditText( + m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw)); + } else { pComboBox->SetCurSel(iSelArray.front()); + } UpdateWidgetProperty(); m_pNormalWidget->UnlockUpdate(); @@ -74,18 +76,18 @@ void CXFA_FFComboBox::UpdateWidgetProperty() { uint32_t dwExtendedStyle = 0; uint32_t dwEditStyles = FWL_STYLEEXT_EDT_ReadOnly; dwExtendedStyle |= UpdateUIProperty(); - if (m_pDataAcc->IsChoiceListAllowTextEntry()) { + if (m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry()) { dwEditStyles &= ~FWL_STYLEEXT_EDT_ReadOnly; dwExtendedStyle |= FWL_STYLEEXT_CMB_DropDown; } - if (!m_pDataAcc->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) { + if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) { dwEditStyles |= FWL_STYLEEXT_EDT_ReadOnly; dwExtendedStyle |= FWL_STYLEEXT_CMB_ReadOnly; } dwExtendedStyle |= GetAlignment(); m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); - if (!m_pDataAcc->IsHorizontalScrollPolicyOff()) + if (!m_pNode->GetWidgetAcc()->IsHorizontalScrollPolicyOff()) dwEditStyles |= FWL_STYLEEXT_EDT_AutoHScroll; pComboBox->EditModifyStylesEx(dwEditStyles, 0xFFFFFFFF); @@ -112,7 +114,7 @@ void CXFA_FFComboBox::OpenDropDownList() { } bool CXFA_FFComboBox::CommitData() { - return m_pDataAcc->SetValue(XFA_VALUEPICTURE_Raw, m_wsNewValue); + return m_pNode->GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Raw, m_wsNewValue); } bool CXFA_FFComboBox::IsDataChanged() { @@ -122,9 +124,11 @@ bool CXFA_FFComboBox::IsDataChanged() { if (iCursel >= 0) { WideString wsSel = pFWLcombobox->GetTextByIndex(iCursel); if (wsSel == wsText) - wsText = m_pDataAcc->GetChoiceListItem(iCursel, true).value_or(L""); + wsText = m_pNode->GetWidgetAcc() + ->GetChoiceListItem(iCursel, true) + .value_or(L""); } - if (m_pDataAcc->GetValue(XFA_VALUEPICTURE_Raw) == wsText) + if (m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw) == wsText) return false; m_wsNewValue = wsText; @@ -133,13 +137,14 @@ bool CXFA_FFComboBox::IsDataChanged() { void CXFA_FFComboBox::FWLEventSelChange(CXFA_EventParam* pParam) { pParam->m_eType = XFA_EVENT_Change; - pParam->m_pTarget = m_pDataAcc.Get(); + pParam->m_pTarget = m_pNode->GetWidgetAcc(); pParam->m_wsNewText = ToComboBox(m_pNormalWidget.get())->GetEditText(); - m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::Change, pParam); + m_pNode->GetWidgetAcc()->ProcessEvent(GetDocView(), XFA_AttributeEnum::Change, + pParam); } uint32_t CXFA_FFComboBox::GetAlignment() { - CXFA_Para* para = m_pDataAcc->GetNode()->GetPara(); + CXFA_Para* para = m_pNode->GetPara(); if (!para) return 0; @@ -183,34 +188,35 @@ bool CXFA_FFComboBox::UpdateFWLData() { if (!pComboBox) return false; - std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems(); + std::vector<int32_t> iSelArray = m_pNode->GetWidgetAcc()->GetSelectedItems(); if (!iSelArray.empty()) { pComboBox->SetCurSel(iSelArray.front()); } else { pComboBox->SetCurSel(-1); - pComboBox->SetEditText(m_pDataAcc->GetValue(XFA_VALUEPICTURE_Raw)); + pComboBox->SetEditText( + m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw)); } pComboBox->Update(); return true; } bool CXFA_FFComboBox::CanUndo() { - return m_pDataAcc->IsChoiceListAllowTextEntry() && + return m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry() && ToComboBox(m_pNormalWidget.get())->EditCanUndo(); } bool CXFA_FFComboBox::CanRedo() { - return m_pDataAcc->IsChoiceListAllowTextEntry() && + return m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry() && ToComboBox(m_pNormalWidget.get())->EditCanRedo(); } bool CXFA_FFComboBox::Undo() { - return m_pDataAcc->IsChoiceListAllowTextEntry() && + return m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry() && ToComboBox(m_pNormalWidget.get())->EditUndo(); } bool CXFA_FFComboBox::Redo() { - return m_pDataAcc->IsChoiceListAllowTextEntry() && + return m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry() && ToComboBox(m_pNormalWidget.get())->EditRedo(); } @@ -219,13 +225,14 @@ bool CXFA_FFComboBox::CanCopy() { } bool CXFA_FFComboBox::CanCut() { - return m_pDataAcc->IsOpenAccess() && - m_pDataAcc->IsChoiceListAllowTextEntry() && + return m_pNode->IsOpenAccess() && + m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry() && ToComboBox(m_pNormalWidget.get())->EditCanCut(); } bool CXFA_FFComboBox::CanPaste() { - return m_pDataAcc->IsChoiceListAllowTextEntry() && m_pDataAcc->IsOpenAccess(); + return m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry() && + m_pNode->IsOpenAccess(); } bool CXFA_FFComboBox::CanSelectAll() { @@ -237,14 +244,14 @@ Optional<WideString> CXFA_FFComboBox::Copy() { } Optional<WideString> CXFA_FFComboBox::Cut() { - if (!m_pDataAcc->IsChoiceListAllowTextEntry()) + if (!m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry()) return {}; return ToComboBox(m_pNormalWidget.get())->EditCut(); } bool CXFA_FFComboBox::Paste(const WideString& wsPaste) { - return m_pDataAcc->IsChoiceListAllowTextEntry() && + return m_pNode->GetWidgetAcc()->IsChoiceListAllowTextEntry() && ToComboBox(m_pNormalWidget.get())->EditPaste(wsPaste); } @@ -286,31 +293,33 @@ void CXFA_FFComboBox::DeleteItem(int32_t nIndex) { void CXFA_FFComboBox::OnTextChanged(CFWL_Widget* pWidget, const WideString& wsChanged) { CXFA_EventParam eParam; - eParam.m_wsPrevText = m_pDataAcc->GetValue(XFA_VALUEPICTURE_Raw); + eParam.m_wsPrevText = m_pNode->GetWidgetAcc()->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_pDataAcc->GetValue(XFA_VALUEPICTURE_Raw); + eParam.m_wsPrevText = m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw); FWLEventSelChange(&eParam); - if (m_pDataAcc->IsChoiceListCommitOnSelect() && bLButtonUp) + if (m_pNode->GetWidgetAcc()->IsChoiceListCommitOnSelect() && bLButtonUp) m_pDocView->SetFocusWidgetAcc(nullptr); } void CXFA_FFComboBox::OnPreOpen(CFWL_Widget* pWidget) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_PreOpen; - eParam.m_pTarget = m_pDataAcc.Get(); - m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::PreOpen, &eParam); + eParam.m_pTarget = m_pNode->GetWidgetAcc(); + m_pNode->GetWidgetAcc()->ProcessEvent(GetDocView(), + 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.Get(); - m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::PostOpen, &eParam); + eParam.m_pTarget = m_pNode->GetWidgetAcc(); + m_pNode->GetWidgetAcc()->ProcessEvent(GetDocView(), + XFA_AttributeEnum::PostOpen, &eParam); } void CXFA_FFComboBox::OnProcessMessage(CFWL_Message* pMessage) { diff --git a/xfa/fxfa/cxfa_ffcombobox.h b/xfa/fxfa/cxfa_ffcombobox.h index 727e1ba7bf..c4bf6e9756 100644 --- a/xfa/fxfa/cxfa_ffcombobox.h +++ b/xfa/fxfa/cxfa_ffcombobox.h @@ -11,7 +11,7 @@ class CXFA_FFComboBox : public CXFA_FFField { public: - explicit CXFA_FFComboBox(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFComboBox(CXFA_Node* pNode); ~CXFA_FFComboBox() override; // CXFA_FFField diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/cxfa_ffdatetimeedit.cpp index aa2746e730..05d20b203d 100644 --- a/xfa/fxfa/cxfa_ffdatetimeedit.cpp +++ b/xfa/fxfa/cxfa_ffdatetimeedit.cpp @@ -19,8 +19,8 @@ #include "xfa/fxfa/parser/cxfa_value.h" #include "xfa/fxfa/parser/xfa_utils.h" -CXFA_FFDateTimeEdit::CXFA_FFDateTimeEdit(CXFA_WidgetAcc* pDataAcc) - : CXFA_FFTextEdit(pDataAcc) {} +CXFA_FFDateTimeEdit::CXFA_FFDateTimeEdit(CXFA_Node* pNode) + : CXFA_FFTextEdit(pNode) {} CXFA_FFDateTimeEdit::~CXFA_FFDateTimeEdit() {} @@ -49,15 +49,17 @@ bool CXFA_FFDateTimeEdit::LoadWidget() { m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); - WideString wsText = m_pDataAcc->GetValue(XFA_VALUEPICTURE_Display); + WideString wsText = + m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Display); pWidget->SetEditText(wsText); - CXFA_Value* value = m_pDataAcc->GetNode()->GetFormValue(); + CXFA_Value* value = m_pNode->GetFormValue(); if (value) { switch (value->GetChildValueClassID()) { case XFA_Element::Date: { if (!wsText.IsEmpty()) { - CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc.Get()); + CXFA_LocaleValue lcValue = + XFA_GetLocaleValue(m_pNode->GetWidgetAcc()); CFX_DateTime date = lcValue.GetDate(); if (date.IsSet()) pWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay()); @@ -84,21 +86,21 @@ void CXFA_FFDateTimeEdit::UpdateWidgetProperty() { m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); uint32_t dwEditStyles = 0; - Optional<int32_t> numCells = m_pDataAcc->GetNumberOfCells(); + Optional<int32_t> numCells = m_pNode->GetWidgetAcc()->GetNumberOfCells(); if (numCells && *numCells > 0) { dwEditStyles |= FWL_STYLEEXT_EDT_CombText; pWidget->SetEditLimit(*numCells); } - if (!m_pDataAcc->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) + if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) dwEditStyles |= FWL_STYLEEXT_EDT_ReadOnly; - if (!m_pDataAcc->IsHorizontalScrollPolicyOff()) + if (!m_pNode->GetWidgetAcc()->IsHorizontalScrollPolicyOff()) dwEditStyles |= FWL_STYLEEXT_EDT_AutoHScroll; pWidget->ModifyEditStylesEx(dwEditStyles, 0xFFFFFFFF); } uint32_t CXFA_FFDateTimeEdit::GetAlignment() { - CXFA_Para* para = m_pDataAcc->GetNode()->GetPara(); + CXFA_Para* para = m_pNode->GetPara(); if (!para) return 0; @@ -137,10 +139,12 @@ uint32_t CXFA_FFDateTimeEdit::GetAlignment() { bool CXFA_FFDateTimeEdit::CommitData() { auto* pPicker = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get()); - if (!m_pDataAcc->SetValue(XFA_VALUEPICTURE_Edit, pPicker->GetEditText())) + if (!m_pNode->GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Edit, + pPicker->GetEditText())) { return false; + } - m_pDataAcc->UpdateUIDisplay(GetDoc()->GetDocView(), this); + m_pNode->GetWidgetAcc()->UpdateUIDisplay(GetDoc()->GetDocView(), this); return true; } @@ -152,11 +156,11 @@ bool CXFA_FFDateTimeEdit::UpdateFWLData() { if (IsFocused()) eType = XFA_VALUEPICTURE_Edit; - WideString wsText = m_pDataAcc->GetValue(eType); + WideString wsText = m_pNode->GetWidgetAcc()->GetValue(eType); auto* normalWidget = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get()); normalWidget->SetEditText(wsText); if (IsFocused() && !wsText.IsEmpty()) { - CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc.Get()); + CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pNode->GetWidgetAcc()); CFX_DateTime date = lcValue.GetDate(); if (lcValue.IsValid()) { if (date.IsSet()) @@ -173,20 +177,21 @@ bool CXFA_FFDateTimeEdit::IsDataChanged() { WideString wsText = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get())->GetEditText(); - return m_pDataAcc->GetValue(XFA_VALUEPICTURE_Edit) != wsText; + return m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Edit) != wsText; } void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget, int32_t iYear, int32_t iMonth, int32_t iDay) { - WideString wsPicture = m_pDataAcc->GetPictureContent(XFA_VALUEPICTURE_Edit); + WideString wsPicture = + m_pNode->GetWidgetAcc()->GetPictureContent(XFA_VALUEPICTURE_Edit); CXFA_LocaleValue date(XFA_VT_DATE, GetDoc()->GetXFADoc()->GetLocalMgr()); date.SetDate(CFX_DateTime(iYear, iMonth, iDay, 0, 0, 0, 0)); WideString wsDate; - date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocale(), + date.FormatPatterns(wsDate, wsPicture, m_pNode->GetLocale(), XFA_VALUEPICTURE_Edit); auto* pDateTime = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get()); @@ -196,9 +201,10 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget, CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Change; - eParam.m_pTarget = m_pDataAcc.Get(); - eParam.m_wsNewText = m_pDataAcc->GetValue(XFA_VALUEPICTURE_Raw); - m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::Change, &eParam); + eParam.m_pTarget = m_pNode->GetWidgetAcc(); + eParam.m_wsNewText = m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw); + m_pNode->GetWidgetAcc()->ProcessEvent(GetDocView(), XFA_AttributeEnum::Change, + &eParam); } void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.h b/xfa/fxfa/cxfa_ffdatetimeedit.h index 8b95164214..a549cbb80f 100644 --- a/xfa/fxfa/cxfa_ffdatetimeedit.h +++ b/xfa/fxfa/cxfa_ffdatetimeedit.h @@ -21,7 +21,7 @@ class CFWL_Widget; class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit { public: - explicit CXFA_FFDateTimeEdit(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFDateTimeEdit(CXFA_Node* pNode); ~CXFA_FFDateTimeEdit() override; // CXFA_FFTextEdit diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp index 75397bfc2b..e702036aee 100644 --- a/xfa/fxfa/cxfa_ffdocview.cpp +++ b/xfa/fxfa/cxfa_ffdocview.cpp @@ -373,7 +373,7 @@ bool CXFA_FFDocView::SetFocus(CXFA_FFWidget* hWidget) { pNewFocus->LoadWidget(); pNewFocus->OnSetFocus(m_pFocusWidget.Get()); } - m_pFocusAcc = pNewFocus ? pNewFocus->GetDataAcc() : nullptr; + m_pFocusAcc = pNewFocus ? pNewFocus->GetNode()->GetWidgetAcc() : nullptr; m_pFocusWidget = pNewFocus; m_pOldFocusWidget = m_pFocusWidget; return true; @@ -395,7 +395,7 @@ void CXFA_FFDocView::SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) { } void CXFA_FFDocView::DeleteLayoutItem(CXFA_FFWidget* pWidget) { - if (m_pFocusAcc != pWidget->GetDataAcc()) + if (m_pFocusAcc && m_pFocusAcc->GetNode() != pWidget->GetNode()) return; m_pFocusAcc = nullptr; @@ -493,7 +493,8 @@ int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode, CXFA_FFWidget* CXFA_FFDocView::GetWidgetByName(const WideString& wsName, CXFA_FFWidget* pRefWidget) { - CXFA_WidgetAcc* pRefAcc = pRefWidget ? pRefWidget->GetDataAcc() : nullptr; + CXFA_WidgetAcc* pRefAcc = + pRefWidget ? pRefWidget->GetNode()->GetWidgetAcc() : nullptr; CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName, pRefAcc); if (!pAcc) return nullptr; @@ -636,9 +637,9 @@ void CXFA_FFDocView::AddCalculateNodeNotify(CXFA_Node* pNodeChange) { if (!pGlobalData) return; - for (auto* pResultAcc : pGlobalData->m_Globals) { - if (!pResultAcc->GetNode()->HasRemovedChildren()) - AddCalculateWidgetAcc(pResultAcc); + for (auto* pResult : pGlobalData->m_Globals) { + if (!pResult->HasRemovedChildren()) + AddCalculateWidgetAcc(pResult->GetWidgetAcc()); } } diff --git a/xfa/fxfa/cxfa_ffdraw.cpp b/xfa/fxfa/cxfa_ffdraw.cpp index 920073352a..420bde1d7c 100644 --- a/xfa/fxfa/cxfa_ffdraw.cpp +++ b/xfa/fxfa/cxfa_ffdraw.cpp @@ -11,6 +11,6 @@ #include "xfa/fxfa/cxfa_ffpageview.h" #include "xfa/fxfa/cxfa_ffwidget.h" -CXFA_FFDraw::CXFA_FFDraw(CXFA_WidgetAcc* pDataAcc) : CXFA_FFWidget(pDataAcc) {} +CXFA_FFDraw::CXFA_FFDraw(CXFA_Node* pNode) : CXFA_FFWidget(pNode) {} CXFA_FFDraw::~CXFA_FFDraw() {} diff --git a/xfa/fxfa/cxfa_ffdraw.h b/xfa/fxfa/cxfa_ffdraw.h index 3ca106ac07..de9cfcf428 100644 --- a/xfa/fxfa/cxfa_ffdraw.h +++ b/xfa/fxfa/cxfa_ffdraw.h @@ -12,7 +12,7 @@ class CXFA_FFDraw : public CXFA_FFWidget { public: - explicit CXFA_FFDraw(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFDraw(CXFA_Node* pNode); ~CXFA_FFDraw() override; }; diff --git a/xfa/fxfa/cxfa_ffexclgroup.cpp b/xfa/fxfa/cxfa_ffexclgroup.cpp index 81c76bd712..318752b1f2 100644 --- a/xfa/fxfa/cxfa_ffexclgroup.cpp +++ b/xfa/fxfa/cxfa_ffexclgroup.cpp @@ -11,8 +11,7 @@ #include "xfa/fxfa/cxfa_ffpageview.h" #include "xfa/fxfa/cxfa_ffwidget.h" -CXFA_FFExclGroup::CXFA_FFExclGroup(CXFA_WidgetAcc* pDataAcc) - : CXFA_FFWidget(pDataAcc) {} +CXFA_FFExclGroup::CXFA_FFExclGroup(CXFA_Node* pNode) : CXFA_FFWidget(pNode) {} CXFA_FFExclGroup::~CXFA_FFExclGroup() {} diff --git a/xfa/fxfa/cxfa_ffexclgroup.h b/xfa/fxfa/cxfa_ffexclgroup.h index bf97702d40..b90430175f 100644 --- a/xfa/fxfa/cxfa_ffexclgroup.h +++ b/xfa/fxfa/cxfa_ffexclgroup.h @@ -12,7 +12,7 @@ class CXFA_FFExclGroup : public CXFA_FFWidget { public: - explicit CXFA_FFExclGroup(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFExclGroup(CXFA_Node* pNode); ~CXFA_FFExclGroup() override; // CXFA_FFWidget diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp index 80752459e2..d80fb1ad55 100644 --- a/xfa/fxfa/cxfa_fffield.cpp +++ b/xfa/fxfa/cxfa_fffield.cpp @@ -39,8 +39,7 @@ CXFA_FFField* ToField(CXFA_LayoutItem* widget) { } // namespace -CXFA_FFField::CXFA_FFField(CXFA_WidgetAcc* pDataAcc) - : CXFA_FFWidget(pDataAcc), m_pNormalWidget(nullptr) {} +CXFA_FFField::CXFA_FFField(CXFA_Node* pNode) : CXFA_FFWidget(pNode) {} CXFA_FFField::~CXFA_FFField() { CXFA_FFField::UnloadWidget(); @@ -50,7 +49,7 @@ CFX_RectF CXFA_FFField::GetBBox(uint32_t dwStatus, bool bDrawFocus) { if (!bDrawFocus) return CXFA_FFWidget::GetBBox(dwStatus); - XFA_Element type = m_pDataAcc->GetUIType(); + XFA_Element type = m_pNode->GetWidgetAcc()->GetUIType(); if (type != XFA_Element::Button && type != XFA_Element::CheckButton && type != XFA_Element::ImageEdit && type != XFA_Element::Signature && type != XFA_Element::ChoiceList) { @@ -70,7 +69,7 @@ void CXFA_FFField::RenderWidget(CXFA_Graphics* pGS, mtRotate.Concat(matrix); CXFA_FFWidget::RenderWidget(pGS, mtRotate, dwStatus); - DrawBorder(pGS, m_pDataAcc->GetUIBorder(), m_rtUI, mtRotate); + DrawBorder(pGS, m_pNode->GetWidgetAcc()->GetUIBorder(), m_rtUI, mtRotate); RenderCaption(pGS, &mtRotate); DrawHighlight(pGS, &mtRotate, dwStatus, false); @@ -86,7 +85,7 @@ void CXFA_FFField::DrawHighlight(CXFA_Graphics* pGS, bool bEllipse) { if (m_rtUI.IsEmpty() || !GetDoc()->GetXFADoc()->IsInteractive()) return; - if (!(dwStatus & XFA_WidgetStatus_Highlight) || !m_pDataAcc->IsOpenAccess()) + if (!(dwStatus & XFA_WidgetStatus_Highlight) || !m_pNode->IsOpenAccess()) return; CXFA_FFDoc* pDoc = GetDoc(); @@ -127,7 +126,7 @@ bool CXFA_FFField::IsLoaded() { bool CXFA_FFField::LoadWidget() { SetFWLThemeProvider(); - m_pDataAcc->LoadCaption(GetDoc()); + m_pNode->GetWidgetAcc()->LoadCaption(GetDoc()); PerformLayout(); return true; } @@ -137,7 +136,7 @@ void CXFA_FFField::UnloadWidget() { } void CXFA_FFField::SetEditScrollOffset() { - XFA_Element eType = m_pDataAcc->GetUIType(); + XFA_Element eType = m_pNode->GetWidgetAcc()->GetUIType(); if (eType != XFA_Element::TextEdit && eType != XFA_Element::NumericEdit && eType != XFA_Element::PasswordEdit) { return; @@ -146,7 +145,7 @@ void CXFA_FFField::SetEditScrollOffset() { float fScrollOffset = 0; CXFA_FFField* pPrev = ToField(GetPrev()); if (pPrev) { - CFX_RectF rtMargin = m_pDataAcc->GetUIMargin(); + CFX_RectF rtMargin = m_pNode->GetWidgetAcc()->GetUIMargin(); fScrollOffset = -rtMargin.top; } @@ -171,7 +170,7 @@ bool CXFA_FFField::PerformLayout() { void CXFA_FFField::CapPlacement() { CFX_RectF rtWidget = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMargin(); if (margin) { CXFA_LayoutItem* pItem = this; float fLeftInset = margin->GetLeftInset(); @@ -192,7 +191,7 @@ void CXFA_FFField::CapPlacement() { XFA_AttributeEnum iCapPlacement = XFA_AttributeEnum::Unknown; float fCapReserve = 0; - CXFA_Caption* caption = m_pDataAcc->GetNode()->GetCaption(); + CXFA_Caption* caption = m_pNode->GetCaption(); if (caption && !caption->IsHidden()) { iCapPlacement = caption->GetPlacementType(); if (iCapPlacement == XFA_AttributeEnum::Top && GetPrev()) { @@ -215,7 +214,8 @@ void CXFA_FFField::CapPlacement() { XFA_RectWidthoutMargin(m_rtCaption, margin); } - CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout(); + CXFA_TextLayout* pCapTextLayout = + m_pNode->GetWidgetAcc()->GetCaptionTextLayout(); if (fCapReserve <= 0 && pCapTextLayout) { CFX_SizeF minSize; CFX_SizeF maxSize; @@ -266,7 +266,7 @@ void CXFA_FFField::CapPlacement() { break; } - CXFA_Border* borderUI = m_pDataAcc->GetUIBorder(); + CXFA_Border* borderUI = m_pNode->GetWidgetAcc()->GetUIBorder(); if (borderUI) { CXFA_Margin* borderMargin = borderUI->GetMargin(); if (borderMargin) @@ -278,7 +278,7 @@ void CXFA_FFField::CapPlacement() { void CXFA_FFField::CapTopBottomPlacement(const CXFA_Margin* margin, const CFX_RectF& rtWidget, XFA_AttributeEnum iCapPlacement) { - CFX_RectF rtUIMargin = m_pDataAcc->GetUIMargin(); + CFX_RectF rtUIMargin = m_pNode->GetWidgetAcc()->GetUIMargin(); m_rtCaption.left += rtUIMargin.left; if (margin) { XFA_RectWidthoutMargin(m_rtCaption, margin); @@ -304,7 +304,7 @@ void CXFA_FFField::CapTopBottomPlacement(const CXFA_Margin* margin, void CXFA_FFField::CapLeftRightPlacement(const CXFA_Margin* margin, const CFX_RectF& rtWidget, XFA_AttributeEnum iCapPlacement) { - CFX_RectF rtUIMargin = m_pDataAcc->GetUIMargin(); + CFX_RectF rtUIMargin = m_pNode->GetWidgetAcc()->GetUIMargin(); m_rtCaption.top += rtUIMargin.top; m_rtCaption.height -= rtUIMargin.top; if (margin) { @@ -335,7 +335,7 @@ void CXFA_FFField::UpdateFWL() { } uint32_t CXFA_FFField::UpdateUIProperty() { - CXFA_Node* pUiNode = m_pDataAcc->GetUIChild(); + CXFA_Node* pUiNode = m_pNode->GetWidgetAcc()->GetUIChild(); if (pUiNode && pUiNode->GetElementType() == XFA_Element::DefaultUi) return FWL_STYLEEXT_EDT_ReadOnly; return 0; @@ -349,7 +349,7 @@ void CXFA_FFField::SetFWLRect() { if (rtUi.width < 1.0) rtUi.width = 1.0; if (!GetDoc()->GetXFADoc()->IsInteractive()) { - float fFontSize = m_pDataAcc->GetNode()->GetFontSize(); + float fFontSize = m_pNode->GetFontSize(); if (rtUi.height < fFontSize) rtUi.height = fFontSize; } @@ -384,7 +384,7 @@ CFX_PointF CXFA_FFField::FWLToClient(const CFX_PointF& point) { bool CXFA_FFField::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { if (!m_pNormalWidget) return false; - if (!m_pDataAcc->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) + if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) return false; if (!PtInActiveRect(point)) return false; @@ -454,7 +454,7 @@ bool CXFA_FFField::OnMouseWheel(uint32_t dwFlags, bool CXFA_FFField::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) { if (!m_pNormalWidget) return false; - if (!m_pDataAcc->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) + if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) return false; if (!PtInActiveRect(point)) return false; @@ -551,7 +551,7 @@ bool CXFA_FFField::OnChar(uint32_t dwChar, uint32_t dwFlags) { return true; if (!m_pNormalWidget) return false; - if (!m_pDataAcc->IsOpenAccess()) + if (!m_pNode->IsOpenAccess()) return false; CFWL_MessageKey ms(nullptr, m_pNormalWidget.get()); @@ -584,7 +584,8 @@ bool CXFA_FFField::PtInActiveRect(const CFX_PointF& point) { } void CXFA_FFField::LayoutCaption() { - CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout(); + CXFA_TextLayout* pCapTextLayout = + m_pNode->GetWidgetAcc()->GetCaptionTextLayout(); if (!pCapTextLayout) return; @@ -595,11 +596,12 @@ void CXFA_FFField::LayoutCaption() { } void CXFA_FFField::RenderCaption(CXFA_Graphics* pGS, CFX_Matrix* pMatrix) { - CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout(); + CXFA_TextLayout* pCapTextLayout = + m_pNode->GetWidgetAcc()->GetCaptionTextLayout(); if (!pCapTextLayout) return; - CXFA_Caption* caption = m_pDataAcc->GetNode()->GetCaption(); + CXFA_Caption* caption = m_pNode->GetCaption(); if (!caption || !caption->IsVisible()) return; @@ -618,7 +620,7 @@ void CXFA_FFField::RenderCaption(CXFA_Graphics* pGS, CFX_Matrix* pMatrix) { } bool CXFA_FFField::ProcessCommittedData() { - if (!m_pDataAcc->IsOpenAccess()) + if (!m_pNode->IsOpenAccess()) return false; if (!IsDataChanged()) return false; @@ -628,18 +630,18 @@ bool CXFA_FFField::ProcessCommittedData() { return false; m_pDocView->SetChangeMark(); - m_pDocView->AddValidateWidget(m_pDataAcc.Get()); + m_pDocView->AddValidateWidget(m_pNode->GetWidgetAcc()); return true; } int32_t CXFA_FFField::CalculateOverride() { - CXFA_Node* exclNode = m_pDataAcc->GetNode()->GetExclGroup(); + CXFA_Node* exclNode = m_pNode->GetExclGroup(); if (!exclNode) - return CalculateWidgetAcc(m_pDataAcc.Get()); + return CalculateWidgetAcc(m_pNode->GetWidgetAcc()); CXFA_WidgetAcc* pAcc = exclNode->GetWidgetAcc(); if (!pAcc) - return CalculateWidgetAcc(m_pDataAcc.Get()); + return CalculateWidgetAcc(m_pNode->GetWidgetAcc()); if (CalculateWidgetAcc(pAcc) == 0) return 0; @@ -738,35 +740,36 @@ void CXFA_FFField::OnProcessEvent(CFWL_Event* pEvent) { if (event->m_dwCmd == FWL_MouseCommand::Enter) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_MouseEnter; - eParam.m_pTarget = m_pDataAcc.Get(); - m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::MouseEnter, - &eParam); + eParam.m_pTarget = m_pNode->GetWidgetAcc(); + m_pNode->GetWidgetAcc()->ProcessEvent( + GetDocView(), 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.Get(); - m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::MouseExit, - &eParam); + eParam.m_pTarget = m_pNode->GetWidgetAcc(); + m_pNode->GetWidgetAcc()->ProcessEvent( + GetDocView(), 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.Get(); - m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::MouseDown, - &eParam); + eParam.m_pTarget = m_pNode->GetWidgetAcc(); + m_pNode->GetWidgetAcc()->ProcessEvent( + GetDocView(), 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.Get(); - m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::MouseUp, - &eParam); + eParam.m_pTarget = m_pNode->GetWidgetAcc(); + m_pNode->GetWidgetAcc()->ProcessEvent( + GetDocView(), XFA_AttributeEnum::MouseUp, &eParam); } break; } case CFWL_Event::Type::Click: { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Click; - eParam.m_pTarget = m_pDataAcc.Get(); - m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::Click, &eParam); + eParam.m_pTarget = m_pNode->GetWidgetAcc(); + m_pNode->GetWidgetAcc()->ProcessEvent(GetDocView(), + XFA_AttributeEnum::Click, &eParam); break; } default: diff --git a/xfa/fxfa/cxfa_fffield.h b/xfa/fxfa/cxfa_fffield.h index f6051275d2..c2ba36c798 100644 --- a/xfa/fxfa/cxfa_fffield.h +++ b/xfa/fxfa/cxfa_fffield.h @@ -19,7 +19,7 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate { public: - explicit CXFA_FFField(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFField(CXFA_Node* pNode); ~CXFA_FFField() override; // CXFA_FFWidget diff --git a/xfa/fxfa/cxfa_ffimage.cpp b/xfa/fxfa/cxfa_ffimage.cpp index dbd0067ec9..5191d34858 100644 --- a/xfa/fxfa/cxfa_ffimage.cpp +++ b/xfa/fxfa/cxfa_ffimage.cpp @@ -15,26 +15,27 @@ #include "xfa/fxfa/parser/cxfa_para.h" #include "xfa/fxfa/parser/cxfa_value.h" -CXFA_FFImage::CXFA_FFImage(CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pDataAcc) {} +CXFA_FFImage::CXFA_FFImage(CXFA_Node* pNode) : CXFA_FFDraw(pNode) {} CXFA_FFImage::~CXFA_FFImage() { CXFA_FFImage::UnloadWidget(); } bool CXFA_FFImage::IsLoaded() { - return !!GetDataAcc()->GetImageImage(); + return !!GetNode()->GetWidgetAcc()->GetImageImage(); } bool CXFA_FFImage::LoadWidget() { - if (GetDataAcc()->GetImageImage()) + if (GetNode()->GetWidgetAcc()->GetImageImage()) return true; - return GetDataAcc()->LoadImageImage(GetDoc()) ? CXFA_FFDraw::LoadWidget() - : false; + return GetNode()->GetWidgetAcc()->LoadImageImage(GetDoc()) + ? CXFA_FFDraw::LoadWidget() + : false; } void CXFA_FFImage::UnloadWidget() { - GetDataAcc()->SetImageImage(nullptr); + GetNode()->GetWidgetAcc()->SetImageImage(nullptr); } void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS, @@ -48,18 +49,19 @@ void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS, CXFA_FFWidget::RenderWidget(pGS, mtRotate, dwStatus); - RetainPtr<CFX_DIBitmap> pDIBitmap = GetDataAcc()->GetImageImage(); + RetainPtr<CFX_DIBitmap> pDIBitmap = + GetNode()->GetWidgetAcc()->GetImageImage(); if (!pDIBitmap) return; CFX_RectF rtImage = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMargin(); if (margin) XFA_RectWidthoutMargin(rtImage, margin); XFA_AttributeEnum iHorzAlign = XFA_AttributeEnum::Left; XFA_AttributeEnum iVertAlign = XFA_AttributeEnum::Top; - CXFA_Para* para = m_pDataAcc->GetNode()->GetPara(); + CXFA_Para* para = m_pNode->GetPara(); if (para) { iHorzAlign = para->GetHorizontalAlign(); iVertAlign = para->GetVerticalAlign(); @@ -67,8 +69,8 @@ void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS, int32_t iImageXDpi = 0; int32_t iImageYDpi = 0; - m_pDataAcc->GetImageDpi(iImageXDpi, iImageYDpi); - auto* value = m_pDataAcc->GetNode()->GetFormValue(); + m_pNode->GetWidgetAcc()->GetImageDpi(iImageXDpi, iImageYDpi); + auto* value = m_pNode->GetFormValue(); CXFA_Image* image = value ? value->GetImage() : nullptr; XFA_DrawImage(pGS, rtImage, mtRotate, pDIBitmap, image->GetAspect(), iImageXDpi, iImageYDpi, iHorzAlign, iVertAlign); diff --git a/xfa/fxfa/cxfa_ffimage.h b/xfa/fxfa/cxfa_ffimage.h index 869654b8df..c721b110f3 100644 --- a/xfa/fxfa/cxfa_ffimage.h +++ b/xfa/fxfa/cxfa_ffimage.h @@ -11,7 +11,7 @@ class CXFA_FFImage : public CXFA_FFDraw { public: - explicit CXFA_FFImage(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFImage(CXFA_Node* pNode); ~CXFA_FFImage() override; // CXFA_FFWidget diff --git a/xfa/fxfa/cxfa_ffimageedit.cpp b/xfa/fxfa/cxfa_ffimageedit.cpp index 525a9e90b9..4784004237 100644 --- a/xfa/fxfa/cxfa_ffimageedit.cpp +++ b/xfa/fxfa/cxfa_ffimageedit.cpp @@ -23,8 +23,8 @@ #include "xfa/fxfa/parser/cxfa_para.h" #include "xfa/fxfa/parser/cxfa_value.h" -CXFA_FFImageEdit::CXFA_FFImageEdit(CXFA_WidgetAcc* pDataAcc) - : CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {} +CXFA_FFImageEdit::CXFA_FFImageEdit(CXFA_Node* pNode) + : CXFA_FFField(pNode), m_pOldDelegate(nullptr) {} CXFA_FFImageEdit::~CXFA_FFImageEdit() { CXFA_FFImageEdit::UnloadWidget(); @@ -44,14 +44,14 @@ bool CXFA_FFImageEdit::LoadWidget() { pPictureBox->SetDelegate(this); CXFA_FFField::LoadWidget(); - if (!m_pDataAcc->GetImageEditImage()) + if (!m_pNode->GetWidgetAcc()->GetImageEditImage()) UpdateFWLData(); return true; } void CXFA_FFImageEdit::UnloadWidget() { - m_pDataAcc->SetImageEditImage(nullptr); + m_pNode->GetWidgetAcc()->SetImageEditImage(nullptr); CXFA_FFField::UnloadWidget(); } @@ -65,23 +65,24 @@ void CXFA_FFImageEdit::RenderWidget(CXFA_Graphics* pGS, mtRotate.Concat(matrix); CXFA_FFWidget::RenderWidget(pGS, mtRotate, dwStatus); - DrawBorder(pGS, m_pDataAcc->GetUIBorder(), m_rtUI, mtRotate); + DrawBorder(pGS, m_pNode->GetWidgetAcc()->GetUIBorder(), m_rtUI, mtRotate); RenderCaption(pGS, &mtRotate); - RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDataAcc->GetImageEditImage(); + RetainPtr<CFX_DIBitmap> pDIBitmap = + m_pNode->GetWidgetAcc()->GetImageEditImage(); if (!pDIBitmap) return; CFX_RectF rtImage = m_pNormalWidget->GetWidgetRect(); XFA_AttributeEnum iHorzAlign = XFA_AttributeEnum::Left; XFA_AttributeEnum iVertAlign = XFA_AttributeEnum::Top; - CXFA_Para* para = m_pDataAcc->GetNode()->GetPara(); + CXFA_Para* para = m_pNode->GetPara(); if (para) { iHorzAlign = para->GetHorizontalAlign(); iVertAlign = para->GetVerticalAlign(); } XFA_AttributeEnum iAspect = XFA_AttributeEnum::Fit; - CXFA_Value* value = m_pDataAcc->GetNode()->GetFormValue(); + CXFA_Value* value = m_pNode->GetFormValue(); if (value) { CXFA_Image* image = value->GetImage(); if (image) @@ -90,14 +91,14 @@ void CXFA_FFImageEdit::RenderWidget(CXFA_Graphics* pGS, int32_t iImageXDpi = 0; int32_t iImageYDpi = 0; - m_pDataAcc->GetImageEditDpi(iImageXDpi, iImageYDpi); + m_pNode->GetWidgetAcc()->GetImageEditDpi(iImageXDpi, iImageYDpi); XFA_DrawImage(pGS, rtImage, mtRotate, pDIBitmap, iAspect, iImageXDpi, iImageYDpi, iHorzAlign, iVertAlign); } bool CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { - if (!m_pDataAcc->IsOpenAccess()) + if (!m_pNode->IsOpenAccess()) return false; if (!PtInActiveRect(point)) return false; @@ -116,7 +117,7 @@ void CXFA_FFImageEdit::SetFWLRect() { if (!m_pNormalWidget) return; - CFX_RectF rtUIMargin = m_pDataAcc->GetUIMargin(); + CFX_RectF rtUIMargin = m_pNode->GetWidgetAcc()->GetUIMargin(); CFX_RectF rtImage(m_rtUI); rtImage.Deflate(rtUIMargin.left, rtUIMargin.top, rtUIMargin.width, rtUIMargin.height); @@ -128,8 +129,8 @@ bool CXFA_FFImageEdit::CommitData() { } bool CXFA_FFImageEdit::UpdateFWLData() { - m_pDataAcc->SetImageEditImage(nullptr); - m_pDataAcc->LoadImageEditImage(GetDoc()); + m_pNode->GetWidgetAcc()->SetImageEditImage(nullptr); + m_pNode->GetWidgetAcc()->LoadImageEditImage(GetDoc()); return true; } diff --git a/xfa/fxfa/cxfa_ffimageedit.h b/xfa/fxfa/cxfa_ffimageedit.h index d9ab6152f5..436435d55b 100644 --- a/xfa/fxfa/cxfa_ffimageedit.h +++ b/xfa/fxfa/cxfa_ffimageedit.h @@ -11,7 +11,7 @@ class CXFA_FFImageEdit : public CXFA_FFField { public: - explicit CXFA_FFImageEdit(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFImageEdit(CXFA_Node* pNode); ~CXFA_FFImageEdit() override; // CXFA_FFField diff --git a/xfa/fxfa/cxfa_ffline.cpp b/xfa/fxfa/cxfa_ffline.cpp index e9c00b01cb..3fe2538368 100644 --- a/xfa/fxfa/cxfa_ffline.cpp +++ b/xfa/fxfa/cxfa_ffline.cpp @@ -29,7 +29,7 @@ CFX_GraphStateData::LineCap LineCapToFXGE(XFA_AttributeEnum iLineCap) { } // namespace -CXFA_FFLine::CXFA_FFLine(CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pDataAcc) {} +CXFA_FFLine::CXFA_FFLine(CXFA_Node* pNode) : CXFA_FFDraw(pNode) {} CXFA_FFLine::~CXFA_FFLine() {} @@ -87,7 +87,7 @@ void CXFA_FFLine::RenderWidget(CXFA_Graphics* pGS, if (!IsMatchVisibleStatus(dwStatus)) return; - CXFA_Value* value = m_pDataAcc->GetNode()->GetFormValue(); + CXFA_Value* value = m_pNode->GetFormValue(); if (!value) return; @@ -111,7 +111,7 @@ void CXFA_FFLine::RenderWidget(CXFA_Graphics* pGS, mtRotate.Concat(matrix); CFX_RectF rtLine = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMargin(); if (margin) XFA_RectWidthoutMargin(rtLine, margin); diff --git a/xfa/fxfa/cxfa_ffline.h b/xfa/fxfa/cxfa_ffline.h index b6db5b3b75..01f3fd3f81 100644 --- a/xfa/fxfa/cxfa_ffline.h +++ b/xfa/fxfa/cxfa_ffline.h @@ -11,7 +11,7 @@ class CXFA_FFLine : public CXFA_FFDraw { public: - explicit CXFA_FFLine(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFLine(CXFA_Node* pNode); ~CXFA_FFLine() override; // CXFA_FFWidget diff --git a/xfa/fxfa/cxfa_fflistbox.cpp b/xfa/fxfa/cxfa_fflistbox.cpp index d9eafb9812..3b01c8fd85 100644 --- a/xfa/fxfa/cxfa_fflistbox.cpp +++ b/xfa/fxfa/cxfa_fflistbox.cpp @@ -24,8 +24,8 @@ CFWL_ListBox* ToListBox(CFWL_Widget* widget) { } // namespace -CXFA_FFListBox::CXFA_FFListBox(CXFA_WidgetAcc* pDataAcc) - : CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {} +CXFA_FFListBox::CXFA_FFListBox(CXFA_Node* pNode) + : CXFA_FFField(pNode), m_pOldDelegate(nullptr) {} CXFA_FFListBox::~CXFA_FFListBox() { if (!m_pNormalWidget) @@ -53,16 +53,16 @@ bool CXFA_FFListBox::LoadWidget() { m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); - for (const auto& label : m_pDataAcc->GetChoiceListItems(false)) + for (const auto& label : m_pNode->GetWidgetAcc()->GetChoiceListItems(false)) pListBox->AddString(label.AsStringView()); uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; - if (m_pDataAcc->IsChoiceListMultiSelect()) + if (m_pNode->GetWidgetAcc()->IsChoiceListMultiSelect()) dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection; dwExtendedStyle |= GetAlignment(); m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); - for (int32_t selected : m_pDataAcc->GetSelectedItems()) + for (int32_t selected : m_pNode->GetWidgetAcc()->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_pDataAcc->SetSelectedItems(iSelArray, true, false, true); + m_pNode->GetWidgetAcc()->SetSelectedItems(iSelArray, true, false, true); return true; } bool CXFA_FFListBox::IsDataChanged() { - std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems(); + std::vector<int32_t> iSelArray = m_pNode->GetWidgetAcc()->GetSelectedItems(); int32_t iOldSels = pdfium::CollectionSize<int32_t>(iSelArray); auto* pListBox = ToListBox(m_pNormalWidget.get()); int32_t iSels = pListBox->CountSelItems(); @@ -105,7 +105,7 @@ bool CXFA_FFListBox::IsDataChanged() { } uint32_t CXFA_FFListBox::GetAlignment() { - CXFA_Para* para = m_pDataAcc->GetNode()->GetPara(); + CXFA_Para* para = m_pNode->GetPara(); if (!para) return 0; @@ -135,7 +135,7 @@ bool CXFA_FFListBox::UpdateFWLData() { return false; auto* pListBox = ToListBox(m_pNormalWidget.get()); - std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems(); + std::vector<int32_t> iSelArray = m_pNode->GetWidgetAcc()->GetSelectedItems(); std::vector<CFWL_ListItem*> selItemArray(iSelArray.size()); std::transform(iSelArray.begin(), iSelArray.end(), selItemArray.begin(), [pListBox](int32_t val) { return pListBox->GetSelItem(val); }); @@ -151,8 +151,8 @@ 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.Get(); - eParam.m_wsPrevText = m_pDataAcc->GetValue(XFA_VALUEPICTURE_Raw); + eParam.m_pTarget = m_pNode->GetWidgetAcc(); + eParam.m_wsPrevText = m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw); auto* pListBox = ToListBox(m_pNormalWidget.get()); int32_t iSels = pListBox->CountSelItems(); @@ -160,7 +160,8 @@ void CXFA_FFListBox::OnSelectChanged(CFWL_Widget* pWidget) { CFWL_ListItem* item = pListBox->GetSelItem(0); eParam.m_wsNewText = item ? item->GetText() : L""; } - m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::Change, &eParam); + m_pNode->GetWidgetAcc()->ProcessEvent(GetDocView(), XFA_AttributeEnum::Change, + &eParam); } void CXFA_FFListBox::SetItemState(int32_t nIndex, bool bSelected) { diff --git a/xfa/fxfa/cxfa_fflistbox.h b/xfa/fxfa/cxfa_fflistbox.h index f31b122bd1..11c77612ce 100644 --- a/xfa/fxfa/cxfa_fflistbox.h +++ b/xfa/fxfa/cxfa_fflistbox.h @@ -11,7 +11,7 @@ class CXFA_FFListBox : public CXFA_FFField { public: - explicit CXFA_FFListBox(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFListBox(CXFA_Node* pNode); ~CXFA_FFListBox() override; // CXFA_FFField diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp index 193c31162e..a85fef96b0 100644 --- a/xfa/fxfa/cxfa_ffnotify.cpp +++ b/xfa/fxfa/cxfa_ffnotify.cpp @@ -108,68 +108,68 @@ CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) { if (eType == XFA_Element::ContentArea) return new CXFA_ContainerLayoutItem(pNode); - CXFA_WidgetAcc* pAcc = pNode->GetWidgetAcc(); - if (!pAcc) + // We only need to create the widget for certain types of objects. + if (!XFA_IsCreateWidget(eType)) return new CXFA_ContentLayoutItem(pNode); CXFA_FFWidget* pWidget; - switch (pAcc->GetUIType()) { + switch (pNode->GetWidgetAcc()->GetUIType()) { case XFA_Element::Barcode: - pWidget = new CXFA_FFBarcode(pAcc); + pWidget = new CXFA_FFBarcode(pNode); break; case XFA_Element::Button: - pWidget = new CXFA_FFPushButton(pAcc); + pWidget = new CXFA_FFPushButton(pNode); break; case XFA_Element::CheckButton: - pWidget = new CXFA_FFCheckButton(pAcc); + pWidget = new CXFA_FFCheckButton(pNode); break; case XFA_Element::ChoiceList: { - if (pAcc->IsListBox()) - pWidget = new CXFA_FFListBox(pAcc); + if (pNode->GetWidgetAcc()->IsListBox()) + pWidget = new CXFA_FFListBox(pNode); else - pWidget = new CXFA_FFComboBox(pAcc); + pWidget = new CXFA_FFComboBox(pNode); } break; case XFA_Element::DateTimeEdit: - pWidget = new CXFA_FFDateTimeEdit(pAcc); + pWidget = new CXFA_FFDateTimeEdit(pNode); break; case XFA_Element::ImageEdit: - pWidget = new CXFA_FFImageEdit(pAcc); + pWidget = new CXFA_FFImageEdit(pNode); break; case XFA_Element::NumericEdit: - pWidget = new CXFA_FFNumericEdit(pAcc); + pWidget = new CXFA_FFNumericEdit(pNode); break; case XFA_Element::PasswordEdit: - pWidget = new CXFA_FFPasswordEdit(pAcc); + pWidget = new CXFA_FFPasswordEdit(pNode); break; case XFA_Element::Signature: - pWidget = new CXFA_FFSignature(pAcc); + pWidget = new CXFA_FFSignature(pNode); break; case XFA_Element::TextEdit: - pWidget = new CXFA_FFTextEdit(pAcc); + pWidget = new CXFA_FFTextEdit(pNode); break; case XFA_Element::Arc: - pWidget = new CXFA_FFArc(pAcc); + pWidget = new CXFA_FFArc(pNode); break; case XFA_Element::Line: - pWidget = new CXFA_FFLine(pAcc); + pWidget = new CXFA_FFLine(pNode); break; case XFA_Element::Rectangle: - pWidget = new CXFA_FFRectangle(pAcc); + pWidget = new CXFA_FFRectangle(pNode); break; case XFA_Element::Text: - pWidget = new CXFA_FFText(pAcc); + pWidget = new CXFA_FFText(pNode); break; case XFA_Element::Image: - pWidget = new CXFA_FFImage(pAcc); + pWidget = new CXFA_FFImage(pNode); break; case XFA_Element::Draw: - pWidget = new CXFA_FFDraw(pAcc); + pWidget = new CXFA_FFDraw(pNode); break; case XFA_Element::Subform: - pWidget = new CXFA_FFSubForm(pAcc); + pWidget = new CXFA_FFSubForm(pNode); break; case XFA_Element::ExclGroup: - pWidget = new CXFA_FFExclGroup(pAcc); + pWidget = new CXFA_FFExclGroup(pNode); break; case XFA_Element::DefaultUi: default: @@ -267,7 +267,8 @@ CXFA_FFWidget* CXFA_FFNotify::GetHWidget(CXFA_LayoutItem* pLayoutItem) { } void CXFA_FFNotify::OpenDropDownList(CXFA_FFWidget* hWidget) { - if (hWidget->GetDataAcc()->GetUIType() != XFA_Element::ChoiceList) + if (hWidget->GetNode()->GetWidgetAcc()->GetUIType() != + XFA_Element::ChoiceList) return; CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); @@ -342,6 +343,7 @@ void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) { pNode->JSObject()->SetWidgetAcc(pdfium::MakeUnique<CXFA_WidgetAcc>(pNode)); return; } + switch (eType) { case XFA_Element::BindItems: pDocView->AddBindItem(static_cast<CXFA_BindItems*>(pNode)); @@ -497,7 +499,8 @@ 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->GetDocEnvironment()->WidgetPostAdd(pWidget, pWidget->GetDataAcc()); + m_pDoc->GetDocEnvironment()->WidgetPostAdd( + pWidget, pWidget->GetNode()->GetWidgetAcc()); } if (pDocView->GetLayoutStatus() != XFA_DOCVIEW_LAYOUTSTATUS_End || !(dwStatus & XFA_WidgetStatus_Visible)) { @@ -523,6 +526,7 @@ void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_LayoutProcessor* pLayout, return; pDocView->DeleteLayoutItem(pWidget); - m_pDoc->GetDocEnvironment()->WidgetPreRemove(pWidget, pWidget->GetDataAcc()); + m_pDoc->GetDocEnvironment()->WidgetPreRemove( + pWidget, pWidget->GetNode()->GetWidgetAcc()); pWidget->AddInvalidateRect(); } diff --git a/xfa/fxfa/cxfa_ffnumericedit.cpp b/xfa/fxfa/cxfa_ffnumericedit.cpp index be0b306802..666f3c0c9b 100644 --- a/xfa/fxfa/cxfa_ffnumericedit.cpp +++ b/xfa/fxfa/cxfa_ffnumericedit.cpp @@ -13,10 +13,11 @@ #include "xfa/fwl/cfwl_notedriver.h" #include "xfa/fxfa/cxfa_ffdoc.h" #include "xfa/fxfa/parser/cxfa_localevalue.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/xfa_utils.h" -CXFA_FFNumericEdit::CXFA_FFNumericEdit(CXFA_WidgetAcc* pDataAcc) - : CXFA_FFTextEdit(pDataAcc) {} +CXFA_FFNumericEdit::CXFA_FFNumericEdit(CXFA_Node* pNode) + : CXFA_FFTextEdit(pNode) {} CXFA_FFNumericEdit::~CXFA_FFNumericEdit() {} @@ -35,7 +36,7 @@ bool CXFA_FFNumericEdit::LoadWidget() { m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); - pWidget->SetText(m_pDataAcc->GetValue(XFA_VALUEPICTURE_Display)); + pWidget->SetText(m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Display)); UpdateWidgetProperty(); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); @@ -50,16 +51,16 @@ void CXFA_FFNumericEdit::UpdateWidgetProperty() { FWL_STYLEEXT_EDT_ShowScrollbarFocus | FWL_STYLEEXT_EDT_OuterScrollbar | FWL_STYLEEXT_EDT_Validate | FWL_STYLEEXT_EDT_Number; dwExtendedStyle |= UpdateUIProperty(); - if (!m_pDataAcc->IsHorizontalScrollPolicyOff()) + if (!m_pNode->GetWidgetAcc()->IsHorizontalScrollPolicyOff()) dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll; - Optional<int32_t> numCells = m_pDataAcc->GetNumberOfCells(); + Optional<int32_t> numCells = m_pNode->GetWidgetAcc()->GetNumberOfCells(); if (numCells && *numCells > 0) { dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText; pWidget->SetLimit(*numCells); } dwExtendedStyle |= GetAlignment(); - if (!m_pDataAcc->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) + if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly; m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); @@ -75,14 +76,16 @@ void CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) { } bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget, WideString& wsText) { - WideString wsPattern = m_pDataAcc->GetPictureContent(XFA_VALUEPICTURE_Edit); + WideString wsPattern = + m_pNode->GetWidgetAcc()->GetPictureContent(XFA_VALUEPICTURE_Edit); if (!wsPattern.IsEmpty()) return true; WideString wsFormat; - CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(m_pDataAcc.Get()); - widgetValue.GetNumericFormat(wsFormat, m_pDataAcc->GetLeadDigits(), - m_pDataAcc->GetFracDigits()); + CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(m_pNode->GetWidgetAcc()); + widgetValue.GetNumericFormat(wsFormat, + m_pNode->GetWidgetAcc()->GetLeadDigits(), + m_pNode->GetWidgetAcc()->GetFracDigits()); return widgetValue.ValidateNumericTemp(wsText, wsFormat, - m_pDataAcc->GetLocale()); + m_pNode->GetLocale()); } diff --git a/xfa/fxfa/cxfa_ffnumericedit.h b/xfa/fxfa/cxfa_ffnumericedit.h index fb06fd4d34..c413ac60c0 100644 --- a/xfa/fxfa/cxfa_ffnumericedit.h +++ b/xfa/fxfa/cxfa_ffnumericedit.h @@ -16,7 +16,7 @@ class CXFA_WidgetAcc; class CXFA_FFNumericEdit : public CXFA_FFTextEdit { public: - explicit CXFA_FFNumericEdit(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFNumericEdit(CXFA_Node* pNode); ~CXFA_FFNumericEdit() override; // CXFA_FFTextEdit diff --git a/xfa/fxfa/cxfa_ffpageview.cpp b/xfa/fxfa/cxfa_ffpageview.cpp index 3fecf2e495..39f4dbe03b 100644 --- a/xfa/fxfa/cxfa_ffpageview.cpp +++ b/xfa/fxfa/cxfa_ffpageview.cpp @@ -70,11 +70,10 @@ bool PageWidgetFilter(CXFA_FFWidget* pWidget, uint32_t dwFilter, bool bTraversal, bool bIgnorerelevant) { - CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); + CXFA_Node* pNode = pWidget->GetNode(); if (!!(dwFilter & XFA_WidgetStatus_Focused) && - (!pWidgetAcc->GetNode() || - pWidgetAcc->GetNode()->GetElementType() != XFA_Element::Field)) { + (!pNode || pNode->GetElementType() != XFA_Element::Field)) { return false; } @@ -310,8 +309,7 @@ bool CXFA_FFTabOrderPageWidgetIterator::SetCurrentWidget( CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetTraverseWidget( CXFA_FFWidget* pWidget) { - CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); - CXFA_Traversal* pTraversal = pAcc->GetNode()->GetChild<CXFA_Traversal>( + CXFA_Traversal* pTraversal = pWidget->GetNode()->GetChild<CXFA_Traversal>( 0, XFA_Element::Traversal, false); if (pTraversal) { CXFA_Traverse* pTraverse = @@ -345,7 +343,7 @@ void CXFA_FFTabOrderPageWidgetIterator::CreateTabOrderWidgetArray() { nWidgetCount) { if (!pdfium::ContainsValue(m_TabOrderWidgetArray, hWidget)) { m_TabOrderWidgetArray.push_back(hWidget); - CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc(); + CXFA_WidgetAcc* pWidgetAcc = hWidget->GetNode()->GetWidgetAcc(); if (pWidgetAcc->GetUIType() == XFA_Element::ExclGroup) { auto it = std::find(SpaceOrderWidgetArray.begin(), SpaceOrderWidgetArray.end(), hWidget); @@ -355,13 +353,11 @@ void CXFA_FFTabOrderPageWidgetIterator::CreateTabOrderWidgetArray() { while (true) { CXFA_FFWidget* pRadio = SpaceOrderWidgetArray[iWidgetIndex % nWidgetCount]; - if (pRadio->GetDataAcc()->GetNode()->GetExclGroup() != - pWidgetAcc->GetNode()) { + if (pRadio->GetNode()->GetExclGroup() != pWidgetAcc->GetNode()) break; - } - if (!pdfium::ContainsValue(m_TabOrderWidgetArray, hWidget)) { + if (!pdfium::ContainsValue(m_TabOrderWidgetArray, hWidget)) m_TabOrderWidgetArray.push_back(pRadio); - } + iWidgetIndex++; } } diff --git a/xfa/fxfa/cxfa_ffpasswordedit.cpp b/xfa/fxfa/cxfa_ffpasswordedit.cpp index c5851ccd2c..15bd5faaae 100644 --- a/xfa/fxfa/cxfa_ffpasswordedit.cpp +++ b/xfa/fxfa/cxfa_ffpasswordedit.cpp @@ -11,9 +11,10 @@ #include "xfa/fwl/cfwl_edit.h" #include "xfa/fwl/cfwl_notedriver.h" #include "xfa/fxfa/cxfa_ffdoc.h" +#include "xfa/fxfa/parser/cxfa_node.h" -CXFA_FFPasswordEdit::CXFA_FFPasswordEdit(CXFA_WidgetAcc* pDataAcc) - : CXFA_FFTextEdit(pDataAcc) {} +CXFA_FFPasswordEdit::CXFA_FFPasswordEdit(CXFA_Node* pNode) + : CXFA_FFTextEdit(pNode) {} CXFA_FFPasswordEdit::~CXFA_FFPasswordEdit() {} @@ -32,7 +33,7 @@ bool CXFA_FFPasswordEdit::LoadWidget() { m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); - pWidget->SetText(m_pDataAcc->GetValue(XFA_VALUEPICTURE_Display)); + pWidget->SetText(m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Display)); UpdateWidgetProperty(); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); @@ -48,12 +49,12 @@ void CXFA_FFPasswordEdit::UpdateWidgetProperty() { FWL_STYLEEXT_EDT_Password; dwExtendedStyle |= UpdateUIProperty(); - WideString password = m_pDataAcc->GetPasswordChar(); + WideString password = m_pNode->GetWidgetAcc()->GetPasswordChar(); if (!password.IsEmpty()) pWidget->SetAliasChar(password[0]); - if (!m_pDataAcc->IsHorizontalScrollPolicyOff()) + if (!m_pNode->GetWidgetAcc()->IsHorizontalScrollPolicyOff()) dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll; - if (!m_pDataAcc->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) + if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly; dwExtendedStyle |= GetAlignment(); diff --git a/xfa/fxfa/cxfa_ffpasswordedit.h b/xfa/fxfa/cxfa_ffpasswordedit.h index 7ff3600216..da7279ab95 100644 --- a/xfa/fxfa/cxfa_ffpasswordedit.h +++ b/xfa/fxfa/cxfa_ffpasswordedit.h @@ -13,7 +13,7 @@ class CXFA_WidgetAcc; class CXFA_FFPasswordEdit : public CXFA_FFTextEdit { public: - explicit CXFA_FFPasswordEdit(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFPasswordEdit(CXFA_Node* pNode); ~CXFA_FFPasswordEdit() override; // CXFA_FFTextEdit diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp index f42e5257b5..c494a3dd82 100644 --- a/xfa/fxfa/cxfa_ffpushbutton.cpp +++ b/xfa/fxfa/cxfa_ffpushbutton.cpp @@ -24,8 +24,8 @@ #include "xfa/fxgraphics/cxfa_gecolor.h" #include "xfa/fxgraphics/cxfa_gepath.h" -CXFA_FFPushButton::CXFA_FFPushButton(CXFA_WidgetAcc* pDataAcc) - : CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {} +CXFA_FFPushButton::CXFA_FFPushButton(CXFA_Node* pNode) + : CXFA_FFField(pNode), m_pOldDelegate(nullptr) {} CXFA_FFPushButton::~CXFA_FFPushButton() { CXFA_FFPushButton::UnloadWidget(); @@ -71,7 +71,7 @@ bool CXFA_FFPushButton::LoadWidget() { void CXFA_FFPushButton::UpdateWidgetProperty() { uint32_t dwStyleEx = 0; - switch (m_pDataAcc->GetButtonHighlight()) { + switch (m_pNode->GetWidgetAcc()->GetButtonHighlight()) { case XFA_AttributeEnum::Inverted: dwStyleEx = XFA_FWL_PSBSTYLEEXT_HiliteInverted; break; @@ -100,11 +100,11 @@ bool CXFA_FFPushButton::PerformLayout() { CFX_RectF rtWidget = GetRectWithoutRotate(); m_rtUI = rtWidget; - CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMargin(); if (margin) XFA_RectWidthoutMargin(rtWidget, margin); - CXFA_Caption* caption = m_pDataAcc->GetNode()->GetCaption(); + CXFA_Caption* caption = m_pNode->GetCaption(); m_rtCaption = rtWidget; CXFA_Margin* captionMargin = caption->GetMargin(); if (captionMargin) @@ -118,7 +118,7 @@ bool CXFA_FFPushButton::PerformLayout() { return true; } float CXFA_FFPushButton::GetLineWidth() { - CXFA_Border* border = m_pDataAcc->GetNode()->GetBorder(false); + CXFA_Border* border = m_pNode->GetBorder(false); if (border && border->GetPresence() == XFA_AttributeEnum::Visible) return border->GetEdge(0)->GetThickness(); return 0; @@ -133,23 +133,23 @@ FX_ARGB CXFA_FFPushButton::GetFillColor() { } void CXFA_FFPushButton::LoadHighlightCaption() { - CXFA_Caption* caption = m_pDataAcc->GetNode()->GetCaption(); + CXFA_Caption* caption = m_pNode->GetCaption(); if (!caption || caption->IsHidden()) return; - if (m_pDataAcc->HasButtonRollover()) { + if (m_pNode->GetWidgetAcc()->HasButtonRollover()) { if (!m_pRollProvider) { m_pRollProvider = pdfium::MakeUnique<CXFA_TextProvider>( - m_pDataAcc.Get(), XFA_TEXTPROVIDERTYPE_Rollover); + m_pNode->GetWidgetAcc(), XFA_TEXTPROVIDERTYPE_Rollover); } m_pRolloverTextLayout = pdfium::MakeUnique<CXFA_TextLayout>(GetDoc(), m_pRollProvider.get()); } - if (m_pDataAcc->HasButtonDown()) { + if (m_pNode->GetWidgetAcc()->HasButtonDown()) { if (!m_pDownProvider) { m_pDownProvider = pdfium::MakeUnique<CXFA_TextProvider>( - m_pDataAcc.Get(), XFA_TEXTPROVIDERTYPE_Down); + m_pNode->GetWidgetAcc(), XFA_TEXTPROVIDERTYPE_Down); } m_pDownTextLayout = pdfium::MakeUnique<CXFA_TextLayout>(GetDoc(), m_pDownProvider.get()); @@ -167,8 +167,9 @@ void CXFA_FFPushButton::LayoutHighlightCaption() { void CXFA_FFPushButton::RenderHighlightCaption(CXFA_Graphics* pGS, CFX_Matrix* pMatrix) { - CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout(); - CXFA_Caption* caption = m_pDataAcc->GetNode()->GetCaption(); + CXFA_TextLayout* pCapTextLayout = + m_pNode->GetWidgetAcc()->GetCaptionTextLayout(); + CXFA_Caption* caption = m_pNode->GetCaption(); if (!caption || !caption->IsVisible()) return; diff --git a/xfa/fxfa/cxfa_ffpushbutton.h b/xfa/fxfa/cxfa_ffpushbutton.h index c2bc89f858..ba2d02318f 100644 --- a/xfa/fxfa/cxfa_ffpushbutton.h +++ b/xfa/fxfa/cxfa_ffpushbutton.h @@ -19,7 +19,7 @@ class CXFA_TextProvider; class CXFA_FFPushButton : public CXFA_FFField { public: - explicit CXFA_FFPushButton(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFPushButton(CXFA_Node* pNode); ~CXFA_FFPushButton() override; // CXFA_FFField diff --git a/xfa/fxfa/cxfa_ffrectangle.cpp b/xfa/fxfa/cxfa_ffrectangle.cpp index 014c19cb97..1e27902a78 100644 --- a/xfa/fxfa/cxfa_ffrectangle.cpp +++ b/xfa/fxfa/cxfa_ffrectangle.cpp @@ -9,8 +9,7 @@ #include "xfa/fxfa/parser/cxfa_rectangle.h" #include "xfa/fxfa/parser/cxfa_value.h" -CXFA_FFRectangle::CXFA_FFRectangle(CXFA_WidgetAcc* pDataAcc) - : CXFA_FFDraw(pDataAcc) {} +CXFA_FFRectangle::CXFA_FFRectangle(CXFA_Node* pNode) : CXFA_FFDraw(pNode) {} CXFA_FFRectangle::~CXFA_FFRectangle() {} @@ -20,12 +19,12 @@ void CXFA_FFRectangle::RenderWidget(CXFA_Graphics* pGS, if (!IsMatchVisibleStatus(dwStatus)) return; - CXFA_Value* value = m_pDataAcc->GetNode()->GetFormValue(); + CXFA_Value* value = m_pNode->GetFormValue(); if (!value) return; CFX_RectF rect = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMargin(); if (margin) XFA_RectWidthoutMargin(rect, margin); diff --git a/xfa/fxfa/cxfa_ffrectangle.h b/xfa/fxfa/cxfa_ffrectangle.h index 24da214093..304c5c69a9 100644 --- a/xfa/fxfa/cxfa_ffrectangle.h +++ b/xfa/fxfa/cxfa_ffrectangle.h @@ -11,7 +11,7 @@ class CXFA_FFRectangle : public CXFA_FFDraw { public: - explicit CXFA_FFRectangle(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFRectangle(CXFA_Node* pNode); ~CXFA_FFRectangle() override; // CXFA_FFWidget diff --git a/xfa/fxfa/cxfa_ffsignature.cpp b/xfa/fxfa/cxfa_ffsignature.cpp index 4501c6d2c1..3b373a9e66 100644 --- a/xfa/fxfa/cxfa_ffsignature.cpp +++ b/xfa/fxfa/cxfa_ffsignature.cpp @@ -12,8 +12,7 @@ #include "xfa/fxfa/cxfa_ffwidget.h" #include "xfa/fxfa/parser/cxfa_border.h" -CXFA_FFSignature::CXFA_FFSignature(CXFA_WidgetAcc* pDataAcc) - : CXFA_FFField(pDataAcc) {} +CXFA_FFSignature::CXFA_FFSignature(CXFA_Node* pNode) : CXFA_FFField(pNode) {} CXFA_FFSignature::~CXFA_FFSignature() {} @@ -32,7 +31,7 @@ void CXFA_FFSignature::RenderWidget(CXFA_Graphics* pGS, CXFA_FFWidget::RenderWidget(pGS, mtRotate, dwStatus); - DrawBorder(pGS, m_pDataAcc->GetUIBorder(), m_rtUI, mtRotate); + DrawBorder(pGS, m_pNode->GetWidgetAcc()->GetUIBorder(), m_rtUI, mtRotate); RenderCaption(pGS, &mtRotate); DrawHighlight(pGS, &mtRotate, dwStatus, false); } diff --git a/xfa/fxfa/cxfa_ffsignature.h b/xfa/fxfa/cxfa_ffsignature.h index b9051962e3..af26004c71 100644 --- a/xfa/fxfa/cxfa_ffsignature.h +++ b/xfa/fxfa/cxfa_ffsignature.h @@ -11,7 +11,7 @@ class CXFA_FFSignature final : public CXFA_FFField { public: - explicit CXFA_FFSignature(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFSignature(CXFA_Node* pNode); ~CXFA_FFSignature() override; // CXFA_FFField diff --git a/xfa/fxfa/cxfa_ffsubform.cpp b/xfa/fxfa/cxfa_ffsubform.cpp index 9345e66dd7..97a075026d 100644 --- a/xfa/fxfa/cxfa_ffsubform.cpp +++ b/xfa/fxfa/cxfa_ffsubform.cpp @@ -11,7 +11,6 @@ #include "xfa/fxfa/cxfa_ffpageview.h" #include "xfa/fxfa/cxfa_ffwidget.h" -CXFA_FFSubForm::CXFA_FFSubForm(CXFA_WidgetAcc* pDataAcc) - : CXFA_FFWidget(pDataAcc) {} +CXFA_FFSubForm::CXFA_FFSubForm(CXFA_Node* pNode) : CXFA_FFWidget(pNode) {} CXFA_FFSubForm::~CXFA_FFSubForm() {} diff --git a/xfa/fxfa/cxfa_ffsubform.h b/xfa/fxfa/cxfa_ffsubform.h index 051bd271bf..a69b571566 100644 --- a/xfa/fxfa/cxfa_ffsubform.h +++ b/xfa/fxfa/cxfa_ffsubform.h @@ -12,7 +12,7 @@ class CXFA_FFSubForm : public CXFA_FFWidget { public: - explicit CXFA_FFSubForm(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFSubForm(CXFA_Node* pNode); ~CXFA_FFSubForm() override; }; diff --git a/xfa/fxfa/cxfa_fftext.cpp b/xfa/fxfa/cxfa_fftext.cpp index baeb8fde43..e395621760 100644 --- a/xfa/fxfa/cxfa_fftext.cpp +++ b/xfa/fxfa/cxfa_fftext.cpp @@ -20,7 +20,7 @@ #include "xfa/fxfa/parser/cxfa_margin.h" #include "xfa/fxgraphics/cxfa_graphics.h" -CXFA_FFText::CXFA_FFText(CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pDataAcc) {} +CXFA_FFText::CXFA_FFText(CXFA_Node* pNode) : CXFA_FFDraw(pNode) {} CXFA_FFText::~CXFA_FFText() {} @@ -35,13 +35,13 @@ void CXFA_FFText::RenderWidget(CXFA_Graphics* pGS, CXFA_FFWidget::RenderWidget(pGS, mtRotate, dwStatus); - CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout(); + CXFA_TextLayout* pTextLayout = m_pNode->GetWidgetAcc()->GetTextLayout(); if (!pTextLayout) return; CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice(); CFX_RectF rtText = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMargin(); if (margin) { CXFA_LayoutItem* pItem = this; if (!pItem->GetPrev() && !pItem->GetNext()) { @@ -66,13 +66,13 @@ void CXFA_FFText::RenderWidget(CXFA_Graphics* pGS, } bool CXFA_FFText::IsLoaded() { - CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout(); + CXFA_TextLayout* pTextLayout = m_pNode->GetWidgetAcc()->GetTextLayout(); return pTextLayout && !pTextLayout->m_bHasBlock; } bool CXFA_FFText::PerformLayout() { CXFA_FFDraw::PerformLayout(); - CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout(); + CXFA_TextLayout* pTextLayout = m_pNode->GetWidgetAcc()->GetTextLayout(); if (!pTextLayout) return false; if (!pTextLayout->m_bHasBlock) @@ -86,7 +86,7 @@ bool CXFA_FFText::PerformLayout() { pItem = pItem->GetFirst(); while (pItem) { CFX_RectF rtText = pItem->GetRect(false); - CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMargin(); if (margin) { if (!pItem->GetPrev()) rtText.height -= margin->GetTopInset(); @@ -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_pDataAcc->GetTextLayout(); + CXFA_TextLayout* pTextLayout = m_pNode->GetWidgetAcc()->GetTextLayout(); if (!pTextLayout) return nullptr; diff --git a/xfa/fxfa/cxfa_fftext.h b/xfa/fxfa/cxfa_fftext.h index 2695f4568b..8c32183d6c 100644 --- a/xfa/fxfa/cxfa_fftext.h +++ b/xfa/fxfa/cxfa_fftext.h @@ -11,7 +11,7 @@ class CXFA_FFText : public CXFA_FFDraw { public: - explicit CXFA_FFText(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFText(CXFA_Node* pNode); ~CXFA_FFText() override; // CXFA_FFWidget diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp index eeeb7b9e64..4d342651a6 100644 --- a/xfa/fxfa/cxfa_fftextedit.cpp +++ b/xfa/fxfa/cxfa_fftextedit.cpp @@ -30,8 +30,8 @@ CFWL_Edit* ToEdit(CFWL_Widget* widget) { } // namespace -CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_WidgetAcc* pDataAcc) - : CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {} +CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_Node* pNode) + : CXFA_FFField(pNode), m_pOldDelegate(nullptr) {} CXFA_FFTextEdit::~CXFA_FFTextEdit() { if (m_pNormalWidget) { @@ -57,7 +57,8 @@ bool CXFA_FFTextEdit::LoadWidget() { m_pNormalWidget->LockUpdate(); UpdateWidgetProperty(); - pFWLEdit->SetText(m_pDataAcc->GetValue(XFA_VALUEPICTURE_Display)); + pFWLEdit->SetText( + m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Display)); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); } @@ -71,27 +72,27 @@ void CXFA_FFTextEdit::UpdateWidgetProperty() { uint32_t dwExtendedStyle = FWL_STYLEEXT_EDT_ShowScrollbarFocus | FWL_STYLEEXT_EDT_OuterScrollbar; dwExtendedStyle |= UpdateUIProperty(); - if (m_pDataAcc->IsMultiLine()) { + if (m_pNode->GetWidgetAcc()->IsMultiLine()) { dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine | FWL_STYLEEXT_EDT_WantReturn; - if (!m_pDataAcc->IsVerticalScrollPolicyOff()) { + if (!m_pNode->GetWidgetAcc()->IsVerticalScrollPolicyOff()) { dwStyle |= FWL_WGTSTYLE_VScroll; dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoVScroll; } - } else if (!m_pDataAcc->IsHorizontalScrollPolicyOff()) { + } else if (!m_pNode->GetWidgetAcc()->IsHorizontalScrollPolicyOff()) { dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll; } - if (!m_pDataAcc->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) { + if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) { dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly; dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine; } XFA_Element eType; int32_t iMaxChars; - std::tie(eType, iMaxChars) = m_pDataAcc->GetMaxChars(); + std::tie(eType, iMaxChars) = m_pNode->GetWidgetAcc()->GetMaxChars(); if (eType == XFA_Element::ExData) iMaxChars = 0; - Optional<int32_t> numCells = m_pDataAcc->GetNumberOfCells(); + Optional<int32_t> numCells = m_pNode->GetWidgetAcc()->GetNumberOfCells(); if (!numCells) { pWidget->SetLimit(iMaxChars); } else if (*numCells == 0) { @@ -126,7 +127,7 @@ bool CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { } bool CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) { - if (!m_pDataAcc->IsOpenAccess()) + if (!m_pNode->IsOpenAccess()) return false; if (!PtInActiveRect(point)) return false; @@ -183,8 +184,8 @@ bool CXFA_FFTextEdit::OnKillFocus(CXFA_FFWidget* pNewWidget) { bool CXFA_FFTextEdit::CommitData() { WideString wsText = static_cast<CFWL_Edit*>(m_pNormalWidget.get())->GetText(); - if (m_pDataAcc->SetValue(XFA_VALUEPICTURE_Edit, wsText)) { - m_pDataAcc->UpdateUIDisplay(GetDoc()->GetDocView(), this); + if (m_pNode->GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Edit, wsText)) { + m_pNode->GetWidgetAcc()->UpdateUIDisplay(GetDoc()->GetDocView(), this); return true; } ValidateNumberField(wsText); @@ -192,7 +193,7 @@ bool CXFA_FFTextEdit::CommitData() { } void CXFA_FFTextEdit::ValidateNumberField(const WideString& wsText) { - CXFA_WidgetAcc* pAcc = GetDataAcc(); + CXFA_WidgetAcc* pAcc = GetNode()->GetWidgetAcc(); if (!pAcc || pAcc->GetUIType() != XFA_Element::NumericEdit) return; @@ -212,7 +213,7 @@ bool CXFA_FFTextEdit::IsDataChanged() { } uint32_t CXFA_FFTextEdit::GetAlignment() { - CXFA_Para* para = m_pDataAcc->GetNode()->GetPara(); + CXFA_Para* para = m_pNode->GetPara(); if (!para) return 0; @@ -259,27 +260,29 @@ bool CXFA_FFTextEdit::UpdateFWLData() { eType = XFA_VALUEPICTURE_Edit; bool bUpdate = false; - if (m_pDataAcc->GetUIType() == XFA_Element::TextEdit && - !m_pDataAcc->GetNumberOfCells()) { + if (m_pNode->GetWidgetAcc()->GetUIType() == XFA_Element::TextEdit && + !m_pNode->GetWidgetAcc()->GetNumberOfCells()) { XFA_Element elementType; int32_t iMaxChars; - std::tie(elementType, iMaxChars) = m_pDataAcc->GetMaxChars(); + std::tie(elementType, iMaxChars) = m_pNode->GetWidgetAcc()->GetMaxChars(); if (elementType == XFA_Element::ExData) iMaxChars = eType == XFA_VALUEPICTURE_Edit ? iMaxChars : 0; if (pEdit->GetLimit() != iMaxChars) { pEdit->SetLimit(iMaxChars); bUpdate = true; } - } else if (m_pDataAcc->GetUIType() == XFA_Element::Barcode) { + } else if (m_pNode->GetWidgetAcc()->GetUIType() == XFA_Element::Barcode) { int32_t nDataLen = 0; - if (eType == XFA_VALUEPICTURE_Edit) - nDataLen = m_pDataAcc->GetBarcodeAttribute_DataLength().value_or(0); + if (eType == XFA_VALUEPICTURE_Edit) { + nDataLen = + m_pNode->GetWidgetAcc()->GetBarcodeAttribute_DataLength().value_or(0); + } pEdit->SetLimit(nDataLen); bUpdate = true; } - WideString wsText = m_pDataAcc->GetValue(eType); + WideString wsText = m_pNode->GetWidgetAcc()->GetValue(eType); WideString wsOldText = pEdit->GetText(); if (wsText != wsOldText || (eType == XFA_VALUEPICTURE_Edit && bUpdate)) { pEdit->SetText(wsText); @@ -298,10 +301,10 @@ 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.Get(); + eParam.m_pTarget = m_pNode->GetWidgetAcc(); eParam.m_wsPrevText = wsPrevText; CFWL_Edit* pEdit = static_cast<CFWL_Edit*>(m_pNormalWidget.get()); - if (m_pDataAcc->GetUIType() == XFA_Element::DateTimeEdit) { + if (m_pNode->GetWidgetAcc()->GetUIType() == XFA_Element::DateTimeEdit) { CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)pEdit; eParam.m_wsNewText = pDateTime->GetEditText(); if (pDateTime->HasSelection()) { @@ -314,18 +317,21 @@ void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget, if (pEdit->HasSelection()) std::tie(eParam.m_iSelStart, eParam.m_iSelEnd) = pEdit->GetSelection(); } - m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::Change, &eParam); + m_pNode->GetWidgetAcc()->ProcessEvent(GetDocView(), XFA_AttributeEnum::Change, + &eParam); } void CXFA_FFTextEdit::OnTextFull(CFWL_Widget* pWidget) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Full; - eParam.m_pTarget = m_pDataAcc.Get(); - m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::Full, &eParam); + eParam.m_pTarget = m_pNode->GetWidgetAcc(); + m_pNode->GetWidgetAcc()->ProcessEvent(GetDocView(), XFA_AttributeEnum::Full, + &eParam); } bool CXFA_FFTextEdit::CheckWord(const ByteStringView& sWord) { - return sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_Element::TextEdit; + return sWord.IsEmpty() || + m_pNode->GetWidgetAcc()->GetUIType() != XFA_Element::TextEdit; } void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) { diff --git a/xfa/fxfa/cxfa_fftextedit.h b/xfa/fxfa/cxfa_fftextedit.h index 404d35ec18..d6bc131ffe 100644 --- a/xfa/fxfa/cxfa_fftextedit.h +++ b/xfa/fxfa/cxfa_fftextedit.h @@ -20,7 +20,7 @@ class IFWL_WidgetDelegate; class CXFA_FFTextEdit : public CXFA_FFField { public: - explicit CXFA_FFTextEdit(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFTextEdit(CXFA_Node* pNode); ~CXFA_FFTextEdit() override; // CXFA_FFField diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index 54a666d3a8..2d3b8fb17c 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -917,10 +917,8 @@ bool IsFXCodecErrorStatus(FXCODEC_STATUS status) { } // namespace -CXFA_FFWidget::CXFA_FFWidget(CXFA_WidgetAcc* pDataAcc) - : CXFA_ContentLayoutItem(pDataAcc->GetNode()), - m_pPageView(nullptr), - m_pDataAcc(pDataAcc) {} +CXFA_FFWidget::CXFA_FFWidget(CXFA_Node* node) + : CXFA_ContentLayoutItem(node), m_pNode(node) {} CXFA_FFWidget::~CXFA_FFWidget() {} @@ -943,7 +941,7 @@ const CFX_RectF& CXFA_FFWidget::RecacheWidgetRect() const { CFX_RectF CXFA_FFWidget::GetRectWithoutRotate() { CFX_RectF rtWidget = GetWidgetRect(); float fValue = 0; - switch (m_pDataAcc->GetNode()->GetRotate()) { + switch (m_pNode->GetRotate()) { case 90: rtWidget.top = rtWidget.bottom(); fValue = rtWidget.width; @@ -978,17 +976,13 @@ CFX_RectF CXFA_FFWidget::GetBBox(uint32_t dwStatus, bool bDrawFocus) { return m_pPageView->GetPageViewRect(); } -CXFA_WidgetAcc* CXFA_FFWidget::GetDataAcc() { - return m_pDataAcc.Get(); -} - void CXFA_FFWidget::RenderWidget(CXFA_Graphics* pGS, const CFX_Matrix& matrix, uint32_t dwStatus) { if (!IsMatchVisibleStatus(dwStatus)) return; - CXFA_Border* border = m_pDataAcc->GetNode()->GetBorder(false); + CXFA_Border* border = m_pNode->GetBorder(false); if (!border) return; @@ -1089,8 +1083,9 @@ 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.Get(); - m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::Enter, &eParam); + eParam.m_pTarget = m_pNode->GetWidgetAcc(); + m_pNode->GetWidgetAcc()->ProcessEvent(GetDocView(), XFA_AttributeEnum::Enter, + &eParam); return true; } @@ -1261,7 +1256,7 @@ static void XFA_GetMatrix(CFX_Matrix& m, CFX_Matrix CXFA_FFWidget::GetRotateMatrix() { CFX_Matrix mt; - int32_t iRotate = m_pDataAcc->GetNode()->GetRotate(); + int32_t iRotate = m_pNode->GetRotate(); if (!iRotate) return mt; @@ -1277,8 +1272,7 @@ bool CXFA_FFWidget::IsLayoutRectEmpty() { return rtLayout.width < 0.1f && rtLayout.height < 0.1f; } CXFA_FFWidget* CXFA_FFWidget::GetParent() { - CXFA_Node* pParentNode = - m_pDataAcc->GetNode()->GetNodeItem(XFA_NODEITEM_Parent); + CXFA_Node* pParentNode = m_pNode->GetNodeItem(XFA_NODEITEM_Parent); if (pParentNode) { CXFA_WidgetAcc* pParentWidgetAcc = static_cast<CXFA_WidgetAcc*>(pParentNode->GetWidgetAcc()); @@ -1295,10 +1289,9 @@ bool CXFA_FFWidget::IsAncestorOf(CXFA_FFWidget* pWidget) { if (!pWidget) return false; - CXFA_Node* pNode = m_pDataAcc->GetNode(); - CXFA_Node* pChildNode = pWidget->GetDataAcc()->GetNode(); + CXFA_Node* pChildNode = pWidget->GetNode(); while (pChildNode) { - if (pChildNode == pNode) + if (pChildNode == m_pNode) return true; pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_Parent); @@ -1341,8 +1334,9 @@ void CXFA_FFWidget::EventKillFocus() { } CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Exit; - eParam.m_pTarget = m_pDataAcc.Get(); - m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::Exit, &eParam); + eParam.m_pTarget = m_pNode->GetWidgetAcc(); + m_pNode->GetWidgetAcc()->ProcessEvent(GetDocView(), XFA_AttributeEnum::Exit, + &eParam); } bool CXFA_FFWidget::IsButtonDown() { diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h index f52098301f..5857800ba9 100644 --- a/xfa/fxfa/cxfa_ffwidget.h +++ b/xfa/fxfa/cxfa_ffwidget.h @@ -78,13 +78,13 @@ class CXFA_CalcData { CXFA_CalcData(); ~CXFA_CalcData(); - std::vector<CXFA_WidgetAcc*> m_Globals; + std::vector<CXFA_Node*> m_Globals; int32_t m_iRefCount; }; class CXFA_FFWidget : public CXFA_ContentLayoutItem { public: - explicit CXFA_FFWidget(CXFA_WidgetAcc* pDataAcc); + explicit CXFA_FFWidget(CXFA_Node* pNode); ~CXFA_FFWidget() override; virtual CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false); @@ -146,7 +146,7 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { uint32_t GetStatus(); void ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved); - CXFA_WidgetAcc* GetDataAcc(); + CXFA_Node* GetNode() { return m_pNode.Get(); } CXFA_FFDocView* GetDocView(); void SetDocView(CXFA_FFDocView* pDocView); @@ -181,9 +181,9 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { bool IsButtonDown(); void SetButtonDown(bool bSet); - CXFA_FFDocView* m_pDocView; - CXFA_FFPageView* m_pPageView; - UnownedPtr<CXFA_WidgetAcc> const m_pDataAcc; + CXFA_FFDocView* m_pDocView = nullptr; + CXFA_FFPageView* m_pPageView = nullptr; + UnownedPtr<CXFA_Node> const m_pNode; mutable CFX_RectF m_rtWidget; }; diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp index ca4ef14a16..454627dacb 100644 --- a/xfa/fxfa/cxfa_ffwidgethandler.cpp +++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp @@ -246,10 +246,8 @@ int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, CXFA_FFWidget* CXFA_FFWidgetHandler::CreateWidget(CXFA_FFWidget* hParent, XFA_WIDGETTYPE eType, CXFA_FFWidget* hBefore) { - CXFA_Node* pParentFormItem = - hParent ? hParent->GetDataAcc()->GetNode() : nullptr; - CXFA_Node* pBeforeFormItem = - hBefore ? hBefore->GetDataAcc()->GetNode() : nullptr; + CXFA_Node* pParentFormItem = hParent ? hParent->GetNode() : nullptr; + CXFA_Node* pBeforeFormItem = hBefore ? hBefore->GetNode() : nullptr; CXFA_Node* pNewFormItem = CreateWidgetFormItem(eType, pParentFormItem, pBeforeFormItem); if (!pNewFormItem) diff --git a/xfa/fxfa/cxfa_fwltheme.cpp b/xfa/fxfa/cxfa_fwltheme.cpp index ed54ab1a9d..cd55ca48d7 100644 --- a/xfa/fxfa/cxfa_fwltheme.cpp +++ b/xfa/fxfa/cxfa_fwltheme.cpp @@ -125,7 +125,7 @@ void CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { if (!pWidget) return; - CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); + CXFA_Node* pNode = pWidget->GetNode(); CXFA_Graphics* pGraphics = pParams->m_pGraphics; CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice(); if (!pRenderDevice) @@ -133,9 +133,9 @@ void CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { m_pTextOut->SetStyles(pParams->m_dwTTOStyles); m_pTextOut->SetAlignment(pParams->m_iTTOAlign); - m_pTextOut->SetFont(pAcc->GetFDEFont(pWidget->GetDoc())); - m_pTextOut->SetFontSize(pAcc->GetNode()->GetFontSize()); - m_pTextOut->SetTextColor(pAcc->GetNode()->GetTextColor()); + m_pTextOut->SetFont(pNode->GetWidgetAcc()->GetFDEFont(pWidget->GetDoc())); + m_pTextOut->SetFontSize(pNode->GetFontSize()); + m_pTextOut->SetTextColor(pNode->GetTextColor()); CFX_Matrix mtPart = pParams->m_matrix; const CFX_Matrix* pMatrix = pGraphics->GetMatrix(); if (pMatrix) @@ -153,7 +153,7 @@ CFX_RectF CXFA_FWLTheme::GetUIMargin(CFWL_ThemePart* pThemePart) const { return rect; CXFA_LayoutItem* pItem = pWidget; - CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); + CXFA_WidgetAcc* pWidgetAcc = pWidget->GetNode()->GetWidgetAcc(); rect = pWidgetAcc->GetUIMargin(); CXFA_Para* para = pWidgetAcc->GetNode()->GetPara(); if (para) { @@ -183,20 +183,20 @@ float CXFA_FWLTheme::GetCYBorderSize() const { float CXFA_FWLTheme::GetFontSize(CFWL_ThemePart* pThemePart) const { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) - return pWidget->GetDataAcc()->GetNode()->GetFontSize(); + return pWidget->GetNode()->GetFontSize(); return FWLTHEME_CAPACITY_FontSize; } RetainPtr<CFGAS_GEFont> CXFA_FWLTheme::GetFont( CFWL_ThemePart* pThemePart) const { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) - return pWidget->GetDataAcc()->GetFDEFont(pWidget->GetDoc()); + return pWidget->GetNode()->GetWidgetAcc()->GetFDEFont(pWidget->GetDoc()); return GetTheme(pThemePart->m_pWidget)->GetFont(); } float CXFA_FWLTheme::GetLineHeight(CFWL_ThemePart* pThemePart) const { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) - return pWidget->GetDataAcc()->GetNode()->GetLineHeight(); + return pWidget->GetNode()->GetLineHeight(); return kLineHeight; } @@ -206,14 +206,14 @@ float CXFA_FWLTheme::GetScrollBarWidth() const { FX_COLORREF CXFA_FWLTheme::GetTextColor(CFWL_ThemePart* pThemePart) const { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) - return pWidget->GetDataAcc()->GetNode()->GetTextColor(); + return pWidget->GetNode()->GetTextColor(); return FWLTHEME_CAPACITY_TextColor; } CFX_SizeF CXFA_FWLTheme::GetSpaceAboveBelow(CFWL_ThemePart* pThemePart) const { CFX_SizeF sizeAboveBelow; if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { - CXFA_Para* para = pWidget->GetDataAcc()->GetNode()->GetPara(); + CXFA_Para* para = pWidget->GetNode()->GetPara(); if (para) { sizeAboveBelow.width = para->GetSpaceAbove(); sizeAboveBelow.height = para->GetSpaceBelow(); @@ -240,10 +240,10 @@ void CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { if (!pWidget) return; - CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); - m_pTextOut->SetFont(pAcc->GetFDEFont(pWidget->GetDoc())); - m_pTextOut->SetFontSize(pAcc->GetNode()->GetFontSize()); - m_pTextOut->SetTextColor(pAcc->GetNode()->GetTextColor()); + CXFA_Node* pNode = pWidget->GetNode(); + m_pTextOut->SetFont(pNode->GetWidgetAcc()->GetFDEFont(pWidget->GetDoc())); + m_pTextOut->SetFontSize(pNode->GetFontSize()); + m_pTextOut->SetTextColor(pNode->GetTextColor()); if (!pParams) return; diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 98661f10c8..f3caea44f2 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -843,8 +843,8 @@ std::pair<int32_t, bool> CXFA_WidgetAcc::ExecuteBoolScript( pdfium::MakeUnique<CXFA_CalcData>()); pGlobalData = pRefNode->JSObject()->GetCalcData(); } - if (!pdfium::ContainsValue(pGlobalData->m_Globals, this)) - pGlobalData->m_Globals.push_back(this); + if (!pdfium::ContainsValue(pGlobalData->m_Globals, GetNode())) + pGlobalData->m_Globals.push_back(GetNode()); } } } |