void CXFA_FFNotify::OnValueChanging(CXFA_Node* pSender, XFA_ATTRIBUTE eAttr) { if (eAttr != XFA_ATTRIBUTE_Presence) return; if (pSender->GetPacketID() & XFA_XDPPACKET_Datasets) return; if (!pSender->IsFormContainer()) return; CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); if (!pDocView) return; if (pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End) return; CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender->GetWidgetData()); if (!pWidgetAcc) return; CXFA_FFWidget* pWidget = nullptr; while ((pWidget = pWidgetAcc->GetNextWidget(pWidget)) != nullptr) { if (pWidget->IsLoaded()) pWidget->AddInvalidateRect(); } }
void CXFA_FFNotify::OnWidgetListItemRemoved(CXFA_WidgetData* pSender, int32_t iIndex) { CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender); if (pWidgetAcc->GetUIType() != XFA_Element::ChoiceList) return; CXFA_FFWidget* pWidget = nullptr; while ((pWidget = pWidgetAcc->GetNextWidget(pWidget)) != nullptr) { if (pWidget->IsLoaded()) { if (pWidgetAcc->IsListBox()) { static_cast<CXFA_FFListBox*>(pWidget)->DeleteItem(iIndex); } else { static_cast<CXFA_FFComboBox*>(pWidget)->DeleteItem(iIndex); } } } }
void CXFA_FFNotify::OnWidgetListItemAdded(CXFA_WidgetData* pSender, const FX_WCHAR* pLabel, const FX_WCHAR* pValue, int32_t iIndex) { CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender); if (pWidgetAcc->GetUIType() != XFA_Element::ChoiceList) return; CXFA_FFWidget* pWidget = nullptr; while ((pWidget = pWidgetAcc->GetNextWidget(pWidget)) != nullptr) { if (pWidget->IsLoaded()) { if (pWidgetAcc->IsListBox()) { static_cast<CXFA_FFListBox*>(pWidget)->InsertItem(pLabel, iIndex); } else { static_cast<CXFA_FFComboBox*>(pWidget)->InsertItem(pLabel, iIndex); } } } }
CXFA_FFWidget* CXFA_FFDocView::GetWidgetByName(const CFX_WideString& wsName, CXFA_FFWidget* pRefWidget) { CXFA_WidgetAcc* pRefAcc = pRefWidget ? pRefWidget->GetDataAcc() : nullptr; CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName, pRefAcc); return pAcc ? pAcc->GetNextWidget(nullptr) : nullptr; }
void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender, XFA_ATTRIBUTE eAttr, CXFA_Node* pParentNode, CXFA_Node* pWidgetNode) { CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); if (!pDocView) return; if (!(pSender->GetPacketID() & XFA_XDPPACKET_Form)) { if (eAttr == XFA_ATTRIBUTE_Value) pDocView->AddCalculateNodeNotify(pSender); return; } XFA_Element eType = pParentNode->GetElementType(); FX_BOOL bIsContainerNode = pParentNode->IsContainerNode(); CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pWidgetNode->GetWidgetData()); if (!pWidgetAcc) return; bool bUpdateProperty = false; pDocView->SetChangeMark(); switch (eType) { case XFA_Element::Caption: { CXFA_TextLayout* pCapOut = pWidgetAcc->GetCaptionTextLayout(); if (!pCapOut) return; pCapOut->Unload(); } break; case XFA_Element::Ui: case XFA_Element::Para: bUpdateProperty = true; break; default: break; } if (bIsContainerNode && eAttr == XFA_ATTRIBUTE_Access) bUpdateProperty = true; if (eAttr == XFA_ATTRIBUTE_Value) { pDocView->AddCalculateNodeNotify(pSender); if (eType == XFA_Element::Value || bIsContainerNode) { if (bIsContainerNode) { pWidgetAcc->UpdateUIDisplay(); pDocView->AddCalculateWidgetAcc(pWidgetAcc); pDocView->AddValidateWidget(pWidgetAcc); } else if (pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent) ->GetElementType() == XFA_Element::ExclGroup) { pWidgetAcc->UpdateUIDisplay(); } return; } } CXFA_FFWidget* pWidget = nullptr; while ((pWidget = pWidgetAcc->GetNextWidget(pWidget)) != nullptr) { if (!pWidget->IsLoaded()) continue; if (bUpdateProperty) pWidget->UpdateWidgetProperty(); pWidget->PerformLayout(); pWidget->AddInvalidateRect(); } }