int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam, CXFA_WidgetAcc* pWidgetAcc) { if (!pParam) return XFA_EVENTERROR_Error; if (pParam->m_eType == XFA_EVENT_Validate) { CFX_WideString wsValidateStr(L"preSubmit"); CXFA_Node* pConfigItem = ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Config)); if (pConfigItem) { CXFA_Node* pValidateNode = nullptr; CXFA_Node* pAcrobatNode = pConfigItem->GetChild(0, XFA_Element::Acrobat); pValidateNode = pAcrobatNode ? pAcrobatNode->GetChild(0, XFA_Element::Validate) : nullptr; if (!pValidateNode) { CXFA_Node* pPresentNode = pConfigItem->GetChild(0, XFA_Element::Present); pValidateNode = pPresentNode ? pPresentNode->GetChild(0, XFA_Element::Validate) : nullptr; } if (pValidateNode) { wsValidateStr = pValidateNode->GetContent(); } } FX_BOOL bValidate = FALSE; switch (pParam->m_iValidateActivities) { case XFA_VALIDATE_preSubmit: bValidate = wsValidateStr.Find(L"preSubmit") != -1; break; case XFA_VALIDATE_prePrint: bValidate = wsValidateStr.Find(L"prePrint") != -1; break; case XFA_VALIDATE_preExecute: bValidate = wsValidateStr.Find(L"preExecute") != -1; break; case XFA_VALIDATE_preSave: bValidate = wsValidateStr.Find(L"preSave") != -1; break; } if (!bValidate) { return XFA_EVENTERROR_Success; } } CXFA_Node* pNode = pWidgetAcc ? pWidgetAcc->GetNode() : nullptr; if (!pNode) { CXFA_Node* pRootItem = ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); if (!pRootItem) { return XFA_EVENTERROR_Error; } pNode = pRootItem->GetChild(0, XFA_Element::Subform); } ExecEventActivityByDeepFirst(pNode, pParam->m_eType, pParam->m_bIsFormReady, TRUE, nullptr); return XFA_EVENTERROR_Success; }
void CXFA_FFDocView::StopLayout() { CXFA_Node* pRootItem = ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); if (!pRootItem) { return; } CXFA_Node* pSubformNode = pRootItem->GetChild(0, XFA_ELEMENT_Subform); if (!pSubformNode) { return; } CXFA_Node* pPageSetNode = pSubformNode->GetFirstChildByClass(XFA_ELEMENT_PageSet); if (!pPageSetNode) { return; } RunCalculateWidgets(); RunValidate(); InitLayout(pPageSetNode); InitCalculate(pPageSetNode); InitValidate(pPageSetNode); ExecEventActivityByDeepFirst(pPageSetNode, XFA_EVENT_Ready, TRUE); ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready); ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_DocReady); RunCalculateWidgets(); RunValidate(); if (RunLayout()) { ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready); } m_CalculateAccs.RemoveAll(); if (m_pFocusAcc && !m_pFocusWidget) { SetFocusWidgetAcc(m_pFocusAcc); } m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_End; }
void CXFA_Calculate::GetMessageText(CFX_WideString& wsMessage) { CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Message); if (!pNode) return; CXFA_Text text(pNode->GetChild(0, XFA_Element::Text)); if (text) text.GetContent(wsMessage); }
int32_t CXFA_Fill::GetPattern(FX_ARGB& foreColor) { CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Pattern); if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) { CFX_WideStringC wsColor; pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, false); foreColor = CXFA_Data::ToColor(wsColor); } else { foreColor = 0xFF000000; } return pNode->GetEnum(XFA_ATTRIBUTE_Type); }
int32_t CXFA_Fill::GetRadial(FX_ARGB& endColor) { CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Radial); XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToEdge; pNode->TryEnum(XFA_ATTRIBUTE_Type, eAttr); if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) { CFX_WideStringC wsColor; pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, false); endColor = CXFA_Data::ToColor(wsColor); } else { endColor = 0xFF000000; } return eAttr; }
int32_t CXFA_Fill::GetStipple(FX_ARGB& stippleColor) { CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Stipple); int32_t eAttr = 50; pNode->TryInteger(XFA_ATTRIBUTE_Rate, eAttr); if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) { CFX_WideStringC wsColor; pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, false); stippleColor = CXFA_Data::ToColor(wsColor); } else { stippleColor = 0xFF000000; } return eAttr; }
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetTraverseWidget( CXFA_FFWidget* pWidget) { CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); CXFA_Node* pTraversal = pAcc->GetNode()->GetChild(0, XFA_Element::Traversal); if (pTraversal) { CXFA_Node* pTraverse = pTraversal->GetChild(0, XFA_Element::Traverse); if (pTraverse) { CFX_WideString wsTraverseWidgetName; if (pTraverse->GetAttribute(XFA_ATTRIBUTE_Ref, wsTraverseWidgetName)) { return FindWidgetByName(wsTraverseWidgetName, pWidget); } } } return nullptr; }