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

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

Issue 1979723003: Make CFX_WideString(const CFX_WideString&) explicit. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Override Created 4 years, 7 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
« no previous file with comments | « xfa/fxfa/parser/xfa_localemgr.cpp ('k') | xfa/fxfa/parser/xfa_parser_imp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/fxfa/parser/xfa_object.h" 7 #include "xfa/fxfa/parser/xfa_object.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 MergeAllData(pClone); 133 MergeAllData(pClone);
134 pClone->UpdateNameHash(); 134 pClone->UpdateNameHash();
135 if (IsNeedSavingXMLNode()) { 135 if (IsNeedSavingXMLNode()) {
136 CFDE_XMLNode* pCloneXML = NULL; 136 CFDE_XMLNode* pCloneXML = NULL;
137 if (IsAttributeInXML()) { 137 if (IsAttributeInXML()) {
138 CFX_WideString wsName; 138 CFX_WideString wsName;
139 GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); 139 GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE);
140 CFDE_XMLElement* pCloneXMLElement = new CFDE_XMLElement(wsName); 140 CFDE_XMLElement* pCloneXMLElement = new CFDE_XMLElement(wsName);
141 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); 141 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value);
142 if (!wsValue.IsEmpty()) { 142 if (!wsValue.IsEmpty()) {
143 pCloneXMLElement->SetTextData(wsValue); 143 pCloneXMLElement->SetTextData(CFX_WideString(wsValue));
144 } 144 }
145 pCloneXML = pCloneXMLElement; 145 pCloneXML = pCloneXMLElement;
146 pCloneXMLElement = NULL; 146 pCloneXMLElement = NULL;
147 pClone->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown); 147 pClone->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown);
148 } else { 148 } else {
149 pCloneXML = m_pXMLNode->Clone(FALSE); 149 pCloneXML = m_pXMLNode->Clone(FALSE);
150 } 150 }
151 pClone->SetXMLMappingNode(pCloneXML); 151 pClone->SetXMLMappingNode(pCloneXML);
152 pClone->SetFlag(XFA_NODEFLAG_OwnXMLNode, false); 152 pClone->SetFlag(XFA_NODEFLAG_OwnXMLNode, false);
153 } 153 }
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 return; 974 return;
975 } 975 }
976 if (bIgnoreRoot && 976 if (bIgnoreRoot &&
977 (pXMLNode->GetType() != FDE_XMLNODE_Element || 977 (pXMLNode->GetType() != FDE_XMLNODE_Element ||
978 XFA_RecognizeRichText(static_cast<CFDE_XMLElement*>(pXMLNode)))) { 978 XFA_RecognizeRichText(static_cast<CFDE_XMLElement*>(pXMLNode)))) {
979 bIgnoreRoot = FALSE; 979 bIgnoreRoot = FALSE;
980 } 980 }
981 CXFA_Node* pFakeRoot = Clone(FALSE); 981 CXFA_Node* pFakeRoot = Clone(FALSE);
982 CFX_WideStringC wsContentType = GetCData(XFA_ATTRIBUTE_ContentType); 982 CFX_WideStringC wsContentType = GetCData(XFA_ATTRIBUTE_ContentType);
983 if (!wsContentType.IsEmpty()) { 983 if (!wsContentType.IsEmpty()) {
984 pFakeRoot->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); 984 pFakeRoot->SetCData(XFA_ATTRIBUTE_ContentType,
985 CFX_WideString(wsContentType));
985 } 986 }
986 CFDE_XMLNode* pFakeXMLRoot = pFakeRoot->GetXMLMappingNode(); 987 CFDE_XMLNode* pFakeXMLRoot = pFakeRoot->GetXMLMappingNode();
987 if (!pFakeXMLRoot) { 988 if (!pFakeXMLRoot) {
988 CFDE_XMLNode* pThisXMLRoot = GetXMLMappingNode(); 989 CFDE_XMLNode* pThisXMLRoot = GetXMLMappingNode();
989 pFakeXMLRoot = pThisXMLRoot ? pThisXMLRoot->Clone(FALSE) : NULL; 990 pFakeXMLRoot = pThisXMLRoot ? pThisXMLRoot->Clone(FALSE) : NULL;
990 } 991 }
991 if (!pFakeXMLRoot) { 992 if (!pFakeXMLRoot) {
992 CFX_WideStringC wsClassName; 993 CFX_WideStringC wsClassName;
993 GetClassName(wsClassName); 994 GetClassName(wsClassName);
994 pFakeXMLRoot = new CFDE_XMLElement(wsClassName); 995 pFakeXMLRoot = new CFDE_XMLElement(CFX_WideString(wsClassName));
995 } 996 }
996 if (bIgnoreRoot) { 997 if (bIgnoreRoot) {
997 CFDE_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); 998 CFDE_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild);
998 while (pXMLChild) { 999 while (pXMLChild) {
999 CFDE_XMLNode* pXMLSibling = 1000 CFDE_XMLNode* pXMLSibling =
1000 pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling); 1001 pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling);
1001 pXMLNode->RemoveChildNode(pXMLChild); 1002 pXMLNode->RemoveChildNode(pXMLChild);
1002 pFakeXMLRoot->InsertChildNode(pXMLChild); 1003 pFakeXMLRoot->InsertChildNode(pXMLChild);
1003 pXMLChild = pXMLSibling; 1004 pXMLChild = pXMLSibling;
1004 } 1005 }
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 } 1718 }
1718 void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue, 1719 void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue,
1719 FX_BOOL bSetting, 1720 FX_BOOL bSetting,
1720 XFA_ATTRIBUTE eAttribute) { 1721 XFA_ATTRIBUTE eAttribute) {
1721 if (bSetting) { 1722 if (bSetting) {
1722 CFX_ByteString newValue; 1723 CFX_ByteString newValue;
1723 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { 1724 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) {
1724 FXJSE_Value_ToUTF8String(hValue, newValue); 1725 FXJSE_Value_ToUTF8String(hValue, newValue);
1725 } 1726 }
1726 int32_t iValue = FXSYS_atoi(newValue.c_str()); 1727 int32_t iValue = FXSYS_atoi(newValue.c_str());
1727 CFX_WideString wsNewValue = (iValue == 0) ? FX_WSTRC(L"0") : FX_WSTRC(L"1"); 1728 CFX_WideString wsNewValue(iValue == 0 ? L"0" : L"1");
1728 CFX_WideString wsFormatValue(wsNewValue); 1729 CFX_WideString wsFormatValue(wsNewValue);
1729 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); 1730 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData();
1730 if (pContainerWidgetData) { 1731 if (pContainerWidgetData) {
1731 pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue); 1732 pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue);
1732 } 1733 }
1733 SetScriptContent(wsNewValue, wsFormatValue, true, TRUE); 1734 SetScriptContent(wsNewValue, wsFormatValue, true, TRUE);
1734 } else { 1735 } else {
1735 CFX_WideString wsValue = GetScriptContent(TRUE); 1736 CFX_WideString wsValue = GetScriptContent(TRUE);
1736 FXJSE_Value_SetBoolean(hValue, wsValue == FX_WSTRC(L"1")); 1737 FXJSE_Value_SetBoolean(hValue, wsValue == FX_WSTRC(L"1"));
1737 } 1738 }
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after
3256 if ((iMax >= 0) && (iDesired > iMax)) { 3257 if ((iMax >= 0) && (iDesired > iMax)) {
3257 ThrowScriptErrorMessage(XFA_IDS_VIOLATE_BOUNDARY, L"max"); 3258 ThrowScriptErrorMessage(XFA_IDS_VIOLATE_BOUNDARY, L"max");
3258 return 2; 3259 return 2;
3259 } 3260 }
3260 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this); 3261 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this);
3261 if (iDesired == iCount) { 3262 if (iDesired == iCount) {
3262 return 0; 3263 return 0;
3263 } 3264 }
3264 if (iDesired < iCount) { 3265 if (iDesired < iCount) {
3265 CFX_WideStringC wsInstManagerName = GetCData(XFA_ATTRIBUTE_Name); 3266 CFX_WideStringC wsInstManagerName = GetCData(XFA_ATTRIBUTE_Name);
3266 CFX_WideString wsInstanceName = wsInstManagerName.IsEmpty() 3267 CFX_WideString wsInstanceName =
3267 ? wsInstManagerName 3268 CFX_WideString(wsInstManagerName.IsEmpty() ? wsInstManagerName
3268 : wsInstManagerName.Mid(1); 3269 : wsInstManagerName.Mid(1));
3269 uint32_t dInstanceNameHash = 3270 uint32_t dInstanceNameHash =
3270 FX_HashCode_GetW(wsInstanceName.AsStringC(), false); 3271 FX_HashCode_GetW(wsInstanceName.AsStringC(), false);
3271 CXFA_Node* pPrevSibling = 3272 CXFA_Node* pPrevSibling =
3272 (iDesired == 0) ? this 3273 (iDesired == 0) ? this
3273 : XFA_ScriptInstanceManager_GetItem(this, iDesired - 1); 3274 : XFA_ScriptInstanceManager_GetItem(this, iDesired - 1);
3274 while (iCount > iDesired) { 3275 while (iCount > iDesired) {
3275 CXFA_Node* pRemoveInstance = 3276 CXFA_Node* pRemoveInstance =
3276 pPrevSibling->GetNodeItem(XFA_NODEITEM_NextSibling); 3277 pPrevSibling->GetNodeItem(XFA_NODEITEM_NextSibling);
3277 if (pRemoveInstance->GetClassID() != XFA_ELEMENT_Subform && 3278 if (pRemoveInstance->GetClassID() != XFA_ELEMENT_Subform &&
3278 pRemoveInstance->GetClassID() != XFA_ELEMENT_SubformSet) { 3279 pRemoveInstance->GetClassID() != XFA_ELEMENT_SubformSet) {
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
3730 } 3731 }
3731 switch (eType) { 3732 switch (eType) {
3732 case XFA_ATTRIBUTETYPE_Enum: { 3733 case XFA_ATTRIBUTETYPE_Enum: {
3733 const XFA_ATTRIBUTEENUMINFO* pEnum = XFA_GetAttributeEnumByName(wsValue); 3734 const XFA_ATTRIBUTEENUMINFO* pEnum = XFA_GetAttributeEnumByName(wsValue);
3734 return SetEnum(pAttr->eName, 3735 return SetEnum(pAttr->eName,
3735 pEnum ? pEnum->eName 3736 pEnum ? pEnum->eName
3736 : (XFA_ATTRIBUTEENUM)(intptr_t)(pAttr->pDefValue), 3737 : (XFA_ATTRIBUTEENUM)(intptr_t)(pAttr->pDefValue),
3737 bNotify); 3738 bNotify);
3738 } break; 3739 } break;
3739 case XFA_ATTRIBUTETYPE_Cdata: 3740 case XFA_ATTRIBUTETYPE_Cdata:
3740 return SetCData(pAttr->eName, wsValue, bNotify); 3741 return SetCData(pAttr->eName, CFX_WideString(wsValue), bNotify);
3741 case XFA_ATTRIBUTETYPE_Boolean: 3742 case XFA_ATTRIBUTETYPE_Boolean:
3742 return SetBoolean(pAttr->eName, wsValue != FX_WSTRC(L"0"), bNotify); 3743 return SetBoolean(pAttr->eName, wsValue != FX_WSTRC(L"0"), bNotify);
3743 case XFA_ATTRIBUTETYPE_Integer: 3744 case XFA_ATTRIBUTETYPE_Integer:
3744 return SetInteger( 3745 return SetInteger(
3745 pAttr->eName, 3746 pAttr->eName,
3746 FXSYS_round(FX_wcstof(wsValue.c_str(), wsValue.GetLength())), 3747 FXSYS_round(FX_wcstof(wsValue.c_str(), wsValue.GetLength())),
3747 bNotify); 3748 bNotify);
3748 case XFA_ATTRIBUTETYPE_Measure: 3749 case XFA_ATTRIBUTETYPE_Measure:
3749 return SetMeasure(pAttr->eName, CXFA_Measurement(wsValue), bNotify); 3750 return SetMeasure(pAttr->eName, CXFA_Measurement(wsValue), bNotify);
3750 default: 3751 default:
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
3931 m_eNodeClass == XFA_ELEMENT_DataGroup)) { 3932 m_eNodeClass == XFA_ELEMENT_DataGroup)) {
3932 return TRUE; 3933 return TRUE;
3933 } 3934 }
3934 3935
3935 if (eAttr == XFA_ATTRIBUTE_Value) { 3936 if (eAttr == XFA_ATTRIBUTE_Value) {
3936 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); 3937 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType();
3937 switch (eXMLType) { 3938 switch (eXMLType) {
3938 case FDE_XMLNODE_Element: 3939 case FDE_XMLNODE_Element:
3939 if (IsAttributeInXML()) { 3940 if (IsAttributeInXML()) {
3940 static_cast<CFDE_XMLElement*>(m_pXMLNode) 3941 static_cast<CFDE_XMLElement*>(m_pXMLNode)
3941 ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsValue); 3942 ->SetString(CFX_WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)),
3943 wsValue);
3942 } else { 3944 } else {
3943 FX_BOOL bDeleteChildren = TRUE; 3945 FX_BOOL bDeleteChildren = TRUE;
3944 if (GetPacketID() == XFA_XDPPACKET_Datasets) { 3946 if (GetPacketID() == XFA_XDPPACKET_Datasets) {
3945 for (CXFA_Node* pChildDataNode = 3947 for (CXFA_Node* pChildDataNode =
3946 GetNodeItem(XFA_NODEITEM_FirstChild); 3948 GetNodeItem(XFA_NODEITEM_FirstChild);
3947 pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem( 3949 pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem(
3948 XFA_NODEITEM_NextSibling)) { 3950 XFA_NODEITEM_NextSibling)) {
3949 CXFA_NodeArray formNodes; 3951 CXFA_NodeArray formNodes;
3950 if (pChildDataNode->GetBindItems(formNodes) > 0) { 3952 if (pChildDataNode->GetBindItems(formNodes) > 0) {
3951 bDeleteChildren = FALSE; 3953 bDeleteChildren = FALSE;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3988 OnChanging(XFA_ATTRIBUTE_Value, bNotify); 3990 OnChanging(XFA_ATTRIBUTE_Value, bNotify);
3989 CFX_WideString* pClone = new CFX_WideString(wsValue); 3991 CFX_WideString* pClone = new CFX_WideString(wsValue);
3990 SetUserData(pKey, pClone, &deleteWideStringCallBack); 3992 SetUserData(pKey, pClone, &deleteWideStringCallBack);
3991 OnChanged(XFA_ATTRIBUTE_Value, bNotify, bScriptModify); 3993 OnChanged(XFA_ATTRIBUTE_Value, bNotify, bScriptModify);
3992 if (IsNeedSavingXMLNode()) { 3994 if (IsNeedSavingXMLNode()) {
3993 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); 3995 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType();
3994 switch (eXMLType) { 3996 switch (eXMLType) {
3995 case FDE_XMLNODE_Element: 3997 case FDE_XMLNODE_Element:
3996 if (IsAttributeInXML()) { 3998 if (IsAttributeInXML()) {
3997 static_cast<CFDE_XMLElement*>(m_pXMLNode) 3999 static_cast<CFDE_XMLElement*>(m_pXMLNode)
3998 ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsXMLValue); 4000 ->SetString(CFX_WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)),
4001 wsXMLValue);
3999 } else { 4002 } else {
4000 FX_BOOL bDeleteChildren = TRUE; 4003 FX_BOOL bDeleteChildren = TRUE;
4001 if (GetPacketID() == XFA_XDPPACKET_Datasets) { 4004 if (GetPacketID() == XFA_XDPPACKET_Datasets) {
4002 for (CXFA_Node* pChildDataNode = 4005 for (CXFA_Node* pChildDataNode =
4003 GetNodeItem(XFA_NODEITEM_FirstChild); 4006 GetNodeItem(XFA_NODEITEM_FirstChild);
4004 pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem( 4007 pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem(
4005 XFA_NODEITEM_NextSibling)) { 4008 XFA_NODEITEM_NextSibling)) {
4006 CXFA_NodeArray formNodes; 4009 CXFA_NodeArray formNodes;
4007 if (pChildDataNode->GetBindItems(formNodes) > 0) { 4010 if (pChildDataNode->GetBindItems(formNodes) > 0) {
4008 bDeleteChildren = FALSE; 4011 bDeleteChildren = FALSE;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
4107 switch (eType) { 4110 switch (eType) {
4108 case XFA_ATTRIBUTETYPE_Enum: 4111 case XFA_ATTRIBUTETYPE_Enum:
4109 static_cast<CFDE_XMLElement*>(m_pXMLNode) 4112 static_cast<CFDE_XMLElement*>(m_pXMLNode)
4110 ->SetString( 4113 ->SetString(
4111 pInfo->pName, 4114 pInfo->pName,
4112 XFA_GetAttributeEnumByID((XFA_ATTRIBUTEENUM)(uintptr_t)pValue) 4115 XFA_GetAttributeEnumByID((XFA_ATTRIBUTEENUM)(uintptr_t)pValue)
4113 ->pName); 4116 ->pName);
4114 break; 4117 break;
4115 case XFA_ATTRIBUTETYPE_Boolean: 4118 case XFA_ATTRIBUTETYPE_Boolean:
4116 static_cast<CFDE_XMLElement*>(m_pXMLNode) 4119 static_cast<CFDE_XMLElement*>(m_pXMLNode)
4117 ->SetString(pInfo->pName, 4120 ->SetString(pInfo->pName, pValue ? L"1" : L"0");
4118 pValue ? FX_WSTRC(L"1") : FX_WSTRC(L"0"));
4119 break; 4121 break;
4120 case XFA_ATTRIBUTETYPE_Integer: 4122 case XFA_ATTRIBUTETYPE_Integer:
4121 static_cast<CFDE_XMLElement*>(m_pXMLNode) 4123 static_cast<CFDE_XMLElement*>(m_pXMLNode)
4122 ->SetInteger(pInfo->pName, (int32_t)(uintptr_t)pValue); 4124 ->SetInteger(pInfo->pName, (int32_t)(uintptr_t)pValue);
4123 break; 4125 break;
4124 default: 4126 default:
4125 ASSERT(0); 4127 ASSERT(0);
4126 } 4128 }
4127 } 4129 }
4128 } 4130 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
4165 FX_BOOL bScriptModify, 4167 FX_BOOL bScriptModify,
4166 FX_BOOL bSyncData) { 4168 FX_BOOL bSyncData) {
4167 CXFA_Node* pNode = NULL; 4169 CXFA_Node* pNode = NULL;
4168 CXFA_Node* pBindNode = NULL; 4170 CXFA_Node* pBindNode = NULL;
4169 switch (GetObjectType()) { 4171 switch (GetObjectType()) {
4170 case XFA_OBJECTTYPE_ContainerNode: { 4172 case XFA_OBJECTTYPE_ContainerNode: {
4171 if (XFA_FieldIsMultiListBox(this)) { 4173 if (XFA_FieldIsMultiListBox(this)) {
4172 CXFA_Node* pValue = GetProperty(0, XFA_ELEMENT_Value); 4174 CXFA_Node* pValue = GetProperty(0, XFA_ELEMENT_Value);
4173 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); 4175 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild);
4174 ASSERT(pChildValue); 4176 ASSERT(pChildValue);
4175 pChildValue->SetCData(XFA_ATTRIBUTE_ContentType, FX_WSTRC(L"text/xml")); 4177 pChildValue->SetCData(XFA_ATTRIBUTE_ContentType, L"text/xml");
4176 pChildValue->SetScriptContent(wsContent, wsContent, bNotify, 4178 pChildValue->SetScriptContent(wsContent, wsContent, bNotify,
4177 bScriptModify, FALSE); 4179 bScriptModify, FALSE);
4178 CXFA_Node* pBind = GetBindData(); 4180 CXFA_Node* pBind = GetBindData();
4179 if (bSyncData && pBind) { 4181 if (bSyncData && pBind) {
4180 CFX_WideStringArray wsSaveTextArray; 4182 CFX_WideStringArray wsSaveTextArray;
4181 int32_t iSize = 0; 4183 int32_t iSize = 0;
4182 if (!wsContent.IsEmpty()) { 4184 if (!wsContent.IsEmpty()) {
4183 int32_t iStart = 0; 4185 int32_t iStart = 0;
4184 int32_t iLength = wsContent.GetLength(); 4186 int32_t iLength = wsContent.GetLength();
4185 int32_t iEnd = wsContent.Find(L'\n', iStart); 4187 int32_t iEnd = wsContent.Find(L'\n', iStart);
(...skipping 19 matching lines...) Expand all
4205 } else { 4207 } else {
4206 CXFA_NodeArray valueNodes; 4208 CXFA_NodeArray valueNodes;
4207 int32_t iDatas = pBind->GetNodeList( 4209 int32_t iDatas = pBind->GetNodeList(
4208 valueNodes, XFA_NODEFILTER_Children, XFA_ELEMENT_DataValue); 4210 valueNodes, XFA_NODEFILTER_Children, XFA_ELEMENT_DataValue);
4209 if (iDatas < iSize) { 4211 if (iDatas < iSize) {
4210 int32_t iAddNodes = iSize - iDatas; 4212 int32_t iAddNodes = iSize - iDatas;
4211 CXFA_Node* pValueNodes = NULL; 4213 CXFA_Node* pValueNodes = NULL;
4212 while (iAddNodes-- > 0) { 4214 while (iAddNodes-- > 0) {
4213 pValueNodes = 4215 pValueNodes =
4214 pBind->CreateSamePacketNode(XFA_ELEMENT_DataValue); 4216 pBind->CreateSamePacketNode(XFA_ELEMENT_DataValue);
4215 pValueNodes->SetCData(XFA_ATTRIBUTE_Name, FX_WSTRC(L"value")); 4217 pValueNodes->SetCData(XFA_ATTRIBUTE_Name, L"value");
4216 pValueNodes->CreateXMLMappingNode(); 4218 pValueNodes->CreateXMLMappingNode();
4217 pBind->InsertChild(pValueNodes); 4219 pBind->InsertChild(pValueNodes);
4218 } 4220 }
4219 pValueNodes = NULL; 4221 pValueNodes = NULL;
4220 } else if (iDatas > iSize) { 4222 } else if (iDatas > iSize) {
4221 int32_t iDelNodes = iDatas - iSize; 4223 int32_t iDelNodes = iDatas - iSize;
4222 while (iDelNodes-- > 0) { 4224 while (iDelNodes-- > 0) {
4223 pBind->RemoveChild(pBind->GetNodeItem(XFA_NODEITEM_FirstChild)); 4225 pBind->RemoveChild(pBind->GetNodeItem(XFA_NODEITEM_FirstChild));
4224 } 4226 }
4225 } 4227 }
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
4692 static_cast<CFDE_XMLElement*>(pNode->m_pXMLNode); 4694 static_cast<CFDE_XMLElement*>(pNode->m_pXMLNode);
4693 CFX_WideStringC wsAttributeName = 4695 CFX_WideStringC wsAttributeName =
4694 pNode->GetCData(XFA_ATTRIBUTE_QualifiedName); 4696 pNode->GetCData(XFA_ATTRIBUTE_QualifiedName);
4695 pXMLElement->RemoveAttribute(wsAttributeName.c_str()); 4697 pXMLElement->RemoveAttribute(wsAttributeName.c_str());
4696 } 4698 }
4697 CFX_WideString wsName; 4699 CFX_WideString wsName;
4698 pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); 4700 pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE);
4699 CFDE_XMLElement* pNewXMLElement = new CFDE_XMLElement(wsName); 4701 CFDE_XMLElement* pNewXMLElement = new CFDE_XMLElement(wsName);
4700 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); 4702 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value);
4701 if (!wsValue.IsEmpty()) { 4703 if (!wsValue.IsEmpty()) {
4702 pNewXMLElement->SetTextData(wsValue); 4704 pNewXMLElement->SetTextData(CFX_WideString(wsValue));
4703 } 4705 }
4704 pNode->m_pXMLNode = pNewXMLElement; 4706 pNode->m_pXMLNode = pNewXMLElement;
4705 pNode->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown); 4707 pNode->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown);
4706 } else { 4708 } else {
4707 m_pXMLNode->RemoveChildNode(pNode->m_pXMLNode); 4709 m_pXMLNode->RemoveChildNode(pNode->m_pXMLNode);
4708 } 4710 }
4709 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, false); 4711 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, false);
4710 } 4712 }
4711 return TRUE; 4713 return TRUE;
4712 } 4714 }
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
4929 if (!pNotsure || pNotsure->eType == XFA_ATTRIBUTETYPE_Cdata) { 4931 if (!pNotsure || pNotsure->eType == XFA_ATTRIBUTETYPE_Cdata) {
4930 wsName = GetCData(XFA_ATTRIBUTE_Name); 4932 wsName = GetCData(XFA_ATTRIBUTE_Name);
4931 m_dwNameHash = FX_HashCode_GetW(wsName, false); 4933 m_dwNameHash = FX_HashCode_GetW(wsName, false);
4932 } else if (pNotsure->eType == XFA_ATTRIBUTETYPE_Enum) { 4934 } else if (pNotsure->eType == XFA_ATTRIBUTETYPE_Enum) {
4933 wsName = XFA_GetAttributeEnumByID(GetEnum(XFA_ATTRIBUTE_Name))->pName; 4935 wsName = XFA_GetAttributeEnumByID(GetEnum(XFA_ATTRIBUTE_Name))->pName;
4934 m_dwNameHash = FX_HashCode_GetW(wsName, false); 4936 m_dwNameHash = FX_HashCode_GetW(wsName, false);
4935 } 4937 }
4936 } 4938 }
4937 CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() { 4939 CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() {
4938 if (!m_pXMLNode) { 4940 if (!m_pXMLNode) {
4939 CFX_WideStringC wsTag = GetCData(XFA_ATTRIBUTE_Name); 4941 CFX_WideString wsTag(GetCData(XFA_ATTRIBUTE_Name));
4940 m_pXMLNode = new CFDE_XMLElement(wsTag); 4942 m_pXMLNode = new CFDE_XMLElement(wsTag);
4941 SetFlag(XFA_NODEFLAG_OwnXMLNode, false); 4943 SetFlag(XFA_NODEFLAG_OwnXMLNode, false);
4942 } 4944 }
4943 return m_pXMLNode; 4945 return m_pXMLNode;
4944 } 4946 }
4945 FX_BOOL CXFA_Node::IsNeedSavingXMLNode() { 4947 FX_BOOL CXFA_Node::IsNeedSavingXMLNode() {
4946 return m_pXMLNode && (GetPacketID() == XFA_XDPPACKET_Datasets || 4948 return m_pXMLNode && (GetPacketID() == XFA_XDPPACKET_Datasets ||
4947 GetClassID() == XFA_ELEMENT_Xfa); 4949 GetClassID() == XFA_ELEMENT_Xfa);
4948 } 4950 }
4949 4951
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
5363 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); 5365 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode);
5364 } 5366 }
5365 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { 5367 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) {
5366 return m_pAttachNode->RemoveChild(pNode); 5368 return m_pAttachNode->RemoveChild(pNode);
5367 } 5369 }
5368 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { 5370 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) {
5369 return m_pAttachNode->GetChild( 5371 return m_pAttachNode->GetChild(
5370 iIndex, XFA_ELEMENT_UNKNOWN, 5372 iIndex, XFA_ELEMENT_UNKNOWN,
5371 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); 5373 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform);
5372 } 5374 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_localemgr.cpp ('k') | xfa/fxfa/parser/xfa_parser_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698