From 5548984944785d80daa03d98e92698309a3bc604 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 13 Dec 2017 01:19:24 +0000 Subject: Move Script_Som_* methods to CJX_Object The CJX_Node isn't the root of the CJX hierarchy. This causes issues now that CJX_Object has child objects which don't inherit from CJX_Node. This CL moves Script_Som_* from CJX_Node to CJX_Object. Change-Id: Iacb21758d9bf83f148044af225c710ad7d8521d2 Reviewed-on: https://pdfium-review.googlesource.com/20993 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- fxjs/xfa/cjx_node.cpp | 571 --------------------- fxjs/xfa/cjx_node.h | 37 -- fxjs/xfa/cjx_object.cpp | 581 ++++++++++++++++++++++ fxjs/xfa/cjx_object.h | 37 ++ xfa/fxfa/parser/xfa_basic_data_element_script.cpp | 86 ++-- 5 files changed, 661 insertions(+), 651 deletions(-) diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp index 7a0d13235e..9d416ea4d1 100644 --- a/fxjs/xfa/cjx_node.cpp +++ b/fxjs/xfa/cjx_node.cpp @@ -119,19 +119,6 @@ const CXFA_Node* CJX_Node::GetXFANode() const { return static_cast(GetXFAObject()); } -int32_t CJX_Node::Subform_and_SubformSet_InstanceIndex() { - int32_t index = 0; - for (CXFA_Node* pNode = GetXFANode()->GetNodeItem(XFA_NODEITEM_PrevSibling); - pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { - if ((pNode->GetElementType() != XFA_Element::Subform) && - (pNode->GetElementType() != XFA_Element::SubformSet)) { - break; - } - index++; - } - return index; -} - int32_t CJX_Node::InstanceManager_SetInstances(int32_t iDesired) { CXFA_OccurData occurData(GetXFANode()->GetOccurNode()); if (iDesired < occurData.GetMin()) { @@ -591,217 +578,6 @@ void CJX_Node::Script_Field_Length(CFXJSE_Value* pValue, pValue->SetInteger(pWidgetData->CountChoiceListItems(true)); } -void CJX_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue, - bool bSetting, - XFA_Attribute /* unused */) { - XFA_Element eType = GetXFANode()->GetElementType(); - if (eType == XFA_Element::Field) { - Script_Field_DefaultValue(pValue, bSetting, XFA_Attribute::Unknown); - return; - } - if (eType == XFA_Element::Draw) { - Script_Draw_DefaultValue(pValue, bSetting, XFA_Attribute::Unknown); - return; - } - if (eType == XFA_Element::Boolean) { - Script_Boolean_Value(pValue, bSetting, XFA_Attribute::Unknown); - return; - } - - if (bSetting) { - WideString wsNewValue; - if (pValue && !(pValue->IsNull() || pValue->IsUndefined())) - wsNewValue = pValue->ToWideString(); - - WideString wsFormatValue(wsNewValue); - CXFA_WidgetData* pContainerWidgetData = nullptr; - if (GetXFANode()->GetPacketType() == XFA_PacketType::Datasets) { - WideString wsPicture; - for (const auto& pFormNode : *(GetXFANode()->GetBindItems())) { - if (!pFormNode || pFormNode->HasRemovedChildren()) - continue; - - pContainerWidgetData = pFormNode->GetContainerWidgetData(); - if (pContainerWidgetData) { - wsPicture = pContainerWidgetData->GetPictureContent( - XFA_VALUEPICTURE_DataBind); - } - if (!wsPicture.IsEmpty()) - break; - - pContainerWidgetData = nullptr; - } - } else if (GetXFANode()->GetPacketType() == XFA_PacketType::Form) { - pContainerWidgetData = GetXFANode()->GetContainerWidgetData(); - } - - if (pContainerWidgetData) - wsFormatValue = pContainerWidgetData->GetFormatDataValue(wsNewValue); - - SetContent(wsNewValue, wsFormatValue, true, true, true); - return; - } - - WideString content = GetContent(true); - if (content.IsEmpty() && eType != XFA_Element::Text && - eType != XFA_Element::SubmitUrl) { - pValue->SetNull(); - } else if (eType == XFA_Element::Integer) { - pValue->SetInteger(FXSYS_wtoi(content.c_str())); - } else if (eType == XFA_Element::Float || eType == XFA_Element::Decimal) { - CFX_Decimal decimal(content.AsStringView()); - pValue->SetFloat((float)(double)decimal); - } else { - pValue->SetString(content.UTF8Encode().AsStringView()); - } -} - -void CJX_Node::Script_Som_DefaultValue_Read(CFXJSE_Value* pValue, - bool bSetting, - XFA_Attribute eAttribute) { - if (bSetting) { - ThrowInvalidPropertyException(); - return; - } - - WideString content = GetContent(true); - if (content.IsEmpty()) { - pValue->SetNull(); - return; - } - pValue->SetString(content.UTF8Encode().AsStringView()); -} - -void CJX_Node::Script_Boolean_Value(CFXJSE_Value* pValue, - bool bSetting, - XFA_Attribute eAttribute) { - if (!bSetting) { - WideString wsValue = GetContent(true); - pValue->SetBoolean(wsValue == L"1"); - return; - } - - ByteString newValue; - if (pValue && !(pValue->IsNull() || pValue->IsUndefined())) - newValue = pValue->ToString(); - - int32_t iValue = FXSYS_atoi(newValue.c_str()); - WideString wsNewValue(iValue == 0 ? L"0" : L"1"); - WideString wsFormatValue(wsNewValue); - CXFA_WidgetData* pContainerWidgetData = - GetXFANode()->GetContainerWidgetData(); - if (pContainerWidgetData) - wsFormatValue = pContainerWidgetData->GetFormatDataValue(wsNewValue); - - SetContent(wsNewValue, wsFormatValue, true, true, true); -} - -void CJX_Node::Script_Som_DataNode(CFXJSE_Value* pValue, - bool bSetting, - XFA_Attribute eAttribute) { - if (bSetting) { - ThrowInvalidPropertyException(); - return; - } - - CXFA_Node* pDataNode = GetXFANode()->GetBindData(); - if (!pDataNode) { - pValue->SetNull(); - return; - } - - pValue->Assign( - GetDocument()->GetScriptContext()->GetJSValueFromMap(pDataNode)); -} - -void CJX_Node::Script_Draw_DefaultValue(CFXJSE_Value* pValue, - bool bSetting, - XFA_Attribute eAttribute) { - if (!bSetting) { - WideString content = GetContent(true); - if (content.IsEmpty()) - pValue->SetNull(); - else - pValue->SetString(content.UTF8Encode().AsStringView()); - - return; - } - - if (!pValue || !pValue->IsString()) - return; - - CXFA_WidgetData* pWidgetData = GetXFANode()->GetWidgetData(); - XFA_Element uiType = pWidgetData->GetUIType(); - if (uiType != XFA_Element::Text) - return; - - WideString wsNewValue = pValue->ToWideString(); - SetContent(wsNewValue, wsNewValue, true, true, true); -} - -void CJX_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, - bool bSetting, - XFA_Attribute eAttribute) { - CXFA_WidgetData* pWidgetData = GetXFANode()->GetWidgetData(); - if (!pWidgetData) - return; - - if (bSetting) { - if (pValue) { - pWidgetData->SetPreNull(pWidgetData->IsNull()); - pWidgetData->SetIsNull(pValue->IsNull()); - } - - WideString wsNewText; - if (pValue && !(pValue->IsNull() || pValue->IsUndefined())) - wsNewText = pValue->ToWideString(); - - CXFA_Node* pUIChild = pWidgetData->GetUIChild(); - if (pUIChild->GetElementType() == XFA_Element::NumericEdit) { - wsNewText = - pWidgetData->NumericLimit(wsNewText, pWidgetData->GetLeadDigits(), - pWidgetData->GetFracDigits()); - } - - CXFA_WidgetData* pContainerWidgetData = - GetXFANode()->GetContainerWidgetData(); - WideString wsFormatText(wsNewText); - if (pContainerWidgetData) - wsFormatText = pContainerWidgetData->GetFormatDataValue(wsNewText); - - SetContent(wsNewText, wsFormatText, true, true, true); - return; - } - - WideString content = GetContent(true); - if (content.IsEmpty()) { - pValue->SetNull(); - return; - } - - CXFA_Node* pUIChild = pWidgetData->GetUIChild(); - CXFA_Node* pNode = pWidgetData->GetFormValueData().GetNode()->GetNodeItem( - XFA_NODEITEM_FirstChild); - if (pNode && pNode->GetElementType() == XFA_Element::Decimal) { - if (pUIChild->GetElementType() == XFA_Element::NumericEdit && - (pNode->JSNode()->GetInteger(XFA_Attribute::FracDigits) == -1)) { - pValue->SetString(content.UTF8Encode().AsStringView()); - } else { - CFX_Decimal decimal(content.AsStringView()); - pValue->SetFloat((float)(double)decimal); - } - } else if (pNode && pNode->GetElementType() == XFA_Element::Integer) { - pValue->SetInteger(FXSYS_wtoi(content.c_str())); - } else if (pNode && pNode->GetElementType() == XFA_Element::Boolean) { - pValue->SetBoolean(FXSYS_wtoi(content.c_str()) == 0 ? false : true); - } else if (pNode && pNode->GetElementType() == XFA_Element::Float) { - CFX_Decimal decimal(content.AsStringView()); - pValue->SetFloat((float)(double)decimal); - } else { - pValue->SetString(content.UTF8Encode().AsStringView()); - } -} - void CJX_Node::Script_Field_EditValue(CFXJSE_Value* pValue, bool bSetting, XFA_Attribute eAttribute) { @@ -833,23 +609,6 @@ void CJX_Node::Script_Field_FormattedValue(CFXJSE_Value* pValue, .AsStringView()); } -void CJX_Node::Script_Som_Mandatory(CFXJSE_Value* pValue, - bool bSetting, - XFA_Attribute eAttribute) { - CXFA_WidgetData* pWidgetData = GetXFANode()->GetWidgetData(); - if (!pWidgetData) - return; - - CXFA_ValidateData validateData = pWidgetData->GetValidateData(true); - if (bSetting) { - validateData.SetNullTest(pValue->ToWideString()); - return; - } - - WideString str = CXFA_Node::AttributeEnumToName(validateData.GetNullTest()); - pValue->SetString(str.UTF8Encode().AsStringView()); -} - void CJX_Node::Script_Field_ParentSubform(CFXJSE_Value* pValue, bool bSetting, XFA_Attribute eAttribute) { @@ -914,44 +673,6 @@ void CJX_Node::Script_ExclGroup_Transient(CFXJSE_Value* pValue, bool bSetting, XFA_Attribute eAttribute) {} -void CJX_Node::Script_Som_InstanceIndex(CFXJSE_Value* pValue, - bool bSetting, - XFA_Attribute eAttribute) { - if (!bSetting) { - pValue->SetInteger(Subform_and_SubformSet_InstanceIndex()); - return; - } - - int32_t iTo = pValue->ToInteger(); - int32_t iFrom = Subform_and_SubformSet_InstanceIndex(); - CXFA_Node* pManagerNode = nullptr; - for (CXFA_Node* pNode = GetXFANode()->GetNodeItem(XFA_NODEITEM_PrevSibling); - pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { - if (pNode->GetElementType() == XFA_Element::InstanceManager) { - pManagerNode = pNode; - break; - } - } - if (!pManagerNode) - return; - - pManagerNode->JSNode()->InstanceManager_MoveInstance(iTo, iFrom); - CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); - if (!pNotify) - return; - - CXFA_Node* pToInstance = pManagerNode->GetItem(iTo); - if (pToInstance && pToInstance->GetElementType() == XFA_Element::Subform) { - pNotify->RunSubformIndexChange(pToInstance); - } - - CXFA_Node* pFromInstance = pManagerNode->GetItem(iFrom); - if (pFromInstance && - pFromInstance->GetElementType() == XFA_Element::Subform) { - pNotify->RunSubformIndexChange(pFromInstance); - } -} - void CJX_Node::Script_Subform_InstanceManager(CFXJSE_Value* pValue, bool bSetting, XFA_Attribute eAttribute) { @@ -1153,46 +874,6 @@ pdfium::Optional CJX_Node::TryNamespace() { return {static_cast(pXMLNode)->GetNamespaceURI()}; } -CXFA_Node* CJX_Node::GetProperty(int32_t index, - XFA_Element eProperty, - bool bCreateProperty) { - if (index < 0 || index >= GetXFANode()->PropertyOccuranceCount(eProperty)) - return nullptr; - - int32_t iCount = 0; - for (CXFA_Node* pNode = GetXFANode()->GetChildNode(); pNode; - pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pNode->GetElementType() == eProperty) { - iCount++; - if (iCount > index) - return pNode; - } - } - if (!bCreateProperty) - return nullptr; - - if (GetXFANode()->HasPropertyFlags(eProperty, XFA_PROPERTYFLAG_OneOf)) { - for (CXFA_Node* pNode = GetXFANode()->GetChildNode(); pNode; - pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (GetXFANode()->HasPropertyFlags(pNode->GetElementType(), - XFA_PROPERTYFLAG_OneOf)) { - return nullptr; - } - } - } - - CXFA_Node* pNewNode = nullptr; - for (; iCount <= index; ++iCount) { - pNewNode = - GetDocument()->CreateNode(GetXFANode()->GetPacketType(), eProperty); - if (!pNewNode) - return nullptr; - GetXFANode()->InsertChild(pNewNode, nullptr); - pNewNode->SetFlag(XFA_NodeFlag_Initialized, true); - } - return pNewNode; -} - int32_t CJX_Node::execSingleEventByName(const WideStringView& wsEventName, XFA_Element eType) { CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); @@ -1278,255 +959,3 @@ void CJX_Node::ThrowTooManyOccurancesException(const WideString& obj) const { L"The element [%ls] has violated its allowable number of occurrences.", obj.c_str()); } - -bool CJX_Node::SetContent(const WideString& wsContent, - const WideString& wsXMLValue, - bool bNotify, - bool bScriptModify, - bool bSyncData) { - CXFA_Node* pNode = nullptr; - CXFA_Node* pBindNode = nullptr; - switch (GetXFANode()->GetObjectType()) { - case XFA_ObjectType::ContainerNode: { - if (XFA_FieldIsMultiListBox(GetXFANode())) { - CXFA_Node* pValue = GetProperty(0, XFA_Element::Value, true); - if (!pValue) - break; - - CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); - ASSERT(pChildValue); - pChildValue->JSNode()->SetCData(XFA_Attribute::ContentType, L"text/xml", - false, false); - pChildValue->JSNode()->SetContent(wsContent, wsContent, bNotify, - bScriptModify, false); - CXFA_Node* pBind = GetXFANode()->GetBindData(); - if (bSyncData && pBind) { - std::vector wsSaveTextArray; - size_t iSize = 0; - if (!wsContent.IsEmpty()) { - size_t iStart = 0; - size_t iLength = wsContent.GetLength(); - auto iEnd = wsContent.Find(L'\n', iStart); - iEnd = !iEnd.has_value() ? iLength : iEnd; - while (iEnd.value() >= iStart) { - wsSaveTextArray.push_back( - wsContent.Mid(iStart, iEnd.value() - iStart)); - iStart = iEnd.value() + 1; - if (iStart >= iLength) - break; - - iEnd = wsContent.Find(L'\n', iStart); - if (!iEnd.has_value()) { - wsSaveTextArray.push_back( - wsContent.Mid(iStart, iLength - iStart)); - } - } - iSize = wsSaveTextArray.size(); - } - if (iSize == 0) { - while (CXFA_Node* pChildNode = - pBind->GetNodeItem(XFA_NODEITEM_FirstChild)) { - pBind->RemoveChild(pChildNode, true); - } - } else { - std::vector valueNodes = pBind->GetNodeList( - XFA_NODEFILTER_Children, XFA_Element::DataValue); - size_t iDatas = valueNodes.size(); - if (iDatas < iSize) { - size_t iAddNodes = iSize - iDatas; - CXFA_Node* pValueNodes = nullptr; - while (iAddNodes-- > 0) { - pValueNodes = - pBind->CreateSamePacketNode(XFA_Element::DataValue); - pValueNodes->JSNode()->SetCData(XFA_Attribute::Name, L"value", - false, false); - pValueNodes->CreateXMLMappingNode(); - pBind->InsertChild(pValueNodes, nullptr); - } - pValueNodes = nullptr; - } else if (iDatas > iSize) { - size_t iDelNodes = iDatas - iSize; - while (iDelNodes-- > 0) { - pBind->RemoveChild(pBind->GetNodeItem(XFA_NODEITEM_FirstChild), - true); - } - } - int32_t i = 0; - for (CXFA_Node* pValueNode = - pBind->GetNodeItem(XFA_NODEITEM_FirstChild); - pValueNode; pValueNode = pValueNode->GetNodeItem( - XFA_NODEITEM_NextSibling)) { - pValueNode->JSNode()->SetAttributeValue( - wsSaveTextArray[i], wsSaveTextArray[i], false, false); - i++; - } - } - for (const auto& pArrayNode : *(pBind->GetBindItems())) { - if (pArrayNode.Get() != GetXFANode()) { - pArrayNode->JSNode()->SetContent(wsContent, wsContent, bNotify, - bScriptModify, false); - } - } - } - break; - } - if (GetXFANode()->GetElementType() == XFA_Element::ExclGroup) { - pNode = GetXFANode(); - } else { - CXFA_Node* pValue = GetProperty(0, XFA_Element::Value, true); - if (!pValue) - break; - - CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); - ASSERT(pChildValue); - pChildValue->JSNode()->SetContent(wsContent, wsContent, bNotify, - bScriptModify, false); - } - pBindNode = GetXFANode()->GetBindData(); - if (pBindNode && bSyncData) { - pBindNode->JSNode()->SetContent(wsContent, wsXMLValue, bNotify, - bScriptModify, false); - for (const auto& pArrayNode : *(pBindNode->GetBindItems())) { - if (pArrayNode.Get() != GetXFANode()) { - pArrayNode->JSNode()->SetContent(wsContent, wsContent, bNotify, - true, false); - } - } - } - pBindNode = nullptr; - break; - } - case XFA_ObjectType::ContentNode: { - WideString wsContentType; - if (GetXFANode()->GetElementType() == XFA_Element::ExData) { - pdfium::Optional ret = - TryAttribute(XFA_Attribute::ContentType, false); - if (ret) - wsContentType = *ret; - if (wsContentType == L"text/html") { - wsContentType = L""; - SetAttribute(XFA_Attribute::ContentType, wsContentType.AsStringView(), - false); - } - } - - CXFA_Node* pContentRawDataNode = - GetXFANode()->GetNodeItem(XFA_NODEITEM_FirstChild); - if (!pContentRawDataNode) { - pContentRawDataNode = GetXFANode()->CreateSamePacketNode( - (wsContentType == L"text/xml") ? XFA_Element::Sharpxml - : XFA_Element::Sharptext); - GetXFANode()->InsertChild(pContentRawDataNode, nullptr); - } - return pContentRawDataNode->JSNode()->SetContent( - wsContent, wsXMLValue, bNotify, bScriptModify, bSyncData); - } - case XFA_ObjectType::NodeC: - case XFA_ObjectType::TextNode: - pNode = GetXFANode(); - break; - case XFA_ObjectType::NodeV: - pNode = GetXFANode(); - if (bSyncData && GetXFANode()->GetPacketType() == XFA_PacketType::Form) { - CXFA_Node* pParent = GetXFANode()->GetNodeItem(XFA_NODEITEM_Parent); - if (pParent) { - pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); - } - if (pParent && pParent->GetElementType() == XFA_Element::Value) { - pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); - if (pParent && pParent->IsContainerNode()) { - pBindNode = pParent->GetBindData(); - if (pBindNode) { - pBindNode->JSNode()->SetContent(wsContent, wsXMLValue, bNotify, - bScriptModify, false); - } - } - } - } - break; - default: - if (GetXFANode()->GetElementType() == XFA_Element::DataValue) { - pNode = GetXFANode(); - pBindNode = GetXFANode(); - } - break; - } - if (!pNode) - return false; - - SetAttributeValue(wsContent, wsXMLValue, bNotify, bScriptModify); - if (pBindNode && bSyncData) { - for (const auto& pArrayNode : *(pBindNode->GetBindItems())) { - pArrayNode->JSNode()->SetContent(wsContent, wsContent, bNotify, - bScriptModify, false); - } - } - return true; -} - -WideString CJX_Node::GetContent(bool bScriptModify) { - return TryContent(bScriptModify, true).value_or(WideString()); -} - -pdfium::Optional CJX_Node::TryContent(bool bScriptModify, - bool bProto) { - CXFA_Node* pNode = nullptr; - switch (GetXFANode()->GetObjectType()) { - case XFA_ObjectType::ContainerNode: - if (GetXFANode()->GetElementType() == XFA_Element::ExclGroup) { - pNode = GetXFANode(); - } else { - CXFA_Node* pValue = - GetXFANode()->GetChild(0, XFA_Element::Value, false); - if (!pValue) - return {}; - - CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); - if (pChildValue && XFA_FieldIsMultiListBox(GetXFANode())) { - pChildValue->JSNode()->SetAttribute(XFA_Attribute::ContentType, - L"text/xml", false); - } - if (pChildValue) - return pChildValue->JSNode()->TryContent(bScriptModify, bProto); - return {}; - } - break; - case XFA_ObjectType::ContentNode: { - CXFA_Node* pContentRawDataNode = - GetXFANode()->GetNodeItem(XFA_NODEITEM_FirstChild); - if (!pContentRawDataNode) { - XFA_Element element = XFA_Element::Sharptext; - if (GetXFANode()->GetElementType() == XFA_Element::ExData) { - pdfium::Optional contentType = - TryAttribute(XFA_Attribute::ContentType, false); - if (contentType) { - if (*contentType == L"text/html") - element = XFA_Element::SharpxHTML; - else if (*contentType == L"text/xml") - element = XFA_Element::Sharpxml; - } - } - pContentRawDataNode = GetXFANode()->CreateSamePacketNode(element); - GetXFANode()->InsertChild(pContentRawDataNode, nullptr); - } - return pContentRawDataNode->JSNode()->TryContent(bScriptModify, true); - } - case XFA_ObjectType::NodeC: - case XFA_ObjectType::NodeV: - case XFA_ObjectType::TextNode: - pNode = GetXFANode(); - default: - if (GetXFANode()->GetElementType() == XFA_Element::DataValue) - pNode = GetXFANode(); - break; - } - if (pNode) { - if (bScriptModify) { - CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext(); - if (pScriptContext) - GetDocument()->GetScriptContext()->AddNodesOfRunScript(GetXFANode()); - } - return TryCData(XFA_Attribute::Value, false); - } - return {}; -} diff --git a/fxjs/xfa/cjx_node.h b/fxjs/xfa/cjx_node.h index 3d8f4dff01..f2ff49217e 100644 --- a/fxjs/xfa/cjx_node.h +++ b/fxjs/xfa/cjx_node.h @@ -28,18 +28,6 @@ class CJX_Node : public CJX_Tree { CXFA_Node* GetXFANode(); const CXFA_Node* GetXFANode() const; - CXFA_Node* GetProperty(int32_t index, - XFA_Element eType, - bool bCreateProperty); - - pdfium::Optional TryContent(bool bScriptModify, bool bProto); - bool SetContent(const WideString& wsContent, - const WideString& wsXMLValue, - bool bNotify, - bool bScriptModify, - bool bSyncData); - WideString GetContent(bool bScriptModify); - void SetLayoutItem(CXFA_LayoutItem* item) { layout_item_ = item; } CXFA_LayoutItem* GetLayoutItem() const { return layout_item_.Get(); } @@ -52,7 +40,6 @@ class CJX_Node : public CJX_Tree { const WideString& prop) const; void ThrowTooManyOccurancesException(const WideString& obj) const; - int32_t Subform_and_SubformSet_InstanceIndex(); int32_t InstanceManager_SetInstances(int32_t iDesired); int32_t InstanceManager_MoveInstance(int32_t iTo, int32_t iFrom); @@ -101,30 +88,6 @@ class CJX_Node : public CJX_Tree { void Script_Field_Length(CFXJSE_Value* pValue, bool bSetting, XFA_Attribute eAttribute); - void Script_Som_DefaultValue(CFXJSE_Value* pValue, - bool bSetting, - XFA_Attribute eAttribute); - void Script_Som_DefaultValue_Read(CFXJSE_Value* pValue, - bool bSetting, - XFA_Attribute eAttribute); - void Script_Boolean_Value(CFXJSE_Value* pValue, - bool bSetting, - XFA_Attribute eAttribute); - void Script_Som_DataNode(CFXJSE_Value* pValue, - bool bSetting, - XFA_Attribute eAttribute); - void Script_Som_Mandatory(CFXJSE_Value* pValue, - bool bSetting, - XFA_Attribute eAttribute); - void Script_Som_InstanceIndex(CFXJSE_Value* pValue, - bool bSetting, - XFA_Attribute eAttribute); - void Script_Draw_DefaultValue(CFXJSE_Value* pValue, - bool bSetting, - XFA_Attribute eAttribute); - void Script_Field_DefaultValue(CFXJSE_Value* pValue, - bool bSetting, - XFA_Attribute eAttribute); void Script_Field_EditValue(CFXJSE_Value* pValue, bool bSetting, XFA_Attribute eAttribute); diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp index 1f4f77aea1..2c6588824f 100644 --- a/fxjs/xfa/cjx_object.cpp +++ b/fxjs/xfa/cjx_object.cpp @@ -8,6 +8,7 @@ #include +#include "core/fxcrt/cfx_decimal.h" #include "core/fxcrt/fx_extension.h" #include "core/fxcrt/xml/cfx_xmltext.h" #include "fxjs/cfxjse_engine.h" @@ -20,6 +21,7 @@ #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_object.h" +#include "xfa/fxfa/parser/xfa_utils.h" namespace { @@ -576,6 +578,308 @@ CFX_XMLElement* CJX_Object::SetValue(XFA_Attribute eAttr, return elem; } +bool CJX_Object::SetContent(const WideString& wsContent, + const WideString& wsXMLValue, + bool bNotify, + bool bScriptModify, + bool bSyncData) { + CXFA_Node* pNode = nullptr; + CXFA_Node* pBindNode = nullptr; + switch (ToNode(GetXFAObject())->GetObjectType()) { + case XFA_ObjectType::ContainerNode: { + if (XFA_FieldIsMultiListBox(ToNode(GetXFAObject()))) { + CXFA_Node* pValue = GetProperty(0, XFA_Element::Value, true); + if (!pValue) + break; + + CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); + ASSERT(pChildValue); + pChildValue->JSNode()->SetCData(XFA_Attribute::ContentType, L"text/xml", + false, false); + pChildValue->JSNode()->SetContent(wsContent, wsContent, bNotify, + bScriptModify, false); + CXFA_Node* pBind = ToNode(GetXFAObject())->GetBindData(); + if (bSyncData && pBind) { + std::vector wsSaveTextArray; + size_t iSize = 0; + if (!wsContent.IsEmpty()) { + size_t iStart = 0; + size_t iLength = wsContent.GetLength(); + auto iEnd = wsContent.Find(L'\n', iStart); + iEnd = !iEnd.has_value() ? iLength : iEnd; + while (iEnd.value() >= iStart) { + wsSaveTextArray.push_back( + wsContent.Mid(iStart, iEnd.value() - iStart)); + iStart = iEnd.value() + 1; + if (iStart >= iLength) + break; + + iEnd = wsContent.Find(L'\n', iStart); + if (!iEnd.has_value()) { + wsSaveTextArray.push_back( + wsContent.Mid(iStart, iLength - iStart)); + } + } + iSize = wsSaveTextArray.size(); + } + if (iSize == 0) { + while (CXFA_Node* pChildNode = + pBind->GetNodeItem(XFA_NODEITEM_FirstChild)) { + pBind->RemoveChild(pChildNode, true); + } + } else { + std::vector valueNodes = pBind->GetNodeList( + XFA_NODEFILTER_Children, XFA_Element::DataValue); + size_t iDatas = valueNodes.size(); + if (iDatas < iSize) { + size_t iAddNodes = iSize - iDatas; + CXFA_Node* pValueNodes = nullptr; + while (iAddNodes-- > 0) { + pValueNodes = + pBind->CreateSamePacketNode(XFA_Element::DataValue); + pValueNodes->JSNode()->SetCData(XFA_Attribute::Name, L"value", + false, false); + pValueNodes->CreateXMLMappingNode(); + pBind->InsertChild(pValueNodes, nullptr); + } + pValueNodes = nullptr; + } else if (iDatas > iSize) { + size_t iDelNodes = iDatas - iSize; + while (iDelNodes-- > 0) { + pBind->RemoveChild(pBind->GetNodeItem(XFA_NODEITEM_FirstChild), + true); + } + } + int32_t i = 0; + for (CXFA_Node* pValueNode = + pBind->GetNodeItem(XFA_NODEITEM_FirstChild); + pValueNode; pValueNode = pValueNode->GetNodeItem( + XFA_NODEITEM_NextSibling)) { + pValueNode->JSNode()->SetAttributeValue( + wsSaveTextArray[i], wsSaveTextArray[i], false, false); + i++; + } + } + for (const auto& pArrayNode : *(pBind->GetBindItems())) { + if (pArrayNode.Get() != ToNode(GetXFAObject())) { + pArrayNode->JSNode()->SetContent(wsContent, wsContent, bNotify, + bScriptModify, false); + } + } + } + break; + } + if (ToNode(GetXFAObject())->GetElementType() == XFA_Element::ExclGroup) { + pNode = ToNode(GetXFAObject()); + } else { + CXFA_Node* pValue = GetProperty(0, XFA_Element::Value, true); + if (!pValue) + break; + + CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); + ASSERT(pChildValue); + pChildValue->JSNode()->SetContent(wsContent, wsContent, bNotify, + bScriptModify, false); + } + pBindNode = ToNode(GetXFAObject())->GetBindData(); + if (pBindNode && bSyncData) { + pBindNode->JSNode()->SetContent(wsContent, wsXMLValue, bNotify, + bScriptModify, false); + for (const auto& pArrayNode : *(pBindNode->GetBindItems())) { + if (pArrayNode.Get() != ToNode(GetXFAObject())) { + pArrayNode->JSNode()->SetContent(wsContent, wsContent, bNotify, + true, false); + } + } + } + pBindNode = nullptr; + break; + } + case XFA_ObjectType::ContentNode: { + WideString wsContentType; + if (ToNode(GetXFAObject())->GetElementType() == XFA_Element::ExData) { + pdfium::Optional ret = + TryAttribute(XFA_Attribute::ContentType, false); + if (ret) + wsContentType = *ret; + if (wsContentType == L"text/html") { + wsContentType = L""; + SetAttribute(XFA_Attribute::ContentType, wsContentType.AsStringView(), + false); + } + } + + CXFA_Node* pContentRawDataNode = + ToNode(GetXFAObject())->GetNodeItem(XFA_NODEITEM_FirstChild); + if (!pContentRawDataNode) { + pContentRawDataNode = + ToNode(GetXFAObject()) + ->CreateSamePacketNode((wsContentType == L"text/xml") + ? XFA_Element::Sharpxml + : XFA_Element::Sharptext); + ToNode(GetXFAObject())->InsertChild(pContentRawDataNode, nullptr); + } + return pContentRawDataNode->JSNode()->SetContent( + wsContent, wsXMLValue, bNotify, bScriptModify, bSyncData); + } + case XFA_ObjectType::NodeC: + case XFA_ObjectType::TextNode: + pNode = ToNode(GetXFAObject()); + break; + case XFA_ObjectType::NodeV: + pNode = ToNode(GetXFAObject()); + if (bSyncData && + ToNode(GetXFAObject())->GetPacketType() == XFA_PacketType::Form) { + CXFA_Node* pParent = + ToNode(GetXFAObject())->GetNodeItem(XFA_NODEITEM_Parent); + if (pParent) { + pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); + } + if (pParent && pParent->GetElementType() == XFA_Element::Value) { + pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); + if (pParent && pParent->IsContainerNode()) { + pBindNode = pParent->GetBindData(); + if (pBindNode) { + pBindNode->JSNode()->SetContent(wsContent, wsXMLValue, bNotify, + bScriptModify, false); + } + } + } + } + break; + default: + if (ToNode(GetXFAObject())->GetElementType() == XFA_Element::DataValue) { + pNode = ToNode(GetXFAObject()); + pBindNode = ToNode(GetXFAObject()); + } + break; + } + if (!pNode) + return false; + + SetAttributeValue(wsContent, wsXMLValue, bNotify, bScriptModify); + if (pBindNode && bSyncData) { + for (const auto& pArrayNode : *(pBindNode->GetBindItems())) { + pArrayNode->JSNode()->SetContent(wsContent, wsContent, bNotify, + bScriptModify, false); + } + } + return true; +} + +WideString CJX_Object::GetContent(bool bScriptModify) { + return TryContent(bScriptModify, true).value_or(WideString()); +} + +pdfium::Optional CJX_Object::TryContent(bool bScriptModify, + bool bProto) { + CXFA_Node* pNode = nullptr; + switch (ToNode(GetXFAObject())->GetObjectType()) { + case XFA_ObjectType::ContainerNode: + if (ToNode(GetXFAObject())->GetElementType() == XFA_Element::ExclGroup) { + pNode = ToNode(GetXFAObject()); + } else { + CXFA_Node* pValue = + ToNode(GetXFAObject())->GetChild(0, XFA_Element::Value, false); + if (!pValue) + return {}; + + CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); + if (pChildValue && XFA_FieldIsMultiListBox(ToNode(GetXFAObject()))) { + pChildValue->JSNode()->SetAttribute(XFA_Attribute::ContentType, + L"text/xml", false); + } + if (pChildValue) + return pChildValue->JSNode()->TryContent(bScriptModify, bProto); + return {}; + } + break; + case XFA_ObjectType::ContentNode: { + CXFA_Node* pContentRawDataNode = + ToNode(GetXFAObject())->GetNodeItem(XFA_NODEITEM_FirstChild); + if (!pContentRawDataNode) { + XFA_Element element = XFA_Element::Sharptext; + if (ToNode(GetXFAObject())->GetElementType() == XFA_Element::ExData) { + pdfium::Optional contentType = + TryAttribute(XFA_Attribute::ContentType, false); + if (contentType) { + if (*contentType == L"text/html") + element = XFA_Element::SharpxHTML; + else if (*contentType == L"text/xml") + element = XFA_Element::Sharpxml; + } + } + pContentRawDataNode = + ToNode(GetXFAObject())->CreateSamePacketNode(element); + ToNode(GetXFAObject())->InsertChild(pContentRawDataNode, nullptr); + } + return pContentRawDataNode->JSNode()->TryContent(bScriptModify, true); + } + case XFA_ObjectType::NodeC: + case XFA_ObjectType::NodeV: + case XFA_ObjectType::TextNode: + pNode = ToNode(GetXFAObject()); + default: + if (ToNode(GetXFAObject())->GetElementType() == XFA_Element::DataValue) + pNode = ToNode(GetXFAObject()); + break; + } + if (pNode) { + if (bScriptModify) { + CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext(); + if (pScriptContext) + GetDocument()->GetScriptContext()->AddNodesOfRunScript( + ToNode(GetXFAObject())); + } + return TryCData(XFA_Attribute::Value, false); + } + return {}; +} + +CXFA_Node* CJX_Object::GetProperty(int32_t index, + XFA_Element eProperty, + bool bCreateProperty) { + if (index < 0 || + index >= ToNode(GetXFAObject())->PropertyOccuranceCount(eProperty)) { + return nullptr; + } + + int32_t iCount = 0; + for (CXFA_Node* pNode = ToNode(GetXFAObject())->GetChildNode(); pNode; + pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { + if (pNode->GetElementType() == eProperty) { + iCount++; + if (iCount > index) + return pNode; + } + } + if (!bCreateProperty) + return nullptr; + + if (ToNode(GetXFAObject()) + ->HasPropertyFlags(eProperty, XFA_PROPERTYFLAG_OneOf)) { + for (CXFA_Node* pNode = ToNode(GetXFAObject())->GetChildNode(); pNode; + pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { + if (ToNode(GetXFAObject()) + ->HasPropertyFlags(pNode->GetElementType(), + XFA_PROPERTYFLAG_OneOf)) { + return nullptr; + } + } + } + + CXFA_Node* pNewNode = nullptr; + for (; iCount <= index; ++iCount) { + pNewNode = GetDocument()->CreateNode( + ToNode(GetXFAObject())->GetPacketType(), eProperty); + if (!pNewNode) + return nullptr; + ToNode(GetXFAObject())->InsertChild(pNewNode, nullptr); + pNewNode->SetFlag(XFA_NodeFlag_Initialized, true); + } + return pNewNode; +} + bool CJX_Object::SetUserData(void* pKey, void* pData, XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo) { @@ -1107,3 +1411,280 @@ void CJX_Object::Script_Som_MandatoryMessage(CFXJSE_Value* pValue, XFA_Attribute eAttribute) { Script_Som_Message(pValue, bSetting, XFA_SOM_MandatoryMessage); } + +void CJX_Object::Script_Som_DefaultValue(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute /* unused */) { + XFA_Element eType = ToNode(GetXFAObject())->GetElementType(); + if (eType == XFA_Element::Field) { + Script_Field_DefaultValue(pValue, bSetting, XFA_Attribute::Unknown); + return; + } + if (eType == XFA_Element::Draw) { + Script_Draw_DefaultValue(pValue, bSetting, XFA_Attribute::Unknown); + return; + } + if (eType == XFA_Element::Boolean) { + Script_Boolean_DefaultValue(pValue, bSetting, XFA_Attribute::Unknown); + return; + } + + if (bSetting) { + WideString wsNewValue; + if (pValue && !(pValue->IsNull() || pValue->IsUndefined())) + wsNewValue = pValue->ToWideString(); + + WideString wsFormatValue(wsNewValue); + CXFA_WidgetData* pContainerWidgetData = nullptr; + if (ToNode(GetXFAObject())->GetPacketType() == XFA_PacketType::Datasets) { + WideString wsPicture; + for (const auto& pFormNode : *(ToNode(GetXFAObject())->GetBindItems())) { + if (!pFormNode || pFormNode->HasRemovedChildren()) + continue; + + pContainerWidgetData = pFormNode->GetContainerWidgetData(); + if (pContainerWidgetData) { + wsPicture = pContainerWidgetData->GetPictureContent( + XFA_VALUEPICTURE_DataBind); + } + if (!wsPicture.IsEmpty()) + break; + + pContainerWidgetData = nullptr; + } + } else if (ToNode(GetXFAObject())->GetPacketType() == + XFA_PacketType::Form) { + pContainerWidgetData = ToNode(GetXFAObject())->GetContainerWidgetData(); + } + + if (pContainerWidgetData) + wsFormatValue = pContainerWidgetData->GetFormatDataValue(wsNewValue); + + SetContent(wsNewValue, wsFormatValue, true, true, true); + return; + } + + WideString content = GetContent(true); + if (content.IsEmpty() && eType != XFA_Element::Text && + eType != XFA_Element::SubmitUrl) { + pValue->SetNull(); + } else if (eType == XFA_Element::Integer) { + pValue->SetInteger(FXSYS_wtoi(content.c_str())); + } else if (eType == XFA_Element::Float || eType == XFA_Element::Decimal) { + CFX_Decimal decimal(content.AsStringView()); + pValue->SetFloat((float)(double)decimal); + } else { + pValue->SetString(content.UTF8Encode().AsStringView()); + } +} + +void CJX_Object::Script_Som_DefaultValue_Read(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute) { + if (bSetting) { + ThrowInvalidPropertyException(); + return; + } + + WideString content = GetContent(true); + if (content.IsEmpty()) { + pValue->SetNull(); + return; + } + pValue->SetString(content.UTF8Encode().AsStringView()); +} + +void CJX_Object::Script_Som_DataNode(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute) { + if (bSetting) { + ThrowInvalidPropertyException(); + return; + } + + CXFA_Node* pDataNode = ToNode(GetXFAObject())->GetBindData(); + if (!pDataNode) { + pValue->SetNull(); + return; + } + + pValue->Assign( + GetDocument()->GetScriptContext()->GetJSValueFromMap(pDataNode)); +} + +void CJX_Object::Script_Som_Mandatory(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute) { + if (!widget_data_) + return; + + CXFA_ValidateData validateData = widget_data_->GetValidateData(true); + if (bSetting) { + validateData.SetNullTest(pValue->ToWideString()); + return; + } + + WideString str = CXFA_Node::AttributeEnumToName(validateData.GetNullTest()); + pValue->SetString(str.UTF8Encode().AsStringView()); +} + +void CJX_Object::Script_Som_InstanceIndex(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute) { + if (!bSetting) { + pValue->SetInteger(Subform_and_SubformSet_InstanceIndex()); + return; + } + + int32_t iTo = pValue->ToInteger(); + int32_t iFrom = Subform_and_SubformSet_InstanceIndex(); + CXFA_Node* pManagerNode = nullptr; + for (CXFA_Node* pNode = + ToNode(GetXFAObject())->GetNodeItem(XFA_NODEITEM_PrevSibling); + pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { + if (pNode->GetElementType() == XFA_Element::InstanceManager) { + pManagerNode = pNode; + break; + } + } + if (!pManagerNode) + return; + + pManagerNode->JSNode()->InstanceManager_MoveInstance(iTo, iFrom); + CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); + if (!pNotify) + return; + + CXFA_Node* pToInstance = pManagerNode->GetItem(iTo); + if (pToInstance && pToInstance->GetElementType() == XFA_Element::Subform) { + pNotify->RunSubformIndexChange(pToInstance); + } + + CXFA_Node* pFromInstance = pManagerNode->GetItem(iFrom); + if (pFromInstance && + pFromInstance->GetElementType() == XFA_Element::Subform) { + pNotify->RunSubformIndexChange(pFromInstance); + } +} + +void CJX_Object::Script_Field_DefaultValue(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute) { + if (!widget_data_) + return; + + if (bSetting) { + if (pValue) { + widget_data_->SetPreNull(widget_data_->IsNull()); + widget_data_->SetIsNull(pValue->IsNull()); + } + + WideString wsNewText; + if (pValue && !(pValue->IsNull() || pValue->IsUndefined())) + wsNewText = pValue->ToWideString(); + + CXFA_Node* pUIChild = widget_data_->GetUIChild(); + if (pUIChild->GetElementType() == XFA_Element::NumericEdit) { + wsNewText = + widget_data_->NumericLimit(wsNewText, widget_data_->GetLeadDigits(), + widget_data_->GetFracDigits()); + } + + CXFA_WidgetData* pContainerWidgetData = + ToNode(GetXFAObject())->GetContainerWidgetData(); + WideString wsFormatText(wsNewText); + if (pContainerWidgetData) + wsFormatText = pContainerWidgetData->GetFormatDataValue(wsNewText); + + SetContent(wsNewText, wsFormatText, true, true, true); + return; + } + + WideString content = GetContent(true); + if (content.IsEmpty()) { + pValue->SetNull(); + return; + } + + CXFA_Node* pUIChild = widget_data_->GetUIChild(); + CXFA_Node* pNode = widget_data_->GetFormValueData().GetNode()->GetNodeItem( + XFA_NODEITEM_FirstChild); + if (pNode && pNode->GetElementType() == XFA_Element::Decimal) { + if (pUIChild->GetElementType() == XFA_Element::NumericEdit && + (pNode->JSNode()->GetInteger(XFA_Attribute::FracDigits) == -1)) { + pValue->SetString(content.UTF8Encode().AsStringView()); + } else { + CFX_Decimal decimal(content.AsStringView()); + pValue->SetFloat((float)(double)decimal); + } + } else if (pNode && pNode->GetElementType() == XFA_Element::Integer) { + pValue->SetInteger(FXSYS_wtoi(content.c_str())); + } else if (pNode && pNode->GetElementType() == XFA_Element::Boolean) { + pValue->SetBoolean(FXSYS_wtoi(content.c_str()) == 0 ? false : true); + } else if (pNode && pNode->GetElementType() == XFA_Element::Float) { + CFX_Decimal decimal(content.AsStringView()); + pValue->SetFloat((float)(double)decimal); + } else { + pValue->SetString(content.UTF8Encode().AsStringView()); + } +} + +void CJX_Object::Script_Boolean_DefaultValue(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute) { + if (!bSetting) { + WideString wsValue = GetContent(true); + pValue->SetBoolean(wsValue == L"1"); + return; + } + + ByteString newValue; + if (pValue && !(pValue->IsNull() || pValue->IsUndefined())) + newValue = pValue->ToString(); + + int32_t iValue = FXSYS_atoi(newValue.c_str()); + WideString wsNewValue(iValue == 0 ? L"0" : L"1"); + WideString wsFormatValue(wsNewValue); + CXFA_WidgetData* pContainerWidgetData = + ToNode(GetXFAObject())->GetContainerWidgetData(); + if (pContainerWidgetData) + wsFormatValue = pContainerWidgetData->GetFormatDataValue(wsNewValue); + + SetContent(wsNewValue, wsFormatValue, true, true, true); +} + +void CJX_Object::Script_Draw_DefaultValue(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute) { + if (!bSetting) { + WideString content = GetContent(true); + if (content.IsEmpty()) + pValue->SetNull(); + else + pValue->SetString(content.UTF8Encode().AsStringView()); + + return; + } + + if (!pValue || !pValue->IsString()) + return; + if (widget_data_->GetUIType() != XFA_Element::Text) + return; + + WideString wsNewValue = pValue->ToWideString(); + SetContent(wsNewValue, wsNewValue, true, true, true); +} + +int32_t CJX_Object::Subform_and_SubformSet_InstanceIndex() { + int32_t index = 0; + for (CXFA_Node* pNode = + ToNode(GetXFAObject())->GetNodeItem(XFA_NODEITEM_PrevSibling); + pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { + if ((pNode->GetElementType() != XFA_Element::Subform) && + (pNode->GetElementType() != XFA_Element::SubformSet)) { + break; + } + index++; + } + return index; +} diff --git a/fxjs/xfa/cjx_object.h b/fxjs/xfa/cjx_object.h index 1263bf82c5..10146f4ef9 100644 --- a/fxjs/xfa/cjx_object.h +++ b/fxjs/xfa/cjx_object.h @@ -77,6 +77,18 @@ class CJX_Object { pdfium::Optional TryAttribute(XFA_Attribute eAttr, bool bUseDefault); + pdfium::Optional TryContent(bool bScriptModify, bool bProto); + bool SetContent(const WideString& wsContent, + const WideString& wsXMLValue, + bool bNotify, + bool bScriptModify, + bool bSyncData); + WideString GetContent(bool bScriptModify); + + CXFA_Node* GetProperty(int32_t index, + XFA_Element eType, + bool bCreateProperty); + void SetAttributeValue(const WideString& wsValue, const WideString& wsXMLValue, bool bNotify, @@ -113,6 +125,21 @@ class CJX_Object { void Script_Field_FormatMessage(CFXJSE_Value* pValue, bool bSetting, XFA_Attribute eAttribute); + void Script_Som_DefaultValue(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute); + void Script_Som_DefaultValue_Read(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute); + void Script_Som_DataNode(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute); + void Script_Som_Mandatory(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute); + void Script_Som_InstanceIndex(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute); pdfium::Optional TryInteger(XFA_Attribute eAttr, bool bUseDefault); bool SetInteger(XFA_Attribute eAttr, int32_t iValue, bool bNotify); @@ -170,6 +197,16 @@ class CJX_Object { void Script_Som_Message(CFXJSE_Value* pValue, bool bSetting, XFA_SOM_MESSAGETYPE iMessageType); + void Script_Boolean_DefaultValue(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute); + void Script_Draw_DefaultValue(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute); + void Script_Field_DefaultValue(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute); + int32_t Subform_and_SubformSet_InstanceIndex(); void OnChanged(XFA_Attribute eAttr, bool bNotify, bool bScriptModify); void OnChanging(XFA_Attribute eAttr, bool bNotify); diff --git a/xfa/fxfa/parser/xfa_basic_data_element_script.cpp b/xfa/fxfa/parser/xfa_basic_data_element_script.cpp index 40ccae11c4..3e22316daf 100644 --- a/xfa/fxfa/parser/xfa_basic_data_element_script.cpp +++ b/xfa/fxfa/parser/xfa_basic_data_element_script.cpp @@ -163,7 +163,7 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Use, XFA_ScriptType::Basic}, {0x1ee2d24d, L"instanceIndex", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_InstanceIndex, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_InstanceIndex, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0x8c99377e, L"relation", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -232,7 +232,7 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Desc, XFA_ScriptType::Basic}, {0xd6e27f1d, L"value", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue_Read, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue_Read, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xf6b47749, L"lock", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_BOOL, @@ -892,25 +892,25 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::MaxChars, XFA_ScriptType::Basic}, {0xa52682bd, L"{default}", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xbc254332, L"usehref", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Usehref, XFA_ScriptType::Basic}, {0xd6e27f1d, L"value", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xc0811ed, L"use", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Use, XFA_ScriptType::Basic}, {0xa52682bd, L"{default}", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xbc254332, L"usehref", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Usehref, XFA_ScriptType::Basic}, {0xd6e27f1d, L"value", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xbe52dfbf, L"desc", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -976,13 +976,13 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Use, XFA_ScriptType::Basic}, {0xa52682bd, L"{default}", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xbc254332, L"usehref", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Usehref, XFA_ScriptType::Basic}, {0xd6e27f1d, L"value", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xc0811ed, L"use", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -1035,7 +1035,7 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Use, XFA_ScriptType::Basic}, {0x1abbd7e0, L"dataNode", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DataNode, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DataNode, XFA_Attribute::Unknown, XFA_ScriptType::Object}, {0x25839852, L"access", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -1056,7 +1056,7 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_BorderColor, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0x5e936ed6, L"fontColor", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_FontColor, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_FontColor, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0x6826c408, L"parentSubform", (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Field_ParentSubform, @@ -1080,7 +1080,7 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::MinW, XFA_ScriptType::Basic}, {0x85fd6faf, L"mandatory", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_Mandatory, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_Mandatory, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0x8e1c2921, L"relevant", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -1089,10 +1089,10 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Field_FormatMessage, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xa03cf627, L"rawValue", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xa52682bd, L"{default}", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xa60dd202, L"length", (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Field_Length, @@ -1296,7 +1296,7 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_ExclGroup_ErrorText, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0x1abbd7e0, L"dataNode", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DataNode, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DataNode, XFA_Attribute::Unknown, XFA_ScriptType::Object}, {0x25839852, L"access", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -1335,7 +1335,7 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_ExclGroup_Transient, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0x85fd6faf, L"mandatory", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_Mandatory, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_Mandatory, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0x8e1c2921, L"relevant", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -1431,7 +1431,7 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::TransferEncoding, XFA_ScriptType::Basic}, {0xa52682bd, L"{default}", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue_Read, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue_Read, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xbc254332, L"usehref", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -1440,7 +1440,7 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Aspect, XFA_ScriptType::Basic}, {0xd6e27f1d, L"value", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue_Read, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue_Read, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xdb55fec5, L"href", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -1491,13 +1491,13 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::FracDigits, XFA_ScriptType::Basic}, {0xa52682bd, L"{default}", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xbc254332, L"usehref", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Usehref, XFA_ScriptType::Basic}, {0xd6e27f1d, L"value", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xde7f92ba, L"leadDigits", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -1523,10 +1523,10 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::ColumnWidths, XFA_ScriptType::Basic}, {0x1abbd7e0, L"dataNode", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DataNode, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DataNode, XFA_Attribute::Unknown, XFA_ScriptType::Object}, {0x1ee2d24d, L"instanceIndex", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_InstanceIndex, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_InstanceIndex, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0x25839852, L"access", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -1713,13 +1713,13 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Use, XFA_ScriptType::Basic}, {0xa52682bd, L"{default}", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xbc254332, L"usehref", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Usehref, XFA_ScriptType::Basic}, {0xd6e27f1d, L"value", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xc0811ed, L"use", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -1758,7 +1758,7 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Use, XFA_ScriptType::Basic}, {0xa52682bd, L"{default}", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xbc254332, L"usehref", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -1767,7 +1767,7 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Desc, XFA_ScriptType::Basic}, {0xd6e27f1d, L"value", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xf6b47749, L"lock", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_BOOL, @@ -1929,13 +1929,13 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Use, XFA_ScriptType::Basic}, {0xa52682bd, L"{default}", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xbc254332, L"usehref", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Usehref, XFA_ScriptType::Basic}, {0xd6e27f1d, L"value", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xc0811ed, L"use", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -2079,7 +2079,7 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Script_Stateless, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xa52682bd, L"{default}", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xadc4c77b, L"binding", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -2091,7 +2091,7 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Desc, XFA_ScriptType::Basic}, {0xd6e27f1d, L"value", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xf6b47749, L"lock", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_BOOL, @@ -2175,7 +2175,7 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Desc, XFA_ScriptType::Basic}, {0xd6e27f1d, L"value", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xf6b47749, L"lock", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_BOOL, @@ -2244,7 +2244,7 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::TransferEncoding, XFA_ScriptType::Basic}, {0xa52682bd, L"{default}", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xbc254332, L"usehref", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -2253,7 +2253,7 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::MaxLength, XFA_ScriptType::Basic}, {0xd6e27f1d, L"value", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xdb55fec5, L"href", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -2283,7 +2283,7 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Action, XFA_ScriptType::Basic}, {0xa52682bd, L"{default}", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xbc254332, L"usehref", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -2412,10 +2412,10 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Contains, XFA_ScriptType::Basic}, {0xa52682bd, L"{default}", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xd6e27f1d, L"value", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xe372ae97, L"isNull", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_BOOL, @@ -2568,13 +2568,13 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Use, XFA_ScriptType::Basic}, {0xa52682bd, L"{default}", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xbc254332, L"usehref", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Usehref, XFA_ScriptType::Basic}, {0xd6e27f1d, L"value", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xc0811ed, L"use", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -2636,10 +2636,10 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Relevant, XFA_ScriptType::Basic}, {0xa03cf627, L"rawValue", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xa52682bd, L"{default}", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xac06e2b0, L"colSpan", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -2822,13 +2822,13 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Use, XFA_ScriptType::Basic}, {0xa52682bd, L"{default}", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xbc254332, L"usehref", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, XFA_Attribute::Usehref, XFA_ScriptType::Basic}, {0xd6e27f1d, L"value", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xbe52dfbf, L"desc", (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Attribute_String, @@ -3286,10 +3286,10 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_ModelClass_AliasNode, XFA_Attribute::Unknown, XFA_ScriptType::Object}, {0xa52682bd, L"{default}", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, {0xd6e27f1d, L"value", - (XFA_ATTRIBUTE_CALLBACK)&CJX_Node::Script_Som_DefaultValue, + (XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue, XFA_Attribute::Unknown, XFA_ScriptType::Basic}, }; const int32_t g_iSomAttributeCount = FX_ArraySize(g_SomAttributeData); -- cgit v1.2.3