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

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

Issue 1857713003: Rename GetCStr and GetPtr to match CFX_ByteString (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 8 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_layout_itemlayout.cpp ('k') | xfa/fxfa/parser/xfa_objectacc_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 "core/fxcrt/include/fx_ext.h" 9 #include "core/fxcrt/include/fx_ext.h"
10 #include "xfa/fde/xml/fde_xml_imp.h" 10 #include "xfa/fde/xml/fde_xml_imp.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 ASSERT(FALSE); 49 ASSERT(FALSE);
50 return (XFA_ELEMENT)0; 50 return (XFA_ELEMENT)0;
51 } 51 }
52 void CXFA_Object::Script_ObjectClass_ClassName(FXJSE_HVALUE hValue, 52 void CXFA_Object::Script_ObjectClass_ClassName(FXJSE_HVALUE hValue,
53 FX_BOOL bSetting, 53 FX_BOOL bSetting,
54 XFA_ATTRIBUTE eAttribute) { 54 XFA_ATTRIBUTE eAttribute) {
55 if (!bSetting) { 55 if (!bSetting) {
56 CFX_WideStringC className; 56 CFX_WideStringC className;
57 GetClassName(className); 57 GetClassName(className);
58 FXJSE_Value_SetUTF8String( 58 FXJSE_Value_SetUTF8String(
59 hValue, FX_UTF8Encode(className.GetPtr(), className.GetLength()) 59 hValue, FX_UTF8Encode(className.raw_str(), className.GetLength())
60 .AsByteStringC()); 60 .AsByteStringC());
61 } else { 61 } else {
62 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 62 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
63 } 63 }
64 } 64 }
65 void CXFA_Object::ThrowScriptErrorMessage(int32_t iStringID, ...) { 65 void CXFA_Object::ThrowScriptErrorMessage(int32_t iStringID, ...) {
66 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider(); 66 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider();
67 FXSYS_assert(pAppProvider); 67 FXSYS_assert(pAppProvider);
68 CFX_WideString wsFormat; 68 CFX_WideString wsFormat;
69 pAppProvider->LoadString(iStringID, wsFormat); 69 pAppProvider->LoadString(iStringID, wsFormat);
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 IFX_Stream* pStream = IFX_Stream::CreateStream( 1094 IFX_Stream* pStream = IFX_Stream::CreateStream(
1095 (IFX_FileWrite*)pMemoryStream, 1095 (IFX_FileWrite*)pMemoryStream,
1096 FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append); 1096 FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append);
1097 if (!pStream) { 1097 if (!pStream) {
1098 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), bsXMLHeader); 1098 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), bsXMLHeader);
1099 pMemoryStream->Release(); 1099 pMemoryStream->Release();
1100 pMemoryStream = NULL; 1100 pMemoryStream = NULL;
1101 return; 1101 return;
1102 } 1102 }
1103 pStream->SetCodePage(FX_CODEPAGE_UTF8); 1103 pStream->SetCodePage(FX_CODEPAGE_UTF8);
1104 pStream->WriteData(bsXMLHeader.GetPtr(), bsXMLHeader.GetLength()); 1104 pStream->WriteData(bsXMLHeader.raw_str(), bsXMLHeader.GetLength());
1105 XFA_DataExporter_RegenerateFormFile(this, pStream, NULL, TRUE); 1105 XFA_DataExporter_RegenerateFormFile(this, pStream, NULL, TRUE);
1106 FXJSE_Value_SetUTF8String( 1106 FXJSE_Value_SetUTF8String(
1107 pArguments->GetReturnValue(), 1107 pArguments->GetReturnValue(),
1108 CFX_ByteStringC(pMemoryStream->GetBuffer(), pMemoryStream->GetSize())); 1108 CFX_ByteStringC(pMemoryStream->GetBuffer(), pMemoryStream->GetSize()));
1109 pStream->Release(); 1109 pStream->Release();
1110 pStream = NULL; 1110 pStream = NULL;
1111 if (pMemoryStream) { 1111 if (pMemoryStream) {
1112 pMemoryStream->Release(); 1112 pMemoryStream->Release();
1113 pMemoryStream = NULL; 1113 pMemoryStream = NULL;
1114 } 1114 }
1115 return; 1115 return;
1116 } 1116 }
1117 if (GetPacketID() == XFA_XDPPACKET_Datasets) { 1117 if (GetPacketID() == XFA_XDPPACKET_Datasets) {
1118 CFDE_XMLNode* pElement = GetXMLMappingNode(); 1118 CFDE_XMLNode* pElement = GetXMLMappingNode();
1119 if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) { 1119 if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) {
1120 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), bsXMLHeader); 1120 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), bsXMLHeader);
1121 return; 1121 return;
1122 } 1122 }
1123 XFA_DataExporter_DealWithDataGroupNode(this); 1123 XFA_DataExporter_DealWithDataGroupNode(this);
1124 IFX_MemoryStream* pMemoryStream = FX_CreateMemoryStream(TRUE); 1124 IFX_MemoryStream* pMemoryStream = FX_CreateMemoryStream(TRUE);
1125 IFX_Stream* pStream = IFX_Stream::CreateStream( 1125 IFX_Stream* pStream = IFX_Stream::CreateStream(
1126 (IFX_FileWrite*)pMemoryStream, 1126 (IFX_FileWrite*)pMemoryStream,
1127 FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append); 1127 FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append);
1128 if (pStream) { 1128 if (pStream) {
1129 pStream->SetCodePage(FX_CODEPAGE_UTF8); 1129 pStream->SetCodePage(FX_CODEPAGE_UTF8);
1130 pStream->WriteData(bsXMLHeader.GetPtr(), bsXMLHeader.GetLength()); 1130 pStream->WriteData(bsXMLHeader.raw_str(), bsXMLHeader.GetLength());
1131 pElement->SaveXMLNode(pStream); 1131 pElement->SaveXMLNode(pStream);
1132 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), 1132 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(),
1133 CFX_ByteStringC(pMemoryStream->GetBuffer(), 1133 CFX_ByteStringC(pMemoryStream->GetBuffer(),
1134 pMemoryStream->GetSize())); 1134 pMemoryStream->GetSize()));
1135 pStream->Release(); 1135 pStream->Release();
1136 pStream = NULL; 1136 pStream = NULL;
1137 } 1137 }
1138 if (pMemoryStream) { 1138 if (pMemoryStream) {
1139 pMemoryStream->Release(); 1139 pMemoryStream->Release();
1140 pMemoryStream = NULL; 1140 pMemoryStream = NULL;
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1786 {0xd95657a6, L"click", XFA_EVENT_Click, 4}, 1786 {0xd95657a6, L"click", XFA_EVENT_Click, 4},
1787 {0xdbfbe02e, L"calculate", XFA_EVENT_Calculate, 1}, 1787 {0xdbfbe02e, L"calculate", XFA_EVENT_Calculate, 1},
1788 {0xe25fa7b8, L"postOpen", XFA_EVENT_PostOpen, 7}, 1788 {0xe25fa7b8, L"postOpen", XFA_EVENT_PostOpen, 7},
1789 {0xe28dce7e, L"enter", XFA_EVENT_Enter, 2}, 1789 {0xe28dce7e, L"enter", XFA_EVENT_Enter, 2},
1790 {0xfc82d695, L"postSave", XFA_EVENT_PostSave, 0}, 1790 {0xfc82d695, L"postSave", XFA_EVENT_PostSave, 0},
1791 {0xfd54fbb7, L"postSign", XFA_EVENT_PostSign, 6}, 1791 {0xfd54fbb7, L"postSign", XFA_EVENT_PostSign, 6},
1792 }; 1792 };
1793 const XFA_ExecEventParaInfo* GetEventParaInfoByName( 1793 const XFA_ExecEventParaInfo* GetEventParaInfoByName(
1794 const CFX_WideStringC& wsEventName) { 1794 const CFX_WideStringC& wsEventName) {
1795 int32_t iLength = wsEventName.GetLength(); 1795 int32_t iLength = wsEventName.GetLength();
1796 uint32_t uHash = FX_HashCode_String_GetW(wsEventName.GetPtr(), iLength); 1796 uint32_t uHash = FX_HashCode_String_GetW(wsEventName.raw_str(), iLength);
1797 const XFA_ExecEventParaInfo* eventParaInfo = NULL; 1797 const XFA_ExecEventParaInfo* eventParaInfo = NULL;
1798 int32_t iStart = 0, 1798 int32_t iStart = 0,
1799 iEnd = (sizeof(gs_eventParaInfos) / sizeof(gs_eventParaInfos[0])) - 1; 1799 iEnd = (sizeof(gs_eventParaInfos) / sizeof(gs_eventParaInfos[0])) - 1;
1800 int32_t iMid = (iStart + iEnd) / 2; 1800 int32_t iMid = (iStart + iEnd) / 2;
1801 do { 1801 do {
1802 iMid = (iStart + iEnd) / 2; 1802 iMid = (iStart + iEnd) / 2;
1803 eventParaInfo = &gs_eventParaInfos[iMid]; 1803 eventParaInfo = &gs_eventParaInfos[iMid];
1804 if (uHash == eventParaInfo->m_uHash) { 1804 if (uHash == eventParaInfo->m_uHash) {
1805 return eventParaInfo; 1805 return eventParaInfo;
1806 } else if (uHash < eventParaInfo->m_uHash) { 1806 } else if (uHash < eventParaInfo->m_uHash) {
(...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after
3747 FX_UTF8Encode(FX_WSTRC(L"0")).AsByteStringC()); 3747 FX_UTF8Encode(FX_WSTRC(L"0")).AsByteStringC());
3748 } 3748 }
3749 void CXFA_Node::Script_Encrypt_Format(FXJSE_HVALUE hValue, 3749 void CXFA_Node::Script_Encrypt_Format(FXJSE_HVALUE hValue,
3750 FX_BOOL bSetting, 3750 FX_BOOL bSetting,
3751 XFA_ATTRIBUTE eAttribute) {} 3751 XFA_ATTRIBUTE eAttribute) {}
3752 enum XFA_KEYTYPE { 3752 enum XFA_KEYTYPE {
3753 XFA_KEYTYPE_Custom, 3753 XFA_KEYTYPE_Custom,
3754 XFA_KEYTYPE_Element, 3754 XFA_KEYTYPE_Element,
3755 }; 3755 };
3756 void* XFA_GetMapKey_Custom(const CFX_WideStringC& wsKey) { 3756 void* XFA_GetMapKey_Custom(const CFX_WideStringC& wsKey) {
3757 uint32_t dwKey = FX_HashCode_String_GetW(wsKey.GetPtr(), wsKey.GetLength()); 3757 uint32_t dwKey = FX_HashCode_String_GetW(wsKey.raw_str(), wsKey.GetLength());
3758 return (void*)(uintptr_t)((dwKey << 1) | XFA_KEYTYPE_Custom); 3758 return (void*)(uintptr_t)((dwKey << 1) | XFA_KEYTYPE_Custom);
3759 } 3759 }
3760 void* XFA_GetMapKey_Element(XFA_ELEMENT eElement, XFA_ATTRIBUTE eAttribute) { 3760 void* XFA_GetMapKey_Element(XFA_ELEMENT eElement, XFA_ATTRIBUTE eAttribute) {
3761 return (void*)(uintptr_t)((eElement << 16) | (eAttribute << 8) | 3761 return (void*)(uintptr_t)((eElement << 16) | (eAttribute << 8) |
3762 XFA_KEYTYPE_Element); 3762 XFA_KEYTYPE_Element);
3763 } 3763 }
3764 FX_BOOL CXFA_Node::HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit) { 3764 FX_BOOL CXFA_Node::HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit) {
3765 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); 3765 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr);
3766 return HasMapModuleKey(pKey, bCanInherit); 3766 return HasMapModuleKey(pKey, bCanInherit);
3767 } 3767 }
(...skipping 18 matching lines...) Expand all
3786 : (XFA_ATTRIBUTEENUM)(intptr_t)(pAttr->pDefValue), 3786 : (XFA_ATTRIBUTEENUM)(intptr_t)(pAttr->pDefValue),
3787 bNotify); 3787 bNotify);
3788 } break; 3788 } break;
3789 case XFA_ATTRIBUTETYPE_Cdata: 3789 case XFA_ATTRIBUTETYPE_Cdata:
3790 return SetCData(pAttr->eName, wsValue, bNotify); 3790 return SetCData(pAttr->eName, wsValue, bNotify);
3791 case XFA_ATTRIBUTETYPE_Boolean: 3791 case XFA_ATTRIBUTETYPE_Boolean:
3792 return SetBoolean(pAttr->eName, wsValue != FX_WSTRC(L"0"), bNotify); 3792 return SetBoolean(pAttr->eName, wsValue != FX_WSTRC(L"0"), bNotify);
3793 case XFA_ATTRIBUTETYPE_Integer: 3793 case XFA_ATTRIBUTETYPE_Integer:
3794 return SetInteger( 3794 return SetInteger(
3795 pAttr->eName, 3795 pAttr->eName,
3796 FXSYS_round(FX_wcstof(wsValue.GetPtr(), wsValue.GetLength())), 3796 FXSYS_round(FX_wcstof(wsValue.raw_str(), wsValue.GetLength())),
3797 bNotify); 3797 bNotify);
3798 case XFA_ATTRIBUTETYPE_Measure: 3798 case XFA_ATTRIBUTETYPE_Measure:
3799 return SetMeasure(pAttr->eName, CXFA_Measurement(wsValue), bNotify); 3799 return SetMeasure(pAttr->eName, CXFA_Measurement(wsValue), bNotify);
3800 default: 3800 default:
3801 break; 3801 break;
3802 } 3802 }
3803 return FALSE; 3803 return FALSE;
3804 } 3804 }
3805 FX_BOOL CXFA_Node::GetAttribute(XFA_ATTRIBUTE eAttr, 3805 FX_BOOL CXFA_Node::GetAttribute(XFA_ATTRIBUTE eAttr,
3806 CFX_WideString& wsValue, 3806 CFX_WideString& wsValue,
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
4728 m_pDocument->AddPurgeNode(pNode); 4728 m_pDocument->AddPurgeNode(pNode);
4729 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { 4729 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) {
4730 if (pNode->IsAttributeInXML()) { 4730 if (pNode->IsAttributeInXML()) {
4731 FXSYS_assert(pNode->m_pXMLNode == m_pXMLNode && 4731 FXSYS_assert(pNode->m_pXMLNode == m_pXMLNode &&
4732 m_pXMLNode->GetType() == FDE_XMLNODE_Element); 4732 m_pXMLNode->GetType() == FDE_XMLNODE_Element);
4733 if (pNode->m_pXMLNode->GetType() == FDE_XMLNODE_Element) { 4733 if (pNode->m_pXMLNode->GetType() == FDE_XMLNODE_Element) {
4734 CFDE_XMLElement* pXMLElement = 4734 CFDE_XMLElement* pXMLElement =
4735 static_cast<CFDE_XMLElement*>(pNode->m_pXMLNode); 4735 static_cast<CFDE_XMLElement*>(pNode->m_pXMLNode);
4736 CFX_WideStringC wsAttributeName = 4736 CFX_WideStringC wsAttributeName =
4737 pNode->GetCData(XFA_ATTRIBUTE_QualifiedName); 4737 pNode->GetCData(XFA_ATTRIBUTE_QualifiedName);
4738 pXMLElement->RemoveAttribute(wsAttributeName.GetPtr()); 4738 pXMLElement->RemoveAttribute(wsAttributeName.raw_str());
4739 } 4739 }
4740 CFX_WideString wsName; 4740 CFX_WideString wsName;
4741 pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); 4741 pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE);
4742 CFDE_XMLElement* pNewXMLElement = new CFDE_XMLElement(wsName); 4742 CFDE_XMLElement* pNewXMLElement = new CFDE_XMLElement(wsName);
4743 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); 4743 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value);
4744 if (!wsValue.IsEmpty()) { 4744 if (!wsValue.IsEmpty()) {
4745 pNewXMLElement->SetTextData(wsValue); 4745 pNewXMLElement->SetTextData(wsValue);
4746 } 4746 }
4747 pNode->m_pXMLNode = pNewXMLElement; 4747 pNode->m_pXMLNode = pNewXMLElement;
4748 pNode->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown); 4748 pNode->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown);
4749 } else { 4749 } else {
4750 m_pXMLNode->RemoveChildNode(pNode->m_pXMLNode); 4750 m_pXMLNode->RemoveChildNode(pNode->m_pXMLNode);
4751 } 4751 }
4752 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); 4752 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE);
4753 } 4753 }
4754 return TRUE; 4754 return TRUE;
4755 } 4755 }
4756 CXFA_Node* CXFA_Node::GetFirstChildByName(const CFX_WideStringC& wsName) const { 4756 CXFA_Node* CXFA_Node::GetFirstChildByName(const CFX_WideStringC& wsName) const {
4757 return GetFirstChildByName( 4757 return GetFirstChildByName(
4758 wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.GetPtr(), 4758 wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.raw_str(),
4759 wsName.GetLength())); 4759 wsName.GetLength()));
4760 } 4760 }
4761 CXFA_Node* CXFA_Node::GetFirstChildByName(uint32_t dwNameHash) const { 4761 CXFA_Node* CXFA_Node::GetFirstChildByName(uint32_t dwNameHash) const {
4762 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode; 4762 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode;
4763 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 4763 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
4764 if (pNode->GetNameHash() == dwNameHash) { 4764 if (pNode->GetNameHash() == dwNameHash) {
4765 return pNode; 4765 return pNode;
4766 } 4766 }
4767 } 4767 }
4768 return NULL; 4768 return NULL;
(...skipping 13 matching lines...) Expand all
4782 if (pNode->GetNameHash() == dwNameHash) { 4782 if (pNode->GetNameHash() == dwNameHash) {
4783 return pNode; 4783 return pNode;
4784 } 4784 }
4785 } 4785 }
4786 return NULL; 4786 return NULL;
4787 } 4787 }
4788 CXFA_Node* CXFA_Node::GetNextSameNameSibling( 4788 CXFA_Node* CXFA_Node::GetNextSameNameSibling(
4789 const CFX_WideStringC& wsNodeName) const { 4789 const CFX_WideStringC& wsNodeName) const {
4790 return GetNextSameNameSibling( 4790 return GetNextSameNameSibling(
4791 wsNodeName.IsEmpty() ? 0 4791 wsNodeName.IsEmpty() ? 0
4792 : FX_HashCode_String_GetW(wsNodeName.GetPtr(), 4792 : FX_HashCode_String_GetW(wsNodeName.raw_str(),
4793 wsNodeName.GetLength())); 4793 wsNodeName.GetLength()));
4794 } 4794 }
4795 CXFA_Node* CXFA_Node::GetNextSameClassSibling(XFA_ELEMENT eElement) const { 4795 CXFA_Node* CXFA_Node::GetNextSameClassSibling(XFA_ELEMENT eElement) const {
4796 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode; 4796 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode;
4797 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 4797 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
4798 if (pNode->GetClassID() == eElement) { 4798 if (pNode->GetClassID() == eElement) {
4799 return pNode; 4799 return pNode;
4800 } 4800 }
4801 } 4801 }
4802 return NULL; 4802 return NULL;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
4975 } 4975 }
4976 } 4976 }
4977 return iRet; 4977 return iRet;
4978 } 4978 }
4979 void CXFA_Node::UpdateNameHash() { 4979 void CXFA_Node::UpdateNameHash() {
4980 const XFA_NOTSUREATTRIBUTE* pNotsure = 4980 const XFA_NOTSUREATTRIBUTE* pNotsure =
4981 XFA_GetNotsureAttribute(GetClassID(), XFA_ATTRIBUTE_Name); 4981 XFA_GetNotsureAttribute(GetClassID(), XFA_ATTRIBUTE_Name);
4982 if (!pNotsure || pNotsure->eType == XFA_ATTRIBUTETYPE_Cdata) { 4982 if (!pNotsure || pNotsure->eType == XFA_ATTRIBUTETYPE_Cdata) {
4983 CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name); 4983 CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name);
4984 m_dwNameHash = 4984 m_dwNameHash =
4985 wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.GetPtr(), 4985 wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.raw_str(),
4986 wsName.GetLength()); 4986 wsName.GetLength());
4987 } else if (pNotsure->eType == XFA_ATTRIBUTETYPE_Enum) { 4987 } else if (pNotsure->eType == XFA_ATTRIBUTETYPE_Enum) {
4988 CFX_WideStringC wsName = 4988 CFX_WideStringC wsName =
4989 XFA_GetAttributeEnumByID(GetEnum(XFA_ATTRIBUTE_Name))->pName; 4989 XFA_GetAttributeEnumByID(GetEnum(XFA_ATTRIBUTE_Name))->pName;
4990 m_dwNameHash = 4990 m_dwNameHash =
4991 wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.GetPtr(), 4991 wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.raw_str(),
4992 wsName.GetLength()); 4992 wsName.GetLength());
4993 } 4993 }
4994 } 4994 }
4995 CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() { 4995 CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() {
4996 if (!m_pXMLNode) { 4996 if (!m_pXMLNode) {
4997 CFX_WideStringC wsTag = GetCData(XFA_ATTRIBUTE_Name); 4997 CFX_WideStringC wsTag = GetCData(XFA_ATTRIBUTE_Name);
4998 m_pXMLNode = new CFDE_XMLElement(wsTag); 4998 m_pXMLNode = new CFDE_XMLElement(wsTag);
4999 SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); 4999 SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE);
5000 } 5000 }
5001 return m_pXMLNode; 5001 return m_pXMLNode;
(...skipping 25 matching lines...) Expand all
5027 if (pModule && pModule->m_ValueMap.Lookup(pKey, pValue)) { 5027 if (pModule && pModule->m_ValueMap.Lookup(pKey, pValue)) {
5028 return TRUE; 5028 return TRUE;
5029 } 5029 }
5030 pNode = pNode->GetPacketID() != XFA_XDPPACKET_Datasets 5030 pNode = pNode->GetPacketID() != XFA_XDPPACKET_Datasets
5031 ? pNode->GetTemplateNode() 5031 ? pNode->GetTemplateNode()
5032 : NULL; 5032 : NULL;
5033 } 5033 }
5034 return FALSE; 5034 return FALSE;
5035 } 5035 }
5036 void CXFA_Node::SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue) { 5036 void CXFA_Node::SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue) {
5037 SetMapModuleBuffer(pKey, (void*)wsValue.GetPtr(), 5037 SetMapModuleBuffer(pKey, (void*)wsValue.raw_str(),
5038 wsValue.GetLength() * sizeof(FX_WCHAR)); 5038 wsValue.GetLength() * sizeof(FX_WCHAR));
5039 } 5039 }
5040 FX_BOOL CXFA_Node::GetMapModuleString(void* pKey, CFX_WideStringC& wsValue) { 5040 FX_BOOL CXFA_Node::GetMapModuleString(void* pKey, CFX_WideStringC& wsValue) {
5041 void* pValue; 5041 void* pValue;
5042 int32_t iBytes; 5042 int32_t iBytes;
5043 if (!GetMapModuleBuffer(pKey, pValue, iBytes)) { 5043 if (!GetMapModuleBuffer(pKey, pValue, iBytes)) {
5044 return FALSE; 5044 return FALSE;
5045 } 5045 }
5046 wsValue = CFX_WideStringC((const FX_WCHAR*)pValue, iBytes / sizeof(FX_WCHAR)); 5046 wsValue = CFX_WideStringC((const FX_WCHAR*)pValue, iBytes / sizeof(FX_WCHAR));
5047 return TRUE; 5047 return TRUE;
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
5256 } 5256 }
5257 pSrcModule->MoveBufferMapData(pDstModule, pKey); 5257 pSrcModule->MoveBufferMapData(pDstModule, pKey);
5258 } 5258 }
5259 CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) 5259 CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument)
5260 : CXFA_Object(pDocument, XFA_OBJECTTYPE_NodeList) { 5260 : CXFA_Object(pDocument, XFA_OBJECTTYPE_NodeList) {
5261 m_pDocument->GetScriptContext()->CacheList(this); 5261 m_pDocument->GetScriptContext()->CacheList(this);
5262 } 5262 }
5263 CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { 5263 CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) {
5264 int32_t iCount = GetLength(); 5264 int32_t iCount = GetLength();
5265 uint32_t dwHashCode = 5265 uint32_t dwHashCode =
5266 FX_HashCode_String_GetW(wsName.GetPtr(), wsName.GetLength()); 5266 FX_HashCode_String_GetW(wsName.raw_str(), wsName.GetLength());
5267 for (int32_t i = 0; i < iCount; i++) { 5267 for (int32_t i = 0; i < iCount; i++) {
5268 CXFA_Node* ret = Item(i); 5268 CXFA_Node* ret = Item(i);
5269 if (dwHashCode == ret->GetNameHash()) { 5269 if (dwHashCode == ret->GetNameHash()) {
5270 return ret; 5270 return ret;
5271 } 5271 }
5272 } 5272 }
5273 return NULL; 5273 return NULL;
5274 } 5274 }
5275 void CXFA_NodeList::Script_ListClass_Append(CFXJSE_Arguments* pArguments) { 5275 void CXFA_NodeList::Script_ListClass_Append(CFXJSE_Arguments* pArguments) {
5276 int32_t argc = pArguments->GetLength(); 5276 int32_t argc = pArguments->GetLength();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
5423 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); 5423 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode);
5424 } 5424 }
5425 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { 5425 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) {
5426 return m_pAttachNode->RemoveChild(pNode); 5426 return m_pAttachNode->RemoveChild(pNode);
5427 } 5427 }
5428 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { 5428 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) {
5429 return m_pAttachNode->GetChild( 5429 return m_pAttachNode->GetChild(
5430 iIndex, XFA_ELEMENT_UNKNOWN, 5430 iIndex, XFA_ELEMENT_UNKNOWN,
5431 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); 5431 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform);
5432 } 5432 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_layout_itemlayout.cpp ('k') | xfa/fxfa/parser/xfa_objectacc_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698