Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: xfa/src/fxfa/src/parser/xfa_object_imp.cpp

Issue 1722913002: Remove uses of this->foo. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/src/foxitlib.h" 7 #include "xfa/src/foxitlib.h"
8 #include "xfa/src/fxfa/src/common/xfa_docdata.h" 8 #include "xfa/src/fxfa/src/common/xfa_docdata.h"
9 #include "xfa/src/fxfa/src/common/xfa_doclayout.h" 9 #include "xfa/src/fxfa/src/common/xfa_doclayout.h"
10 #include "xfa/src/fxfa/src/common/xfa_document.h" 10 #include "xfa/src/fxfa/src/common/xfa_document.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 CXFA_Node* pClone = pFactory->CreateNode(m_ePacket, m_eNodeClass); 113 CXFA_Node* pClone = pFactory->CreateNode(m_ePacket, m_eNodeClass);
114 if (!pClone) { 114 if (!pClone) {
115 return NULL; 115 return NULL;
116 } 116 }
117 MergeAllData(pClone); 117 MergeAllData(pClone);
118 pClone->UpdateNameHash(); 118 pClone->UpdateNameHash();
119 if (IsNeedSavingXMLNode()) { 119 if (IsNeedSavingXMLNode()) {
120 IFDE_XMLNode* pCloneXML = NULL; 120 IFDE_XMLNode* pCloneXML = NULL;
121 if (IsAttributeInXML()) { 121 if (IsAttributeInXML()) {
122 CFX_WideString wsName; 122 CFX_WideString wsName;
123 this->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); 123 GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE);
124 IFDE_XMLElement* pCloneXMLElement = IFDE_XMLElement::Create(wsName); 124 IFDE_XMLElement* pCloneXMLElement = IFDE_XMLElement::Create(wsName);
125 CFX_WideStringC wsValue = this->GetCData(XFA_ATTRIBUTE_Value); 125 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value);
126 if (!wsValue.IsEmpty()) { 126 if (!wsValue.IsEmpty()) {
127 pCloneXMLElement->SetTextData(wsValue); 127 pCloneXMLElement->SetTextData(wsValue);
128 } 128 }
129 pCloneXML = pCloneXMLElement; 129 pCloneXML = pCloneXMLElement;
130 pCloneXMLElement = NULL; 130 pCloneXMLElement = NULL;
131 pClone->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown); 131 pClone->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown);
132 } else { 132 } else {
133 pCloneXML = m_pXMLNode->Clone(FALSE); 133 pCloneXML = m_pXMLNode->Clone(FALSE);
134 } 134 }
135 pClone->SetXMLMappingNode(pCloneXML); 135 pClone->SetXMLMappingNode(pCloneXML);
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 } 417 }
418 XFA_ELEMENT classID = GetClassID(); 418 XFA_ELEMENT classID = GetClassID();
419 if (classID == XFA_ELEMENT_ExclGroup) { 419 if (classID == XFA_ELEMENT_ExclGroup) {
420 return NULL; 420 return NULL;
421 } 421 }
422 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); 422 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
423 if (pParentNode && pParentNode->GetClassID() == XFA_ELEMENT_ExclGroup) { 423 if (pParentNode && pParentNode->GetClassID() == XFA_ELEMENT_ExclGroup) {
424 return NULL; 424 return NULL;
425 } 425 }
426 if (classID == XFA_ELEMENT_Field) { 426 if (classID == XFA_ELEMENT_Field) {
427 CXFA_WidgetData* pFieldWidgetData = this->GetWidgetData(); 427 CXFA_WidgetData* pFieldWidgetData = GetWidgetData();
428 if (pFieldWidgetData && 428 if (pFieldWidgetData &&
429 pFieldWidgetData->GetChoiceListOpen() == 429 pFieldWidgetData->GetChoiceListOpen() ==
430 XFA_ATTRIBUTEENUM_MultiSelect) { 430 XFA_ATTRIBUTEENUM_MultiSelect) {
431 return NULL; 431 return NULL;
432 } else { 432 } else {
433 CFX_WideString wsPicture; 433 CFX_WideString wsPicture;
434 if (pFieldWidgetData) { 434 if (pFieldWidgetData) {
435 pFieldWidgetData->GetPictureContent(wsPicture, 435 pFieldWidgetData->GetPictureContent(wsPicture,
436 XFA_VALUEPICTURE_DataBind); 436 XFA_VALUEPICTURE_DataBind);
437 } 437 }
438 if (!wsPicture.IsEmpty()) { 438 if (!wsPicture.IsEmpty()) {
439 return pFieldWidgetData; 439 return pFieldWidgetData;
440 } 440 }
441 CXFA_Node* pDataNode = this->GetBindData(); 441 CXFA_Node* pDataNode = GetBindData();
442 if (!pDataNode) { 442 if (!pDataNode) {
443 return NULL; 443 return NULL;
444 } 444 }
445 pFieldWidgetData = NULL; 445 pFieldWidgetData = NULL;
446 CXFA_NodeArray formNodes; 446 CXFA_NodeArray formNodes;
447 pDataNode->GetBindItems(formNodes); 447 pDataNode->GetBindItems(formNodes);
448 for (int32_t i = 0; i < formNodes.GetSize(); i++) { 448 for (int32_t i = 0; i < formNodes.GetSize(); i++) {
449 CXFA_Node* pFormNode = formNodes.GetAt(i); 449 CXFA_Node* pFormNode = formNodes.GetAt(i);
450 if (!pFormNode || pFormNode->HasFlag(XFA_NODEFLAG_HasRemoved)) { 450 if (!pFormNode || pFormNode->HasFlag(XFA_NODEFLAG_HasRemoved)) {
451 continue; 451 continue;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 case XFA_ATTRIBUTEENUM_Tb: 561 case XFA_ATTRIBUTEENUM_Tb:
562 case XFA_ATTRIBUTEENUM_Table: 562 case XFA_ATTRIBUTEENUM_Table:
563 case XFA_ATTRIBUTEENUM_Lr_tb: 563 case XFA_ATTRIBUTEENUM_Lr_tb:
564 case XFA_ATTRIBUTEENUM_Rl_tb: 564 case XFA_ATTRIBUTEENUM_Rl_tb:
565 return XFA_ATTRIBUTEENUM_None; 565 return XFA_ATTRIBUTEENUM_None;
566 default: 566 default:
567 break; 567 break;
568 } 568 }
569 break; 569 break;
570 case XFA_ELEMENT_Field: { 570 case XFA_ELEMENT_Field: {
571 CXFA_Node* pParentNode = this->GetNodeItem(XFA_NODEITEM_Parent); 571 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
572 if (!pParentNode || pParentNode->GetClassID() == XFA_ELEMENT_PageArea) { 572 if (!pParentNode || pParentNode->GetClassID() == XFA_ELEMENT_PageArea) {
573 return XFA_ATTRIBUTEENUM_ContentArea; 573 return XFA_ATTRIBUTEENUM_ContentArea;
574 } 574 }
575 if (pParentNode->GetIntact() == XFA_ATTRIBUTEENUM_None) { 575 if (pParentNode->GetIntact() == XFA_ATTRIBUTEENUM_None) {
576 XFA_ATTRIBUTEENUM eParLayout = 576 XFA_ATTRIBUTEENUM eParLayout =
577 pParentNode->GetEnum(XFA_ATTRIBUTE_Layout); 577 pParentNode->GetEnum(XFA_ATTRIBUTE_Layout);
578 if (eParLayout == XFA_ATTRIBUTEENUM_Position || 578 if (eParLayout == XFA_ATTRIBUTEENUM_Position ||
579 eParLayout == XFA_ATTRIBUTEENUM_Row || 579 eParLayout == XFA_ATTRIBUTEENUM_Row ||
580 eParLayout == XFA_ATTRIBUTEENUM_Table) { 580 eParLayout == XFA_ATTRIBUTEENUM_Table) {
581 return XFA_ATTRIBUTEENUM_None; 581 return XFA_ATTRIBUTEENUM_None;
582 } 582 }
583 XFA_VERSION version = m_pDocument->GetCurVersionMode(); 583 XFA_VERSION version = m_pDocument->GetCurVersionMode();
584 if (eParLayout == XFA_ATTRIBUTEENUM_Tb && version < XFA_VERSION_208) { 584 if (eParLayout == XFA_ATTRIBUTEENUM_Tb && version < XFA_VERSION_208) {
585 CXFA_Measurement measureH; 585 CXFA_Measurement measureH;
586 if (this->TryMeasure(XFA_ATTRIBUTE_H, measureH, FALSE)) { 586 if (TryMeasure(XFA_ATTRIBUTE_H, measureH, FALSE)) {
587 return XFA_ATTRIBUTEENUM_ContentArea; 587 return XFA_ATTRIBUTEENUM_ContentArea;
588 } 588 }
589 } 589 }
590 return XFA_ATTRIBUTEENUM_None; 590 return XFA_ATTRIBUTEENUM_None;
591 } 591 }
592 return XFA_ATTRIBUTEENUM_ContentArea; 592 return XFA_ATTRIBUTEENUM_ContentArea;
593 } 593 }
594 case XFA_ELEMENT_Draw: 594 case XFA_ELEMENT_Draw:
595 return XFA_ATTRIBUTEENUM_ContentArea; 595 return XFA_ATTRIBUTEENUM_ContentArea;
596 default: 596 default:
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 } 745 }
746 } 746 }
747 void CXFA_Node::Script_TreeClass_ClassAll(FXJSE_HVALUE hValue, 747 void CXFA_Node::Script_TreeClass_ClassAll(FXJSE_HVALUE hValue,
748 FX_BOOL bSetting, 748 FX_BOOL bSetting,
749 XFA_ATTRIBUTE eAttribute) { 749 XFA_ATTRIBUTE eAttribute) {
750 if (bSetting) { 750 if (bSetting) {
751 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 751 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
752 } else { 752 } else {
753 FX_DWORD dwFlag = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_ALL; 753 FX_DWORD dwFlag = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_ALL;
754 CFX_WideStringC wsName; 754 CFX_WideStringC wsName;
755 this->GetClassName(wsName); 755 GetClassName(wsName);
756 CFX_WideString wsExpression = FX_WSTRC(L"#") + wsName + FX_WSTRC(L"[*]"); 756 CFX_WideString wsExpression = FX_WSTRC(L"#") + wsName + FX_WSTRC(L"[*]");
757 Script_Som_ResolveNodeList(hValue, wsExpression, dwFlag); 757 Script_Som_ResolveNodeList(hValue, wsExpression, dwFlag);
758 } 758 }
759 } 759 }
760 void CXFA_Node::Script_TreeClass_Parent(FXJSE_HVALUE hValue, 760 void CXFA_Node::Script_TreeClass_Parent(FXJSE_HVALUE hValue,
761 FX_BOOL bSetting, 761 FX_BOOL bSetting,
762 XFA_ATTRIBUTE eAttribute) { 762 XFA_ATTRIBUTE eAttribute) {
763 if (bSetting) { 763 if (bSetting) {
764 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 764 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
765 } else { 765 } else {
766 CXFA_Node* pParent = this->GetNodeItem(XFA_NODEITEM_Parent); 766 CXFA_Node* pParent = GetNodeItem(XFA_NODEITEM_Parent);
767 if (pParent) { 767 if (pParent) {
768 FXJSE_Value_Set( 768 FXJSE_Value_Set(
769 hValue, m_pDocument->GetScriptContext()->GetJSValueFromMap(pParent)); 769 hValue, m_pDocument->GetScriptContext()->GetJSValueFromMap(pParent));
770 } else { 770 } else {
771 FXJSE_Value_SetNull(hValue); 771 FXJSE_Value_SetNull(hValue);
772 } 772 }
773 } 773 }
774 } 774 }
775 void CXFA_Node::Script_TreeClass_Index(FXJSE_HVALUE hValue, 775 void CXFA_Node::Script_TreeClass_Index(FXJSE_HVALUE hValue,
776 FX_BOOL bSetting, 776 FX_BOOL bSetting,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 } 835 }
836 } 836 }
837 void CXFA_Node::Script_NodeClass_Clone(CFXJSE_Arguments* pArguments) { 837 void CXFA_Node::Script_NodeClass_Clone(CFXJSE_Arguments* pArguments) {
838 int32_t iLength = pArguments->GetLength(); 838 int32_t iLength = pArguments->GetLength();
839 if (iLength != 1) { 839 if (iLength != 1) {
840 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clone"); 840 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clone");
841 return; 841 return;
842 } 842 }
843 FX_BOOL bClone = TRUE; 843 FX_BOOL bClone = TRUE;
844 bClone = pArguments->GetInt32(0) == 0 ? FALSE : TRUE; 844 bClone = pArguments->GetInt32(0) == 0 ? FALSE : TRUE;
845 CXFA_Node* pCloneNode = this->Clone(bClone); 845 CXFA_Node* pCloneNode = Clone(bClone);
846 FXJSE_Value_Set( 846 FXJSE_Value_Set(
847 pArguments->GetReturnValue(), 847 pArguments->GetReturnValue(),
848 m_pDocument->GetScriptContext()->GetJSValueFromMap(pCloneNode)); 848 m_pDocument->GetScriptContext()->GetJSValueFromMap(pCloneNode));
849 } 849 }
850 void CXFA_Node::Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments) { 850 void CXFA_Node::Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments) {
851 int32_t iLength = pArguments->GetLength(); 851 int32_t iLength = pArguments->GetLength();
852 if (iLength != 1) { 852 if (iLength != 1) {
853 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 853 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
854 L"getAttribute"); 854 L"getAttribute");
855 return; 855 return;
856 } 856 }
857 CFX_WideString wsExpression; 857 CFX_WideString wsExpression;
858 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); 858 CFX_ByteString bsExpression = pArguments->GetUTF8String(0);
859 wsExpression = 859 wsExpression =
860 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); 860 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength());
861 CFX_WideString wsValue; 861 CFX_WideString wsValue;
862 this->GetAttribute(wsExpression, wsValue); 862 GetAttribute(wsExpression, wsValue);
863 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 863 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
864 if (hValue) { 864 if (hValue) {
865 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue)); 865 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue));
866 } 866 }
867 } 867 }
868 void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { 868 void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) {
869 int32_t iLength = pArguments->GetLength(); 869 int32_t iLength = pArguments->GetLength();
870 if (iLength < 1 || iLength > 2) { 870 if (iLength < 1 || iLength > 2) {
871 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getElement"); 871 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getElement");
872 return; 872 return;
873 } 873 }
874 CFX_WideString wsExpression; 874 CFX_WideString wsExpression;
875 int32_t iValue = 0; 875 int32_t iValue = 0;
876 if (iLength >= 1) { 876 if (iLength >= 1) {
877 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); 877 CFX_ByteString bsExpression = pArguments->GetUTF8String(0);
878 wsExpression = 878 wsExpression =
879 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); 879 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength());
880 } 880 }
881 if (iLength >= 2) { 881 if (iLength >= 2) {
882 iValue = pArguments->GetInt32(1); 882 iValue = pArguments->GetInt32(1);
883 } 883 }
884 const XFA_ELEMENTINFO* pElementInfo = XFA_GetElementByName(wsExpression); 884 const XFA_ELEMENTINFO* pElementInfo = XFA_GetElementByName(wsExpression);
885 CXFA_Node* pNode = this->GetProperty(iValue, pElementInfo->eName); 885 CXFA_Node* pNode = GetProperty(iValue, pElementInfo->eName);
886 FXJSE_Value_Set(pArguments->GetReturnValue(), 886 FXJSE_Value_Set(pArguments->GetReturnValue(),
887 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); 887 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode));
888 } 888 }
889 void CXFA_Node::Script_NodeClass_IsPropertySpecified( 889 void CXFA_Node::Script_NodeClass_IsPropertySpecified(
890 CFXJSE_Arguments* pArguments) { 890 CFXJSE_Arguments* pArguments) {
891 int32_t iLength = pArguments->GetLength(); 891 int32_t iLength = pArguments->GetLength();
892 if (iLength < 1 || iLength > 3) { 892 if (iLength < 1 || iLength > 3) {
893 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 893 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
894 L"isPropertySpecified"); 894 L"isPropertySpecified");
895 return; 895 return;
(...skipping 10 matching lines...) Expand all
906 bParent = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; 906 bParent = pArguments->GetInt32(1) == 0 ? FALSE : TRUE;
907 } 907 }
908 if (iLength >= 3) { 908 if (iLength >= 3) {
909 iIndex = pArguments->GetInt32(2); 909 iIndex = pArguments->GetInt32(2);
910 } 910 }
911 FX_BOOL bHas = FALSE; 911 FX_BOOL bHas = FALSE;
912 const XFA_ATTRIBUTEINFO* pAttributeInfo = 912 const XFA_ATTRIBUTEINFO* pAttributeInfo =
913 XFA_GetAttributeByName(wsExpression); 913 XFA_GetAttributeByName(wsExpression);
914 CFX_WideString wsValue; 914 CFX_WideString wsValue;
915 if (pAttributeInfo) { 915 if (pAttributeInfo) {
916 bHas = this->HasAttribute(pAttributeInfo->eName); 916 bHas = HasAttribute(pAttributeInfo->eName);
917 } 917 }
918 if (!bHas) { 918 if (!bHas) {
919 const XFA_ELEMENTINFO* pElementInfo = XFA_GetElementByName(wsExpression); 919 const XFA_ELEMENTINFO* pElementInfo = XFA_GetElementByName(wsExpression);
920 bHas = (this->GetProperty(iIndex, pElementInfo->eName) != NULL); 920 bHas = (GetProperty(iIndex, pElementInfo->eName) != NULL);
921 } 921 }
922 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 922 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
923 if (hValue) { 923 if (hValue) {
924 FXJSE_Value_SetBoolean(hValue, bHas); 924 FXJSE_Value_SetBoolean(hValue, bHas);
925 } 925 }
926 } 926 }
927 void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { 927 void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
928 int32_t iLength = pArguments->GetLength(); 928 int32_t iLength = pArguments->GetLength();
929 if (iLength < 1 || iLength > 3) { 929 if (iLength < 1 || iLength > 3) {
930 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"loadXML"); 930 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"loadXML");
(...skipping 24 matching lines...) Expand all
955 int32_t iParserStatus = pParser->ParseXMLData(wsExpression, pXMLNode, NULL); 955 int32_t iParserStatus = pParser->ParseXMLData(wsExpression, pXMLNode, NULL);
956 if (iParserStatus != XFA_PARSESTATUS_Done || !pXMLNode) { 956 if (iParserStatus != XFA_PARSESTATUS_Done || !pXMLNode) {
957 pParser->Release(); 957 pParser->Release();
958 pParser = NULL; 958 pParser = NULL;
959 return; 959 return;
960 } 960 }
961 if (bIgnoreRoot && (pXMLNode->GetType() != FDE_XMLNODE_Element || 961 if (bIgnoreRoot && (pXMLNode->GetType() != FDE_XMLNODE_Element ||
962 XFA_RecognizeRichText((IFDE_XMLElement*)pXMLNode))) { 962 XFA_RecognizeRichText((IFDE_XMLElement*)pXMLNode))) {
963 bIgnoreRoot = FALSE; 963 bIgnoreRoot = FALSE;
964 } 964 }
965 CXFA_Node* pFakeRoot = this->Clone(FALSE); 965 CXFA_Node* pFakeRoot = Clone(FALSE);
966 CFX_WideStringC wsContentType = this->GetCData(XFA_ATTRIBUTE_ContentType); 966 CFX_WideStringC wsContentType = GetCData(XFA_ATTRIBUTE_ContentType);
967 if (!wsContentType.IsEmpty()) { 967 if (!wsContentType.IsEmpty()) {
968 pFakeRoot->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); 968 pFakeRoot->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
969 } 969 }
970 IFDE_XMLNode* pFakeXMLRoot = pFakeRoot->GetXMLMappingNode(); 970 IFDE_XMLNode* pFakeXMLRoot = pFakeRoot->GetXMLMappingNode();
971 if (!pFakeXMLRoot) { 971 if (!pFakeXMLRoot) {
972 IFDE_XMLNode* pThisXMLRoot = this->GetXMLMappingNode(); 972 IFDE_XMLNode* pThisXMLRoot = GetXMLMappingNode();
973 pFakeXMLRoot = pThisXMLRoot ? pThisXMLRoot->Clone(FALSE) : NULL; 973 pFakeXMLRoot = pThisXMLRoot ? pThisXMLRoot->Clone(FALSE) : NULL;
974 } 974 }
975 if (!pFakeXMLRoot) { 975 if (!pFakeXMLRoot) {
976 CFX_WideStringC wsClassName; 976 CFX_WideStringC wsClassName;
977 this->GetClassName(wsClassName); 977 GetClassName(wsClassName);
978 pFakeXMLRoot = IFDE_XMLElement::Create(wsClassName); 978 pFakeXMLRoot = IFDE_XMLElement::Create(wsClassName);
979 } 979 }
980 if (bIgnoreRoot) { 980 if (bIgnoreRoot) {
981 IFDE_XMLNode* pXMLChild = pXMLNode->GetNodeItem(IFDE_XMLNode::FirstChild); 981 IFDE_XMLNode* pXMLChild = pXMLNode->GetNodeItem(IFDE_XMLNode::FirstChild);
982 while (pXMLChild) { 982 while (pXMLChild) {
983 IFDE_XMLNode* pXMLSibling = 983 IFDE_XMLNode* pXMLSibling =
984 pXMLChild->GetNodeItem(IFDE_XMLNode::NextSibling); 984 pXMLChild->GetNodeItem(IFDE_XMLNode::NextSibling);
985 pXMLNode->RemoveChildNode(pXMLChild); 985 pXMLNode->RemoveChildNode(pXMLChild);
986 pFakeXMLRoot->InsertChildNode(pXMLChild); 986 pFakeXMLRoot->InsertChildNode(pXMLChild);
987 pXMLChild = pXMLSibling; 987 pXMLChild = pXMLSibling;
988 } 988 }
989 } else { 989 } else {
990 IFDE_XMLNode* pXMLParent = pXMLNode->GetNodeItem(IFDE_XMLNode::Parent); 990 IFDE_XMLNode* pXMLParent = pXMLNode->GetNodeItem(IFDE_XMLNode::Parent);
991 if (pXMLParent) { 991 if (pXMLParent) {
992 pXMLParent->RemoveChildNode(pXMLNode); 992 pXMLParent->RemoveChildNode(pXMLNode);
993 } 993 }
994 pFakeXMLRoot->InsertChildNode(pXMLNode); 994 pFakeXMLRoot->InsertChildNode(pXMLNode);
995 } 995 }
996 pParser->ConstructXFANode(pFakeRoot, pFakeXMLRoot); 996 pParser->ConstructXFANode(pFakeRoot, pFakeXMLRoot);
997 pFakeRoot = pParser->GetRootNode(); 997 pFakeRoot = pParser->GetRootNode();
998 if (pFakeRoot) { 998 if (pFakeRoot) {
999 if (bOverwrite) { 999 if (bOverwrite) {
1000 CXFA_Node* pChild = this->GetNodeItem(XFA_NODEITEM_FirstChild); 1000 CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild);
1001 CXFA_Node* pNewChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild); 1001 CXFA_Node* pNewChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
1002 int32_t index = 0; 1002 int32_t index = 0;
1003 while (pNewChild) { 1003 while (pNewChild) {
1004 CXFA_Node* pItem = pNewChild->GetNodeItem(XFA_NODEITEM_NextSibling); 1004 CXFA_Node* pItem = pNewChild->GetNodeItem(XFA_NODEITEM_NextSibling);
1005 pFakeRoot->RemoveChild(pNewChild); 1005 pFakeRoot->RemoveChild(pNewChild);
1006 this->InsertChild(index++, pNewChild); 1006 InsertChild(index++, pNewChild);
1007 pNewChild->SetFlag(XFA_NODEFLAG_Initialized); 1007 pNewChild->SetFlag(XFA_NODEFLAG_Initialized);
1008 pNewChild = pItem; 1008 pNewChild = pItem;
1009 } 1009 }
1010 while (pChild) { 1010 while (pChild) {
1011 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); 1011 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
1012 this->RemoveChild(pChild); 1012 RemoveChild(pChild);
1013 pFakeRoot->InsertChild(pChild); 1013 pFakeRoot->InsertChild(pChild);
1014 pChild = pItem; 1014 pChild = pItem;
1015 } 1015 }
1016 if (GetPacketID() == XFA_XDPPACKET_Form && 1016 if (GetPacketID() == XFA_XDPPACKET_Form &&
1017 GetClassID() == XFA_ELEMENT_ExData) { 1017 GetClassID() == XFA_ELEMENT_ExData) {
1018 IFDE_XMLNode* pTempXMLNode = this->GetXMLMappingNode(); 1018 IFDE_XMLNode* pTempXMLNode = GetXMLMappingNode();
1019 this->SetXMLMappingNode(pFakeXMLRoot); 1019 SetXMLMappingNode(pFakeXMLRoot);
1020 this->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); 1020 SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE);
1021 if (pTempXMLNode && 1021 if (pTempXMLNode &&
1022 pTempXMLNode->GetNodeItem(IFDE_XMLNode::Parent) == NULL) { 1022 pTempXMLNode->GetNodeItem(IFDE_XMLNode::Parent) == NULL) {
1023 pFakeXMLRoot = pTempXMLNode; 1023 pFakeXMLRoot = pTempXMLNode;
1024 } else { 1024 } else {
1025 pFakeXMLRoot = NULL; 1025 pFakeXMLRoot = NULL;
1026 } 1026 }
1027 } 1027 }
1028 MoveBufferMapData(pFakeRoot, this, XFA_CalcData, TRUE); 1028 MoveBufferMapData(pFakeRoot, this, XFA_CalcData, TRUE);
1029 } else { 1029 } else {
1030 CXFA_Node* pChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild); 1030 CXFA_Node* pChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
1031 while (pChild) { 1031 while (pChild) {
1032 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); 1032 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
1033 pFakeRoot->RemoveChild(pChild); 1033 pFakeRoot->RemoveChild(pChild);
1034 this->InsertChild(pChild); 1034 InsertChild(pChild);
1035 pChild->SetFlag(XFA_NODEFLAG_Initialized); 1035 pChild->SetFlag(XFA_NODEFLAG_Initialized);
1036 pChild = pItem; 1036 pChild = pItem;
1037 } 1037 }
1038 } 1038 }
1039 if (pFakeXMLRoot) { 1039 if (pFakeXMLRoot) {
1040 pFakeRoot->SetXMLMappingNode(pFakeXMLRoot); 1040 pFakeRoot->SetXMLMappingNode(pFakeXMLRoot);
1041 pFakeRoot->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); 1041 pFakeRoot->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE);
1042 } 1042 }
1043 pFakeRoot->SetFlag(XFA_NODEFLAG_HasRemoved, TRUE, FALSE); 1043 pFakeRoot->SetFlag(XFA_NODEFLAG_HasRemoved, TRUE, FALSE);
1044 } else { 1044 } else {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 CFX_ByteStringC(pMemoryStream->GetBuffer(), pMemoryStream->GetSize())); 1088 CFX_ByteStringC(pMemoryStream->GetBuffer(), pMemoryStream->GetSize()));
1089 pStream->Release(); 1089 pStream->Release();
1090 pStream = NULL; 1090 pStream = NULL;
1091 if (pMemoryStream) { 1091 if (pMemoryStream) {
1092 pMemoryStream->Release(); 1092 pMemoryStream->Release();
1093 pMemoryStream = NULL; 1093 pMemoryStream = NULL;
1094 } 1094 }
1095 return; 1095 return;
1096 } 1096 }
1097 if (GetPacketID() == XFA_XDPPACKET_Datasets) { 1097 if (GetPacketID() == XFA_XDPPACKET_Datasets) {
1098 IFDE_XMLNode* pElement = this->GetXMLMappingNode(); 1098 IFDE_XMLNode* pElement = GetXMLMappingNode();
1099 if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) { 1099 if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) {
1100 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), bsXMLHeader); 1100 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), bsXMLHeader);
1101 return; 1101 return;
1102 } 1102 }
1103 XFA_DataExporter_DealWithDataGroupNode(this); 1103 XFA_DataExporter_DealWithDataGroupNode(this);
1104 IFX_MemoryStream* pMemoryStream = FX_CreateMemoryStream(TRUE); 1104 IFX_MemoryStream* pMemoryStream = FX_CreateMemoryStream(TRUE);
1105 IFX_Stream* pStream = IFX_Stream::CreateStream( 1105 IFX_Stream* pStream = IFX_Stream::CreateStream(
1106 (IFX_FileWrite*)pMemoryStream, 1106 (IFX_FileWrite*)pMemoryStream,
1107 FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append); 1107 FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append);
1108 if (pStream) { 1108 if (pStream) {
(...skipping 22 matching lines...) Expand all
1131 L"setAttribute"); 1131 L"setAttribute");
1132 return; 1132 return;
1133 } 1133 }
1134 CFX_WideString wsAttribute; 1134 CFX_WideString wsAttribute;
1135 CFX_WideString wsAttributeValue; 1135 CFX_WideString wsAttributeValue;
1136 CFX_ByteString bsAttributeValue = pArguments->GetUTF8String(0); 1136 CFX_ByteString bsAttributeValue = pArguments->GetUTF8String(0);
1137 CFX_ByteString bsAttribute = pArguments->GetUTF8String(1); 1137 CFX_ByteString bsAttribute = pArguments->GetUTF8String(1);
1138 wsAttributeValue = 1138 wsAttributeValue =
1139 CFX_WideString::FromUTF8(bsAttributeValue, bsAttributeValue.GetLength()); 1139 CFX_WideString::FromUTF8(bsAttributeValue, bsAttributeValue.GetLength());
1140 wsAttribute = CFX_WideString::FromUTF8(bsAttribute, bsAttribute.GetLength()); 1140 wsAttribute = CFX_WideString::FromUTF8(bsAttribute, bsAttribute.GetLength());
1141 this->SetAttribute(wsAttribute, wsAttributeValue, TRUE); 1141 SetAttribute(wsAttribute, wsAttributeValue, TRUE);
1142 } 1142 }
1143 void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) { 1143 void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) {
1144 int32_t iLength = pArguments->GetLength(); 1144 int32_t iLength = pArguments->GetLength();
1145 if (iLength != 1 && iLength != 2) { 1145 if (iLength != 1 && iLength != 2) {
1146 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setElement"); 1146 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setElement");
1147 return; 1147 return;
1148 } 1148 }
1149 CXFA_Node* pNode = NULL; 1149 CXFA_Node* pNode = NULL;
1150 CFX_WideString wsName; 1150 CFX_WideString wsName;
1151 if (iLength >= 1) { 1151 if (iLength >= 1) {
1152 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); 1152 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
1153 } 1153 }
1154 if (iLength >= 2) { 1154 if (iLength >= 2) {
1155 CFX_ByteString bsName = pArguments->GetUTF8String(1); 1155 CFX_ByteString bsName = pArguments->GetUTF8String(1);
1156 wsName = CFX_WideString::FromUTF8(bsName, bsName.GetLength()); 1156 wsName = CFX_WideString::FromUTF8(bsName, bsName.GetLength());
1157 } 1157 }
1158 } 1158 }
1159 void CXFA_Node::Script_NodeClass_Ns(FXJSE_HVALUE hValue, 1159 void CXFA_Node::Script_NodeClass_Ns(FXJSE_HVALUE hValue,
1160 FX_BOOL bSetting, 1160 FX_BOOL bSetting,
1161 XFA_ATTRIBUTE eAttribute) { 1161 XFA_ATTRIBUTE eAttribute) {
1162 if (bSetting) { 1162 if (bSetting) {
1163 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1163 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
1164 } else { 1164 } else {
1165 CFX_WideString wsNameSpace; 1165 CFX_WideString wsNameSpace;
1166 this->TryNamespace(wsNameSpace); 1166 TryNamespace(wsNameSpace);
1167 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsNameSpace)); 1167 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsNameSpace));
1168 } 1168 }
1169 } 1169 }
1170 void CXFA_Node::Script_NodeClass_Model(FXJSE_HVALUE hValue, 1170 void CXFA_Node::Script_NodeClass_Model(FXJSE_HVALUE hValue,
1171 FX_BOOL bSetting, 1171 FX_BOOL bSetting,
1172 XFA_ATTRIBUTE eAttribute) { 1172 XFA_ATTRIBUTE eAttribute) {
1173 if (bSetting) { 1173 if (bSetting) {
1174 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1174 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
1175 } else { 1175 } else {
1176 FXJSE_Value_Set(hValue, m_pDocument->GetScriptContext()->GetJSValueFromMap( 1176 FXJSE_Value_Set(hValue, m_pDocument->GetScriptContext()->GetJSValueFromMap(
1177 this->GetModelNode())); 1177 GetModelNode()));
1178 } 1178 }
1179 } 1179 }
1180 void CXFA_Node::Script_NodeClass_IsContainer(FXJSE_HVALUE hValue, 1180 void CXFA_Node::Script_NodeClass_IsContainer(FXJSE_HVALUE hValue,
1181 FX_BOOL bSetting, 1181 FX_BOOL bSetting,
1182 XFA_ATTRIBUTE eAttribute) { 1182 XFA_ATTRIBUTE eAttribute) {
1183 if (bSetting) { 1183 if (bSetting) {
1184 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1184 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
1185 } else { 1185 } else {
1186 FXJSE_Value_SetBoolean(hValue, this->IsContainerNode()); 1186 FXJSE_Value_SetBoolean(hValue, IsContainerNode());
1187 } 1187 }
1188 } 1188 }
1189 void CXFA_Node::Script_NodeClass_IsNull(FXJSE_HVALUE hValue, 1189 void CXFA_Node::Script_NodeClass_IsNull(FXJSE_HVALUE hValue,
1190 FX_BOOL bSetting, 1190 FX_BOOL bSetting,
1191 XFA_ATTRIBUTE eAttribute) { 1191 XFA_ATTRIBUTE eAttribute) {
1192 if (bSetting) { 1192 if (bSetting) {
1193 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1193 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
1194 } else { 1194 } else {
1195 if (this->GetClassID() == XFA_ELEMENT_Subform) { 1195 if (GetClassID() == XFA_ELEMENT_Subform) {
1196 FXJSE_Value_SetBoolean(hValue, FALSE); 1196 FXJSE_Value_SetBoolean(hValue, FALSE);
1197 return; 1197 return;
1198 } 1198 }
1199 CFX_WideString strValue; 1199 CFX_WideString strValue;
1200 FXJSE_Value_SetBoolean(hValue, !TryContent(strValue) || strValue.IsEmpty()); 1200 FXJSE_Value_SetBoolean(hValue, !TryContent(strValue) || strValue.IsEmpty());
1201 } 1201 }
1202 } 1202 }
1203 void CXFA_Node::Script_NodeClass_OneOfChild(FXJSE_HVALUE hValue, 1203 void CXFA_Node::Script_NodeClass_OneOfChild(FXJSE_HVALUE hValue,
1204 FX_BOOL bSetting, 1204 FX_BOOL bSetting,
1205 XFA_ATTRIBUTE eAttribute) { 1205 XFA_ATTRIBUTE eAttribute) {
1206 if (bSetting) { 1206 if (bSetting) {
1207 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1207 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
1208 } else { 1208 } else {
1209 CXFA_NodeArray properts; 1209 CXFA_NodeArray properts;
1210 int32_t iSize = this->GetNodeList(properts, XFA_NODEFILTER_OneOfProperty); 1210 int32_t iSize = GetNodeList(properts, XFA_NODEFILTER_OneOfProperty);
1211 if (iSize > 0) { 1211 if (iSize > 0) {
1212 FXJSE_Value_Set( 1212 FXJSE_Value_Set(
1213 hValue, 1213 hValue,
1214 m_pDocument->GetScriptContext()->GetJSValueFromMap(properts[0])); 1214 m_pDocument->GetScriptContext()->GetJSValueFromMap(properts[0]));
1215 } 1215 }
1216 } 1216 }
1217 } 1217 }
1218 void CXFA_Node::Script_ContainerClass_GetDelta(CFXJSE_Arguments* pArguments) {} 1218 void CXFA_Node::Script_ContainerClass_GetDelta(CFXJSE_Arguments* pArguments) {}
1219 void CXFA_Node::Script_ContainerClass_GetDeltas(CFXJSE_Arguments* pArguments) { 1219 void CXFA_Node::Script_ContainerClass_GetDeltas(CFXJSE_Arguments* pArguments) {
1220 CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument); 1220 CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument);
(...skipping 12 matching lines...) Expand all
1233 L"isCompatibleNS"); 1233 L"isCompatibleNS");
1234 return; 1234 return;
1235 } 1235 }
1236 CFX_WideString wsNameSpace; 1236 CFX_WideString wsNameSpace;
1237 if (iLength >= 1) { 1237 if (iLength >= 1) {
1238 CFX_ByteString bsNameSpace = pArguments->GetUTF8String(0); 1238 CFX_ByteString bsNameSpace = pArguments->GetUTF8String(0);
1239 wsNameSpace = 1239 wsNameSpace =
1240 CFX_WideString::FromUTF8(bsNameSpace, bsNameSpace.GetLength()); 1240 CFX_WideString::FromUTF8(bsNameSpace, bsNameSpace.GetLength());
1241 } 1241 }
1242 CFX_WideString wsNodeNameSpace; 1242 CFX_WideString wsNodeNameSpace;
1243 this->TryNamespace(wsNodeNameSpace); 1243 TryNamespace(wsNodeNameSpace);
1244 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 1244 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
1245 if (hValue) { 1245 if (hValue) {
1246 FXJSE_Value_SetBoolean(hValue, wsNodeNameSpace.Equal(wsNameSpace)); 1246 FXJSE_Value_SetBoolean(hValue, wsNodeNameSpace.Equal(wsNameSpace));
1247 } 1247 }
1248 } 1248 }
1249 void CXFA_Node::Script_ModelClass_Context(FXJSE_HVALUE hValue, 1249 void CXFA_Node::Script_ModelClass_Context(FXJSE_HVALUE hValue,
1250 FX_BOOL bSetting, 1250 FX_BOOL bSetting,
1251 XFA_ATTRIBUTE eAttribute) {} 1251 XFA_ATTRIBUTE eAttribute) {}
1252 void CXFA_Node::Script_ModelClass_AliasNode(FXJSE_HVALUE hValue, 1252 void CXFA_Node::Script_ModelClass_AliasNode(FXJSE_HVALUE hValue,
1253 FX_BOOL bSetting, 1253 FX_BOOL bSetting,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 void* eValue, 1293 void* eValue,
1294 FX_BOOL bScriptModify) { 1294 FX_BOOL bScriptModify) {
1295 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); 1295 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor();
1296 if (!pLayoutPro) { 1296 if (!pLayoutPro) {
1297 return; 1297 return;
1298 } 1298 }
1299 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 1299 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify();
1300 if (!pNotify) { 1300 if (!pNotify) {
1301 return; 1301 return;
1302 } 1302 }
1303 FX_DWORD dwPacket = this->GetPacketID(); 1303 FX_DWORD dwPacket = GetPacketID();
1304 if (dwPacket & XFA_XDPPACKET_Form) { 1304 if (dwPacket & XFA_XDPPACKET_Form) {
1305 FX_BOOL bNeedFindContainer = FALSE; 1305 FX_BOOL bNeedFindContainer = FALSE;
1306 XFA_ELEMENT eType = this->GetClassID(); 1306 XFA_ELEMENT eType = GetClassID();
1307 switch (eType) { 1307 switch (eType) {
1308 case XFA_ELEMENT_Caption: 1308 case XFA_ELEMENT_Caption:
1309 bNeedFindContainer = TRUE; 1309 bNeedFindContainer = TRUE;
1310 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, 1310 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1311 eValue, this, 1311 eValue, this, GetNodeItem(XFA_NODEITEM_Parent));
1312 this->GetNodeItem(XFA_NODEITEM_Parent));
1313 break; 1312 break;
1314 case XFA_ELEMENT_Font: 1313 case XFA_ELEMENT_Font:
1315 case XFA_ELEMENT_Para: { 1314 case XFA_ELEMENT_Para: {
1316 bNeedFindContainer = TRUE; 1315 bNeedFindContainer = TRUE;
1317 CXFA_Node* pParentNode = this->GetNodeItem(XFA_NODEITEM_Parent); 1316 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
1318 if (pParentNode->GetClassID() == XFA_ELEMENT_Caption) { 1317 if (pParentNode->GetClassID() == XFA_ELEMENT_Caption) {
1319 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, 1318 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1320 eValue, pParentNode, 1319 eValue, pParentNode,
1321 pParentNode->GetNodeItem(XFA_NODEITEM_Parent)); 1320 pParentNode->GetNodeItem(XFA_NODEITEM_Parent));
1322 } else { 1321 } else {
1323 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, 1322 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1324 eValue, this, pParentNode); 1323 eValue, this, pParentNode);
1325 } 1324 }
1326 } break; 1325 } break;
1327 case XFA_ELEMENT_Margin: { 1326 case XFA_ELEMENT_Margin: {
1328 bNeedFindContainer = TRUE; 1327 bNeedFindContainer = TRUE;
1329 CXFA_Node* pParentNode = this->GetNodeItem(XFA_NODEITEM_Parent); 1328 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
1330 XFA_ELEMENT eParentType = pParentNode->GetClassID(); 1329 XFA_ELEMENT eParentType = pParentNode->GetClassID();
1331 if (pParentNode->IsContainerNode()) { 1330 if (pParentNode->IsContainerNode()) {
1332 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, 1331 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1333 eValue, this, pParentNode); 1332 eValue, this, pParentNode);
1334 } else if (eParentType == XFA_ELEMENT_Caption) { 1333 } else if (eParentType == XFA_ELEMENT_Caption) {
1335 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, 1334 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1336 eValue, pParentNode, 1335 eValue, pParentNode,
1337 pParentNode->GetNodeItem(XFA_NODEITEM_Parent)); 1336 pParentNode->GetNodeItem(XFA_NODEITEM_Parent));
1338 } else { 1337 } else {
1339 CXFA_Node* pNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent); 1338 CXFA_Node* pNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent);
1340 if (pNode && pNode->GetClassID() == XFA_ELEMENT_Ui) { 1339 if (pNode && pNode->GetClassID() == XFA_ELEMENT_Ui) {
1341 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, 1340 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1342 eValue, pNode, 1341 eValue, pNode,
1343 pNode->GetNodeItem(XFA_NODEITEM_Parent)); 1342 pNode->GetNodeItem(XFA_NODEITEM_Parent));
1344 } 1343 }
1345 } 1344 }
1346 } break; 1345 } break;
1347 case XFA_ELEMENT_Comb: { 1346 case XFA_ELEMENT_Comb: {
1348 CXFA_Node* pEditNode = this->GetNodeItem(XFA_NODEITEM_Parent); 1347 CXFA_Node* pEditNode = GetNodeItem(XFA_NODEITEM_Parent);
1349 XFA_ELEMENT eUIType = pEditNode->GetClassID(); 1348 XFA_ELEMENT eUIType = pEditNode->GetClassID();
1350 if (pEditNode && (eUIType == XFA_ELEMENT_DateTimeEdit || 1349 if (pEditNode && (eUIType == XFA_ELEMENT_DateTimeEdit ||
1351 eUIType == XFA_ELEMENT_NumericEdit || 1350 eUIType == XFA_ELEMENT_NumericEdit ||
1352 eUIType == XFA_ELEMENT_TextEdit)) { 1351 eUIType == XFA_ELEMENT_TextEdit)) {
1353 CXFA_Node* pUINode = pEditNode->GetNodeItem(XFA_NODEITEM_Parent); 1352 CXFA_Node* pUINode = pEditNode->GetNodeItem(XFA_NODEITEM_Parent);
1354 if (pUINode) { 1353 if (pUINode) {
1355 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, 1354 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1356 eValue, pUINode, 1355 eValue, pUINode,
1357 pUINode->GetNodeItem(XFA_NODEITEM_Parent)); 1356 pUINode->GetNodeItem(XFA_NODEITEM_Parent));
1358 } 1357 }
1359 } 1358 }
1360 } break; 1359 } break;
1361 case XFA_ELEMENT_Button: 1360 case XFA_ELEMENT_Button:
1362 case XFA_ELEMENT_Barcode: 1361 case XFA_ELEMENT_Barcode:
1363 case XFA_ELEMENT_ChoiceList: 1362 case XFA_ELEMENT_ChoiceList:
1364 case XFA_ELEMENT_DateTimeEdit: 1363 case XFA_ELEMENT_DateTimeEdit:
1365 case XFA_ELEMENT_NumericEdit: 1364 case XFA_ELEMENT_NumericEdit:
1366 case XFA_ELEMENT_PasswordEdit: 1365 case XFA_ELEMENT_PasswordEdit:
1367 case XFA_ELEMENT_TextEdit: { 1366 case XFA_ELEMENT_TextEdit: {
1368 CXFA_Node* pUINode = this->GetNodeItem(XFA_NODEITEM_Parent); 1367 CXFA_Node* pUINode = GetNodeItem(XFA_NODEITEM_Parent);
1369 if (pUINode) { 1368 if (pUINode) {
1370 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, 1369 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1371 eValue, pUINode, 1370 eValue, pUINode,
1372 pUINode->GetNodeItem(XFA_NODEITEM_Parent)); 1371 pUINode->GetNodeItem(XFA_NODEITEM_Parent));
1373 } 1372 }
1374 } break; 1373 } break;
1375 case XFA_ELEMENT_CheckButton: { 1374 case XFA_ELEMENT_CheckButton: {
1376 bNeedFindContainer = TRUE; 1375 bNeedFindContainer = TRUE;
1377 CXFA_Node* pUINode = this->GetNodeItem(XFA_NODEITEM_Parent); 1376 CXFA_Node* pUINode = GetNodeItem(XFA_NODEITEM_Parent);
1378 if (pUINode) { 1377 if (pUINode) {
1379 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, 1378 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1380 eValue, pUINode, 1379 eValue, pUINode,
1381 pUINode->GetNodeItem(XFA_NODEITEM_Parent)); 1380 pUINode->GetNodeItem(XFA_NODEITEM_Parent));
1382 } 1381 }
1383 } break; 1382 } break;
1384 case XFA_ELEMENT_Keep: 1383 case XFA_ELEMENT_Keep:
1385 case XFA_ELEMENT_Bookend: 1384 case XFA_ELEMENT_Bookend:
1386 case XFA_ELEMENT_Break: 1385 case XFA_ELEMENT_Break:
1387 case XFA_ELEMENT_BreakAfter: 1386 case XFA_ELEMENT_BreakAfter:
1388 case XFA_ELEMENT_BreakBefore: 1387 case XFA_ELEMENT_BreakBefore:
1389 case XFA_ELEMENT_Overflow: 1388 case XFA_ELEMENT_Overflow:
1390 bNeedFindContainer = TRUE; 1389 bNeedFindContainer = TRUE;
1391 break; 1390 break;
1392 case XFA_ELEMENT_Area: 1391 case XFA_ELEMENT_Area:
1393 case XFA_ELEMENT_Draw: 1392 case XFA_ELEMENT_Draw:
1394 case XFA_ELEMENT_ExclGroup: 1393 case XFA_ELEMENT_ExclGroup:
1395 case XFA_ELEMENT_Field: 1394 case XFA_ELEMENT_Field:
1396 case XFA_ELEMENT_Subform: 1395 case XFA_ELEMENT_Subform:
1397 case XFA_ELEMENT_SubformSet: 1396 case XFA_ELEMENT_SubformSet:
1398 pLayoutPro->AddChangedContainer(this); 1397 pLayoutPro->AddChangedContainer(this);
1399 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, 1398 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1400 eValue, this, this); 1399 eValue, this, this);
1401 break; 1400 break;
1402 case XFA_ELEMENT_Sharptext: 1401 case XFA_ELEMENT_Sharptext:
1403 case XFA_ELEMENT_Sharpxml: 1402 case XFA_ELEMENT_Sharpxml:
1404 case XFA_ELEMENT_SharpxHTML: { 1403 case XFA_ELEMENT_SharpxHTML: {
1405 CXFA_Node* pTextNode = this->GetNodeItem(XFA_NODEITEM_Parent); 1404 CXFA_Node* pTextNode = GetNodeItem(XFA_NODEITEM_Parent);
1406 if (!pTextNode) { 1405 if (!pTextNode) {
1407 return; 1406 return;
1408 } 1407 }
1409 CXFA_Node* pValueNode = pTextNode->GetNodeItem(XFA_NODEITEM_Parent); 1408 CXFA_Node* pValueNode = pTextNode->GetNodeItem(XFA_NODEITEM_Parent);
1410 if (!pValueNode) { 1409 if (!pValueNode) {
1411 return; 1410 return;
1412 } 1411 }
1413 XFA_ELEMENT eType = pValueNode->GetClassID(); 1412 XFA_ELEMENT eType = pValueNode->GetClassID();
1414 if (eType == XFA_ELEMENT_Value) { 1413 if (eType == XFA_ELEMENT_Value) {
1415 bNeedFindContainer = TRUE; 1414 bNeedFindContainer = TRUE;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 } 1456 }
1458 void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue, 1457 void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue,
1459 FX_BOOL bSetting, 1458 FX_BOOL bSetting,
1460 XFA_ATTRIBUTE eAttribute) { 1459 XFA_ATTRIBUTE eAttribute) {
1461 if (bSetting) { 1460 if (bSetting) {
1462 CFX_ByteString szValue; 1461 CFX_ByteString szValue;
1463 FXJSE_Value_ToUTF8String(hValue, szValue); 1462 FXJSE_Value_ToUTF8String(hValue, szValue);
1464 CFX_WideString wsValue = 1463 CFX_WideString wsValue =
1465 CFX_WideString::FromUTF8(szValue, szValue.GetLength()); 1464 CFX_WideString::FromUTF8(szValue, szValue.GetLength());
1466 SetAttribute(eAttribute, wsValue, TRUE); 1465 SetAttribute(eAttribute, wsValue, TRUE);
1467 if (eAttribute == XFA_ATTRIBUTE_Use && 1466 if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_ELEMENT_Desc) {
1468 this->GetClassID() == XFA_ELEMENT_Desc) {
1469 CFX_WideString wsUseVal = wsValue, wsID, wsSOM; 1467 CFX_WideString wsUseVal = wsValue, wsID, wsSOM;
1470 CXFA_Node* pTemplateNode = 1468 CXFA_Node* pTemplateNode =
1471 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template)); 1469 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template));
1472 CXFA_Node* pProtoRoot = 1470 CXFA_Node* pProtoRoot =
1473 pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Subform) 1471 pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Subform)
1474 ->GetFirstChildByClass(XFA_ELEMENT_Proto); 1472 ->GetFirstChildByClass(XFA_ELEMENT_Proto);
1475 if (!wsUseVal.IsEmpty()) { 1473 if (!wsUseVal.IsEmpty()) {
1476 if (wsUseVal[0] == '#') { 1474 if (wsUseVal[0] == '#') {
1477 wsID = CFX_WideString((const FX_WCHAR*)wsUseVal + 1, 1475 wsID = CFX_WideString((const FX_WCHAR*)wsUseVal + 1,
1478 wsUseVal.GetLength() - 1); 1476 wsUseVal.GetLength() - 1);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 CFX_ByteString newValue; 1652 CFX_ByteString newValue;
1655 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { 1653 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) {
1656 FXJSE_Value_ToUTF8String(hValue, newValue); 1654 FXJSE_Value_ToUTF8String(hValue, newValue);
1657 } 1655 }
1658 CFX_WideString wsNewValue = 1656 CFX_WideString wsNewValue =
1659 CFX_WideString::FromUTF8(newValue, newValue.GetLength()); 1657 CFX_WideString::FromUTF8(newValue, newValue.GetLength());
1660 CFX_WideString wsFormatValue(wsNewValue); 1658 CFX_WideString wsFormatValue(wsNewValue);
1661 CXFA_WidgetData* pContainerWidgetData = NULL; 1659 CXFA_WidgetData* pContainerWidgetData = NULL;
1662 if (GetPacketID() == XFA_XDPPACKET_Datasets) { 1660 if (GetPacketID() == XFA_XDPPACKET_Datasets) {
1663 CXFA_NodeArray formNodes; 1661 CXFA_NodeArray formNodes;
1664 this->GetBindItems(formNodes); 1662 GetBindItems(formNodes);
1665 CFX_WideString wsPicture; 1663 CFX_WideString wsPicture;
1666 for (int32_t i = 0; i < formNodes.GetSize(); i++) { 1664 for (int32_t i = 0; i < formNodes.GetSize(); i++) {
1667 CXFA_Node* pFormNode = formNodes.GetAt(i); 1665 CXFA_Node* pFormNode = formNodes.GetAt(i);
1668 if (!pFormNode || pFormNode->HasFlag(XFA_NODEFLAG_HasRemoved)) { 1666 if (!pFormNode || pFormNode->HasFlag(XFA_NODEFLAG_HasRemoved)) {
1669 continue; 1667 continue;
1670 } 1668 }
1671 pContainerWidgetData = pFormNode->GetContainerWidgetData(); 1669 pContainerWidgetData = pFormNode->GetContainerWidgetData();
1672 if (pContainerWidgetData) { 1670 if (pContainerWidgetData) {
1673 pContainerWidgetData->GetPictureContent(wsPicture, 1671 pContainerWidgetData->GetPictureContent(wsPicture,
1674 XFA_VALUEPICTURE_DataBind); 1672 XFA_VALUEPICTURE_DataBind);
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
2545 } 2543 }
2546 } 2544 }
2547 } else { 2545 } else {
2548 FXJSE_Value_SetInteger(hValue, Subform_and_SubformSet_InstanceIndex()); 2546 FXJSE_Value_SetInteger(hValue, Subform_and_SubformSet_InstanceIndex());
2549 } 2547 }
2550 } 2548 }
2551 void CXFA_Node::Script_Subform_InstanceManager(FXJSE_HVALUE hValue, 2549 void CXFA_Node::Script_Subform_InstanceManager(FXJSE_HVALUE hValue,
2552 FX_BOOL bSetting, 2550 FX_BOOL bSetting,
2553 XFA_ATTRIBUTE eAttribute) { 2551 XFA_ATTRIBUTE eAttribute) {
2554 if (!bSetting) { 2552 if (!bSetting) {
2555 CFX_WideStringC wsName = this->GetCData(XFA_ATTRIBUTE_Name); 2553 CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name);
2556 CXFA_Node* pInstanceMgr = NULL; 2554 CXFA_Node* pInstanceMgr = NULL;
2557 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); 2555 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling);
2558 pNode != NULL; pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { 2556 pNode != NULL; pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) {
2559 if (pNode->GetClassID() == XFA_ELEMENT_InstanceManager) { 2557 if (pNode->GetClassID() == XFA_ELEMENT_InstanceManager) {
2560 CFX_WideStringC wsInstMgrName = pNode->GetCData(XFA_ATTRIBUTE_Name); 2558 CFX_WideStringC wsInstMgrName = pNode->GetCData(XFA_ATTRIBUTE_Name);
2561 if (wsInstMgrName.GetLength() >= 1 && wsInstMgrName.GetAt(0) == '_' && 2559 if (wsInstMgrName.GetLength() >= 1 && wsInstMgrName.GetAt(0) == '_' &&
2562 wsInstMgrName.Mid(1) == wsName) { 2560 wsInstMgrName.Mid(1) == wsName) {
2563 pInstanceMgr = pNode; 2561 pInstanceMgr = pNode;
2564 } 2562 }
2565 break; 2563 break;
2566 } 2564 }
2567 } 2565 }
2568 if (pInstanceMgr) { 2566 if (pInstanceMgr) {
2569 FXJSE_Value_Set( 2567 FXJSE_Value_Set(
2570 hValue, 2568 hValue,
2571 m_pDocument->GetScriptContext()->GetJSValueFromMap(pInstanceMgr)); 2569 m_pDocument->GetScriptContext()->GetJSValueFromMap(pInstanceMgr));
2572 } else { 2570 } else {
2573 FXJSE_Value_SetNull(hValue); 2571 FXJSE_Value_SetNull(hValue);
2574 } 2572 }
2575 } else { 2573 } else {
2576 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 2574 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
2577 } 2575 }
2578 } 2576 }
2579 void CXFA_Node::Script_Subform_Locale(FXJSE_HVALUE hValue, 2577 void CXFA_Node::Script_Subform_Locale(FXJSE_HVALUE hValue,
2580 FX_BOOL bSetting, 2578 FX_BOOL bSetting,
2581 XFA_ATTRIBUTE eAttribute) { 2579 XFA_ATTRIBUTE eAttribute) {
2582 if (bSetting) { 2580 if (bSetting) {
2583 CFX_ByteString bsLocaleName; 2581 CFX_ByteString bsLocaleName;
2584 FXJSE_Value_ToUTF8String(hValue, bsLocaleName); 2582 FXJSE_Value_ToUTF8String(hValue, bsLocaleName);
2585 this->SetCData( 2583 SetCData(XFA_ATTRIBUTE_Locale,
2586 XFA_ATTRIBUTE_Locale, 2584 CFX_WideString::FromUTF8(bsLocaleName, bsLocaleName.GetLength()),
2587 CFX_WideString::FromUTF8(bsLocaleName, bsLocaleName.GetLength()), TRUE, 2585 TRUE, TRUE);
2588 TRUE);
2589 } else { 2586 } else {
2590 CFX_WideString wsLocaleName; 2587 CFX_WideString wsLocaleName;
2591 GetLocaleName(wsLocaleName); 2588 GetLocaleName(wsLocaleName);
2592 FXJSE_Value_SetUTF8String( 2589 FXJSE_Value_SetUTF8String(
2593 hValue, FX_UTF8Encode(wsLocaleName, wsLocaleName.GetLength())); 2590 hValue, FX_UTF8Encode(wsLocaleName, wsLocaleName.GetLength()));
2594 } 2591 }
2595 } 2592 }
2596 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { 2593 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) {
2597 int32_t argc = pArguments->GetLength(); 2594 int32_t argc = pArguments->GetLength();
2598 if (argc == 1) { 2595 if (argc == 1) {
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
3279 } 3276 }
3280 if ((iMax >= 0) && (iDesired > iMax)) { 3277 if ((iMax >= 0) && (iDesired > iMax)) {
3281 ThrowScriptErrorMessage(XFA_IDS_VIOLATE_BOUNDARY, L"max"); 3278 ThrowScriptErrorMessage(XFA_IDS_VIOLATE_BOUNDARY, L"max");
3282 return 2; 3279 return 2;
3283 } 3280 }
3284 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this); 3281 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this);
3285 if (iDesired == iCount) { 3282 if (iDesired == iCount) {
3286 return 0; 3283 return 0;
3287 } 3284 }
3288 if (iDesired < iCount) { 3285 if (iDesired < iCount) {
3289 CFX_WideStringC wsInstManagerName = this->GetCData(XFA_ATTRIBUTE_Name); 3286 CFX_WideStringC wsInstManagerName = GetCData(XFA_ATTRIBUTE_Name);
3290 CFX_WideString wsInstanceName = wsInstManagerName.IsEmpty() 3287 CFX_WideString wsInstanceName = wsInstManagerName.IsEmpty()
3291 ? wsInstManagerName 3288 ? wsInstManagerName
3292 : wsInstManagerName.Mid(1); 3289 : wsInstManagerName.Mid(1);
3293 FX_DWORD dInstanceNameHash = 3290 FX_DWORD dInstanceNameHash =
3294 wsInstanceName.IsEmpty() ? 0 : FX_HashCode_String_GetW( 3291 wsInstanceName.IsEmpty() ? 0 : FX_HashCode_String_GetW(
3295 wsInstanceName, 3292 wsInstanceName,
3296 wsInstanceName.GetLength()); 3293 wsInstanceName.GetLength());
3297 CXFA_Node* pPrevSibling = 3294 CXFA_Node* pPrevSibling =
3298 (iDesired == 0) ? this 3295 (iDesired == 0) ? this
3299 : XFA_ScriptInstanceManager_GetItem(this, iDesired - 1); 3296 : XFA_ScriptInstanceManager_GetItem(this, iDesired - 1);
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
3967 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); 3964 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType();
3968 switch (eXMLType) { 3965 switch (eXMLType) {
3969 case FDE_XMLNODE_Element: 3966 case FDE_XMLNODE_Element:
3970 if (IsAttributeInXML()) { 3967 if (IsAttributeInXML()) {
3971 ((IFDE_XMLElement*)m_pXMLNode) 3968 ((IFDE_XMLElement*)m_pXMLNode)
3972 ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsValue); 3969 ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsValue);
3973 } else { 3970 } else {
3974 FX_BOOL bDeleteChildren = TRUE; 3971 FX_BOOL bDeleteChildren = TRUE;
3975 if (GetPacketID() == XFA_XDPPACKET_Datasets) { 3972 if (GetPacketID() == XFA_XDPPACKET_Datasets) {
3976 for (CXFA_Node* pChildDataNode = 3973 for (CXFA_Node* pChildDataNode =
3977 this->GetNodeItem(XFA_NODEITEM_FirstChild); 3974 GetNodeItem(XFA_NODEITEM_FirstChild);
3978 pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem( 3975 pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem(
3979 XFA_NODEITEM_NextSibling)) { 3976 XFA_NODEITEM_NextSibling)) {
3980 CXFA_NodeArray formNodes; 3977 CXFA_NodeArray formNodes;
3981 if (pChildDataNode->GetBindItems(formNodes) > 0) { 3978 if (pChildDataNode->GetBindItems(formNodes) > 0) {
3982 bDeleteChildren = FALSE; 3979 bDeleteChildren = FALSE;
3983 break; 3980 break;
3984 } 3981 }
3985 } 3982 }
3986 } 3983 }
3987 if (bDeleteChildren) { 3984 if (bDeleteChildren) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
4027 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); 4024 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType();
4028 switch (eXMLType) { 4025 switch (eXMLType) {
4029 case FDE_XMLNODE_Element: 4026 case FDE_XMLNODE_Element:
4030 if (IsAttributeInXML()) { 4027 if (IsAttributeInXML()) {
4031 ((IFDE_XMLElement*)m_pXMLNode) 4028 ((IFDE_XMLElement*)m_pXMLNode)
4032 ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsXMLValue); 4029 ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsXMLValue);
4033 } else { 4030 } else {
4034 FX_BOOL bDeleteChildren = TRUE; 4031 FX_BOOL bDeleteChildren = TRUE;
4035 if (GetPacketID() == XFA_XDPPACKET_Datasets) { 4032 if (GetPacketID() == XFA_XDPPACKET_Datasets) {
4036 for (CXFA_Node* pChildDataNode = 4033 for (CXFA_Node* pChildDataNode =
4037 this->GetNodeItem(XFA_NODEITEM_FirstChild); 4034 GetNodeItem(XFA_NODEITEM_FirstChild);
4038 pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem( 4035 pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem(
4039 XFA_NODEITEM_NextSibling)) { 4036 XFA_NODEITEM_NextSibling)) {
4040 CXFA_NodeArray formNodes; 4037 CXFA_NodeArray formNodes;
4041 if (pChildDataNode->GetBindItems(formNodes) > 0) { 4038 if (pChildDataNode->GetBindItems(formNodes) > 0) {
4042 bDeleteChildren = FALSE; 4039 bDeleteChildren = FALSE;
4043 break; 4040 break;
4044 } 4041 }
4045 } 4042 }
4046 } 4043 }
4047 if (bDeleteChildren) { 4044 if (bDeleteChildren) {
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
4484 case XFA_XDPPACKET_SourceSet: 4481 case XFA_XDPPACKET_SourceSet:
4485 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_SourceSet)); 4482 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_SourceSet));
4486 case XFA_XDPPACKET_Xdc: 4483 case XFA_XDPPACKET_Xdc:
4487 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Xdc)); 4484 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Xdc));
4488 default: 4485 default:
4489 return this; 4486 return this;
4490 } 4487 }
4491 } 4488 }
4492 FX_BOOL CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) { 4489 FX_BOOL CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) {
4493 wsNamespace.Empty(); 4490 wsNamespace.Empty();
4494 if (this->GetObjectType() == XFA_OBJECTTYPE_ModelNode || 4491 if (GetObjectType() == XFA_OBJECTTYPE_ModelNode ||
4495 this->GetClassID() == XFA_ELEMENT_Packet) { 4492 GetClassID() == XFA_ELEMENT_Packet) {
4496 IFDE_XMLNode* pXMLNode = this->GetXMLMappingNode(); 4493 IFDE_XMLNode* pXMLNode = GetXMLMappingNode();
4497 if (!pXMLNode || pXMLNode->GetType() != FDE_XMLNODE_Element) { 4494 if (!pXMLNode || pXMLNode->GetType() != FDE_XMLNODE_Element) {
4498 return FALSE; 4495 return FALSE;
4499 } 4496 }
4500 ((IFDE_XMLElement*)pXMLNode)->GetNamespaceURI(wsNamespace); 4497 ((IFDE_XMLElement*)pXMLNode)->GetNamespaceURI(wsNamespace);
4501 return TRUE; 4498 return TRUE;
4502 } else if (this->GetPacketID() == XFA_XDPPACKET_Datasets) { 4499 } else if (GetPacketID() == XFA_XDPPACKET_Datasets) {
4503 IFDE_XMLNode* pXMLNode = this->GetXMLMappingNode(); 4500 IFDE_XMLNode* pXMLNode = GetXMLMappingNode();
4504 if (!pXMLNode) { 4501 if (!pXMLNode) {
4505 return FALSE; 4502 return FALSE;
4506 } 4503 }
4507 if (pXMLNode->GetType() != FDE_XMLNODE_Element) { 4504 if (pXMLNode->GetType() != FDE_XMLNODE_Element) {
4508 return TRUE; 4505 return TRUE;
4509 } 4506 }
4510 if (this->GetClassID() == XFA_ELEMENT_DataValue && 4507 if (GetClassID() == XFA_ELEMENT_DataValue &&
4511 this->GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData) { 4508 GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData) {
4512 return XFA_FDEExtension_ResolveNamespaceQualifier( 4509 return XFA_FDEExtension_ResolveNamespaceQualifier(
4513 (IFDE_XMLElement*)pXMLNode, 4510 (IFDE_XMLElement*)pXMLNode, GetCData(XFA_ATTRIBUTE_QualifiedName),
4514 this->GetCData(XFA_ATTRIBUTE_QualifiedName), wsNamespace); 4511 wsNamespace);
4515 } 4512 }
4516 ((IFDE_XMLElement*)pXMLNode)->GetNamespaceURI(wsNamespace); 4513 ((IFDE_XMLElement*)pXMLNode)->GetNamespaceURI(wsNamespace);
4517 return TRUE; 4514 return TRUE;
4518 } else { 4515 } else {
4519 CXFA_Node* pModelNode = GetModelNode(); 4516 CXFA_Node* pModelNode = GetModelNode();
4520 return pModelNode->TryNamespace(wsNamespace); 4517 return pModelNode->TryNamespace(wsNamespace);
4521 } 4518 }
4522 } 4519 }
4523 CXFA_Node* CXFA_Node::GetProperty(int32_t index, 4520 CXFA_Node* CXFA_Node::GetProperty(int32_t index,
4524 XFA_ELEMENT eProperty, 4521 XFA_ELEMENT eProperty,
(...skipping 29 matching lines...) Expand all
4554 } 4551 }
4555 } 4552 }
4556 IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); 4553 IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory();
4557 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(dwPacket); 4554 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(dwPacket);
4558 CXFA_Node* pNewNode; 4555 CXFA_Node* pNewNode;
4559 for (; iCount <= index; iCount++) { 4556 for (; iCount <= index; iCount++) {
4560 pNewNode = pFactory->CreateNode(pPacket, eProperty); 4557 pNewNode = pFactory->CreateNode(pPacket, eProperty);
4561 if (!pNewNode) { 4558 if (!pNewNode) {
4562 return NULL; 4559 return NULL;
4563 } 4560 }
4564 this->InsertChild(pNewNode, NULL); 4561 InsertChild(pNewNode, nullptr);
4565 pNewNode->SetFlag(XFA_NODEFLAG_Initialized); 4562 pNewNode->SetFlag(XFA_NODEFLAG_Initialized);
4566 } 4563 }
4567 return pNewNode; 4564 return pNewNode;
4568 } 4565 }
4569 int32_t CXFA_Node::CountChildren(XFA_ELEMENT eElement, FX_BOOL bOnlyChild) { 4566 int32_t CXFA_Node::CountChildren(XFA_ELEMENT eElement, FX_BOOL bOnlyChild) {
4570 CXFA_Node* pNode = m_pChild; 4567 CXFA_Node* pNode = m_pChild;
4571 int32_t iCount = 0; 4568 int32_t iCount = 0;
4572 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 4569 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
4573 if (pNode->GetClassID() == eElement || eElement == XFA_ELEMENT_UNKNOWN) { 4570 if (pNode->GetClassID() == eElement || eElement == XFA_ELEMENT_UNKNOWN) {
4574 if (bOnlyChild) { 4571 if (bOnlyChild) {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
4739 m_pXMLNode->GetType() == FDE_XMLNODE_Element); 4736 m_pXMLNode->GetType() == FDE_XMLNODE_Element);
4740 if (pNode->m_pXMLNode->GetType() == FDE_XMLNODE_Element) { 4737 if (pNode->m_pXMLNode->GetType() == FDE_XMLNODE_Element) {
4741 IFDE_XMLElement* pXMLElement = (IFDE_XMLElement*)(pNode->m_pXMLNode); 4738 IFDE_XMLElement* pXMLElement = (IFDE_XMLElement*)(pNode->m_pXMLNode);
4742 CFX_WideStringC wsAttributeName = 4739 CFX_WideStringC wsAttributeName =
4743 pNode->GetCData(XFA_ATTRIBUTE_QualifiedName); 4740 pNode->GetCData(XFA_ATTRIBUTE_QualifiedName);
4744 pXMLElement->RemoveAttribute(wsAttributeName.GetPtr()); 4741 pXMLElement->RemoveAttribute(wsAttributeName.GetPtr());
4745 } 4742 }
4746 CFX_WideString wsName; 4743 CFX_WideString wsName;
4747 pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); 4744 pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE);
4748 IFDE_XMLElement* pNewXMLElement = IFDE_XMLElement::Create(wsName); 4745 IFDE_XMLElement* pNewXMLElement = IFDE_XMLElement::Create(wsName);
4749 CFX_WideStringC wsValue = this->GetCData(XFA_ATTRIBUTE_Value); 4746 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value);
4750 if (!wsValue.IsEmpty()) { 4747 if (!wsValue.IsEmpty()) {
4751 pNewXMLElement->SetTextData(wsValue); 4748 pNewXMLElement->SetTextData(wsValue);
4752 } 4749 }
4753 pNode->m_pXMLNode = pNewXMLElement; 4750 pNode->m_pXMLNode = pNewXMLElement;
4754 pNode->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown); 4751 pNode->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown);
4755 } else { 4752 } else {
4756 m_pXMLNode->RemoveChildNode(pNode->m_pXMLNode); 4753 m_pXMLNode->RemoveChildNode(pNode->m_pXMLNode);
4757 } 4754 }
4758 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); 4755 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE);
4759 } 4756 }
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
5010 return m_pXMLNode && (GetPacketID() == XFA_XDPPACKET_Datasets || 5007 return m_pXMLNode && (GetPacketID() == XFA_XDPPACKET_Datasets ||
5011 GetClassID() == XFA_ELEMENT_Xfa); 5008 GetClassID() == XFA_ELEMENT_Xfa);
5012 } 5009 }
5013 XFA_LPMAPMODULEDATA CXFA_Node::GetMapModuleData(FX_BOOL bCreateNew) { 5010 XFA_LPMAPMODULEDATA CXFA_Node::GetMapModuleData(FX_BOOL bCreateNew) {
5014 if (!m_pMapModuleData && bCreateNew) { 5011 if (!m_pMapModuleData && bCreateNew) {
5015 m_pMapModuleData = new XFA_MAPMODULEDATA; 5012 m_pMapModuleData = new XFA_MAPMODULEDATA;
5016 } 5013 }
5017 return m_pMapModuleData; 5014 return m_pMapModuleData;
5018 } 5015 }
5019 void CXFA_Node::SetMapModuleValue(void* pKey, void* pValue) { 5016 void CXFA_Node::SetMapModuleValue(void* pKey, void* pValue) {
5020 XFA_LPMAPMODULEDATA pMoudle = this->GetMapModuleData(TRUE); 5017 XFA_LPMAPMODULEDATA pModule = GetMapModuleData(TRUE);
5021 if (!pMoudle) { 5018 if (pModule)
5022 return; 5019 pModule->m_ValueMap.SetAt(pKey, pValue);
5023 }
5024 pMoudle->m_ValueMap.SetAt(pKey, pValue);
5025 } 5020 }
5026 FX_BOOL CXFA_Node::GetMapModuleValue(void* pKey, void*& pValue) { 5021 FX_BOOL CXFA_Node::GetMapModuleValue(void* pKey, void*& pValue) {
5027 CXFA_Node* pNode = this; 5022 CXFA_Node* pNode = this;
5028 while (pNode) { 5023 while (pNode) {
5029 XFA_LPMAPMODULEDATA pMoudle = pNode->GetMapModuleData(FALSE); 5024 XFA_LPMAPMODULEDATA pModule = pNode->GetMapModuleData(FALSE);
5030 if (pMoudle && pMoudle->m_ValueMap.Lookup(pKey, pValue)) { 5025 if (pModule && pModule->m_ValueMap.Lookup(pKey, pValue)) {
5031 return TRUE; 5026 return TRUE;
5032 } 5027 }
5033 pNode = pNode->GetPacketID() != XFA_XDPPACKET_Datasets 5028 pNode = pNode->GetPacketID() != XFA_XDPPACKET_Datasets
5034 ? pNode->GetTemplateNode() 5029 ? pNode->GetTemplateNode()
5035 : NULL; 5030 : NULL;
5036 } 5031 }
5037 return FALSE; 5032 return FALSE;
5038 } 5033 }
5039 void CXFA_Node::SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue) { 5034 void CXFA_Node::SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue) {
5040 SetMapModuleBuffer(pKey, (void*)wsValue.GetPtr(), 5035 SetMapModuleBuffer(pKey, (void*)wsValue.GetPtr(),
5041 wsValue.GetLength() * sizeof(FX_WCHAR)); 5036 wsValue.GetLength() * sizeof(FX_WCHAR));
5042 } 5037 }
5043 FX_BOOL CXFA_Node::GetMapModuleString(void* pKey, CFX_WideStringC& wsValue) { 5038 FX_BOOL CXFA_Node::GetMapModuleString(void* pKey, CFX_WideStringC& wsValue) {
5044 void* pValue; 5039 void* pValue;
5045 int32_t iBytes; 5040 int32_t iBytes;
5046 if (!GetMapModuleBuffer(pKey, pValue, iBytes)) { 5041 if (!GetMapModuleBuffer(pKey, pValue, iBytes)) {
5047 return FALSE; 5042 return FALSE;
5048 } 5043 }
5049 wsValue = CFX_WideStringC((const FX_WCHAR*)pValue, iBytes / sizeof(FX_WCHAR)); 5044 wsValue = CFX_WideStringC((const FX_WCHAR*)pValue, iBytes / sizeof(FX_WCHAR));
5050 return TRUE; 5045 return TRUE;
5051 } 5046 }
5052 void CXFA_Node::SetMapModuleBuffer( 5047 void CXFA_Node::SetMapModuleBuffer(
5053 void* pKey, 5048 void* pKey,
5054 void* pValue, 5049 void* pValue,
5055 int32_t iBytes, 5050 int32_t iBytes,
5056 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo) { 5051 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo) {
5057 XFA_LPMAPMODULEDATA pMoudle = this->GetMapModuleData(TRUE); 5052 XFA_LPMAPMODULEDATA pModule = GetMapModuleData(TRUE);
5058 if (!pMoudle) { 5053 if (!pModule)
5059 return; 5054 return;
5060 } 5055
5061 XFA_LPMAPDATABLOCK& pBuffer = pMoudle->m_BufferMap[pKey]; 5056 XFA_LPMAPDATABLOCK& pBuffer = pModule->m_BufferMap[pKey];
5062 if (pBuffer == NULL) { 5057 if (pBuffer == NULL) {
5063 pBuffer = (XFA_LPMAPDATABLOCK)FX_Alloc(uint8_t, 5058 pBuffer = (XFA_LPMAPDATABLOCK)FX_Alloc(uint8_t,
5064 sizeof(XFA_MAPDATABLOCK) + iBytes); 5059 sizeof(XFA_MAPDATABLOCK) + iBytes);
5065 } else if (pBuffer->iBytes != iBytes) { 5060 } else if (pBuffer->iBytes != iBytes) {
5066 if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree) { 5061 if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree) {
5067 pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData()); 5062 pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData());
5068 } 5063 }
5069 pBuffer = (XFA_LPMAPDATABLOCK)FX_Realloc(uint8_t, pBuffer, 5064 pBuffer = (XFA_LPMAPDATABLOCK)FX_Realloc(uint8_t, pBuffer,
5070 sizeof(XFA_MAPDATABLOCK) + iBytes); 5065 sizeof(XFA_MAPDATABLOCK) + iBytes);
5071 } else if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree) { 5066 } else if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree) {
5072 pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData()); 5067 pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData());
5073 } 5068 }
5074 if (pBuffer == NULL) { 5069 if (pBuffer == NULL) {
5075 return; 5070 return;
5076 } 5071 }
5077 pBuffer->pCallbackInfo = pCallbackInfo; 5072 pBuffer->pCallbackInfo = pCallbackInfo;
5078 pBuffer->iBytes = iBytes; 5073 pBuffer->iBytes = iBytes;
5079 FXSYS_memcpy(pBuffer->GetData(), pValue, iBytes); 5074 FXSYS_memcpy(pBuffer->GetData(), pValue, iBytes);
5080 } 5075 }
5081 FX_BOOL CXFA_Node::GetMapModuleBuffer(void* pKey, 5076 FX_BOOL CXFA_Node::GetMapModuleBuffer(void* pKey,
5082 void*& pValue, 5077 void*& pValue,
5083 int32_t& iBytes, 5078 int32_t& iBytes,
5084 FX_BOOL bProtoAlso) { 5079 FX_BOOL bProtoAlso) {
5085 XFA_LPMAPDATABLOCK pBuffer = NULL; 5080 XFA_LPMAPDATABLOCK pBuffer = NULL;
5086 CXFA_Node* pNode = this; 5081 CXFA_Node* pNode = this;
5087 while (pNode) { 5082 while (pNode) {
5088 XFA_LPMAPMODULEDATA pMoudle = pNode->GetMapModuleData(FALSE); 5083 XFA_LPMAPMODULEDATA pModule = pNode->GetMapModuleData(FALSE);
5089 if (pMoudle && pMoudle->m_BufferMap.Lookup(pKey, pBuffer)) { 5084 if (pModule && pModule->m_BufferMap.Lookup(pKey, pBuffer)) {
5090 break; 5085 break;
5091 } 5086 }
5092 pNode = (bProtoAlso && pNode->GetPacketID() != XFA_XDPPACKET_Datasets) 5087 pNode = (bProtoAlso && pNode->GetPacketID() != XFA_XDPPACKET_Datasets)
5093 ? pNode->GetTemplateNode() 5088 ? pNode->GetTemplateNode()
5094 : NULL; 5089 : NULL;
5095 } 5090 }
5096 if (pBuffer == NULL) { 5091 if (pBuffer == NULL) {
5097 return FALSE; 5092 return FALSE;
5098 } 5093 }
5099 pValue = pBuffer->GetData(); 5094 pValue = pBuffer->GetData();
5100 iBytes = pBuffer->iBytes; 5095 iBytes = pBuffer->iBytes;
5101 return TRUE; 5096 return TRUE;
5102 } 5097 }
5103 FX_BOOL CXFA_Node::HasMapModuleKey(void* pKey, FX_BOOL bProtoAlso) { 5098 FX_BOOL CXFA_Node::HasMapModuleKey(void* pKey, FX_BOOL bProtoAlso) {
5104 CXFA_Node* pNode = this; 5099 CXFA_Node* pNode = this;
5105 while (pNode) { 5100 while (pNode) {
5106 void* pVal; 5101 void* pVal;
5107 XFA_LPMAPMODULEDATA pMoudle = pNode->GetMapModuleData(FALSE); 5102 XFA_LPMAPMODULEDATA pModule = pNode->GetMapModuleData(FALSE);
5108 if (pMoudle && 5103 if (pModule &&
5109 (pMoudle->m_ValueMap.Lookup(pKey, pVal) || 5104 (pModule->m_ValueMap.Lookup(pKey, pVal) ||
5110 pMoudle->m_BufferMap.Lookup(pKey, (XFA_LPMAPDATABLOCK&)pVal))) { 5105 pModule->m_BufferMap.Lookup(pKey, (XFA_LPMAPDATABLOCK&)pVal))) {
5111 return TRUE; 5106 return TRUE;
5112 } 5107 }
5113 pNode = (bProtoAlso && pNode->GetPacketID() != XFA_XDPPACKET_Datasets) 5108 pNode = (bProtoAlso && pNode->GetPacketID() != XFA_XDPPACKET_Datasets)
5114 ? pNode->GetTemplateNode() 5109 ? pNode->GetTemplateNode()
5115 : NULL; 5110 : NULL;
5116 } 5111 }
5117 return FALSE; 5112 return FALSE;
5118 } 5113 }
5119 void CXFA_Node::RemoveMapModuleKey(void* pKey) { 5114 void CXFA_Node::RemoveMapModuleKey(void* pKey) {
5120 XFA_LPMAPMODULEDATA pMoudle = this->GetMapModuleData(FALSE); 5115 XFA_LPMAPMODULEDATA pModule = GetMapModuleData(FALSE);
5121 if (!pMoudle) { 5116 if (!pModule)
5122 return; 5117 return;
5123 } 5118
5124 if (pKey) { 5119 if (pKey) {
5125 XFA_LPMAPDATABLOCK pBuffer = NULL; 5120 XFA_LPMAPDATABLOCK pBuffer = NULL;
5126 pMoudle->m_BufferMap.Lookup(pKey, pBuffer); 5121 pModule->m_BufferMap.Lookup(pKey, pBuffer);
5127 if (pBuffer) { 5122 if (pBuffer) {
5128 if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree) { 5123 if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree) {
5129 pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData()); 5124 pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData());
5130 } 5125 }
5131 FX_Free(pBuffer); 5126 FX_Free(pBuffer);
5132 } 5127 }
5133 pMoudle->m_BufferMap.RemoveKey(pKey); 5128 pModule->m_BufferMap.RemoveKey(pKey);
5134 pMoudle->m_ValueMap.RemoveKey(pKey); 5129 pModule->m_ValueMap.RemoveKey(pKey);
5135 } else { 5130 } else {
5136 XFA_LPMAPDATABLOCK pBuffer; 5131 XFA_LPMAPDATABLOCK pBuffer;
5137 FX_POSITION posBuffer = pMoudle->m_BufferMap.GetStartPosition(); 5132 FX_POSITION posBuffer = pModule->m_BufferMap.GetStartPosition();
5138 while (posBuffer) { 5133 while (posBuffer) {
5139 pMoudle->m_BufferMap.GetNextAssoc(posBuffer, pKey, pBuffer); 5134 pModule->m_BufferMap.GetNextAssoc(posBuffer, pKey, pBuffer);
5140 if (pBuffer) { 5135 if (pBuffer) {
5141 if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree) { 5136 if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree) {
5142 pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData()); 5137 pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData());
5143 } 5138 }
5144 FX_Free(pBuffer); 5139 FX_Free(pBuffer);
5145 } 5140 }
5146 } 5141 }
5147 pMoudle->m_BufferMap.RemoveAll(); 5142 pModule->m_BufferMap.RemoveAll();
5148 pMoudle->m_ValueMap.RemoveAll(); 5143 pModule->m_ValueMap.RemoveAll();
5149 if (pMoudle) { 5144 delete pModule;
5150 delete pMoudle;
5151 pMoudle = NULL;
5152 }
5153 } 5145 }
5154 } 5146 }
5155 void CXFA_Node::MergeAllData(void* pDstModule, FX_BOOL bUseSrcAttr) { 5147 void CXFA_Node::MergeAllData(void* pDstModule, FX_BOOL bUseSrcAttr) {
5156 XFA_LPMAPMODULEDATA pDstModuleData = 5148 XFA_LPMAPMODULEDATA pDstModuleData =
5157 static_cast<CXFA_Node*>(pDstModule)->GetMapModuleData(TRUE); 5149 static_cast<CXFA_Node*>(pDstModule)->GetMapModuleData(TRUE);
5158 if (!pDstModuleData) { 5150 if (!pDstModuleData) {
5159 return; 5151 return;
5160 } 5152 }
5161 XFA_LPMAPMODULEDATA pSrcModuleData = this->GetMapModuleData(FALSE); 5153 XFA_LPMAPMODULEDATA pSrcModuleData = GetMapModuleData(FALSE);
5162 if (!pSrcModuleData) { 5154 if (!pSrcModuleData) {
5163 return; 5155 return;
5164 } 5156 }
5165 FX_POSITION psValue = pSrcModuleData->m_ValueMap.GetStartPosition(); 5157 FX_POSITION psValue = pSrcModuleData->m_ValueMap.GetStartPosition();
5166 while (psValue) { 5158 while (psValue) {
5167 void* pKey; 5159 void* pKey;
5168 void* pValue; 5160 void* pValue;
5169 pSrcModuleData->m_ValueMap.GetNextAssoc(psValue, pKey, pValue); 5161 pSrcModuleData->m_ValueMap.GetNextAssoc(psValue, pKey, pValue);
5170 if (bUseSrcAttr || !pDstModuleData->m_ValueMap.GetValueAt(pKey)) { 5162 if (bUseSrcAttr || !pDstModuleData->m_ValueMap.GetValueAt(pKey)) {
5171 pDstModuleData->m_ValueMap.SetAt(pKey, pValue); 5163 pDstModuleData->m_ValueMap.SetAt(pKey, pValue);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
5212 } 5204 }
5213 } 5205 }
5214 void CXFA_Node::MoveBufferMapData(CXFA_Node* pDstModule, void* pKey) { 5206 void CXFA_Node::MoveBufferMapData(CXFA_Node* pDstModule, void* pKey) {
5215 if (!pDstModule) { 5207 if (!pDstModule) {
5216 return; 5208 return;
5217 } 5209 }
5218 FX_BOOL bNeedMove = TRUE; 5210 FX_BOOL bNeedMove = TRUE;
5219 if (!pKey) { 5211 if (!pKey) {
5220 bNeedMove = FALSE; 5212 bNeedMove = FALSE;
5221 } 5213 }
5222 if (pDstModule->GetClassID() != this->GetClassID()) { 5214 if (pDstModule->GetClassID() != GetClassID()) {
5223 bNeedMove = FALSE; 5215 bNeedMove = FALSE;
5224 } 5216 }
5225 XFA_LPMAPMODULEDATA pSrcModuleData = NULL; 5217 XFA_LPMAPMODULEDATA pSrcModuleData = NULL;
5226 XFA_LPMAPMODULEDATA pDstModuleData = NULL; 5218 XFA_LPMAPMODULEDATA pDstModuleData = NULL;
5227 if (bNeedMove) { 5219 if (bNeedMove) {
5228 pSrcModuleData = this->GetMapModuleData(FALSE); 5220 pSrcModuleData = GetMapModuleData(FALSE);
5229 if (!pSrcModuleData) { 5221 if (!pSrcModuleData) {
5230 bNeedMove = FALSE; 5222 bNeedMove = FALSE;
5231 } 5223 }
5232 pDstModuleData = pDstModule->GetMapModuleData(TRUE); 5224 pDstModuleData = pDstModule->GetMapModuleData(TRUE);
5233 if (!pDstModuleData) { 5225 if (!pDstModuleData) {
5234 bNeedMove = FALSE; 5226 bNeedMove = FALSE;
5235 } 5227 }
5236 } 5228 }
5237 if (bNeedMove) { 5229 if (bNeedMove) {
5238 void* pBufferBlockData = pSrcModuleData->m_BufferMap.GetValueAt(pKey); 5230 void* pBufferBlockData = pSrcModuleData->m_BufferMap.GetValueAt(pKey);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
5438 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); 5430 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode);
5439 } 5431 }
5440 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { 5432 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) {
5441 return m_pAttachNode->RemoveChild(pNode); 5433 return m_pAttachNode->RemoveChild(pNode);
5442 } 5434 }
5443 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { 5435 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) {
5444 return m_pAttachNode->GetChild( 5436 return m_pAttachNode->GetChild(
5445 iIndex, XFA_ELEMENT_UNKNOWN, 5437 iIndex, XFA_ELEMENT_UNKNOWN,
5446 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); 5438 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform);
5447 } 5439 }
OLDNEW
« no previous file with comments | « xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp ('k') | xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698