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 --- fpdfsdk/cpdfsdk_widget.cpp | 86 ++++++++++--------------- fxjs/xfa/cjx_boolean.cpp | 6 +- fxjs/xfa/cjx_exclgroup.cpp | 8 +-- fxjs/xfa/cjx_field.cpp | 60 +++++++---------- fxjs/xfa/cjx_node.cpp | 2 +- fxjs/xfa/cjx_object.cpp | 17 +++-- 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 +++++------ 28 files changed, 230 insertions(+), 333 deletions(-) diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index 5b8910993f..8243d31383 100644 --- a/fpdfsdk/cpdfsdk_widget.cpp +++ b/fpdfsdk/cpdfsdk_widget.cpp @@ -298,37 +298,31 @@ void CPDFSDK_Widget::Synchronize(bool bSynchronizeElse) { CPDF_FormControl* pFormCtrl = GetFormControl(); XFA_CHECKSTATE eCheckState = pFormCtrl->IsChecked() ? XFA_CHECKSTATE_On : XFA_CHECKSTATE_Off; - node->GetWidgetAcc()->SetCheckState(eCheckState, true); + node->SetCheckState(eCheckState, true); break; } case FormFieldType::kTextField: - node->GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Edit, - pFormField->GetValue()); + node->SetValue(XFA_VALUEPICTURE_Edit, pFormField->GetValue()); break; case FormFieldType::kListBox: { - node->GetWidgetAcc()->ClearAllSelections(); + node->ClearAllSelections(); for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) { int nIndex = pFormField->GetSelectedIndex(i); - if (nIndex > -1 && - nIndex < node->GetWidgetAcc()->CountChoiceListItems(false)) { - node->GetWidgetAcc()->SetItemState(nIndex, true, false, false, true); - } + if (nIndex > -1 && nIndex < node->CountChoiceListItems(false)) + node->SetItemState(nIndex, true, false, false, true); } break; } case FormFieldType::kComboBox: { - node->GetWidgetAcc()->ClearAllSelections(); + node->ClearAllSelections(); for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) { int nIndex = pFormField->GetSelectedIndex(i); - if (nIndex > -1 && - nIndex < node->GetWidgetAcc()->CountChoiceListItems(false)) { - node->GetWidgetAcc()->SetItemState(nIndex, true, false, false, true); - } + if (nIndex > -1 && nIndex < node->CountChoiceListItems(false)) + node->SetItemState(nIndex, true, false, false, true); } - node->GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Edit, - pFormField->GetValue()); + node->SetValue(XFA_VALUEPICTURE_Edit, pFormField->GetValue()); break; } default: @@ -378,9 +372,9 @@ void CPDFSDK_Widget::SynchronizeXFAValue(CXFA_FFDocView* pXFADocView, switch (pFormField->GetFieldType()) { case FormFieldType::kCheckBox: { if (node->IsWidgetReady()) { - pFormField->CheckControl( - pFormField->GetControlIndex(pFormControl), - node->GetWidgetAcc()->GetCheckState() == XFA_CHECKSTATE_On, true); + pFormField->CheckControl(pFormField->GetControlIndex(pFormControl), + node->GetCheckState() == XFA_CHECKSTATE_On, + true); } break; } @@ -388,26 +382,23 @@ void CPDFSDK_Widget::SynchronizeXFAValue(CXFA_FFDocView* pXFADocView, // TODO(weili): Check whether we need to handle checkbox and radio // button differently, otherwise, merge these two cases. if (node->IsWidgetReady()) { - pFormField->CheckControl( - pFormField->GetControlIndex(pFormControl), - node->GetWidgetAcc()->GetCheckState() == XFA_CHECKSTATE_On, true); + pFormField->CheckControl(pFormField->GetControlIndex(pFormControl), + node->GetCheckState() == XFA_CHECKSTATE_On, + true); } break; } case FormFieldType::kTextField: { - if (node->IsWidgetReady()) { - pFormField->SetValue( - node->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Display), true); - } + if (node->IsWidgetReady()) + pFormField->SetValue(node->GetValue(XFA_VALUEPICTURE_Display), true); break; } case FormFieldType::kListBox: { pFormField->ClearSelection(false); if (node->IsWidgetReady()) { - for (int i = 0, sz = node->GetWidgetAcc()->CountSelectedItems(); i < sz; - i++) { - int nIndex = node->GetWidgetAcc()->GetSelectedItem(i); + for (int i = 0, sz = node->CountSelectedItems(); i < sz; i++) { + int nIndex = node->GetSelectedItem(i); if (nIndex > -1 && nIndex < pFormField->CountOptions()) { pFormField->SetItemSelection(nIndex, true, true); @@ -420,16 +411,12 @@ void CPDFSDK_Widget::SynchronizeXFAValue(CXFA_FFDocView* pXFADocView, pFormField->ClearSelection(false); if (node->IsWidgetReady()) { - for (int i = 0, sz = node->GetWidgetAcc()->CountSelectedItems(); i < sz; - i++) { - int nIndex = node->GetWidgetAcc()->GetSelectedItem(i); - - if (nIndex > -1 && nIndex < pFormField->CountOptions()) { + for (int i = 0, sz = node->CountSelectedItems(); i < sz; i++) { + int nIndex = node->GetSelectedItem(i); + if (nIndex > -1 && nIndex < pFormField->CountOptions()) pFormField->SetItemSelection(nIndex, true, true); - } } - pFormField->SetValue( - node->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Display), true); + pFormField->SetValue(node->GetValue(XFA_VALUEPICTURE_Display), true); } break; } @@ -451,11 +438,9 @@ void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, pFormField->ClearOptions(true); if (node->IsWidgetReady()) { - for (int i = 0, sz = node->GetWidgetAcc()->CountChoiceListItems(false); - i < sz; i++) { + for (int i = 0, sz = node->CountChoiceListItems(false); i < sz; i++) { pFormField->InsertOption( - node->GetWidgetAcc()->GetChoiceListItem(i, false).value_or(L""), - i, true); + node->GetChoiceListItem(i, false).value_or(L""), i, true); } } break; @@ -465,11 +450,9 @@ void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, pFormField->ClearOptions(false); if (node->IsWidgetReady()) { - for (int i = 0, sz = node->GetWidgetAcc()->CountChoiceListItems(false); - i < sz; i++) { + for (int i = 0, sz = node->CountChoiceListItems(false); i < sz; i++) { pFormField->InsertOption( - node->GetWidgetAcc()->GetChoiceListItem(i, false).value_or(L""), - i, false); + node->GetChoiceListItem(i, false).value_or(L""), i, false); } } @@ -620,8 +603,8 @@ int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const { if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { CXFA_Node* node = hWidget->GetNode(); if (node->IsWidgetReady()) { - if (nIndex < node->GetWidgetAcc()->CountSelectedItems()) - return node->GetWidgetAcc()->GetSelectedItem(nIndex); + if (nIndex < node->CountSelectedItems()) + return node->GetSelectedItem(nIndex); } } #endif // PDF_ENABLE_XFA @@ -634,8 +617,8 @@ WideString CPDFSDK_Widget::GetValue(bool bDisplay) const { if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { CXFA_Node* node = hWidget->GetNode(); if (node->IsWidgetReady()) { - return node->GetWidgetAcc()->GetValue(bDisplay ? XFA_VALUEPICTURE_Display - : XFA_VALUEPICTURE_Edit); + return node->GetValue(bDisplay ? XFA_VALUEPICTURE_Display + : XFA_VALUEPICTURE_Edit); } } #else @@ -665,9 +648,8 @@ bool CPDFSDK_Widget::IsOptionSelected(int nIndex) const { if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { CXFA_Node* node = hWidget->GetNode(); if (node->IsWidgetReady()) { - if (nIndex > -1 && - nIndex < node->GetWidgetAcc()->CountChoiceListItems(false)) - return node->GetWidgetAcc()->GetItemState(nIndex); + if (nIndex > -1 && nIndex < node->CountChoiceListItems(false)) + return node->GetItemState(nIndex); return false; } @@ -687,7 +669,7 @@ bool CPDFSDK_Widget::IsChecked() const { if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { CXFA_Node* node = hWidget->GetNode(); if (node->IsWidgetReady()) - return node->GetWidgetAcc()->GetCheckState() == XFA_CHECKSTATE_On; + return node->GetCheckState() == XFA_CHECKSTATE_On; } #endif // PDF_ENABLE_XFA CPDF_FormControl* pFormCtrl = GetFormControl(); diff --git a/fxjs/xfa/cjx_boolean.cpp b/fxjs/xfa/cjx_boolean.cpp index 6abcd3c8bd..7ca3889ee6 100644 --- a/fxjs/xfa/cjx_boolean.cpp +++ b/fxjs/xfa/cjx_boolean.cpp @@ -36,10 +36,8 @@ void CJX_Boolean::defaultValue(CFXJSE_Value* pValue, WideString wsNewValue(iValue == 0 ? L"0" : L"1"); WideString wsFormatValue(wsNewValue); CXFA_Node* pContainerNode = ToNode(GetXFAObject())->GetContainerNode(); - if (pContainerNode && pContainerNode->GetWidgetAcc()) { - wsFormatValue = - pContainerNode->GetWidgetAcc()->GetFormatDataValue(wsNewValue); - } + if (pContainerNode) + wsFormatValue = pContainerNode->GetFormatDataValue(wsNewValue); SetContent(wsNewValue, wsFormatValue, true, true, true); } diff --git a/fxjs/xfa/cjx_exclgroup.cpp b/fxjs/xfa/cjx_exclgroup.cpp index fbce784b42..85a6697442 100644 --- a/fxjs/xfa/cjx_exclgroup.cpp +++ b/fxjs/xfa/cjx_exclgroup.cpp @@ -94,9 +94,9 @@ CJS_Return CJX_ExclGroup::selectedMember( CXFA_Node* pReturnNode = nullptr; if (params.empty()) { - pReturnNode = node->GetWidgetAcc()->GetSelectedMember(); + pReturnNode = node->GetSelectedMember(); } else { - pReturnNode = node->GetWidgetAcc()->SetSelectedMember( + pReturnNode = node->SetSelectedMember( runtime->ToWideString(params[0]).AsStringView(), true); } if (!pReturnNode) @@ -118,8 +118,8 @@ void CJX_ExclGroup::defaultValue(CFXJSE_Value* pValue, return; if (bSetting) { - node->GetWidgetAcc()->SetSelectedMemberByValue( - pValue->ToWideString().AsStringView(), true, true, true); + node->SetSelectedMemberByValue(pValue->ToWideString().AsStringView(), true, + true, true); return; } diff --git a/fxjs/xfa/cjx_field.cpp b/fxjs/xfa/cjx_field.cpp index 9433127eba..9b4364bc14 100644 --- a/fxjs/xfa/cjx_field.cpp +++ b/fxjs/xfa/cjx_field.cpp @@ -43,7 +43,7 @@ CJS_Return CJX_Field::clearItems( const std::vector>& params) { CXFA_Node* node = GetXFANode(); if (node->IsWidgetReady()) - node->GetWidgetAcc()->DeleteItem(-1, true, false); + node->DeleteItem(-1, true, false); return CJS_Return(true); } @@ -86,8 +86,7 @@ CJS_Return CJX_Field::deleteItem( if (!node->IsWidgetReady()) return CJS_Return(true); - bool bValue = - node->GetWidgetAcc()->DeleteItem(runtime->ToInt32(params[0]), true, true); + bool bValue = node->DeleteItem(runtime->ToInt32(params[0]), true, true); return CJS_Return(runtime->NewBoolean(bValue)); } @@ -105,8 +104,7 @@ CJS_Return CJX_Field::getSaveItem( if (!node->IsWidgetReady()) return CJS_Return(runtime->NewNull()); - Optional value = - node->GetWidgetAcc()->GetChoiceListItem(iIndex, true); + Optional value = node->GetChoiceListItem(iIndex, true); if (!value) return CJS_Return(runtime->NewNull()); @@ -124,8 +122,7 @@ CJS_Return CJX_Field::boundItem( return CJS_Return(true); WideString value = runtime->ToWideString(params[0]); - WideString boundValue = - node->GetWidgetAcc()->GetItemValue(value.AsStringView()); + WideString boundValue = node->GetItemValue(value.AsStringView()); return CJS_Return(runtime->NewString(boundValue.UTF8Encode().AsStringView())); } @@ -139,8 +136,7 @@ CJS_Return CJX_Field::getItemState( if (!node->IsWidgetReady()) return CJS_Return(true); - int32_t state = - node->GetWidgetAcc()->GetItemState(runtime->ToInt32(params[0])); + int32_t state = node->GetItemState(runtime->ToInt32(params[0])); return CJS_Return(runtime->NewBoolean(state != 0)); } @@ -172,8 +168,7 @@ CJS_Return CJX_Field::getDisplayItem( if (!node->IsWidgetReady()) return CJS_Return(runtime->NewNull()); - Optional value = - node->GetWidgetAcc()->GetChoiceListItem(iIndex, false); + Optional value = node->GetChoiceListItem(iIndex, false); if (!value) return CJS_Return(runtime->NewNull()); @@ -192,11 +187,11 @@ CJS_Return CJX_Field::setItemState( int32_t iIndex = runtime->ToInt32(params[0]); if (runtime->ToInt32(params[1]) != 0) { - node->GetWidgetAcc()->SetItemState(iIndex, true, true, true, true); + node->SetItemState(iIndex, true, true, true, true); return CJS_Return(true); } - if (node->GetWidgetAcc()->GetItemState(iIndex)) - node->GetWidgetAcc()->SetItemState(iIndex, false, true, true, true); + if (node->GetItemState(iIndex)) + node->SetItemState(iIndex, false, true, true, true); return CJS_Return(true); } @@ -218,7 +213,7 @@ CJS_Return CJX_Field::addItem(CJS_V8* runtime, if (params.size() >= 2) value = runtime->ToWideString(params[1]); - node->GetWidgetAcc()->InsertItem(label, value, true); + node->InsertItem(label, value, true); return CJS_Return(true); } @@ -255,17 +250,14 @@ void CJX_Field::defaultValue(CFXJSE_Value* pValue, wsNewText = pValue->ToWideString(); if (xfaNode->GetUIChild()->GetElementType() == XFA_Element::NumericEdit) { - wsNewText = xfaNode->GetWidgetAcc()->NumericLimit( - wsNewText, xfaNode->GetWidgetAcc()->GetLeadDigits(), - xfaNode->GetWidgetAcc()->GetFracDigits()); + wsNewText = xfaNode->NumericLimit(wsNewText, xfaNode->GetLeadDigits(), + xfaNode->GetFracDigits()); } CXFA_Node* pContainerNode = xfaNode->GetContainerNode(); WideString wsFormatText(wsNewText); - if (pContainerNode && pContainerNode->GetWidgetAcc()) { - wsFormatText = - pContainerNode->GetWidgetAcc()->GetFormatDataValue(wsNewText); - } + if (pContainerNode) + wsFormatText = pContainerNode->GetFormatDataValue(wsNewText); SetContent(wsNewText, wsFormatText, true, true, true); return; @@ -307,14 +299,11 @@ void CJX_Field::editValue(CFXJSE_Value* pValue, return; if (bSetting) { - node->GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Edit, - pValue->ToWideString()); + node->SetValue(XFA_VALUEPICTURE_Edit, pValue->ToWideString()); return; } - pValue->SetString(node->GetWidgetAcc() - ->GetValue(XFA_VALUEPICTURE_Edit) - .UTF8Encode() - .AsStringView()); + pValue->SetString( + node->GetValue(XFA_VALUEPICTURE_Edit).UTF8Encode().AsStringView()); } void CJX_Field::formatMessage(CFXJSE_Value* pValue, @@ -331,14 +320,11 @@ void CJX_Field::formattedValue(CFXJSE_Value* pValue, return; if (bSetting) { - node->GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Display, - pValue->ToWideString()); + node->SetValue(XFA_VALUEPICTURE_Display, pValue->ToWideString()); return; } - pValue->SetString(node->GetWidgetAcc() - ->GetValue(XFA_VALUEPICTURE_Display) - .UTF8Encode() - .AsStringView()); + pValue->SetString( + node->GetValue(XFA_VALUEPICTURE_Display).UTF8Encode().AsStringView()); } void CJX_Field::parentSubform(CFXJSE_Value* pValue, @@ -359,17 +345,17 @@ void CJX_Field::selectedIndex(CFXJSE_Value* pValue, return; if (!bSetting) { - pValue->SetInteger(node->GetWidgetAcc()->GetSelectedItem(0)); + pValue->SetInteger(node->GetSelectedItem(0)); return; } int32_t iIndex = pValue->ToInteger(); if (iIndex == -1) { - node->GetWidgetAcc()->ClearAllSelections(); + node->ClearAllSelections(); return; } - node->GetWidgetAcc()->SetItemState(iIndex, true, true, true, true); + node->SetItemState(iIndex, true, true, true, true); } void CJX_Field::access(CFXJSE_Value* pValue, diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp index 6458a33367..1d6e022060 100644 --- a/fxjs/xfa/cjx_node.cpp +++ b/fxjs/xfa/cjx_node.cpp @@ -519,7 +519,7 @@ int32_t CJX_Node::execSingleEventByName(const WideStringView& wsEventName, CXFA_Node* pUINode = GetXFANode()->GetUIChild(); if (pUINode->GetElementType() != XFA_Element::ChoiceList || - GetXFANode()->GetWidgetAcc()->IsListBox()) { + GetXFANode()->IsListBox()) { return XFA_EVENTERROR_NotExist; } return pNotify->ExecEventByDeepFirst( diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp index 0c57392ce3..46af66ae28 100644 --- a/fxjs/xfa/cjx_object.cpp +++ b/fxjs/xfa/cjx_object.cpp @@ -1158,8 +1158,8 @@ void CJX_Object::MoveBufferMapData(CXFA_Object* pDstModule) { WideString wsValue = ToNode(pDstModule)->JSObject()->GetContent(false); WideString wsFormatValue(wsValue); CXFA_Node* pNode = ToNode(pDstModule)->GetContainerNode(); - if (pNode && pNode->GetWidgetAcc()) - wsFormatValue = pNode->GetWidgetAcc()->GetFormatDataValue(wsValue); + if (pNode) + wsFormatValue = pNode->GetFormatDataValue(wsValue); ToNode(pDstModule) ->JSObject() @@ -1482,7 +1482,7 @@ void CJX_Object::Script_Field_Length(CFXJSE_Value* pValue, pValue->SetInteger(0); return; } - pValue->SetInteger(node->GetWidgetAcc()->CountChoiceListItems(true)); + pValue->SetInteger(node->CountChoiceListItems(true)); } void CJX_Object::Script_Som_DefaultValue(CFXJSE_Value* pValue, @@ -1523,9 +1523,9 @@ void CJX_Object::Script_Som_DefaultValue(CFXJSE_Value* pValue, continue; pContainerNode = pFormNode->GetContainerNode(); - if (pContainerNode && pContainerNode->GetWidgetAcc()) { - wsPicture = pContainerNode->GetWidgetAcc()->GetPictureContent( - XFA_VALUEPICTURE_DataBind); + if (pContainerNode) { + wsPicture = + pContainerNode->GetPictureContent(XFA_VALUEPICTURE_DataBind); } if (!wsPicture.IsEmpty()) break; @@ -1537,9 +1537,8 @@ void CJX_Object::Script_Som_DefaultValue(CFXJSE_Value* pValue, pContainerNode = ToNode(GetXFAObject())->GetContainerNode(); } - if (pContainerNode && pContainerNode->GetWidgetAcc()) - wsFormatValue = - pContainerNode->GetWidgetAcc()->GetFormatDataValue(wsNewValue); + if (pContainerNode) + wsFormatValue = pContainerNode->GetFormatDataValue(wsNewValue); SetContent(wsNewValue, wsFormatValue, true, true, true); return; 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