7#include "xfa/fxfa/parser/cxfa_document.h"
12#include "core/fxcrt/fx_extension.h"
13#include "core/fxcrt/stl_util.h"
14#include "core/fxcrt/xml/cfx_xmldocument.h"
15#include "core/fxcrt/xml/cfx_xmlelement.h"
16#include "fxjs/gc/container_trace.h"
17#include "fxjs/xfa/cfxjse_engine.h"
18#include "fxjs/xfa/cfxjse_resolveprocessor.h"
19#include "fxjs/xfa/cjx_object.h"
20#include "third_party/base/check.h"
21#include "third_party/base/check_op.h"
22#include "third_party/base/notreached.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,
93 const WideString& wsContent,
99 CXFA_Node* pChildNode = FormValueNode_CreateChild(pValueNode, iType);
105 CXFA_Node* pContentRawDataNode = pChildNode->GetFirstChild();
106 if (!pContentRawDataNode) {
109 absl::optional<WideString> contentType =
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) {
189 WideString wsSubformName =
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,
298 const WideString& wsName,
304 uint32_t dwNameHash = FX_HashCode_GetW(wsName.AsStringView());
308 ScopeMatchGlobalBinding(pDataScope, dwNameHash, eMatchNodeType,
true);
315CXFA_Node* FindOnceDataNode(
const WideString& wsName,
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,
343 const WideString& wsRef,
350 XFA_ResolveFlag::kBindNew};
355 absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
356 pDocument->GetScriptContext()->ResolveObjectsWithBindNode(
357 pDataScope, wsRef.AsStringView(), dwFlags, pTemplateNode);
358 if (!maybeResult.has_value())
361 if (maybeResult.value().type ==
362 CFXJSE_Engine::ResolveResult::Type::kCreateNodeAll ||
363 maybeResult.value().type ==
364 CFXJSE_Engine::ResolveResult::Type::kCreateNodeMidAll ||
365 maybeResult.value().objects.size() > 1) {
366 return pDocument->GetNotBindNode(maybeResult.value().objects);
369 if (maybeResult.value().type ==
370 CFXJSE_Engine::ResolveResult::Type::kCreateNodeOne) {
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) {
421 pCurTemplateNode = pIterator->MoveToNext();
426 CXFA_Bind* pTemplateNodeBind =
427 pCurTemplateNode->GetFirstChildByClass<CXFA_Bind>(
XFA_Element::Bind);
430 ? pTemplateNodeBind->JSObject()->GetEnum(
XFA_Attribute::Match)
435 pCurTemplateNode = pIterator->MoveToNext();
438 bAccessedDataDOM =
true;
440 pCurTemplateNode = pIterator->MoveToNext();
445 XFA_FieldIsMultiListBox(pTemplateNodeBind))) {
446 CXFA_Node* pGlobalBindNode = FindGlobalDataNode(
449 pDataScope, eMatchNodeType);
450 if (!pGlobalBindNode) {
451 pCurTemplateNode = pIterator->MoveToNext();
454 pResult = pGlobalBindNode;
459 bAccessedDataDOM =
true;
460 CXFA_Node* pOnceBindNode = FindOnceDataNode(
462 pDataScope, eMatchNodeType);
463 if (!pOnceBindNode) {
464 pCurTemplateNode = pIterator->MoveToNext();
467 pResult = pOnceBindNode;
471 bAccessedDataDOM =
true;
472 CXFA_Node* pDataRefBindNode = FindDataRefDataNode(
475 pDataScope, eMatchNodeType, pTemplateNode, bForceBind, bUpLevel);
476 if (pDataRefBindNode &&
478 pResult = pDataRefBindNode;
481 pCurTemplateNode = pIterator->SkipChildrenAndMoveToNext();
489 if (pCurTemplateNode == pTemplateNode && pResult)
496void CreateDataBinding(
CXFA_Node* pFormNode,
505 DCHECK(pFormNode->IsWidgetReady());
506 auto* defValue = pFormNode->JSObject()->GetOrCreateProperty<CXFA_Value>(
512 CXFA_Image* image = defValue ? defValue->GetImageIfExists() :
nullptr;
513 WideString wsContentType;
520 CFX_XMLElement* pXMLDataElement =
522 DCHECK(pXMLDataElement);
523 pDataNode->JSObject()->SetAttributeValue(
533 wsValue = defValue ? defValue->GetChildValueContent() : WideString
();
535 std::vector<WideString> wsSelTextArray =
536 pFormNode->GetSelectedItemsValue();
537 if (!wsSelTextArray.empty()) {
538 for (
const auto& text : wsSelTextArray) {
540 pDataNode->CreateSamePacketNode(XFA_Element::DataValue);
541 pValue->JSObject()->SetCData(XFA_Attribute::Name, L"value");
542 pValue->CreateXMLMappingNode();
543 pDataNode->InsertChildAndNotify(pValue,
nullptr);
544 pValue->JSObject()->SetCData(XFA_Attribute::Value, text);
547 CFX_XMLElement* pElement =
552 pDataNode->JSObject()->SetAttributeValue(
557 wsValue = defValue ? defValue->GetChildValueContent() : WideString
();
561 pDataNode->JSObject()->SetAttributeValue(
566 CXFA_Node* pChild = pFormNode->GetFirstChild();
567 for (; pChild; pChild = pChild->GetNextSibling()) {
572 pChild->GetChild<CXFA_Value>(0,
XFA_Element::Value,
false);
576 wsValue = pValue->GetChildValueContent();
581 pChild->GetChild<CXFA_Items>(0,
XFA_Element::Items,
false);
585 CXFA_Node* pText = pItems->GetFirstChild();
589 WideString wsContent = pText->JSObject()->GetContent(
false);
590 if (wsContent
== wsValue) {
592 pDataNode->JSObject()->SetAttributeValue(wsValue, wsValue);
593 pFormNode->JSObject()->SetCData(
XFA_Attribute::Value, wsContent);
600 pChild = pFormNode->GetFirstChild();
601 for (; pChild; pChild = pChild->GetNextSibling()) {
602 if (pChild == pChecked)
608 pChild->JSObject()->GetOrCreateProperty<CXFA_Value>(
611 pChild->GetChild<CXFA_Items>(0,
XFA_Element::Items,
false);
612 CXFA_Node* pText = pItems ? pItems->GetFirstChild() :
nullptr;
614 pText = pText->GetNextSibling();
616 WideString wsContent;
618 wsContent = pText->JSObject()->GetContent(
false);
620 FormValueNode_SetChildContent(pValue, wsContent,
XFA_Element::Text);
625 wsValue = defValue ? defValue->GetChildValueContent() : WideString
();
630 pDataNode->JSObject()->SetAttributeValue(
633 pFormNode->JSObject()->GetOrCreateProperty<CXFA_Value>(
635 FormValueNode_SetChildContent(pValue, wsValue,
XFA_Element::Float);
639 wsValue = defValue ? defValue->GetChildValueContent() : WideString
();
643 pDataNode->JSObject()->SetAttributeValue(
650 WideString wsXMLValue = pDataNode->JSObject()->GetContent(
false);
653 pDataNode->JSObject()->SetAttributeValue(wsNormalizeValue, wsXMLValue);
656 FormValueNode_SetChildContent(defValue, wsNormalizeValue,
658 CXFA_Image* image = defValue ? defValue->GetImageIfExists() :
nullptr;
660 CFX_XMLElement* pXMLDataElement =
662 WideString wsContentType =
678 std::vector<CXFA_Node*> items = pDataNode->GetNodeListWithFilter(
679 {XFA_NodeFilter::kChildren, XFA_NodeFilter::kProperties});
680 if (!items.empty()) {
681 bool single = items.size() == 1;
684 for (CXFA_Node* pNode : items) {
685 WideString wsItem = pNode->JSObject()->GetContent(
false);
689 wsNormalizeValue += wsItem;
691 CXFA_ExData* exData =
692 defValue ? defValue->GetExDataIfExists() :
nullptr;
696 FormValueNode_SetChildContent(defValue, wsNormalizeValue,
699 FormValueNode_SetChildContent(defValue, wsNormalizeValue,
705 false, false, false);
709 FormValueNode_SetChildContent(defValue, wsNormalizeValue,
713 WideString wsPicture =
718 FormValueNode_SetChildContent(defValue, wsNormalizeValue,
723 FormValueNode_SetChildContent(defValue, wsNormalizeValue,
729CXFA_Node* MaybeCreateDataNode(CXFA_Document* pDocument,
732 const WideString& wsName) {
737 if (!pParentDDNode) {
740 pDataNode->JSObject()->SetCData(
XFA_Attribute::Name, wsName);
747 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_DDGroup> sIterator(
749 for (
CXFA_Node* pDDGroupNode = sIterator.GetCurrent(); pDDGroupNode;
750 pDDGroupNode = sIterator.MoveToNext()) {
751 if (pDDGroupNode != pParentDDNode) {
755 absl::optional<WideString> ns = pDDGroupNode->JSObject()->TryNamespace();
756 if (!ns.has_value() ||
757 !ns.value().EqualsASCII(
"http://ns.adobe.com/data-description/")) {
763 pDDGroupNode->GetFirstChildByName(wsName.AsStringView());
771 pDataNode->JSObject()->SetCData(
XFA_Attribute::Name, wsName);
787CXFA_Node* CopyContainer_Field(CXFA_Document* pDocument,
793 CXFA_Node* pFieldNode = XFA_NodeMerge_CloneOrMergeContainer(
794 pDocument, pFormNode, pTemplateNode,
false,
nullptr);
796 for (
CXFA_Node* pTemplateChildNode = pTemplateNode->GetFirstChild();
798 pTemplateChildNode = pTemplateChildNode->GetNextSibling()) {
801 pTemplateChildNode
, true, nullptr);
805 CopyContainer_Field(pDocument, pTemplateChildNode, pFieldNode,
nullptr,
811 bool bAccessedDataDOM =
false;
812 bool bSelfMatch =
false;
814 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFAContainerNode>
815 sNodeIter(pTemplateNode);
816 CXFA_Node* pDataNode = FindMatchingDataNode(
817 pDocument, pTemplateNode, pDataScope, bAccessedDataDOM,
true,
818 &sNodeIter, bSelfMatch, eBindMatch, bUpLevel);
820 CreateDataBinding(pFieldNode, pDataNode,
true);
822 FormValueNode_MatchNoneCreateChild(pFieldNode);
827CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
836 bool bUseInstanceManager =
839 std::vector<CXFA_Node*> subformArray;
840 std::vector<CXFA_Node*>* pSearchArray =
nullptr;
843 pInstMgrNode = bUseInstanceManager ? CloneOrMergeInstanceManager(
844 pDocument, pFormParentNode,
845 pTemplateNode, &subformArray)
847 if (CXFA_Occur* pOccurTemplateNode =
848 pTemplateNode->GetFirstChildByClass<CXFA_Occur>(
850 pOccurNode = pInstMgrNode ? XFA_NodeMerge_CloneOrMergeContainer(
851 pDocument, pInstMgrNode,
852 pOccurTemplateNode,
false,
nullptr)
853 : pOccurTemplateNode;
854 }
else if (pInstMgrNode) {
856 pInstMgrNode->GetFirstChildByClass<CXFA_Occur>(
XFA_Element::Occur);
862 pSearchArray = &subformArray;
865 if (subformArray.empty())
866 pSearchArray =
nullptr;
867 }
else if (pTemplateNode
->GetNameHash() == 0 && subformArray.empty()) {
868 pSearchArray =
nullptr;
876 if (!bOneInstance && pOccurNode) {
877 std::tie(iMin, iMax, iInit) =
883 ? pTemplateNode->JSObject()->GetEnum(
XFA_Attribute::Relation)
885 int32_t iCurRepeatIndex = 0;
888 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFAContainerNode>
889 sNodeIterator(pTemplateNode);
890 bool bAccessedDataDOM =
false;
892 sNodeIterator.MoveToNext();
894 std::map<CXFA_Node*, CXFA_Node*> subformMapArray;
895 std::vector<CXFA_Node*> nodeArray;
896 for (; iMax < 0 || iCurRepeatIndex < iMax; iCurRepeatIndex++) {
897 bool bSelfMatch =
false;
899 CXFA_Node* pDataNode = FindMatchingDataNode(
900 pDocument, pTemplateNode, pDataScope, bAccessedDataDOM,
false,
901 &sNodeIterator, bSelfMatch, eBindMatch,
true);
902 if (!pDataNode || sNodeIterator.GetCurrent() != pTemplateNode)
905 eParentBindMatch = eBindMatch;
906 CXFA_Node* pSubformNode = XFA_NodeMerge_CloneOrMergeContainer(
907 pDocument, pFormParentNode, pTemplateNode,
false, pSearchArray);
909 pFirstInstance = pSubformNode;
911 CreateDataBinding(pSubformNode, pDataNode,
true);
912 DCHECK(pSubformNode);
913 subformMapArray[pSubformNode] = pDataNode;
914 nodeArray.push_back(pSubformNode);
917 for (CXFA_Node* pSubform : nodeArray) {
918 CXFA_Node* pDataNode =
nullptr;
919 auto it = subformMapArray.find(pSubform);
920 if (it != subformMapArray.end())
921 pDataNode = it->second;
922 for (CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
924 pTemplateChild = pTemplateChild->GetNextSibling()) {
925 if (XFA_DataMerge_NeedGenerateForm(pTemplateChild,
926 bUseInstanceManager)) {
927 XFA_NodeMerge_CloneOrMergeContainer(pDocument, pSubform,
928 pTemplateChild,
true,
nullptr);
929 }
else if (pTemplateChild->IsContainerNode()) {
930 pDocument->DataMerge_CopyContainer(pTemplateChild, pSubform,
931 pDataNode,
false,
true,
false);
935 subformMapArray.clear();
938 for (; iMax < 0 || iCurRepeatIndex < iMax; iCurRepeatIndex++) {
939 bool bSelfMatch =
false;
941 if (!FindMatchingDataNode(pDocument, pTemplateNode, pDataScope,
942 bAccessedDataDOM,
false, &sNodeIterator,
943 bSelfMatch, eBindMatch,
true)) {
953 CXFA_Node* pSubformSetNode = XFA_NodeMerge_CloneOrMergeContainer(
954 pDocument, pFormParentNode, pTemplateNode,
false, pSearchArray);
955 DCHECK(pSubformSetNode);
957 pFirstInstance = pSubformSetNode;
959 std::vector<RecurseRecord> rgItemMatchList;
960 std::vector<CXFA_Node*> rgItemUnmatchList;
961 for (
CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
963 pTemplateChild = pTemplateChild->GetNextSibling()) {
965 bUseInstanceManager
)) {
967 pTemplateChild
, true, nullptr);
972 CXFA_NodeIteratorTemplate<CXFA_Node,
973 CXFA_TraverseStrategy_XFAContainerNode>
974 sChildIter(pTemplateChild);
975 CXFA_Node* pDataMatch = FindMatchingDataNode(
976 pDocument, pTemplateChild, pDataScope, bAccessedDataDOM,
977 false, &sChildIter, bSelfMatch, eBindMatch,
true);
979 RecurseRecord sNewRecord = {pTemplateChild, pDataMatch};
981 rgItemMatchList.insert(rgItemMatchList.begin(), sNewRecord);
983 rgItemMatchList.push_back(sNewRecord);
985 rgItemUnmatchList.push_back(pTemplateChild);
988 rgItemUnmatchList.push_back(pTemplateChild);
995 DCHECK(!rgItemMatchList.empty());
996 SortRecurseRecord(&rgItemMatchList, pDataScope,
true);
998 rgItemMatchList.front().pTemplateChild
, pSubformSetNode
,
999 pDataScope
, false, true, true);
1003 if (!rgItemMatchList.empty()) {
1004 SortRecurseRecord(&rgItemMatchList, pDataScope,
false);
1005 for (
const auto& matched : rgItemMatchList) {
1006 pDocument->DataMerge_CopyContainer(matched.pTemplateChild,
1007 pSubformSetNode, pDataScope,
1011 for (
auto* unmatched : rgItemUnmatchList) {
1012 pDocument->DataMerge_CopyContainer(unmatched, pSubformSetNode,
1013 pDataScope,
false,
true,
true);
1021 CXFA_Node* pSubformSetNode = XFA_NodeMerge_CloneOrMergeContainer(
1022 pDocument, pFormParentNode, pTemplateNode,
false, pSearchArray);
1023 DCHECK(pSubformSetNode);
1024 if (!pFirstInstance)
1025 pFirstInstance = pSubformSetNode;
1027 for (
CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
1029 pTemplateChild = pTemplateChild->GetNextSibling()) {
1031 bUseInstanceManager
)) {
1033 pTemplateChild
, true, nullptr);
1036 pDataScope
, false, true, true);
1042 if (iCurRepeatIndex == 0 && !bAccessedDataDOM) {
1043 int32_t iLimit = iMax;
1045 iLimit =
fxcrt::CollectionSize<int32_t>(subformArray);
1050 for (; (iLimit < 0 || iCurRepeatIndex < iLimit); iCurRepeatIndex++) {
1052 if (pSearchArray && pSearchArray->empty()) {
1055 pSearchArray =
nullptr;
1057 }
else if (!XFA_DataMerge_FindFormDOMInstance(
1062 CXFA_Node* pSubformNode = XFA_NodeMerge_CloneOrMergeContainer(
1063 pDocument, pFormParentNode, pTemplateNode,
false, pSearchArray);
1064 DCHECK(pSubformNode);
1065 if (!pFirstInstance)
1066 pFirstInstance = pSubformNode;
1068 for (
CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
1070 pTemplateChild = pTemplateChild->GetNextSibling()) {
1072 bUseInstanceManager
)) {
1074 pTemplateChild
, true, nullptr);
1077 pDataScope
, false, true, true);
1084 int32_t iMinimalLimit = iCurRepeatIndex == 0 ? iInit : iMin;
1085 for (; iCurRepeatIndex < iMinimalLimit; iCurRepeatIndex++) {
1086 CXFA_Node* pSubformSetNode = XFA_NodeMerge_CloneOrMergeContainer(
1087 pDocument, pFormParentNode, pTemplateNode,
false, pSearchArray);
1088 DCHECK(pSubformSetNode);
1089 if (!pFirstInstance)
1090 pFirstInstance = pSubformSetNode;
1092 bool bFound =
false;
1093 for (
CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
1094 pTemplateChild; pTemplateChild = pTemplateChild->GetNextSibling()) {
1097 pTemplateChild
, true, nullptr);
1103 pDataScope
, false, bDataMerge
, true);
1108 return pFirstInstance;
1111void UpdateBindingRelations(CXFA_Document* pDocument,
1115 bool bParentDataRef) {
1116 bool bMatchRef =
true;
1122 CXFA_Bind* pTemplateNodeBind =
1124 ? pTemplateNode->GetFirstChildByClass<CXFA_Bind>(
XFA_Element::Bind)
1128 ? pTemplateNodeBind->JSObject()->GetEnum(
XFA_Attribute::Match)
1132 if (!bDataRef || bParentDataRef)
1133 FormValueNode_MatchNoneCreateChild(pFormNode);
1136 if (!bDataRef || bParentDataRef) {
1145 pDataNode = MaybeCreateDataNode(
1146 pDocument, pDataScope, eDataNodeType,
1150 CreateDataBinding(pFormNode, pDataNode,
false);
1153 FormValueNode_MatchNoneCreateChild(pFormNode);
1156 CXFA_Node* pDataParent = pDataNode->GetParent();
1157 if (pDataParent != pDataScope) {
1158 DCHECK(pDataParent);
1166 if (!bDataRef || bParentDataRef) {
1168 if (dwNameHash != 0 && !pDataNode) {
1177 pDataNode = MaybeCreateDataNode(
1178 pDocument, pRecordNode, eDataNodeType,
1182 CreateDataBinding(pFormNode, pDataNode,
false);
1187 CreateDataBinding(pFormNode, pDataNode,
true);
1191 FormValueNode_MatchNoneCreateChild(pFormNode);
1195 bMatchRef = bDataRef;
1196 bParentDataRef =
true;
1197 if (!pDataNode && bDataRef) {
1200 ? pTemplateNodeBind->JSObject()->GetCData(
XFA_Attribute::Ref)
1203 XFA_ResolveFlag::kCreateNode};
1204 absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
1205 pDocument->GetScriptContext()->ResolveObjectsWithBindNode(
1206 pDataScope, wsRef.AsStringView(), kFlags, pTemplateNode);
1208 maybeResult.has_value() && !maybeResult.value().objects.empty()
1209 ? maybeResult.value().objects.front().Get()
1214 pFormNode, pDataNode,
1215 maybeResult.value().type ==
1216 CFXJSE_Engine::ResolveResult::Type::kExistNodes);
1218 FormValueNode_MatchNoneCreateChild(pFormNode);
1232 for (
CXFA_Node* pFormChild = pFormNode->GetFirstChild(); pFormChild;
1233 pFormChild = pFormChild->GetNextSibling()) {
1239 UpdateBindingRelations(pDocument, pFormChild,
1240 pDataNode ? pDataNode : pDataScope, bDataRef,
1247 DCHECK(pDataDescriptionNode);
1248 for (
CXFA_Node* pDataChild = pDataNode->GetFirstChild(); pDataChild;
1249 pDataChild = pDataChild->GetNextSibling()) {
1254 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_DDGroup>
1255 sIterator(pDataDescriptionNode);
1256 for (
CXFA_Node* pDDGroupNode = sIterator.GetCurrent(); pDDGroupNode;
1257 pDDGroupNode = sIterator.MoveToNext()) {
1258 if (pDDGroupNode != pDataDescriptionNode) {
1262 absl::optional<WideString> ns =
1263 pDDGroupNode->JSObject()->TryNamespace();
1264 if (!ns.has_value() ||
1265 !ns.value().EqualsASCII(
"http://ns.adobe.com/data-description/")) {
1277 UpdateDataRelation(pDataChild, pDDNode);
1290 node_owner_(cppgc::MakeGarbageCollected<CXFA_NodeOwner>(
1291 heap->GetAllocationHandle())),
1292 m_pLayoutProcessor(std::move(pLayout)) {
1293 if (m_pLayoutProcessor)
1294 m_pLayoutProcessor->SetDocument(
this);
1299void CXFA_Document::Trace(
cppgc::Visitor* visitor)
const {
1300 visitor->Trace(notify_);
1301 visitor->Trace(node_owner_);
1302 visitor->Trace(m_pRootNode);
1303 visitor->Trace(m_pLocaleMgr);
1304 visitor->Trace(m_pLayoutProcessor);
1305 visitor->Trace(m_pScriptDataWindow);
1306 visitor->Trace(m_pScriptEvent);
1307 visitor->Trace(m_pScriptHost);
1308 visitor->Trace(m_pScriptLog);
1309 visitor->Trace(m_pScriptLayout);
1310 visitor->Trace(m_pScriptSignature);
1311 ContainerTrace(visitor, m_rgGlobalBinding);
1312 ContainerTrace(visitor, m_pPendingPageSet);
1316 m_pLayoutProcessor =
nullptr;
1317 m_pScriptContext.reset();
1318 m_pLocaleMgr.Clear();
1319 m_pScriptDataWindow =
nullptr;
1320 m_pScriptEvent =
nullptr;
1321 m_pScriptHost =
nullptr;
1322 m_pScriptLog =
nullptr;
1323 m_pScriptLayout =
nullptr;
1324 m_pScriptSignature =
nullptr;
1328 switch (dwNodeNameHash) {
1334 for (CXFA_DataGroup* pDatasetsChild =
1335 pDatasetsNode->GetFirstChildByClass<CXFA_DataGroup>(
1339 pDatasetsChild->GetNextSameClassSibling<CXFA_DataGroup>(
1344 absl::optional<WideString> namespaceURI =
1345 pDatasetsChild->JSObject()->TryNamespace();
1346 if (!namespaceURI.has_value())
1349 absl::optional<WideString> datasetsURI =
1350 pDatasetsNode->JSObject()->TryNamespace();
1351 if (!datasetsURI.has_value())
1353 if (namespaceURI.value() == datasetsURI.value())
1354 return pDatasetsChild;
1360 return pData ? pData->GetFirstChildByClass<CXFA_DataGroup>(
1365 if (!m_pScriptDataWindow)
1366 m_pScriptDataWindow = cppgc::MakeGarbageCollected<CScript_DataWindow>(
1367 GetHeap()->GetAllocationHandle(),
this);
1368 return m_pScriptDataWindow;
1371 if (!m_pScriptEvent)
1372 m_pScriptEvent = cppgc::MakeGarbageCollected<CScript_EventPseudoModel>(
1373 GetHeap()->GetAllocationHandle(),
this);
1374 return m_pScriptEvent;
1378 m_pScriptHost = cppgc::MakeGarbageCollected<CScript_HostPseudoModel>(
1379 GetHeap()->GetAllocationHandle(),
this);
1380 return m_pScriptHost;
1384 m_pScriptLog = cppgc::MakeGarbageCollected<CScript_LogPseudoModel>(
1385 GetHeap()->GetAllocationHandle(),
this);
1386 return m_pScriptLog;
1389 if (!m_pScriptSignature)
1390 m_pScriptSignature =
1391 cppgc::MakeGarbageCollected<CScript_SignaturePseudoModel>(
1392 GetHeap()->GetAllocationHandle(),
this);
1393 return m_pScriptSignature;
1396 if (!m_pScriptLayout)
1398 cppgc::MakeGarbageCollected<CScript_LayoutPseudoModel>(
1399 GetHeap()->GetAllocationHandle(),
this);
1400 return m_pScriptLayout;
1403 return m_pRootNode->GetFirstChildByName(dwNodeNameHash);
1416 if (m_Interactive.has_value())
1417 return m_Interactive.value();
1423 CXFA_Present* pPresent =
1424 pConfig->GetFirstChildByClass<CXFA_Present>(
XFA_Element::Present);
1428 CXFA_Pdf* pPDF = pPresent->GetFirstChildByClass<CXFA_Pdf>(
XFA_Element::Pdf);
1432 CXFA_Interactive* pFormFiller =
1433 pPDF->GetChild<CXFA_Interactive>(0,
XFA_Element::Interactive,
false);
1437 WideString wsInteractive = pFormFiller->JSObject()->GetContent(
false);
1439 m_Interactive = bInteractive;
1440 return bInteractive;
1444 if (!m_pLocaleMgr) {
1445 m_pLocaleMgr = cppgc::MakeGarbageCollected<CXFA_LocaleMgr>(
1446 heap_->GetAllocationHandle(), heap_,
1447 ToNode(GetXFAObject(XFA_HASHCODE_LocaleSet)),
1448 GetNotify()->GetAppProvider()->GetLanguage());
1450 return m_pLocaleMgr;
1458 DCHECK(!m_pScriptContext);
1459 m_pScriptContext = std::make_unique<CFXJSE_Engine>(
this, fxjs_runtime);
1460 return m_pScriptContext.get();
1464 DCHECK(m_pScriptContext);
1465 return m_pScriptContext.get();
1469 const WideString& wsTemplateNS) {
1470 XFA_VERSION eVersion = ParseXFAVersion(wsTemplateNS);
1472 m_eCurVersionMode = eVersion;
1478XFA_VERSION CXFA_Document::ParseXFAVersion(
const WideString& wsTemplateNS) {
1479 WideStringView wsTemplateURIPrefix(kTemplateNS);
1480 if (wsTemplateNS.GetLength() <= wsTemplateURIPrefix.GetLength())
1483 size_t prefixLength = wsTemplateURIPrefix.GetLength();
1484 if (wsTemplateNS.AsStringView().First(prefixLength) != wsTemplateURIPrefix)
1487 auto nDotPos = wsTemplateNS.Find(
'.', prefixLength);
1488 if (!nDotPos.has_value())
1491 int8_t iMajor = FXSYS_wtoi(
1492 wsTemplateNS.Substr(prefixLength, nDotPos.value() - prefixLength)
1494 int8_t iMinor = FXSYS_wtoi(wsTemplateNS.Substr(nDotPos.value() + 1).c_str());
1496 static_cast<
XFA_VERSION>(
static_cast<int32_t>(iMajor) * 100 + iMinor);
1508 WideStringView wsID)
const {
1509 if (!pRoot || wsID.IsEmpty())
1512 CXFA_NodeIterator sIterator(pRoot);
1513 for (
CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
1514 pNode = sIterator.MoveToNext()) {
1515 WideString wsIDVal = pNode->JSObject()->GetCData(
XFA_Attribute::Id);
1527 std::map<uint32_t, CXFA_Node*> mIDMap;
1528 std::set<CXFA_Node*> sUseNodes;
1529 CXFA_NodeIterator sIterator(pTemplateRoot);
1530 for (
CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
1531 pNode = sIterator.MoveToNext()) {
1532 WideString wsIDVal = pNode->JSObject()->GetCData(
XFA_Attribute::Id);
1534 mIDMap[FX_HashCode_GetW(wsIDVal.AsStringView())] = pNode;
1536 WideString wsUseVal = pNode->JSObject()->GetCData(
XFA_Attribute::Use);
1538 sUseNodes.insert(pNode);
1540 wsUseVal = pNode->JSObject()->GetCData(
XFA_Attribute::Usehref);
1542 sUseNodes.insert(pNode);
1546 for (CXFA_Node* pUseHrefNode : sUseNodes) {
1548 WideString wsUseVal =
1549 pUseHrefNode->JSObject()->GetCData(XFA_Attribute::Usehref);
1550 WideStringView wsURI;
1551 WideStringView wsID;
1552 WideStringView wsSOM;
1553 if (!wsUseVal.IsEmpty()) {
1554 ParseUseHref(wsUseVal, wsURI, wsID, wsSOM);
1555 if (!wsURI.IsEmpty() && !wsURI.EqualsASCII(
"."))
1558 wsUseVal = pUseHrefNode->JSObject()->GetCData(XFA_Attribute::Use);
1559 ParseUse(wsUseVal, wsID, wsSOM);
1562 CXFA_Node* pProtoNode =
nullptr;
1563 if (!wsSOM.IsEmpty()) {
1564 absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
1565 m_pScriptContext->ResolveObjects(
1566 pUseHrefNode, wsSOM,
1567 Mask<XFA_ResolveFlag>{
1568 XFA_ResolveFlag::kChildren, XFA_ResolveFlag::kAttributes,
1569 XFA_ResolveFlag::kProperties, XFA_ResolveFlag::kParent,
1570 XFA_ResolveFlag::kSiblings});
1571 if (maybeResult.has_value()) {
1572 auto* pFirstObject = maybeResult.value().objects.front().Get();
1573 if (pFirstObject && pFirstObject->IsNode())
1574 pProtoNode = pFirstObject->AsNode();
1576 }
else if (!wsID.IsEmpty()) {
1577 auto it = mIDMap.find(FX_HashCode_GetW(wsID));
1578 if (it == mIDMap.end())
1580 pProtoNode = it->second;
1585 MergeNode(pUseHrefNode, pProtoNode);
1590void CXFA_Document::ParseUseHref(
const WideString& wsUseVal,
1591 WideStringView& wsURI,
1592 WideStringView& wsID,
1593 WideStringView& wsSOM) {
1597 auto uSharpPos = wsUseVal.Find(
'#');
1598 if (!uSharpPos.has_value()) {
1599 wsURI = wsUseVal.AsStringView();
1602 wsURI = wsUseVal.AsStringView().First(uSharpPos.value());
1603 if (wsUseVal.AsStringView().Substr(uSharpPos.value(), 5) == L"#som(" &&
1605 wsSOM = wsUseVal.AsStringView().Substr(
1606 uSharpPos.value() + 5,
1607 wsUseVal.GetLength() - 1 - uSharpPos.value() - 5);
1610 wsID = wsUseVal.AsStringView().Substr(uSharpPos.value() + 1);
1614void CXFA_Document::ParseUse(
const WideString& wsUseVal,
1615 WideStringView& wsID,
1616 WideStringView& wsSOM) {
1620 if (wsUseVal
[0
] ==
'#') {
1621 wsID = wsUseVal.AsStringView().Substr(1);
1624 wsSOM = wsUseVal.AsStringView();
1633 DCHECK(pTemplateNode->IsContainerNode());
1639 return CopyContainer_SubformSet(
this, pTemplateNode, pFormNode,
1640 pDataScope, bOneInstance, bDataMerge);
1645 return CopyContainer_Field(
this, pTemplateNode, pFormNode, pDataScope,
1646 bDataMerge, bUpLevel);
1651 NOTREACHED_NORETURN();
1658 XFA_DataMerge_FindDataScope(pFormUpdateRoot->GetParent());
1662 UpdateBindingRelations(
this, pFormUpdateRoot, pDataScope,
false,
false);
1663 UpdateBindingRelations(
this, pFormUpdateRoot, pDataScope,
true,
false);
1668 for (
auto& pObject : arrayObjects) {
1669 CXFA_Node* pNode = pObject->AsNode();
1670 if (pNode && !pNode->HasBindItem())
1678 if (!pDatasetsRoot) {
1680 auto* pDatasetsXMLNode =
1681 notify_->GetFFDoc()->GetXMLDocument()->CreateNode<CFX_XMLElement>(
1683 pDatasetsXMLNode->SetAttribute(L"xmlns:xfa",
1684 L"http://www.xfa.org/schema/xfa-data/1.0/");
1687 pDatasetsRoot->JSObject()->SetCData(
XFA_Attribute::Name, L"datasets");
1689 m_pRootNode->GetXMLMappingNode()->AppendLastChild(pDatasetsXMLNode);
1690 m_pRootNode->InsertChildAndNotify(pDatasetsRoot,
nullptr);
1696 WideString wsDatasetsURI =
1697 pDatasetsRoot->JSObject()->TryNamespace().value_or(WideString
());
1698 for (
CXFA_Node* pChildNode = pDatasetsRoot->GetFirstChild(); pChildNode;
1699 pChildNode = pChildNode->GetNextSibling()) {
1704 absl::optional<WideString> namespaceURI =
1705 pChildNode->JSObject()->TryNamespace();
1706 if (!namespaceURI.has_value())
1708 if (namespaceURI.value().EqualsASCII(
1709 "http://ns.adobe.com/data-description/")) {
1710 pDDRoot = pChildNode;
1713 absl::optional<WideString> namespaceURI =
1714 pChildNode->JSObject()->TryNamespace();
1715 if (!namespaceURI.has_value())
1717 if (namespaceURI == wsDatasetsURI)
1718 pDataRoot = pChildNode;
1720 if (pDataRoot && pDDRoot)
1726 pDataRoot->JSObject()->SetCData(
XFA_Attribute::Name, L"data");
1729 notify_->GetFFDoc()->GetXMLDocument()->CreateNode<CFX_XMLElement>(
1735 CXFA_DataGroup* pDataTopLevel =
1736 pDataRoot->GetFirstChildByClass<CXFA_DataGroup>(
XFA_Element::DataGroup);
1737 uint32_t dwNameHash = pDataTopLevel ? pDataTopLevel
->GetNameHash() : 0;
1738 CXFA_Template* pTemplateRoot =
1739 m_pRootNode->GetFirstChildByClass<CXFA_Template>(XFA_Element::Template);
1744 dwNameHash != 0 ? pTemplateRoot->GetFirstChildByName(dwNameHash)
1746 if (!pTemplateChosen ||
1749 pTemplateRoot->GetFirstChildByClass<CXFA_Subform>(
XFA_Element::Subform);
1751 if (!pTemplateChosen)
1754 CXFA_Form* pFormRoot =
1755 m_pRootNode->GetFirstChildByClass<CXFA_Form>(XFA_Element::Form);
1756 bool bEmptyForm =
false;
1759 pFormRoot =
static_cast<CXFA_Form*>(
1762 pFormRoot->JSObject()->SetCData(
XFA_Attribute::Name, L"form");
1763 m_pRootNode->InsertChildAndNotify(pFormRoot,
nullptr);
1765 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode>
1766 sIterator(pFormRoot);
1767 for (
CXFA_Node* pNode = sIterator.MoveToNext(); pNode;
1768 pNode = sIterator.MoveToNext()) {
1773 CXFA_Node* pSubformSetNode = XFA_NodeMerge_CloneOrMergeContainer(
1774 this, pFormRoot, pTemplateChosen,
false,
nullptr);
1775 DCHECK(pSubformSetNode);
1776 if (!pDataTopLevel) {
1777 WideString wsFormName =
1779 WideString wsDataTopLevelName(wsFormName
.IsEmpty() ? L"form" : wsFormName);
1781 pDataTopLevel =
static_cast<CXFA_DataGroup*>(
1784 wsDataTopLevelName);
1787 notify_->GetFFDoc()->GetXMLDocument()->CreateNode<CFX_XMLElement>(
1788 wsDataTopLevelName);
1791 CXFA_Node* pBeforeNode = pDataRoot->GetFirstChild();
1792 pDataRoot->InsertChildAndNotify(pDataTopLevel, pBeforeNode);
1795 DCHECK(pDataTopLevel);
1796 CreateDataBinding(pSubformSetNode, pDataTopLevel,
true);
1797 for (
CXFA_Node* pTemplateChild = pTemplateChosen->GetFirstChild();
1798 pTemplateChild; pTemplateChild = pTemplateChild->GetNextSibling()) {
1808 UpdateDataRelation(pDataRoot, pDDRoot);
1811 CXFA_PageSet* pPageSetNode =
1812 pSubformSetNode->GetFirstChildByClass<CXFA_PageSet>(
XFA_Element::PageSet);
1813 while (pPageSetNode) {
1814 m_pPendingPageSet.push_back(pPageSetNode);
1815 CXFA_PageSet* pNextPageSetNode =
1816 pPageSetNode->GetNextSameClassSibling<CXFA_PageSet>(
1819 pPageSetNode = pNextPageSetNode;
1825 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator(
1827 CXFA_Node* pNode = sIterator.MoveToNext();
1832 CXFA_Node* pNext = sIterator.SkipChildrenAndMoveToNext();
1833 pNode->GetParent()->RemoveChildAndNotify(pNode,
true);
1838 pNode = sIterator.MoveToNext();
1842 pNode = sIterator.MoveToNext();
1850 while (
CXFA_Node* pNode = pFormRoot->GetFirstChild())
1855 m_rgGlobalBinding.clear();
1861 auto it = m_rgGlobalBinding.find(dwNameHash);
1862 return it != m_rgGlobalBinding.end() ? it->second :
nullptr;
1867 m_rgGlobalBinding[dwNameHash] = pDataNode;
1871 return m_pPendingPageSet.size();
1875 return m_pPendingPageSet[index];
1879 m_pPendingPageSet.push_back(node);
1883 m_pPendingPageSet.clear();
1887 for (CXFA_Node* pPageNode : m_pPendingPageSet) {
1888 CXFA_NodeIterator sIterator(pPageNode);
1889 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
1890 pNode = sIterator.MoveToNext()) {
1891 if (pNode->IsContainerNode()) {
1892 CXFA_Node* pBindNode = pNode->GetBindData();
1894 pBindNode->RemoveBindItem(pNode);
1895 pNode->SetBindingNode(
nullptr);
1898 pNode->SetFlag(XFA_NodeFlag::kUnusedNode);
1908 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
CharType operator[](const size_t index) const
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)
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)