7#include "xfa/fxfa/parser/cxfa_document.h"
12#include "core/fxcrt/check.h"
13#include "core/fxcrt/check_op.h"
14#include "core/fxcrt/fx_extension.h"
15#include "core/fxcrt/notreached.h"
16#include "core/fxcrt/stl_util.h"
17#include "core/fxcrt/xml/cfx_xmldocument.h"
18#include "core/fxcrt/xml/cfx_xmlelement.h"
19#include "fxjs/gc/container_trace.h"
20#include "fxjs/xfa/cfxjse_engine.h"
21#include "fxjs/xfa/cfxjse_resolveprocessor.h"
22#include "fxjs/xfa/cjx_object.h"
23#include "xfa/fxfa/cxfa_ffdoc.h"
24#include "xfa/fxfa/cxfa_ffnotify.h"
25#include "xfa/fxfa/parser/cscript_datawindow.h"
26#include "xfa/fxfa/parser/cscript_eventpseudomodel.h"
27#include "xfa/fxfa/parser/cscript_hostpseudomodel.h"
28#include "xfa/fxfa/parser/cscript_layoutpseudomodel.h"
29#include "xfa/fxfa/parser/cscript_logpseudomodel.h"
30#include "xfa/fxfa/parser/cscript_signaturepseudomodel.h"
31#include "xfa/fxfa/parser/cxfa_bind.h"
32#include "xfa/fxfa/parser/cxfa_datagroup.h"
33#include "xfa/fxfa/parser/cxfa_exdata.h"
34#include "xfa/fxfa/parser/cxfa_form.h"
35#include "xfa/fxfa/parser/cxfa_image.h"
36#include "xfa/fxfa/parser/cxfa_interactive.h"
37#include "xfa/fxfa/parser/cxfa_items.h"
38#include "xfa/fxfa/parser/cxfa_localemgr.h"
39#include "xfa/fxfa/parser/cxfa_node.h"
40#include "xfa/fxfa/parser/cxfa_occur.h"
41#include "xfa/fxfa/parser/cxfa_pageset.h"
42#include "xfa/fxfa/parser/cxfa_pdf.h"
43#include "xfa/fxfa/parser/cxfa_present.h"
44#include "xfa/fxfa/parser/cxfa_subform.h"
45#include "xfa/fxfa/parser/cxfa_template.h"
46#include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h"
47#include "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h"
48#include "xfa/fxfa/parser/cxfa_value.h"
49#include "xfa/fxfa/parser/xfa_document_datamerger_imp.h"
50#include "xfa/fxfa/parser/xfa_utils.h"
54const wchar_t kTemplateNS[] = L"http://www.xfa.org/schema/xfa-template/";
57 cppgc::Persistent<CXFA_Node> pTemplateChild;
58 cppgc::Persistent<CXFA_Node> pDataChild;
61class CXFA_TraverseStrategy_DDGroup {
70 return pDDGroupNode->GetParent();
74void FormValueNode_MatchNoneCreateChild(
CXFA_Node* pFormNode) {
75 DCHECK(pFormNode->IsWidgetReady());
81 CXFA_Node* pChildNode = pValueNode->GetFirstChild();
87 pValueNode->JSObject()->GetOrCreateProperty<
CXFA_Node>(0, iType);
92void FormValueNode_SetChildContent(
CXFA_Node* pValueNode,
99 CXFA_Node* pChildNode = FormValueNode_CreateChild(pValueNode, iType);
105 CXFA_Node* pContentRawDataNode = pChildNode->GetFirstChild();
106 if (!pContentRawDataNode) {
110 pChildNode->JSObject()->TryAttribute(XFA_Attribute::ContentType,
112 if (contentType.has_value()) {
113 if (contentType.value().EqualsASCII(
"text/html"))
115 else if (contentType.value().EqualsASCII(
"text/xml"))
122 pContentRawDataNode->JSObject()->SetCData(
XFA_Attribute::Value,
129 pChildNode->JSObject()->SetCData(
XFA_Attribute::Value, wsContent);
139 for (
CXFA_Node* pFormChild = pDestNodeParent->GetFirstChild(); pFormChild;
140 pFormChild = pFormChild->GetNextSibling()) {
145 pExistingNode = pFormChild;
152 for (
CXFA_Node* pTemplateChild = pProtoNode->GetFirstChild();
153 pTemplateChild; pTemplateChild = pTemplateChild->GetNextSibling()) {
154 MergeNodeRecurse(pExistingNode, pTemplateChild);
165 CXFA_NodeIterator sIterator(pDestNode);
166 for (
CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
167 pNode = sIterator.MoveToNext()) {
172 for (
CXFA_Node* pTemplateChild = pProtoNode->GetFirstChild(); pTemplateChild;
173 pTemplateChild = pTemplateChild->GetNextSibling()) {
174 MergeNodeRecurse(pDestNode, pTemplateChild);
177 CXFA_NodeIterator sIterator(pDestNode);
178 for (
CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
179 pNode = sIterator.MoveToNext()) {
185CXFA_Node* CloneOrMergeInstanceManager(CXFA_Document* pDocument,
188 std::vector<CXFA_Node*>* subforms) {
191 WideString wsInstMgrNodeName = L"_"
+ wsSubformName;
192 uint32_t dwInstNameHash = FX_HashCode_GetW(wsInstMgrNodeName.AsStringView());
197 for (
CXFA_Node* pNode = pExistingNode->GetNextSibling(); pNode;) {
204 pNode = pNode->GetNextSibling();
210 CXFA_Node* pNextNode = pNode->GetNextSibling();
212 subforms->push_back(pNode);
219 return pExistingNode;
225 L"_" + pTemplateNode->JSObject()->GetCData(
XFA_Attribute::Name);
226 pNewNode->JSObject()->SetCData(
XFA_Attribute::Name, wsInstMgrNodeName);
232void SortRecurseRecord(std::vector<RecurseRecord>* rgRecords,
235 std::vector<RecurseRecord> rgResultRecord;
236 for (
CXFA_Node* pNode = pDataScope->GetFirstChild(); pNode;
237 pNode = pNode->GetNextSibling()) {
238 auto it =
std::find_if(rgRecords->begin(), rgRecords->end(),
239 [pNode](
const RecurseRecord& record) {
240 return pNode == record.pDataChild;
242 if (it != rgRecords->end()) {
243 rgResultRecord.push_back(*it);
244 rgRecords->erase(it);
249 if (rgResultRecord.empty())
253 rgResultRecord.insert(rgResultRecord.end(), rgRecords->begin(),
256 *rgRecords = rgResultRecord;
263 for (
CXFA_Node *pCurDataScope = pDataScope, *pLastDataScope =
nullptr;
266 pLastDataScope = pCurDataScope,
267 pCurDataScope = pCurDataScope->GetParent()) {
271 if (pDataChild == pLastDataScope ||
280 for (CXFA_DataGroup* pDataChild =
281 pCurDataScope->GetFirstChildByClass<CXFA_DataGroup>(
284 pDataChild = pDataChild->GetNextSameClassSibling<CXFA_DataGroup>(
286 CXFA_Node* pDataNode = ScopeMatchGlobalBinding(pDataChild, dwNameHash,
287 eMatchDataNodeType,
false);
297CXFA_Node* FindGlobalDataNode(CXFA_Document* pDocument,
301 if (wsName.IsEmpty())
304 uint32_t dwNameHash = FX_HashCode_GetW(wsName.AsStringView());
308 ScopeMatchGlobalBinding(pDataScope, dwNameHash, eMatchNodeType,
true);
318 if (wsName.IsEmpty())
321 uint32_t dwNameHash = FX_HashCode_GetW(wsName.AsStringView());
323 for (
CXFA_Node* pCurDataScope = pDataScope;
326 pCurDataScope = pCurDataScope->GetParent()) {
337 pLastDataScope = pCurDataScope;
342CXFA_Node* FindDataRefDataNode(CXFA_Document* pDocument,
350 XFA_ResolveFlag::kBindNew};
356 pDocument->GetScriptContext()->ResolveObjectsWithBindNode(
357 pDataScope, wsRef.AsStringView(), dwFlags, pTemplateNode);
358 if (!maybeResult.has_value())
361 if (maybeResult.value().type ==
363 maybeResult.value().type ==
365 maybeResult.value().objects.size() > 1) {
366 return pDocument->GetNotBindNode(maybeResult.value().objects);
369 if (maybeResult.value().type ==
371 CXFA_Object* pObject = !maybeResult.value().objects.empty()
372 ? maybeResult.value().objects.front().Get()
375 return (bForceBind || !pNode || !pNode
->HasBindItem()) ? pNode :
nullptr;
381 CXFA_Document* pDocument,
384 bool& bAccessedDataDOM,
386 CXFA_NodeIteratorTemplate<CXFA_Node,
387 CXFA_TraverseStrategy_XFAContainerNode>*
393 CXFA_Node* pCurTemplateNode = pIterator->GetCurrent();
394 while (pCurTemplateNode) {
409 pCurTemplateNode = pIterator->MoveToNext();
413 CXFA_Occur* pTemplateNodeOccur =
414 pCurTemplateNode->GetFirstChildByClass<CXFA_Occur>(
XFA_Element::Occur);
415 if (pTemplateNodeOccur) {
418 pCurTemplateNode = pIterator->MoveToNext();
423 CXFA_Bind* pTemplateNodeBind =
424 pCurTemplateNode->GetFirstChildByClass<CXFA_Bind>(
XFA_Element::Bind);
427 ? pTemplateNodeBind->JSObject()->GetEnum(
XFA_Attribute::Match)
432 pCurTemplateNode = pIterator->MoveToNext();
435 bAccessedDataDOM =
true;
437 pCurTemplateNode = pIterator->MoveToNext();
442 XFA_FieldIsMultiListBox(pTemplateNodeBind))) {
443 CXFA_Node* pGlobalBindNode = FindGlobalDataNode(
446 pDataScope, eMatchNodeType);
447 if (!pGlobalBindNode) {
448 pCurTemplateNode = pIterator->MoveToNext();
451 pResult = pGlobalBindNode;
456 bAccessedDataDOM =
true;
457 CXFA_Node* pOnceBindNode = FindOnceDataNode(
459 pDataScope, eMatchNodeType);
460 if (!pOnceBindNode) {
461 pCurTemplateNode = pIterator->MoveToNext();
464 pResult = pOnceBindNode;
468 bAccessedDataDOM =
true;
469 CXFA_Node* pDataRefBindNode = FindDataRefDataNode(
472 pDataScope, eMatchNodeType, pTemplateNode, bForceBind, bUpLevel);
473 if (pDataRefBindNode &&
475 pResult = pDataRefBindNode;
478 pCurTemplateNode = pIterator->SkipChildrenAndMoveToNext();
486 if (pCurTemplateNode == pTemplateNode && pResult)
493void CreateDataBinding(
CXFA_Node* pFormNode,
502 DCHECK(pFormNode->IsWidgetReady());
503 auto* defValue = pFormNode->JSObject()->GetOrCreateProperty<CXFA_Value>(
509 CXFA_Image* image = defValue ? defValue->GetImageIfExists() :
nullptr;
517 CFX_XMLElement* pXMLDataElement =
520 pDataNode->JSObject()->SetAttributeValue(
524 if (!wsHref.IsEmpty())
530 wsValue = defValue ? defValue->GetChildValueContent() :
WideString();
532 std::vector<WideString> wsSelTextArray =
533 pFormNode->GetSelectedItemsValue();
534 if (!wsSelTextArray.empty()) {
535 for (
const auto& text : wsSelTextArray) {
537 pDataNode->CreateSamePacketNode(XFA_Element::DataValue);
538 pValue->JSObject()->SetCData(XFA_Attribute::Name, L"value");
539 pValue->CreateXMLMappingNode();
540 pDataNode->InsertChildAndNotify(pValue,
nullptr);
541 pValue->JSObject()->SetCData(XFA_Attribute::Value, text);
544 CFX_XMLElement* pElement =
548 }
else if (!wsValue.IsEmpty()) {
549 pDataNode->JSObject()->SetAttributeValue(
554 wsValue = defValue ? defValue->GetChildValueContent() :
WideString();
555 if (wsValue.IsEmpty())
558 pDataNode->JSObject()->SetAttributeValue(
563 CXFA_Node* pChild = pFormNode->GetFirstChild();
564 for (; pChild; pChild = pChild->GetNextSibling()) {
569 pChild->GetChild<CXFA_Value>(0,
XFA_Element::Value,
false);
573 wsValue = pValue->GetChildValueContent();
574 if (wsValue.IsEmpty())
578 pChild->GetChild<CXFA_Items>(0,
XFA_Element::Items,
false);
582 CXFA_Node* pText = pItems->GetFirstChild();
586 WideString wsContent = pText->JSObject()->GetContent(
false);
587 if (wsContent
== wsValue) {
589 pDataNode->JSObject()->SetAttributeValue(wsValue, wsValue);
590 pFormNode->JSObject()->SetCData(
XFA_Attribute::Value, wsContent);
597 pChild = pFormNode->GetFirstChild();
598 for (; pChild; pChild = pChild->GetNextSibling()) {
599 if (pChild == pChecked)
605 pChild->JSObject()->GetOrCreateProperty<CXFA_Value>(
608 pChild->GetChild<CXFA_Items>(0,
XFA_Element::Items,
false);
609 CXFA_Node* pText = pItems ? pItems->GetFirstChild() :
nullptr;
611 pText = pText->GetNextSibling();
615 wsContent = pText->JSObject()->GetContent(
false);
617 FormValueNode_SetChildContent(pValue, wsContent,
XFA_Element::Text);
622 wsValue = defValue ? defValue->GetChildValueContent() :
WideString();
623 if (wsValue.IsEmpty())
627 pDataNode->JSObject()->SetAttributeValue(
630 pFormNode->JSObject()->GetOrCreateProperty<CXFA_Value>(
632 FormValueNode_SetChildContent(pValue, wsValue,
XFA_Element::Float);
636 wsValue = defValue ? defValue->GetChildValueContent() :
WideString();
637 if (wsValue.IsEmpty())
640 pDataNode->JSObject()->SetAttributeValue(
647 WideString wsXMLValue = pDataNode->JSObject()->GetContent(
false);
650 pDataNode->JSObject()->SetAttributeValue(wsNormalizeValue, wsXMLValue);
653 FormValueNode_SetChildContent(defValue, wsNormalizeValue,
655 CXFA_Image* image = defValue ? defValue->GetImageIfExists() :
nullptr;
657 CFX_XMLElement* pXMLDataElement =
661 if (!wsContentType.IsEmpty()) {
668 if (!wsHref.IsEmpty())
675 std::vector<CXFA_Node*> items = pDataNode->GetNodeListWithFilter(
677 if (!items.empty()) {
678 bool single = items.size() == 1;
679 wsNormalizeValue.clear();
681 for (CXFA_Node* pNode : items) {
682 WideString wsItem = pNode->JSObject()->GetContent(
false);
686 wsNormalizeValue += wsItem;
688 CXFA_ExData* exData =
689 defValue ? defValue->GetExDataIfExists() :
nullptr;
693 FormValueNode_SetChildContent(defValue, wsNormalizeValue,
696 FormValueNode_SetChildContent(defValue, wsNormalizeValue,
702 false, false, false);
706 FormValueNode_SetChildContent(defValue, wsNormalizeValue,
712 if (wsPicture.IsEmpty())
715 FormValueNode_SetChildContent(defValue, wsNormalizeValue,
720 FormValueNode_SetChildContent(defValue, wsNormalizeValue,
726CXFA_Node* MaybeCreateDataNode(CXFA_Document* pDocument,
734 if (!pParentDDNode) {
737 pDataNode->JSObject()->SetCData(
XFA_Attribute::Name, wsName);
744 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_DDGroup> sIterator(
746 for (
CXFA_Node* pDDGroupNode = sIterator.GetCurrent(); pDDGroupNode;
747 pDDGroupNode = sIterator.MoveToNext()) {
748 if (pDDGroupNode != pParentDDNode) {
752 std::optional<
WideString> ns = pDDGroupNode->JSObject()->TryNamespace();
753 if (!ns.has_value() ||
754 !ns.value().EqualsASCII(
"http://ns.adobe.com/data-description/")) {
760 pDDGroupNode->GetFirstChildByName(wsName.AsStringView());
768 pDataNode->JSObject()->SetCData(
XFA_Attribute::Name, wsName);
784CXFA_Node* CopyContainer_Field(CXFA_Document* pDocument,
790 CXFA_Node* pFieldNode = XFA_NodeMerge_CloneOrMergeContainer(
791 pDocument, pFormNode, pTemplateNode,
false,
nullptr);
793 for (
CXFA_Node* pTemplateChildNode = pTemplateNode->GetFirstChild();
795 pTemplateChildNode = pTemplateChildNode->GetNextSibling()) {
798 pTemplateChildNode
, true, nullptr);
802 CopyContainer_Field(pDocument, pTemplateChildNode, pFieldNode,
nullptr,
808 bool bAccessedDataDOM =
false;
809 bool bSelfMatch =
false;
811 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFAContainerNode>
812 sNodeIter(pTemplateNode);
813 CXFA_Node* pDataNode = FindMatchingDataNode(
814 pDocument, pTemplateNode, pDataScope, bAccessedDataDOM,
true,
815 &sNodeIter, bSelfMatch, eBindMatch, bUpLevel);
817 CreateDataBinding(pFieldNode, pDataNode,
true);
819 FormValueNode_MatchNoneCreateChild(pFieldNode);
824CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
833 bool bUseInstanceManager =
836 std::vector<CXFA_Node*> subformArray;
837 std::vector<CXFA_Node*>* pSearchArray =
nullptr;
840 pInstMgrNode = bUseInstanceManager ? CloneOrMergeInstanceManager(
841 pDocument, pFormParentNode,
842 pTemplateNode, &subformArray)
844 if (CXFA_Occur* pOccurTemplateNode =
845 pTemplateNode->GetFirstChildByClass<CXFA_Occur>(
847 pOccurNode = pInstMgrNode ? XFA_NodeMerge_CloneOrMergeContainer(
848 pDocument, pInstMgrNode,
849 pOccurTemplateNode,
false,
nullptr)
850 : pOccurTemplateNode;
851 }
else if (pInstMgrNode) {
853 pInstMgrNode->GetFirstChildByClass<CXFA_Occur>(
XFA_Element::Occur);
859 pSearchArray = &subformArray;
862 if (subformArray.empty())
863 pSearchArray =
nullptr;
864 }
else if (pTemplateNode
->GetNameHash() == 0 && subformArray.empty()) {
865 pSearchArray =
nullptr;
873 if (!bOneInstance && pOccurNode) {
874 std::tie(iMin, iMax, iInit) =
880 ? pTemplateNode->JSObject()->GetEnum(
XFA_Attribute::Relation)
882 int32_t iCurRepeatIndex = 0;
885 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFAContainerNode>
886 sNodeIterator(pTemplateNode);
887 bool bAccessedDataDOM =
false;
889 sNodeIterator.MoveToNext();
891 std::map<CXFA_Node*, CXFA_Node*> subformMapArray;
892 std::vector<CXFA_Node*> nodeArray;
893 for (; iMax < 0 || iCurRepeatIndex < iMax; iCurRepeatIndex++) {
894 bool bSelfMatch =
false;
896 CXFA_Node* pDataNode = FindMatchingDataNode(
897 pDocument, pTemplateNode, pDataScope, bAccessedDataDOM,
false,
898 &sNodeIterator, bSelfMatch, eBindMatch,
true);
899 if (!pDataNode || sNodeIterator.GetCurrent() != pTemplateNode)
902 eParentBindMatch = eBindMatch;
903 CXFA_Node* pSubformNode = XFA_NodeMerge_CloneOrMergeContainer(
904 pDocument, pFormParentNode, pTemplateNode,
false, pSearchArray);
906 pFirstInstance = pSubformNode;
908 CreateDataBinding(pSubformNode, pDataNode,
true);
910 subformMapArray[pSubformNode] = pDataNode;
911 nodeArray.push_back(pSubformNode);
914 for (CXFA_Node* pSubform : nodeArray) {
915 CXFA_Node* pDataNode =
nullptr;
916 auto it = subformMapArray.find(pSubform);
917 if (it != subformMapArray.end())
918 pDataNode = it->second;
919 for (CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
921 pTemplateChild = pTemplateChild->GetNextSibling()) {
922 if (XFA_DataMerge_NeedGenerateForm(pTemplateChild,
923 bUseInstanceManager)) {
924 XFA_NodeMerge_CloneOrMergeContainer(pDocument, pSubform,
925 pTemplateChild,
true,
nullptr);
926 }
else if (pTemplateChild->IsContainerNode()) {
927 pDocument->DataMerge_CopyContainer(pTemplateChild, pSubform,
928 pDataNode,
false,
true,
false);
932 subformMapArray.clear();
935 for (; iMax < 0 || iCurRepeatIndex < iMax; iCurRepeatIndex++) {
936 bool bSelfMatch =
false;
938 if (!FindMatchingDataNode(pDocument, pTemplateNode, pDataScope,
939 bAccessedDataDOM,
false, &sNodeIterator,
940 bSelfMatch, eBindMatch,
true)) {
950 CXFA_Node* pSubformSetNode = XFA_NodeMerge_CloneOrMergeContainer(
951 pDocument, pFormParentNode, pTemplateNode,
false, pSearchArray);
954 pFirstInstance = pSubformSetNode;
956 std::vector<RecurseRecord> rgItemMatchList;
957 std::vector<CXFA_Node*> rgItemUnmatchList;
958 for (
CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
960 pTemplateChild = pTemplateChild->GetNextSibling()) {
962 bUseInstanceManager
)) {
964 pTemplateChild
, true, nullptr);
969 CXFA_NodeIteratorTemplate<CXFA_Node,
970 CXFA_TraverseStrategy_XFAContainerNode>
971 sChildIter(pTemplateChild);
972 CXFA_Node* pDataMatch = FindMatchingDataNode(
973 pDocument, pTemplateChild, pDataScope, bAccessedDataDOM,
974 false, &sChildIter, bSelfMatch, eBindMatch,
true);
976 RecurseRecord sNewRecord = {pTemplateChild, pDataMatch};
978 rgItemMatchList.insert(rgItemMatchList.begin(), sNewRecord);
980 rgItemMatchList.push_back(sNewRecord);
982 rgItemUnmatchList.push_back(pTemplateChild);
985 rgItemUnmatchList.push_back(pTemplateChild);
992 DCHECK(!rgItemMatchList.empty());
993 SortRecurseRecord(&rgItemMatchList, pDataScope,
true);
995 rgItemMatchList.front().pTemplateChild
, pSubformSetNode
,
996 pDataScope
, false, true, true);
1000 if (!rgItemMatchList.empty()) {
1001 SortRecurseRecord(&rgItemMatchList, pDataScope,
false);
1002 for (
const auto& matched : rgItemMatchList) {
1003 pDocument->DataMerge_CopyContainer(matched.pTemplateChild,
1004 pSubformSetNode, pDataScope,
1008 for (
auto* unmatched : rgItemUnmatchList) {
1009 pDocument->DataMerge_CopyContainer(unmatched, pSubformSetNode,
1010 pDataScope,
false,
true,
true);
1018 CXFA_Node* pSubformSetNode = XFA_NodeMerge_CloneOrMergeContainer(
1019 pDocument, pFormParentNode, pTemplateNode,
false, pSearchArray);
1021 if (!pFirstInstance)
1022 pFirstInstance = pSubformSetNode;
1024 for (
CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
1026 pTemplateChild = pTemplateChild->GetNextSibling()) {
1028 bUseInstanceManager
)) {
1030 pTemplateChild
, true, nullptr);
1033 pDataScope
, false, true, true);
1039 if (iCurRepeatIndex == 0 && !bAccessedDataDOM) {
1040 int32_t iLimit = iMax;
1042 iLimit =
fxcrt::CollectionSize<int32_t>(subformArray);
1047 for (; (iLimit < 0 || iCurRepeatIndex < iLimit); iCurRepeatIndex++) {
1049 if (pSearchArray && pSearchArray->empty()) {
1052 pSearchArray =
nullptr;
1054 }
else if (!XFA_DataMerge_FindFormDOMInstance(
1059 CXFA_Node* pSubformNode = XFA_NodeMerge_CloneOrMergeContainer(
1060 pDocument, pFormParentNode, pTemplateNode,
false, pSearchArray);
1062 if (!pFirstInstance)
1063 pFirstInstance = pSubformNode;
1065 for (
CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
1067 pTemplateChild = pTemplateChild->GetNextSibling()) {
1069 bUseInstanceManager
)) {
1071 pTemplateChild
, true, nullptr);
1074 pDataScope
, false, true, true);
1081 int32_t iMinimalLimit = iCurRepeatIndex == 0 ? iInit : iMin;
1082 for (; iCurRepeatIndex < iMinimalLimit; iCurRepeatIndex++) {
1083 CXFA_Node* pSubformSetNode = XFA_NodeMerge_CloneOrMergeContainer(
1084 pDocument, pFormParentNode, pTemplateNode,
false, pSearchArray);
1086 if (!pFirstInstance)
1087 pFirstInstance = pSubformSetNode;
1089 bool bFound =
false;
1090 for (
CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
1091 pTemplateChild; pTemplateChild = pTemplateChild->GetNextSibling()) {
1094 pTemplateChild
, true, nullptr);
1100 pDataScope
, false, bDataMerge
, true);
1105 return pFirstInstance;
1108void UpdateBindingRelations(CXFA_Document* pDocument,
1112 bool bParentDataRef) {
1113 bool bMatchRef =
true;
1119 CXFA_Bind* pTemplateNodeBind =
1121 ? pTemplateNode->GetFirstChildByClass<CXFA_Bind>(
XFA_Element::Bind)
1125 ? pTemplateNodeBind->JSObject()->GetEnum(
XFA_Attribute::Match)
1129 if (!bDataRef || bParentDataRef)
1130 FormValueNode_MatchNoneCreateChild(pFormNode);
1133 if (!bDataRef || bParentDataRef) {
1142 pDataNode = MaybeCreateDataNode(
1143 pDocument, pDataScope, eDataNodeType,
1147 CreateDataBinding(pFormNode, pDataNode,
false);
1150 FormValueNode_MatchNoneCreateChild(pFormNode);
1153 CXFA_Node* pDataParent = pDataNode->GetParent();
1154 if (pDataParent != pDataScope) {
1163 if (!bDataRef || bParentDataRef) {
1165 if (dwNameHash != 0 && !pDataNode) {
1174 pDataNode = MaybeCreateDataNode(
1175 pDocument, pRecordNode, eDataNodeType,
1179 CreateDataBinding(pFormNode, pDataNode,
false);
1184 CreateDataBinding(pFormNode, pDataNode,
true);
1188 FormValueNode_MatchNoneCreateChild(pFormNode);
1192 bMatchRef = bDataRef;
1193 bParentDataRef =
true;
1194 if (!pDataNode && bDataRef) {
1197 ? pTemplateNodeBind->JSObject()->GetCData(
XFA_Attribute::Ref)
1200 XFA_ResolveFlag::kCreateNode};
1202 pDocument->GetScriptContext()->ResolveObjectsWithBindNode(
1203 pDataScope, wsRef.AsStringView(), kFlags, pTemplateNode);
1205 maybeResult.has_value() && !maybeResult.value().objects.empty()
1206 ? maybeResult.value().objects.front().Get()
1211 pFormNode, pDataNode,
1212 maybeResult.value().type ==
1215 FormValueNode_MatchNoneCreateChild(pFormNode);
1229 for (
CXFA_Node* pFormChild = pFormNode->GetFirstChild(); pFormChild;
1230 pFormChild = pFormChild->GetNextSibling()) {
1236 UpdateBindingRelations(pDocument, pFormChild,
1237 pDataNode ? pDataNode : pDataScope, bDataRef,
1244 DCHECK(pDataDescriptionNode);
1245 for (
CXFA_Node* pDataChild = pDataNode->GetFirstChild(); pDataChild;
1246 pDataChild = pDataChild->GetNextSibling()) {
1251 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_DDGroup>
1252 sIterator(pDataDescriptionNode);
1253 for (
CXFA_Node* pDDGroupNode = sIterator.GetCurrent(); pDDGroupNode;
1254 pDDGroupNode = sIterator.MoveToNext()) {
1255 if (pDDGroupNode != pDataDescriptionNode) {
1259 std::optional<
WideString> ns = pDDGroupNode->JSObject()->TryNamespace();
1260 if (!ns.has_value() ||
1261 !ns.value().EqualsASCII(
"http://ns.adobe.com/data-description/")) {
1273 UpdateDataRelation(pDataChild, pDDNode);
1286 node_owner_(cppgc::MakeGarbageCollected<CXFA_NodeOwner>(
1287 heap->GetAllocationHandle())),
1288 m_pLayoutProcessor(pLayout) {
1289 if (m_pLayoutProcessor)
1290 m_pLayoutProcessor->SetDocument(
this);
1295void CXFA_Document::Trace(
cppgc::Visitor* visitor)
const {
1296 visitor->Trace(notify_);
1297 visitor->Trace(node_owner_);
1298 visitor->Trace(m_pRootNode);
1299 visitor->Trace(m_pLocaleMgr);
1300 visitor->Trace(m_pLayoutProcessor);
1301 visitor->Trace(m_pScriptDataWindow);
1302 visitor->Trace(m_pScriptEvent);
1303 visitor->Trace(m_pScriptHost);
1304 visitor->Trace(m_pScriptLog);
1305 visitor->Trace(m_pScriptLayout);
1306 visitor->Trace(m_pScriptSignature);
1307 ContainerTrace(visitor, m_rgGlobalBinding);
1308 ContainerTrace(visitor, m_pPendingPageSet);
1312 m_pLayoutProcessor =
nullptr;
1313 m_pScriptContext.reset();
1314 m_pLocaleMgr.Clear();
1315 m_pScriptDataWindow =
nullptr;
1316 m_pScriptEvent =
nullptr;
1317 m_pScriptHost =
nullptr;
1318 m_pScriptLog =
nullptr;
1319 m_pScriptLayout =
nullptr;
1320 m_pScriptSignature =
nullptr;
1324 switch (dwNodeNameHash) {
1330 for (CXFA_DataGroup* pDatasetsChild =
1331 pDatasetsNode->GetFirstChildByClass<CXFA_DataGroup>(
1335 pDatasetsChild->GetNextSameClassSibling<CXFA_DataGroup>(
1341 pDatasetsChild->JSObject()->TryNamespace();
1342 if (!namespaceURI.has_value())
1346 pDatasetsNode->JSObject()->TryNamespace();
1347 if (!datasetsURI.has_value())
1349 if (namespaceURI.value() == datasetsURI.value())
1350 return pDatasetsChild;
1356 return pData ? pData->GetFirstChildByClass<CXFA_DataGroup>(
1361 if (!m_pScriptDataWindow)
1362 m_pScriptDataWindow = cppgc::MakeGarbageCollected<CScript_DataWindow>(
1363 GetHeap()->GetAllocationHandle(),
this);
1364 return m_pScriptDataWindow;
1367 if (!m_pScriptEvent)
1368 m_pScriptEvent = cppgc::MakeGarbageCollected<CScript_EventPseudoModel>(
1369 GetHeap()->GetAllocationHandle(),
this);
1370 return m_pScriptEvent;
1374 m_pScriptHost = cppgc::MakeGarbageCollected<CScript_HostPseudoModel>(
1375 GetHeap()->GetAllocationHandle(),
this);
1376 return m_pScriptHost;
1380 m_pScriptLog = cppgc::MakeGarbageCollected<CScript_LogPseudoModel>(
1381 GetHeap()->GetAllocationHandle(),
this);
1382 return m_pScriptLog;
1385 if (!m_pScriptSignature)
1386 m_pScriptSignature =
1387 cppgc::MakeGarbageCollected<CScript_SignaturePseudoModel>(
1388 GetHeap()->GetAllocationHandle(),
this);
1389 return m_pScriptSignature;
1392 if (!m_pScriptLayout)
1394 cppgc::MakeGarbageCollected<CScript_LayoutPseudoModel>(
1395 GetHeap()->GetAllocationHandle(),
this);
1396 return m_pScriptLayout;
1399 return m_pRootNode->GetFirstChildByName(dwNodeNameHash);
1412 if (m_Interactive.has_value())
1413 return m_Interactive.value();
1419 CXFA_Present* pPresent =
1420 pConfig->GetFirstChildByClass<CXFA_Present>(
XFA_Element::Present);
1424 CXFA_Pdf* pPDF = pPresent->GetFirstChildByClass<CXFA_Pdf>(
XFA_Element::Pdf);
1428 CXFA_Interactive* pFormFiller =
1429 pPDF->GetChild<CXFA_Interactive>(0,
XFA_Element::Interactive,
false);
1433 WideString wsInteractive = pFormFiller->JSObject()->GetContent(
false);
1435 m_Interactive = bInteractive;
1436 return bInteractive;
1440 if (!m_pLocaleMgr) {
1441 m_pLocaleMgr = cppgc::MakeGarbageCollected<CXFA_LocaleMgr>(
1442 heap_->GetAllocationHandle(), heap_,
1443 ToNode(GetXFAObject(XFA_HASHCODE_LocaleSet)),
1444 GetNotify()->GetAppProvider()->GetLanguage());
1446 return m_pLocaleMgr;
1454 DCHECK(!m_pScriptContext);
1455 m_pScriptContext = std::make_unique<CFXJSE_Engine>(
this, fxjs_runtime);
1456 return m_pScriptContext.get();
1460 DCHECK(m_pScriptContext);
1461 return m_pScriptContext.get();
1466 XFA_VERSION eVersion = ParseXFAVersion(wsTemplateNS);
1468 m_eCurVersionMode = eVersion;
1476 if (wsTemplateNS.GetLength() <= wsTemplateURIPrefix.GetLength())
1479 size_t prefixLength = wsTemplateURIPrefix.GetLength();
1480 if (wsTemplateNS.AsStringView().First(prefixLength) != wsTemplateURIPrefix)
1483 auto nDotPos = wsTemplateNS.Find(
'.', prefixLength);
1484 if (!nDotPos.has_value())
1487 int8_t iMajor = FXSYS_wtoi(
1488 wsTemplateNS.Substr(prefixLength, nDotPos.value() - prefixLength)
1490 int8_t iMinor = FXSYS_wtoi(wsTemplateNS.Substr(nDotPos.value() + 1).c_str());
1492 static_cast<
XFA_VERSION>(
static_cast<int32_t>(iMajor) * 100 + iMinor);
1505 if (!pRoot || wsID.IsEmpty())
1508 CXFA_NodeIterator sIterator(pRoot);
1509 for (
CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
1510 pNode = sIterator.MoveToNext()) {
1512 if (!wsIDVal.IsEmpty() && wsIDVal == wsID)
1523 std::map<uint32_t, CXFA_Node*> mIDMap;
1524 std::set<CXFA_Node*> sUseNodes;
1525 CXFA_NodeIterator sIterator(pTemplateRoot);
1526 for (
CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
1527 pNode = sIterator.MoveToNext()) {
1529 if (!wsIDVal.IsEmpty())
1530 mIDMap[FX_HashCode_GetW(wsIDVal.AsStringView())] = pNode;
1533 if (!wsUseVal.IsEmpty()) {
1534 sUseNodes.insert(pNode);
1536 wsUseVal = pNode->JSObject()->GetCData(
XFA_Attribute::Usehref);
1537 if (!wsUseVal.IsEmpty())
1538 sUseNodes.insert(pNode);
1542 for (CXFA_Node* pUseHrefNode : sUseNodes) {
1544 WideString wsUseVal =
1545 pUseHrefNode->JSObject()->GetCData(XFA_Attribute::Usehref);
1546 WideStringView wsURI;
1547 WideStringView wsID;
1548 WideStringView wsSOM;
1549 if (!wsUseVal.IsEmpty()) {
1550 ParseUseHref(wsUseVal, wsURI, wsID, wsSOM);
1551 if (!wsURI.IsEmpty() && !wsURI.EqualsASCII(
"."))
1554 wsUseVal = pUseHrefNode->JSObject()->GetCData(XFA_Attribute::Use);
1555 ParseUse(wsUseVal, wsID, wsSOM);
1558 CXFA_Node* pProtoNode =
nullptr;
1559 if (!wsSOM.IsEmpty()) {
1560 std::optional<CFXJSE_Engine::ResolveResult> maybeResult =
1561 m_pScriptContext->ResolveObjects(
1562 pUseHrefNode, wsSOM,
1563 Mask<XFA_ResolveFlag>{
1564 XFA_ResolveFlag::kChildren, XFA_ResolveFlag::kAttributes,
1565 XFA_ResolveFlag::kProperties, XFA_ResolveFlag::kParent,
1566 XFA_ResolveFlag::kSiblings});
1567 if (maybeResult.has_value()) {
1568 auto* pFirstObject = maybeResult.value().objects.front().Get();
1569 if (pFirstObject && pFirstObject->IsNode())
1570 pProtoNode = pFirstObject->AsNode();
1572 }
else if (!wsID.IsEmpty()) {
1573 auto it = mIDMap.find(FX_HashCode_GetW(wsID));
1574 if (it == mIDMap.end())
1576 pProtoNode = it->second;
1581 MergeNode(pUseHrefNode, pProtoNode);
1586void CXFA_Document::ParseUseHref(
const WideString& wsUseVal,
1590 if (wsUseVal.IsEmpty())
1593 auto uSharpPos = wsUseVal.Find(
'#');
1594 if (!uSharpPos.has_value()) {
1595 wsURI = wsUseVal.AsStringView();
1598 wsURI = wsUseVal.AsStringView().First(uSharpPos.value());
1599 if (wsUseVal.AsStringView().Substr(uSharpPos.value(), 5) == L"#som(" &&
1600 wsUseVal.Back() ==
')') {
1601 wsSOM = wsUseVal.AsStringView().Substr(
1602 uSharpPos.value() + 5,
1603 wsUseVal.GetLength() - 1 - uSharpPos.value() - 5);
1606 wsID = wsUseVal.AsStringView().Substr(uSharpPos.value() + 1);
1610void CXFA_Document::ParseUse(
const WideString& wsUseVal,
1613 if (wsUseVal.IsEmpty())
1616 if (wsUseVal[0] ==
'#') {
1617 wsID = wsUseVal.AsStringView().Substr(1);
1620 wsSOM = wsUseVal.AsStringView();
1629 DCHECK(pTemplateNode->IsContainerNode());
1635 return CopyContainer_SubformSet(
this, pTemplateNode, pFormNode,
1636 pDataScope, bOneInstance, bDataMerge);
1641 return CopyContainer_Field(
this, pTemplateNode, pFormNode, pDataScope,
1642 bDataMerge, bUpLevel);
1654 XFA_DataMerge_FindDataScope(pFormUpdateRoot->GetParent());
1658 UpdateBindingRelations(
this, pFormUpdateRoot, pDataScope,
false,
false);
1659 UpdateBindingRelations(
this, pFormUpdateRoot, pDataScope,
true,
false);
1664 for (
auto& pObject : arrayObjects) {
1665 CXFA_Node* pNode = pObject->AsNode();
1666 if (pNode && !pNode->HasBindItem())
1674 if (!pDatasetsRoot) {
1676 auto* pDatasetsXMLNode =
1677 notify_->GetFFDoc()->GetXMLDocument()->CreateNode<CFX_XMLElement>(
1679 pDatasetsXMLNode->SetAttribute(L"xmlns:xfa",
1680 L"http://www.xfa.org/schema/xfa-data/1.0/");
1683 pDatasetsRoot->JSObject()->SetCData(
XFA_Attribute::Name, L"datasets");
1685 m_pRootNode->GetXMLMappingNode()->AppendLastChild(pDatasetsXMLNode);
1686 m_pRootNode->InsertChildAndNotify(pDatasetsRoot,
nullptr);
1693 pDatasetsRoot->JSObject()->TryNamespace().value_or(
WideString());
1694 for (
CXFA_Node* pChildNode = pDatasetsRoot->GetFirstChild(); pChildNode;
1695 pChildNode = pChildNode->GetNextSibling()) {
1701 pChildNode->JSObject()->TryNamespace();
1702 if (!namespaceURI.has_value())
1704 if (namespaceURI.value().EqualsASCII(
1705 "http://ns.adobe.com/data-description/")) {
1706 pDDRoot = pChildNode;
1710 pChildNode->JSObject()->TryNamespace();
1711 if (!namespaceURI.has_value())
1713 if (namespaceURI == wsDatasetsURI)
1714 pDataRoot = pChildNode;
1716 if (pDataRoot && pDDRoot)
1722 pDataRoot->JSObject()->SetCData(
XFA_Attribute::Name, L"data");
1725 notify_->GetFFDoc()->GetXMLDocument()->CreateNode<CFX_XMLElement>(
1731 CXFA_DataGroup* pDataTopLevel =
1732 pDataRoot->GetFirstChildByClass<CXFA_DataGroup>(
XFA_Element::DataGroup);
1733 uint32_t dwNameHash = pDataTopLevel ? pDataTopLevel
->GetNameHash() : 0;
1734 CXFA_Template* pTemplateRoot =
1735 m_pRootNode->GetFirstChildByClass<CXFA_Template>(XFA_Element::Template);
1740 dwNameHash != 0 ? pTemplateRoot->GetFirstChildByName(dwNameHash)
1742 if (!pTemplateChosen ||
1745 pTemplateRoot->GetFirstChildByClass<CXFA_Subform>(
XFA_Element::Subform);
1747 if (!pTemplateChosen)
1750 CXFA_Form* pFormRoot =
1751 m_pRootNode->GetFirstChildByClass<CXFA_Form>(XFA_Element::Form);
1752 bool bEmptyForm =
false;
1755 pFormRoot =
static_cast<CXFA_Form*>(
1758 pFormRoot->JSObject()->SetCData(
XFA_Attribute::Name, L"form");
1759 m_pRootNode->InsertChildAndNotify(pFormRoot,
nullptr);
1761 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode>
1762 sIterator(pFormRoot);
1763 for (
CXFA_Node* pNode = sIterator.MoveToNext(); pNode;
1764 pNode = sIterator.MoveToNext()) {
1769 CXFA_Node* pSubformSetNode = XFA_NodeMerge_CloneOrMergeContainer(
1770 this, pFormRoot, pTemplateChosen,
false,
nullptr);
1772 if (!pDataTopLevel) {
1775 WideString wsDataTopLevelName(wsFormName.IsEmpty() ? L"form" : wsFormName);
1777 pDataTopLevel =
static_cast<CXFA_DataGroup*>(
1780 wsDataTopLevelName);
1783 notify_->GetFFDoc()->GetXMLDocument()->CreateNode<CFX_XMLElement>(
1784 wsDataTopLevelName);
1787 CXFA_Node* pBeforeNode = pDataRoot->GetFirstChild();
1788 pDataRoot->InsertChildAndNotify(pDataTopLevel, pBeforeNode);
1792 CreateDataBinding(pSubformSetNode, pDataTopLevel,
true);
1793 for (
CXFA_Node* pTemplateChild = pTemplateChosen->GetFirstChild();
1794 pTemplateChild; pTemplateChild = pTemplateChild->GetNextSibling()) {
1804 UpdateDataRelation(pDataRoot, pDDRoot);
1807 CXFA_PageSet* pPageSetNode =
1808 pSubformSetNode->GetFirstChildByClass<CXFA_PageSet>(
XFA_Element::PageSet);
1809 while (pPageSetNode) {
1810 m_pPendingPageSet.push_back(pPageSetNode);
1811 CXFA_PageSet* pNextPageSetNode =
1812 pPageSetNode->GetNextSameClassSibling<CXFA_PageSet>(
1815 pPageSetNode = pNextPageSetNode;
1821 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator(
1823 CXFA_Node* pNode = sIterator.MoveToNext();
1828 CXFA_Node* pNext = sIterator.SkipChildrenAndMoveToNext();
1829 pNode->GetParent()->RemoveChildAndNotify(pNode,
true);
1834 pNode = sIterator.MoveToNext();
1838 pNode = sIterator.MoveToNext();
1846 while (
CXFA_Node* pNode = pFormRoot->GetFirstChild())
1851 m_rgGlobalBinding.clear();
1857 auto it = m_rgGlobalBinding.find(dwNameHash);
1858 return it != m_rgGlobalBinding.end() ? it->second :
nullptr;
1863 m_rgGlobalBinding[dwNameHash] = pDataNode;
1867 return m_pPendingPageSet.size();
1871 return m_pPendingPageSet[index];
1875 m_pPendingPageSet.push_back(node);
1879 m_pPendingPageSet.clear();
1883 for (CXFA_Node* pPageNode : m_pPendingPageSet) {
1884 CXFA_NodeIterator sIterator(pPageNode);
1885 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
1886 pNode = sIterator.MoveToNext()) {
1887 if (pNode->IsContainerNode()) {
1888 CXFA_Node* pBindNode = pNode->GetBindData();
1890 pBindNode->RemoveBindItem(pNode);
1891 pNode->SetBindingNode(
nullptr);
1894 pNode->SetFlag(XFA_NodeFlag::kUnusedNode);
1904 visitor->Trace(m_pDocument);
CFX_XMLElement * ToXMLElement(CFX_XMLNode *pNode)
friend class EventParamScope
WideString GetAttribute(const WideString &name) const
void SetAttribute(const WideString &name, const WideString &value)
virtual ~LayoutProcessorIface()
virtual void SetForceRelayout()=0
cppgc::Heap * GetHeap() const
CXFA_Node * GetNodeByID(CXFA_Node *pRoot, WideStringView wsID) const
CXFA_FFNotify * GetNotify() const
CFXJSE_Engine * InitScriptContext(CJS_Runtime *fxjs_runtime)
CXFA_Node * DataMerge_CopyContainer(CXFA_Node *pTemplateNode, CXFA_Node *pFormNode, CXFA_Node *pDataScope, bool bOneInstance, bool bDataMerge, bool bUpLevel)
CXFA_LocaleMgr * GetLocaleMgr()
XFA_VERSION RecognizeXFAVersionNumber(const WideString &wsTemplateNS)
void AppendPendingNode(CXFA_Node *node)
CXFA_Node * GetNotBindNode(pdfium::span< cppgc::Member< CXFA_Object > > arrayNodes) const
void DataMerge_UpdateBindingRelations(CXFA_Node *pFormUpdateRoot)
CXFA_Node * CreateNode(XFA_PacketType packet, XFA_Element eElement)
size_t GetPendingNodesCount() const
CFXJSE_Engine * GetScriptContext() const
CXFA_Object * GetXFAObject(XFA_HashCode wsNodeNameHash)
void SetPendingNodesUnusedAndUnbound()
void RegisterGlobalBinding(uint32_t dwNameHash, CXFA_Node *pDataNode)
CXFA_Node * GetPendingNodeAtIndex(size_t index) const
FormType GetFormType() const
CXFA_Node * GetGlobalBinding(uint32_t dwNameHash)
LayoutProcessorIface * GetLayoutProcessor() const
void SetContentType(const WideString &wsContentType)
FormType GetFormType() const
CXFA_FFDoc * GetFFDoc() const
void SetContentType(const WideString &wsContentType)
void SetHref(const WideString &wsHref)
WideString GetContentType()
CFX_XMLNode * GetXMLMappingNode() const
void RemoveChildAndNotify(CXFA_Node *pNode, bool bNotify)
WideString NormalizeNumStr(const WideString &wsValue)
CXFA_Node * GetFirstChildByName(uint32_t dwNodeNameHash) const
void SetTemplateNode(CXFA_Node *pTemplateNode)
CXFA_Node * Clone(bool bRecursive)
void InsertChildAndNotify(CXFA_Node *pNode, CXFA_Node *pBeforeNode)
void SetDataDescriptionNode(CXFA_Node *pDataDescriptionNode)
CXFA_Node * GetNextSameNameSibling(uint32_t dwNodeNameHash) const
static CXFA_Node * Create(CXFA_Document *doc, XFA_Element element, XFA_PacketType packet)
void SetSelectedMemberByValue(WideStringView wsValue, bool bNotify, bool bScriptModify, bool bSyncData)
void SetBindingNode(CXFA_Node *node)
void AddBindItem(CXFA_Node *pFormNode)
WideString GetFormatDataValue(const WideString &wsValue)
void SetFlag(XFA_NodeFlag dwFlag)
bool IsChoiceListMultiSelect()
CXFA_Node * CreateSamePacketNode(XFA_Element eType)
void ClearFlag(XFA_NodeFlag dwFlag)
CXFA_Node * GetTemplateNodeIfExists() const
WideString GetNormalizeDataValue(const WideString &wsValue)
CXFA_Node * GetDataDescriptionNode()
CXFA_Node * GetBindData()
uint32_t GetNameHash() const
CFX_XMLNode * CreateXMLMappingNode()
void SetXMLMappingNode(CFX_XMLNode *node)
WideString GetPictureContent(XFA_ValuePicture ePicture)
bool IsUnusedNode() const
CXFA_Node * GetUIChildNode()
XFA_PacketType GetPacketType() const
XFA_FFWidgetType GetFFWidgetType()
void SetInitializedFlagAndNotify()
XFA_Element GetElementType() const
XFA_ObjectType GetObjectType() const
bool IsContainerNode() const
std::tuple< int32_t, int32_t, int32_t > GetOccurInfo()
bool operator==(const WideString &other) const
WideString & operator=(WideString &&that) noexcept
bool EqualsASCII(ByteStringView that) const
CXFA_Node * ToNode(CXFA_Object *pObj)
@ XFA_HASHCODE_DataWindow
@ XFA_HASHCODE_DataDescription
WideString operator+(const wchar_t *str1, const WideString &str2)
#define NOTREACHED_NORETURN()
fxcrt::WideStringView WideStringView
fxcrt::WideString WideString
CXFA_Node * XFA_NodeMerge_CloneOrMergeContainer(CXFA_Document *pDocument, CXFA_Node *pFormParent, CXFA_Node *pTemplateNode, bool bRecursive, std::vector< CXFA_Node * > *pSubformArray)
CXFA_Node * XFA_DataMerge_FindFormDOMInstance(CXFA_Document *pDocument, XFA_Element eType, uint32_t dwNameHash, CXFA_Node *pFormParent)
bool XFA_DataMerge_NeedGenerateForm(CXFA_Node *pTemplateChild, bool bUseInstanceManager)
bool XFA_FieldIsMultiListBox(const CXFA_Node *pFieldNode)