void CXFA_ScriptContext::GlobalPropertySetter(CFXJSE_Value* pObject, const CFX_ByteStringC& szPropName, CFXJSE_Value* pValue) { CXFA_Object* lpOrginalNode = ToObject(pObject, nullptr); CXFA_Document* pDoc = lpOrginalNode->GetDocument(); CXFA_ScriptContext* lpScriptContext = pDoc->GetScriptContext(); CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(lpOrginalNode); CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); uint32_t dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Attributes; CXFA_Node* pRefNode = ToNode(lpScriptContext->GetThisObject()); if (lpOrginalNode->IsVariablesThis()) pRefNode = ToNode(lpCurNode); if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsStringC(), pValue, dwFlag, TRUE)) { return; } if (lpOrginalNode->IsVariablesThis()) { if (pValue && pValue->IsUndefined()) { pObject->SetObjectOwnProperty(szPropName, pValue); return; } } CXFA_FFNotify* pNotify = pDoc->GetNotify(); if (!pNotify) { return; } pNotify->GetDocProvider()->SetGlobalProperty(pNotify->GetHDOC(), szPropName, pValue); }
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_ScriptContext::GlobalPropertyGetter(CFXJSE_Value* pObject, const CFX_ByteStringC& szPropName, CFXJSE_Value* pValue) { CXFA_Object* pOriginalObject = ToObject(pObject, nullptr); CXFA_Document* pDoc = pOriginalObject->GetDocument(); CXFA_ScriptContext* lpScriptContext = pDoc->GetScriptContext(); CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(pOriginalObject); CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); if (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Formcalc) { if (szPropName == kFormCalcRuntime) { lpScriptContext->m_FM2JSContext->GlobalPropertyGetter(pValue); return; } XFA_HashCode uHashCode = static_cast<XFA_HashCode>( FX_HashCode_GetW(wsPropName.AsStringC(), false)); if (uHashCode != XFA_HASHCODE_Layout) { CXFA_Object* pObj = lpScriptContext->GetDocument()->GetXFAObject(uHashCode); if (pObj) { pValue->Assign(lpScriptContext->GetJSValueFromMap(pObj)); return; } } } uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Attributes; CXFA_Node* pRefNode = ToNode(lpScriptContext->GetThisObject()); if (pOriginalObject->IsVariablesThis()) { pRefNode = ToNode(lpCurNode); } if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsStringC(), pValue, dwFlag, FALSE)) { return; } dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsStringC(), pValue, dwFlag, FALSE)) { return; } CXFA_Object* pScriptObject = lpScriptContext->GetVariablesThis(pOriginalObject, TRUE); if (pScriptObject && lpScriptContext->QueryVariableValue(pScriptObject->AsNode(), szPropName, pValue, TRUE)) { return; } CXFA_FFNotify* pNotify = pDoc->GetNotify(); if (!pNotify) { return; } pNotify->GetDocProvider()->GetGlobalProperty(pNotify->GetHDOC(), szPropName, pValue); }
DBCoordinate *DBVPolyIF::Vertexes (const DBObjRecord *polyRec) const { DBInt vertex, i, line; DBObjRecord *lineRec, *nodeRec,*firstNodeRec; DBCoordinate *lcoords; vertex = 0; lineRec = FirstLine (polyRec); firstNodeRec = nodeRec = LineRightPoly (lineRec) == polyRec ? FromNode (lineRec) : ToNode (lineRec); for (line = 0;line < LineNum (polyRec);++line) { if (LineRightPoly (lineRec) == polyRec) { if (nodeRec != FromNode (lineRec)) { CoordsPTR [vertex++] = NodeCoord (nodeRec); if (nodeRec != firstNodeRec) CoordsPTR [vertex++] = NodeCoord (firstNodeRec); nodeRec = FromNode (lineRec); } CoordsPTR [vertex++] = NodeCoord (nodeRec); if (DBVLineIF::VertexNum(lineRec) > 0) { lcoords = DBVLineIF::Vertexes (lineRec); for (i = 0;i < DBVLineIF::VertexNum (lineRec);++i) CoordsPTR [vertex++] = lcoords [i]; } nodeRec = ToNode (lineRec); lineRec = LineNextLine (lineRec); } else { if (nodeRec != ToNode (lineRec)) { CoordsPTR [vertex++] = NodeCoord (nodeRec); if (nodeRec != firstNodeRec) CoordsPTR [vertex++] = NodeCoord (firstNodeRec); nodeRec = ToNode (lineRec); } CoordsPTR [vertex++] = NodeCoord (nodeRec); if (DBVLineIF::VertexNum (lineRec) > 0) { lcoords = (DBCoordinate *) (DBVLineIF::Vertexes (lineRec)); for (i = DBVLineIF::VertexNum (lineRec);i > 0;--i) CoordsPTR [vertex++] = lcoords [i - 1]; } nodeRec = FromNode (lineRec); lineRec = LinePrevLine (lineRec); } } CoordsPTR [vertex++] = NodeCoord (nodeRec); if (nodeRec != firstNodeRec) CoordsPTR [vertex++] = NodeCoord (firstNodeRec); if (VertexNum (polyRec) != vertex) CMmsgPrint (CMmsgAppError, "Warning in Polygon %d VertexNum [%d %d] in: %s %d",polyRec->RowID (), VertexNum (polyRec),vertex,__FILE__,__LINE__); return (CoordsPTR); }
void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue, const CFX_ByteStringC& szPropName, CFXJSE_Value* pReturnValue) { CXFA_Object* pOriginalObject = ToObject(pOriginalValue, nullptr); if (!pOriginalObject) return; CXFA_ScriptContext* lpScriptContext = pOriginalObject->GetDocument()->GetScriptContext(); CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOriginalObject); CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = XFA_GetScriptAttributeByName( pObject->GetElementType(), wsPropName.AsStringC()); if (lpAttributeInfo) { (pObject->*(lpAttributeInfo->lpfnCallback))( pReturnValue, TRUE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); } else { if (pObject->IsNode()) { if (wsPropName.GetAt(0) == '#') { wsPropName = wsPropName.Right(wsPropName.GetLength() - 1); } CXFA_Node* pNode = ToNode(pObject); CXFA_Node* pPropOrChild = nullptr; XFA_Element eType = XFA_GetElementTypeForName(wsPropName.AsStringC()); if (eType != XFA_Element::Unknown) pPropOrChild = pNode->GetProperty(0, eType); else pPropOrChild = pNode->GetFirstChildByName(wsPropName.AsStringC()); if (pPropOrChild) { CFX_WideString wsDefaultName(L"{default}"); const XFA_SCRIPTATTRIBUTEINFO* lpAttrInfo = XFA_GetScriptAttributeByName(pPropOrChild->GetElementType(), wsDefaultName.AsStringC()); if (lpAttrInfo) { (pPropOrChild->*(lpAttrInfo->lpfnCallback))( pReturnValue, TRUE, (XFA_ATTRIBUTE)lpAttrInfo->eAttribute); return; } } } CXFA_Object* pScriptObject = lpScriptContext->GetVariablesThis(pOriginalObject, TRUE); if (pScriptObject) { lpScriptContext->QueryVariableValue(ToNode(pScriptObject), szPropName, pReturnValue, FALSE); } } }
CJS_Result CJX_List::insert(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 2) return CJS_Result::Failure(JSMessage::kParamError); auto* pNewNode = ToNode(static_cast<CFXJSE_Engine*>(runtime)->ToXFAObject(params[0])); if (!pNewNode) return CJS_Result::Failure(JSMessage::kValueError); auto* pBeforeNode = ToNode(static_cast<CFXJSE_Engine*>(runtime)->ToXFAObject(params[1])); GetXFAList()->Insert(pNewNode, pBeforeNode); return CJS_Result::Success(); }
FX_BOOL CXFA_NodeHelper::ResolveNodes_CreateNode( CFX_WideString wsName, CFX_WideString wsCondition, FX_BOOL bLastNode, CXFA_ScriptContext* pScriptContext) { if (!m_pCreateParent) { return FALSE; } FX_BOOL bIsClassName = FALSE; FX_BOOL bResult = FALSE; if (wsName.GetAt(0) == '!') { wsName = wsName.Right(wsName.GetLength() - 1); m_pCreateParent = ToNode( pScriptContext->GetDocument()->GetXFAObject(XFA_HASHCODE_Datasets)); } if (wsName.GetAt(0) == '#') { bIsClassName = TRUE; wsName = wsName.Right(wsName.GetLength() - 1); } if (m_iCreateCount == 0) { CreateNode_ForCondition(wsCondition); } if (bIsClassName) { XFA_Element eType = XFA_GetElementTypeForName(wsName.AsStringC()); if (eType == XFA_Element::Unknown) return FALSE; for (int32_t iIndex = 0; iIndex < m_iCreateCount; iIndex++) { CXFA_Node* pNewNode = m_pCreateParent->CreateSamePacketNode(eType); if (pNewNode) { m_pCreateParent->InsertChild(pNewNode); if (iIndex == m_iCreateCount - 1) { m_pCreateParent = pNewNode; } bResult = TRUE; } } } else { XFA_Element eClassType = XFA_Element::DataGroup; if (bLastNode) { eClassType = m_eLastCreateType; } for (int32_t iIndex = 0; iIndex < m_iCreateCount; iIndex++) { CXFA_Node* pNewNode = m_pCreateParent->CreateSamePacketNode(eClassType); if (pNewNode) { pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, wsName.AsStringC()); pNewNode->CreateXMLMappingNode(); m_pCreateParent->InsertChild(pNewNode); if (iIndex == m_iCreateCount - 1) { m_pCreateParent = pNewNode; } bResult = TRUE; } } } if (!bResult) { m_pCreateParent = nullptr; } return bResult; }
int32_t CXFA_LayoutProcessor::StartLayout(FX_BOOL bForceRestart) { if (!bForceRestart && !IsNeedLayout()) { return 100; } if (m_pRootItemLayoutProcessor) { delete m_pRootItemLayoutProcessor; m_pRootItemLayoutProcessor = NULL; } m_nProgressCounter = 0; CXFA_Node* pFormPacketNode = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form)); if (!pFormPacketNode) { return -1; } CXFA_Node* pFormRoot = pFormPacketNode->GetFirstChildByClass(XFA_ELEMENT_Subform); if (!pFormRoot) { return -1; } if (!m_pLayoutPageMgr) { m_pLayoutPageMgr = new CXFA_LayoutPageMgr(this); } if (!m_pLayoutPageMgr->InitLayoutPage(pFormRoot)) { return -1; } if (!m_pLayoutPageMgr->PrepareFirstPage(pFormRoot)) { return -1; } m_pRootItemLayoutProcessor = new CXFA_ItemLayoutProcessor(pFormRoot, m_pLayoutPageMgr); m_nProgressCounter = 1; return 0; }
int32_t CXFA_LayoutProcessor::StartLayout(bool bForceRestart) { if (!bForceRestart && !IsNeedLayout()) return 100; m_pRootItemLayoutProcessor.reset(); m_nProgressCounter = 0; CXFA_Node* pFormPacketNode = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form)); if (!pFormPacketNode) return -1; CXFA_Node* pFormRoot = pFormPacketNode->GetFirstChildByClass(XFA_Element::Subform); if (!pFormRoot) return -1; if (!m_pLayoutPageMgr) m_pLayoutPageMgr = pdfium::MakeUnique<CXFA_LayoutPageMgr>(this); if (!m_pLayoutPageMgr->InitLayoutPage(pFormRoot)) return -1; if (!m_pLayoutPageMgr->PrepareFirstPage(pFormRoot)) return -1; m_pRootItemLayoutProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>( pFormRoot, m_pLayoutPageMgr.get()); m_nProgressCounter = 1; return 0; }
int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Excalmatory( CXFA_ResolveNodesData& rnd) { if (rnd.m_nLevel > 0) { return 0; } CXFA_Node* datasets = ToNode(rnd.m_pSC->GetDocument()->GetXFAObject(XFA_HASHCODE_Datasets)); if (!datasets) { return 0; } CXFA_ResolveNodesData rndFind; rndFind.m_pSC = rnd.m_pSC; rndFind.m_CurNode = datasets; rndFind.m_wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1); rndFind.m_uHashName = FX_HashCode_String_GetW(rndFind.m_wsName, rndFind.m_wsName.GetLength()); rndFind.m_nLevel = rnd.m_nLevel + 1; rndFind.m_dwStyles = XFA_RESOLVENODE_Children; rndFind.m_wsCondition = rnd.m_wsCondition; XFA_ResolveNodes(rndFind); if (rndFind.m_Nodes.GetSize() > 0) { rnd.m_Nodes.Append(rndFind.m_Nodes); rndFind.m_Nodes.RemoveAll(); } return rnd.m_Nodes.GetSize(); }
int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_NumberSign( CXFA_ResolveNodesData& rnd) { CFX_WideString wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1); CFX_WideString wsCondition = rnd.m_wsCondition; CXFA_Node* curNode = ToNode(rnd.m_CurNode); if (XFA_ResolveNodes_ForAttributeRs(curNode, rnd, wsName)) { return 1; } CXFA_ResolveNodesData rndFind; rndFind.m_pSC = rnd.m_pSC; rndFind.m_nLevel = rnd.m_nLevel + 1; rndFind.m_dwStyles = rnd.m_dwStyles; rndFind.m_dwStyles |= XFA_RESOLVENODE_TagName; rndFind.m_dwStyles &= ~XFA_RESOLVENODE_Attributes; rndFind.m_wsName = wsName; rndFind.m_uHashName = FX_HashCode_String_GetW(rndFind.m_wsName, rndFind.m_wsName.GetLength()); rndFind.m_wsCondition = wsCondition; rndFind.m_CurNode = curNode; XFA_ResolveNodes_Normal(rndFind); if (rndFind.m_Nodes.GetSize() > 0) { if (wsCondition.GetLength() == 0 && rndFind.m_Nodes.Find(curNode) >= 0) { rnd.m_Nodes.Add(curNode); } else { rnd.m_Nodes.Append(rndFind.m_Nodes); rndFind.m_Nodes.RemoveAll(); } } return rnd.m_Nodes.GetSize(); }
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; }
int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_AnyChild( CXFA_ResolveNodesData& rnd) { CFX_WideString wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1); CFX_WideString wsCondition = rnd.m_wsCondition; CXFA_Node* findNode = NULL; CXFA_NodeArray siblings; FX_BOOL bClassName = FALSE; if (wsName.GetAt(0) == '#') { bClassName = TRUE; wsName = wsName.Right(wsName.GetLength() - 1); } findNode = m_pNodeHelper->XFA_ResolveNodes_GetOneChild(ToNode(rnd.m_CurNode), wsName, bClassName); if (findNode == NULL) { return 0; } if (wsCondition.IsEmpty()) { rnd.m_Nodes.Add(findNode); return rnd.m_Nodes.GetSize(); } m_pNodeHelper->XFA_CountSiblings(findNode, XFA_LOGIC_Transparent, (CXFA_NodeArray*)&rnd.m_Nodes, bClassName); XFA_ResolveNode_FilterCondition(rnd, wsCondition); return rnd.m_Nodes.GetSize(); }
void CXFA_FFDocView::RunDocClose() { CXFA_Node* pRootItem = ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); if (!pRootItem) { return; } ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_DocClose); }
CXFA_Node* CXFA_FFDocView::GetRootSubform() { CXFA_Node* pFormPacketNode = ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); if (!pFormPacketNode) { return NULL; } return pFormPacketNode->GetFirstChildByClass(XFA_ELEMENT_Subform); }
void CXFA_ScriptContext::NormalPropertyGetter(CFXJSE_Value* pOriginalValue, const CFX_ByteStringC& szPropName, CFXJSE_Value* pReturnValue) { CXFA_Object* pOriginalObject = ToObject(pOriginalValue, nullptr); if (!pOriginalObject) { pReturnValue->SetUndefined(); return; } CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); CXFA_ScriptContext* lpScriptContext = pOriginalObject->GetDocument()->GetScriptContext(); CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOriginalObject); if (wsPropName == FX_WSTRC(L"xfa")) { CFXJSE_Value* pValue = lpScriptContext->GetJSValueFromMap( lpScriptContext->GetDocument()->GetRoot()); pReturnValue->Assign(pValue); return; } uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Attributes; FX_BOOL bRet = lpScriptContext->QueryNodeByFlag( ToNode(pObject), wsPropName.AsStringC(), pReturnValue, dwFlag, FALSE); if (bRet) { return; } if (pObject == lpScriptContext->GetThisObject() || (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Javascript && !lpScriptContext->IsStrictScopeInJavaScript())) { dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; bRet = lpScriptContext->QueryNodeByFlag( ToNode(pObject), wsPropName.AsStringC(), pReturnValue, dwFlag, FALSE); } if (bRet) { return; } CXFA_Object* pScriptObject = lpScriptContext->GetVariablesThis(pOriginalObject, TRUE); if (pScriptObject) { bRet = lpScriptContext->QueryVariableValue(ToNode(pScriptObject), szPropName, pReturnValue, TRUE); } if (!bRet) { pReturnValue->SetUndefined(); } }
bool LIB_MANAGER_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsigned int aCol, wxDataViewItemAttr& aAttr ) const { if( IsFrozen() ) return false; // change attributes only for the name field if( aCol != 0 ) return false; auto node = ToNode( aItem ); wxCHECK( node, false ); switch( node->Type ) { case CMP_TREE_NODE::LIB: // mark modified libs with bold font aAttr.SetBold( m_libMgr->IsLibraryModified( node->Name ) ); #ifdef __WXGTK__ // The native wxGTK+ impl ignores background colour, so set the text colour instead. // This works reasonably well in dark themes, and quite poorly in light ones.... if( node->Name == m_libMgr->GetCurrentLib() ) aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); #else // mark the current library with background color if( node->Name == m_libMgr->GetCurrentLib() ) aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); #endif break; case CMP_TREE_NODE::LIBID: // mark modified part with bold font aAttr.SetBold( m_libMgr->IsPartModified( node->Name, node->Parent->Name ) ); // mark aliases with italic font aAttr.SetItalic( !node->IsRoot ); #ifdef __WXGTK__ // The native wxGTK+ impl ignores background colour, so set the text colour instead. // This works reasonably well in dark themes, and quite poorly in light ones.... if( node->LibId == m_libMgr->GetCurrentLibId() ) aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); #else // mark the current part with background color if( node->LibId == m_libMgr->GetCurrentLibId() ) aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); #endif break; default: return false; } return true; }
int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Asterisk( CXFA_ResolveNodesData& rnd) { CXFA_Node* curNode = ToNode(rnd.m_CurNode); CXFA_ObjArray& nodes = rnd.m_Nodes; CXFA_NodeArray array; curNode->GetNodeList(array, XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties); nodes.Append((CXFA_ObjArray&)array); return nodes.GetSize(); }
FX_BOOL CXFA_FFDocView::RunEventLayoutReady() { CXFA_Node* pRootItem = ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); if (!pRootItem) { return FALSE; } ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready); RunLayout(); return TRUE; }
void CScript_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } int32_t iLength = pArguments->GetLength(); if (iLength != 1) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"openList"); return; } CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } CXFA_Node* pNode = nullptr; if (iLength >= 1) { std::unique_ptr<CFXJSE_Value> pValue(pArguments->GetValue(0)); if (pValue->IsObject()) { pNode = ToNode(pValue.get(), nullptr); } else if (pValue->IsString()) { CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) return; CXFA_Object* pObject = pScriptContext->GetThisObject(); if (!pObject) return; uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; int32_t iRet = pScriptContext->ResolveObjects( pObject, pValue->ToWideString().AsStringC(), resoveNodeRS, dwFlag); if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) return; pNode = resoveNodeRS.nodes[0]->AsNode(); } } CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } CXFA_FFWidget* hWidget = pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); if (!hWidget) { return; } pNotify->GetDocEnvironment()->SetFocusWidget(pNotify->GetHDOC(), hWidget); pNotify->OpenDropDownList(hWidget); }
Optional<WideString> CXFA_TextProvider::GetEmbeddedObj( const WideString& wsAttr) const { if (m_eType != XFA_TEXTPROVIDERTYPE_Text) return {}; CXFA_Node* pParent = m_pNode->GetParent(); CXFA_Document* pDocument = m_pNode->GetDocument(); CXFA_Node* pIDNode = nullptr; if (pParent) pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsStringView()); if (!pIDNode) { pIDNode = pDocument->GetNodeByID( ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)), wsAttr.AsStringView()); } if (!pIDNode || !pIDNode->IsWidgetReady()) return {}; return pIDNode->GetValue(XFA_VALUEPICTURE_Display); }
int32_t CXFA_FFDocView::StartLayout(int32_t iStartPage) { m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Start; m_pDoc->GetXFADoc()->DoProtoMerge(); m_pDoc->GetXFADoc()->DoDataMerge(); m_pXFADocLayout = GetXFALayout(); int32_t iStatus = m_pXFADocLayout->StartLayout(); if (iStatus < 0) { return iStatus; } CXFA_Node* pRootItem = ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); if (!pRootItem) { return iStatus; } InitLayout(pRootItem); InitCalculate(pRootItem); InitValidate(pRootItem); ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, TRUE); m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Start; return iStatus; }
void LIB_MANAGER_ADAPTER::GetValue( wxVariant& aVariant, wxDataViewItem const& aItem, unsigned int aCol ) const { if( IsFrozen() ) { aVariant = wxEmptyString; return; } auto node = ToNode( aItem ); wxASSERT( node ); switch( aCol ) { case 0: aVariant = node->Name; // mark modified libs with an asterix if( node->Type == CMP_TREE_NODE::LIB && m_libMgr->IsLibraryModified( node->Name ) ) aVariant = node->Name + " *"; // mark modified parts with an asterix if( node->Type == CMP_TREE_NODE::LIBID && m_libMgr->IsPartModified( node->Name, node->Parent->Name ) ) aVariant = node->Name + " *"; break; case 1: aVariant = node->Desc; break; default: // column == -1 is used for default Compare function aVariant = node->Name; break; } }
void CXFA_ResolveProcessor::XFA_ResolveNode_FilterCondition( CXFA_ResolveNodesData& rnd, CFX_WideString wsCondition) { CXFA_NodeArray& findNodes = (CXFA_NodeArray&)rnd.m_Nodes; int32_t iCurrIndex = 0; const CXFA_NodeArray& array = rnd.m_pSC->GetUpObjectArray(); int32_t iSize = array.GetSize(); if (iSize) { CXFA_Node* curNode = array[iSize - 1]; FX_BOOL bIsProperty = m_pNodeHelper->XFA_NodeIsProperty(curNode); if (curNode->IsUnnamed() || (bIsProperty && curNode->GetClassID() != XFA_ELEMENT_PageSet)) { iCurrIndex = m_pNodeHelper->XFA_GetIndex(curNode, XFA_LOGIC_Transparent, bIsProperty, TRUE); } else { iCurrIndex = m_pNodeHelper->XFA_GetIndex(curNode, XFA_LOGIC_Transparent, bIsProperty, FALSE); } } int32_t iFoundCount = findNodes.GetSize(); wsCondition.TrimLeft(); wsCondition.TrimRight(); int32_t iLen = wsCondition.GetLength(); if (!iLen) { if (rnd.m_dwStyles & XFA_RESOLVENODE_ALL) { return; } if (iFoundCount == 1) { return; } if (iFoundCount <= iCurrIndex) { if (rnd.m_dwStyles & XFA_RESOLVENODE_CreateNode) { m_pNodeHelper->m_pCreateParent = ToNode(rnd.m_CurNode); m_pNodeHelper->m_iCreateCount = iCurrIndex - iFoundCount + 1; } findNodes.RemoveAll(); return; } else { CXFA_Node* ret = findNodes[iCurrIndex]; findNodes.RemoveAll(); findNodes.Add(ret); return; } } FX_WCHAR wTypeChar = wsCondition[0]; switch (wTypeChar) { case '[': XFA_ResolveNode_ConditionArray(iCurrIndex, wsCondition, iFoundCount, rnd); return; case '(': return; case '"': return; case '.': if (iLen > 1 && (wsCondition[1] == '[' || wsCondition[1] == '(')) { XFA_ResolveNode_DoPredicateFilter(iCurrIndex, wsCondition, iFoundCount, rnd); } default: return; } }
void CXFA_ResolveProcessor::XFA_ResolveNode_ConditionArray( int32_t iCurIndex, CFX_WideString wsCondition, int32_t iFoundCount, CXFA_ResolveNodesData& rnd) { CXFA_NodeArray& findNodes = (CXFA_NodeArray&)rnd.m_Nodes; int32_t iLen = wsCondition.GetLength(); FX_BOOL bRelative = FALSE; FX_BOOL bAll = FALSE; int32_t i = 1; for (; i < iLen; ++i) { FX_WCHAR ch = wsCondition[i]; if (ch == ' ') { continue; } if (ch == '+' || ch == '-') { bRelative = TRUE; break; } else if (ch == '*') { bAll = TRUE; break; } else { break; } } if (bAll) { if (rnd.m_dwStyles & XFA_RESOLVENODE_CreateNode) { if (rnd.m_dwStyles & XFA_RESOLVENODE_Bind) { m_pNodeHelper->m_pCreateParent = ToNode(rnd.m_CurNode); m_pNodeHelper->m_iCreateCount = 1; findNodes.RemoveAll(); m_pNodeHelper->m_iCurAllStart = -1; m_pNodeHelper->m_pAllStartParent = NULL; } else { if (m_pNodeHelper->m_iCurAllStart == -1) { m_pNodeHelper->m_iCurAllStart = m_iCurStart; m_pNodeHelper->m_pAllStartParent = ToNode(rnd.m_CurNode); } } } else if (rnd.m_dwStyles & XFA_RESOLVENODE_BindNew) { if (m_pNodeHelper->m_iCurAllStart == -1) { m_pNodeHelper->m_iCurAllStart = m_iCurStart; } } return; } if (iFoundCount == 1 && !iLen) { return; } CFX_WideString wsIndex; wsIndex = wsCondition.Mid(i, iLen - 1 - i); int32_t iIndex = wsIndex.GetInteger(); if (bRelative) { iIndex += iCurIndex; } if (iFoundCount <= iIndex || iIndex < 0) { if (rnd.m_dwStyles & XFA_RESOLVENODE_CreateNode) { m_pNodeHelper->m_pCreateParent = ToNode(rnd.m_CurNode); m_pNodeHelper->m_iCreateCount = iIndex - iFoundCount + 1; } findNodes.RemoveAll(); } else { CXFA_Node* ret = findNodes[iIndex]; findNodes.RemoveAll(); findNodes.Add(ret); } }
int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( CXFA_ResolveNodesData& rnd) { if (rnd.m_nLevel > 32) { return 0; } if (!rnd.m_CurNode->IsNode()) { return 0; } CXFA_Node* curNode = ToNode(rnd.m_CurNode); CXFA_ObjArray& nodes = rnd.m_Nodes; int32_t nNum = nodes.GetSize(); FX_DWORD dwStyles = rnd.m_dwStyles; CFX_WideString& wsName = rnd.m_wsName; uint32_t uNameHash = rnd.m_uHashName; CFX_WideString& wsCondition = rnd.m_wsCondition; CXFA_ResolveNodesData rndFind; rndFind.m_wsName = rnd.m_wsName; rndFind.m_wsCondition = rnd.m_wsCondition; rndFind.m_pSC = rnd.m_pSC; rndFind.m_nLevel = rnd.m_nLevel + 1; rndFind.m_uHashName = uNameHash; CXFA_NodeArray children; CXFA_NodeArray properties; CXFA_Node* pVariablesNode = NULL; CXFA_Node* pPageSetNode = NULL; CXFA_Node* pChild = curNode->GetNodeItem(XFA_NODEITEM_FirstChild); while (pChild) { if (pChild->GetClassID() == XFA_ELEMENT_Variables) { pVariablesNode = pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); continue; } else if (pChild->GetClassID() == XFA_ELEMENT_PageSet) { pPageSetNode = pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); continue; } else { XFA_LPCPROPERTY pPropert = XFA_GetPropertyOfElement( curNode->GetClassID(), pChild->GetClassID(), XFA_XDPPACKET_UNKNOWN); if (pPropert) { properties.Add(pChild); } else { children.Add(pChild); } } pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); } if ((dwStyles & XFA_RESOLVENODE_Properties) && pVariablesNode) { uint32_t uPropHash = pVariablesNode->GetClassHashCode(); if (uPropHash == uNameHash) { nodes.Add(pVariablesNode); } else { rndFind.m_CurNode = pVariablesNode; XFA_ResolveNodes_SetStylesForChild(dwStyles, rndFind); CFX_WideString wsSaveCondition = rndFind.m_wsCondition; rndFind.m_wsCondition.Empty(); XFA_ResolveNodes_Normal(rndFind); rndFind.m_wsCondition = wsSaveCondition; if (rndFind.m_Nodes.GetSize() > 0) { nodes.Append(rndFind.m_Nodes); rndFind.m_Nodes.RemoveAll(); } } if (nodes.GetSize() > nNum) { XFA_ResolveNode_FilterCondition(rnd, wsCondition); if (nodes.GetSize() > 0) { return 1; } return 0; } } if (dwStyles & XFA_RESOLVENODE_Children) { FX_BOOL bSetFlag = FALSE; if (pPageSetNode && (dwStyles & XFA_RESOLVENODE_Properties)) { children.Add(pPageSetNode); } for (int32_t i = 0; i < children.GetSize(); i++) { CXFA_Node* child = children[i]; if (dwStyles & XFA_RESOLVENODE_TagName) { if (child->GetClassHashCode() == uNameHash) { nodes.Add(child); } } else if (child->GetNameHash() == uNameHash) { nodes.Add(child); } if (m_pNodeHelper->XFA_NodeIsTransparent(child) && child->GetClassID() != XFA_ELEMENT_PageSet) { if (!bSetFlag) { XFA_ResolveNodes_SetStylesForChild(dwStyles, rndFind); bSetFlag = TRUE; } rndFind.m_CurNode = child; CFX_WideString wsSaveCondition = rndFind.m_wsCondition; rndFind.m_wsCondition.Empty(); XFA_ResolveNodes_Normal(rndFind); rndFind.m_wsCondition = wsSaveCondition; if (rndFind.m_Nodes.GetSize() > 0) { nodes.Append(rndFind.m_Nodes); rndFind.m_Nodes.RemoveAll(); } } } if (nodes.GetSize() > nNum) { if (!(dwStyles & XFA_RESOLVENODE_ALL)) { CXFA_NodeArray upArrayNodes; if (m_pNodeHelper->XFA_NodeIsTransparent(ToNode(curNode))) { m_pNodeHelper->XFA_CountSiblings( ToNode(nodes[0]), XFA_LOGIC_Transparent, &upArrayNodes, !!(dwStyles & XFA_RESOLVENODE_TagName)); } if (upArrayNodes.GetSize() > nodes.GetSize()) { upArrayNodes[0] = ToNode(nodes[0]); nodes.RemoveAll(); nodes.Append((CXFA_ObjArray&)upArrayNodes); upArrayNodes.RemoveAll(); } } XFA_ResolveNode_FilterCondition(rnd, wsCondition); if (nodes.GetSize() > 0) { return 1; } return 0; } } if (dwStyles & XFA_RESOLVENODE_Attributes) { if (XFA_ResolveNodes_ForAttributeRs(curNode, rnd, wsName)) { return 1; } } if (dwStyles & XFA_RESOLVENODE_Properties) { for (int32_t i = 0; i < properties.GetSize(); i++) { CXFA_Node* childProperty = properties[i]; if (childProperty->IsUnnamed()) { uint32_t uPropHash = childProperty->GetClassHashCode(); if (uPropHash == uNameHash) { nodes.Add(childProperty); } } else if (childProperty->GetNameHash() == uNameHash && childProperty->GetClassID() != XFA_ELEMENT_Extras && childProperty->GetClassID() != XFA_ELEMENT_Items) { nodes.Add(childProperty); } } if (nodes.GetSize() > nNum) { XFA_ResolveNode_FilterCondition(rnd, wsCondition); if (nodes.GetSize() > 0) { return 1; } return 0; } CXFA_Node* pProp = NULL; if (XFA_ELEMENT_Subform == curNode->GetClassID() && XFA_HASHCODE_Occur == uNameHash) { CXFA_Node* pInstanceManager = curNode->AsNode()->GetInstanceMgrOfSubform(); if (pInstanceManager) { pProp = pInstanceManager->GetProperty(0, XFA_ELEMENT_Occur, TRUE); } } else { XFA_LPCELEMENTINFO pElement = XFA_GetElementByName(wsName); if (pElement) { pProp = curNode->AsNode()->GetProperty( 0, pElement->eName, pElement->eName != XFA_ELEMENT_PageSet); } } if (pProp) { nodes.Add(pProp); return nodes.GetSize(); } } CXFA_Node* parentNode = m_pNodeHelper->XFA_ResolveNodes_GetParent( curNode->AsNode(), XFA_LOGIC_NoTransparent); uint32_t uCurClassHash = curNode->GetClassHashCode(); if (!parentNode) { if (uCurClassHash == uNameHash) { nodes.Add(curNode->AsNode()); XFA_ResolveNode_FilterCondition(rnd, wsCondition); if (nodes.GetSize() > 0) { return 1; } } return 0; } if (dwStyles & XFA_RESOLVENODE_Siblings) { CXFA_Node* child = parentNode->GetNodeItem(XFA_NODEITEM_FirstChild); FX_DWORD dwSubStyles = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties; if (dwStyles & XFA_RESOLVENODE_TagName) { dwSubStyles |= XFA_RESOLVENODE_TagName; } if (dwStyles & XFA_RESOLVENODE_ALL) { dwSubStyles |= XFA_RESOLVENODE_ALL; } rndFind.m_dwStyles = dwSubStyles; while (child) { if (child == curNode) { if (dwStyles & XFA_RESOLVENODE_TagName) { if (uCurClassHash == uNameHash) { nodes.Add(curNode); } } else { if (child->GetNameHash() == uNameHash) { nodes.Add(curNode); if (rnd.m_nLevel == 0 && wsCondition.GetLength() == 0) { nodes.RemoveAll(); nodes.Add(curNode); return 1; } } } child = child->GetNodeItem(XFA_NODEITEM_NextSibling); continue; } if (dwStyles & XFA_RESOLVENODE_TagName) { if (child->GetClassHashCode() == uNameHash) { nodes.Add(child); } } else if (child->GetNameHash() == uNameHash) { nodes.Add(child); } XFA_LPCPROPERTY pPropert = XFA_GetPropertyOfElement( parentNode->GetClassID(), child->GetClassID(), XFA_XDPPACKET_UNKNOWN); FX_BOOL bInnerSearch = FALSE; if (pPropert) { if ((child->GetClassID() == XFA_ELEMENT_Variables || child->GetClassID() == XFA_ELEMENT_PageSet)) { bInnerSearch = TRUE; } } else { if (m_pNodeHelper->XFA_NodeIsTransparent(child)) { bInnerSearch = TRUE; } } if (bInnerSearch) { rndFind.m_CurNode = child; CFX_WideString wsOriginCondition = rndFind.m_wsCondition; rndFind.m_wsCondition.Empty(); FX_DWORD dwOriginStyle = rndFind.m_dwStyles; rndFind.m_dwStyles = dwOriginStyle | XFA_RESOLVENODE_ALL; XFA_ResolveNodes_Normal(rndFind); rndFind.m_dwStyles = dwOriginStyle; rndFind.m_wsCondition = wsOriginCondition; if (rndFind.m_Nodes.GetSize() > 0) { nodes.Append(rndFind.m_Nodes); rndFind.m_Nodes.RemoveAll(); } } child = child->GetNodeItem(XFA_NODEITEM_NextSibling); } if (nodes.GetSize() > nNum) { if (m_pNodeHelper->XFA_NodeIsTransparent(parentNode)) { CXFA_NodeArray upArrayNodes; m_pNodeHelper->XFA_CountSiblings( ToNode(nodes[0]), XFA_LOGIC_Transparent, &upArrayNodes, !!(dwStyles & XFA_RESOLVENODE_TagName)); if (upArrayNodes.GetSize() > nodes.GetSize()) { upArrayNodes[0] = ToNode(nodes[0]); nodes.RemoveAll(); nodes.Append((CXFA_ObjArray&)upArrayNodes); upArrayNodes.RemoveAll(); } } XFA_ResolveNode_FilterCondition(rnd, wsCondition); if (nodes.GetSize() > 0) { return 1; } return 0; } } if (dwStyles & XFA_RESOLVENODE_Parent) { FX_DWORD dwSubStyles = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Properties; if (dwStyles & XFA_RESOLVENODE_TagName) { dwSubStyles |= XFA_RESOLVENODE_TagName; } if (dwStyles & XFA_RESOLVENODE_ALL) { dwSubStyles |= XFA_RESOLVENODE_ALL; } rndFind.m_dwStyles = dwSubStyles; rndFind.m_CurNode = parentNode; CXFA_NodeArray& array = rnd.m_pSC->GetUpObjectArray(); array.Add(parentNode); XFA_ResolveNodes_Normal(rndFind); if (rndFind.m_Nodes.GetSize() > 0) { nodes.Append(rndFind.m_Nodes); rndFind.m_Nodes.RemoveAll(); } if (nodes.GetSize() > nNum) { return 1; } } return 0; }
bool LIB_MANAGER_ADAPTER::IsContainer( const wxDataViewItem& aItem ) const { const CMP_TREE_NODE* node = ToNode( aItem ); return node ? node->Type == CMP_TREE_NODE::LIB : true; }
int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode, const CFX_WideStringC& wsExpression, XFA_RESOLVENODE_RS& resolveNodeRS, uint32_t dwStyles, CXFA_Node* bindNode) { if (wsExpression.IsEmpty()) { return 0; } if (m_eScriptType != XFA_SCRIPTLANGTYPE_Formcalc || (dwStyles & (XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings))) { m_upObjectArray.RemoveAll(); } if (refNode && refNode->IsNode() && (dwStyles & (XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings))) { m_upObjectArray.Add(refNode->AsNode()); } FX_BOOL bNextCreate = FALSE; if (dwStyles & XFA_RESOLVENODE_CreateNode) { m_ResolveProcessor->GetNodeHelper()->SetCreateNodeType(bindNode); } m_ResolveProcessor->GetNodeHelper()->m_pCreateParent = nullptr; m_ResolveProcessor->GetNodeHelper()->m_iCurAllStart = -1; CXFA_ResolveNodesData rndFind; int32_t nStart = 0; int32_t nLevel = 0; int32_t nRet = -1; rndFind.m_pSC = this; CXFA_ObjArray findNodes; findNodes.Add(refNode ? refNode : m_pDocument->GetRoot()); int32_t nNodes = 0; while (TRUE) { nNodes = findNodes.GetSize(); int32_t i = 0; rndFind.m_dwStyles = dwStyles; m_ResolveProcessor->SetCurStart(nStart); nStart = m_ResolveProcessor->GetFilter(wsExpression, nStart, rndFind); if (nStart < 1) { if ((dwStyles & XFA_RESOLVENODE_CreateNode) && !bNextCreate) { CXFA_Node* pDataNode = nullptr; nStart = m_ResolveProcessor->GetNodeHelper()->m_iCurAllStart; if (nStart != -1) { pDataNode = m_pDocument->GetNotBindNode(findNodes); if (pDataNode) { findNodes.RemoveAll(); findNodes.Add(pDataNode); break; } } else { pDataNode = findNodes[0]->AsNode(); findNodes.RemoveAll(); findNodes.Add(pDataNode); break; } dwStyles |= XFA_RESOLVENODE_Bind; findNodes.RemoveAll(); findNodes.Add(m_ResolveProcessor->GetNodeHelper()->m_pAllStartParent); continue; } else { break; } } if (bNextCreate) { FX_BOOL bCreate = m_ResolveProcessor->GetNodeHelper()->ResolveNodes_CreateNode( rndFind.m_wsName, rndFind.m_wsCondition, nStart == wsExpression.GetLength(), this); if (bCreate) { continue; } else { break; } } CXFA_ObjArray retNodes; while (i < nNodes) { FX_BOOL bDataBind = FALSE; if (((dwStyles & XFA_RESOLVENODE_Bind) || (dwStyles & XFA_RESOLVENODE_CreateNode)) && nNodes > 1) { CXFA_ResolveNodesData rndBind; m_ResolveProcessor->GetFilter(wsExpression, nStart, rndBind); m_ResolveProcessor->SetIndexDataBind(rndBind.m_wsCondition, i, nNodes); bDataBind = TRUE; } rndFind.m_CurNode = findNodes[i++]; rndFind.m_nLevel = nLevel; rndFind.m_dwFlag = XFA_RESOVENODE_RSTYPE_Nodes; nRet = m_ResolveProcessor->Resolve(rndFind); if (nRet < 1) { continue; } if (rndFind.m_dwFlag == XFA_RESOVENODE_RSTYPE_Attribute && rndFind.m_pScriptAttribute && nStart < wsExpression.GetLength()) { std::unique_ptr<CFXJSE_Value> pValue(new CFXJSE_Value(m_pIsolate)); (rndFind.m_Nodes[0]->*(rndFind.m_pScriptAttribute->lpfnCallback))( pValue.get(), FALSE, (XFA_ATTRIBUTE)rndFind.m_pScriptAttribute->eAttribute); rndFind.m_Nodes.SetAt(0, ToObject(pValue.get(), nullptr)); } int32_t iSize = m_upObjectArray.GetSize(); if (iSize) { m_upObjectArray.RemoveAt(iSize - 1); } retNodes.Append(rndFind.m_Nodes); rndFind.m_Nodes.RemoveAll(); if (bDataBind) { break; } } findNodes.RemoveAll(); nNodes = retNodes.GetSize(); if (nNodes < 1) { if (dwStyles & XFA_RESOLVENODE_CreateNode) { bNextCreate = TRUE; if (!m_ResolveProcessor->GetNodeHelper()->m_pCreateParent) { m_ResolveProcessor->GetNodeHelper()->m_pCreateParent = ToNode(rndFind.m_CurNode); m_ResolveProcessor->GetNodeHelper()->m_iCreateCount = 1; } FX_BOOL bCreate = m_ResolveProcessor->GetNodeHelper()->ResolveNodes_CreateNode( rndFind.m_wsName, rndFind.m_wsCondition, nStart == wsExpression.GetLength(), this); if (bCreate) { continue; } else { break; } } else { break; } } findNodes.Copy(retNodes); rndFind.m_Nodes.RemoveAll(); if (nLevel == 0) { dwStyles &= ~(XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings); } nLevel++; } if (!bNextCreate) { resolveNodeRS.dwFlags = rndFind.m_dwFlag; if (nNodes > 0) { resolveNodeRS.nodes.Append(findNodes); } if (rndFind.m_dwFlag == XFA_RESOVENODE_RSTYPE_Attribute) { resolveNodeRS.pScriptAttribute = rndFind.m_pScriptAttribute; return 1; } } if (dwStyles & (XFA_RESOLVENODE_CreateNode | XFA_RESOLVENODE_Bind | XFA_RESOLVENODE_BindNew)) { m_ResolveProcessor->SetResultCreateNode(resolveNodeRS, rndFind.m_wsCondition); if (!bNextCreate && (dwStyles & XFA_RESOLVENODE_CreateNode)) { resolveNodeRS.dwFlags = XFA_RESOVENODE_RSTYPE_ExistNodes; } return resolveNodeRS.nodes.GetSize(); } return nNodes; }