| OLD | NEW |
| 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 1670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1681 } | 1681 } |
| 1682 if (!wsPicture.IsEmpty()) { | 1682 if (!wsPicture.IsEmpty()) { |
| 1683 break; | 1683 break; |
| 1684 } | 1684 } |
| 1685 pContainerWidgetData = NULL; | 1685 pContainerWidgetData = NULL; |
| 1686 } | 1686 } |
| 1687 } else if (GetPacketID() == XFA_XDPPACKET_Form) { | 1687 } else if (GetPacketID() == XFA_XDPPACKET_Form) { |
| 1688 pContainerWidgetData = GetContainerWidgetData(); | 1688 pContainerWidgetData = GetContainerWidgetData(); |
| 1689 } | 1689 } |
| 1690 if (pContainerWidgetData) { | 1690 if (pContainerWidgetData) { |
| 1691 pContainerWidgetData->GetFormatDataValue(wsNewValue.AsStringC(), | 1691 pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue); |
| 1692 wsFormatValue); | |
| 1693 } | 1692 } |
| 1694 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); | 1693 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); |
| 1695 } else { | 1694 } else { |
| 1696 CFX_WideString content = GetScriptContent(TRUE); | 1695 CFX_WideString content = GetScriptContent(TRUE); |
| 1697 if (content.IsEmpty() && classID != XFA_ELEMENT_Text && | 1696 if (content.IsEmpty() && classID != XFA_ELEMENT_Text && |
| 1698 classID != XFA_ELEMENT_SubmitUrl) { | 1697 classID != XFA_ELEMENT_SubmitUrl) { |
| 1699 FXJSE_Value_SetNull(hValue); | 1698 FXJSE_Value_SetNull(hValue); |
| 1700 } else if (classID == XFA_ELEMENT_Integer) { | 1699 } else if (classID == XFA_ELEMENT_Integer) { |
| 1701 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content.c_str())); | 1700 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content.c_str())); |
| 1702 } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) { | 1701 } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1731 if (bSetting) { | 1730 if (bSetting) { |
| 1732 CFX_ByteString newValue; | 1731 CFX_ByteString newValue; |
| 1733 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { | 1732 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { |
| 1734 FXJSE_Value_ToUTF8String(hValue, newValue); | 1733 FXJSE_Value_ToUTF8String(hValue, newValue); |
| 1735 } | 1734 } |
| 1736 int32_t iValue = FXSYS_atoi(newValue.c_str()); | 1735 int32_t iValue = FXSYS_atoi(newValue.c_str()); |
| 1737 CFX_WideString wsNewValue = (iValue == 0) ? FX_WSTRC(L"0") : FX_WSTRC(L"1"); | 1736 CFX_WideString wsNewValue = (iValue == 0) ? FX_WSTRC(L"0") : FX_WSTRC(L"1"); |
| 1738 CFX_WideString wsFormatValue(wsNewValue); | 1737 CFX_WideString wsFormatValue(wsNewValue); |
| 1739 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); | 1738 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); |
| 1740 if (pContainerWidgetData) { | 1739 if (pContainerWidgetData) { |
| 1741 pContainerWidgetData->GetFormatDataValue(wsNewValue.AsStringC(), | 1740 pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue); |
| 1742 wsFormatValue); | |
| 1743 } | 1741 } |
| 1744 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); | 1742 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); |
| 1745 } else { | 1743 } else { |
| 1746 CFX_WideString wsValue = GetScriptContent(TRUE); | 1744 CFX_WideString wsValue = GetScriptContent(TRUE); |
| 1747 FXJSE_Value_SetBoolean(hValue, wsValue == FX_WSTRC(L"1")); | 1745 FXJSE_Value_SetBoolean(hValue, wsValue == FX_WSTRC(L"1")); |
| 1748 } | 1746 } |
| 1749 } | 1747 } |
| 1750 struct XFA_ExecEventParaInfo { | 1748 struct XFA_ExecEventParaInfo { |
| 1751 public: | 1749 public: |
| 1752 uint32_t m_uHash; | 1750 uint32_t m_uHash; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1992 int32_t iLeadDigits = 0; | 1990 int32_t iLeadDigits = 0; |
| 1993 int32_t iFracDigits = 0; | 1991 int32_t iFracDigits = 0; |
| 1994 pWidgetData->GetLeadDigits(iLeadDigits); | 1992 pWidgetData->GetLeadDigits(iLeadDigits); |
| 1995 pWidgetData->GetFracDigits(iFracDigits); | 1993 pWidgetData->GetFracDigits(iFracDigits); |
| 1996 wsNewText = | 1994 wsNewText = |
| 1997 pWidgetData->NumericLimit(wsNewText, iLeadDigits, iFracDigits); | 1995 pWidgetData->NumericLimit(wsNewText, iLeadDigits, iFracDigits); |
| 1998 } | 1996 } |
| 1999 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); | 1997 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); |
| 2000 CFX_WideString wsFormatText(wsNewText); | 1998 CFX_WideString wsFormatText(wsNewText); |
| 2001 if (pContainerWidgetData) { | 1999 if (pContainerWidgetData) { |
| 2002 pContainerWidgetData->GetFormatDataValue(wsNewText.AsStringC(), | 2000 pContainerWidgetData->GetFormatDataValue(wsNewText, wsFormatText); |
| 2003 wsFormatText); | |
| 2004 } | 2001 } |
| 2005 SetScriptContent(wsNewText, wsFormatText, TRUE, TRUE); | 2002 SetScriptContent(wsNewText, wsFormatText, TRUE, TRUE); |
| 2006 } else { | 2003 } else { |
| 2007 CFX_WideString content = GetScriptContent(TRUE); | 2004 CFX_WideString content = GetScriptContent(TRUE); |
| 2008 if (content.IsEmpty()) { | 2005 if (content.IsEmpty()) { |
| 2009 FXJSE_Value_SetNull(hValue); | 2006 FXJSE_Value_SetNull(hValue); |
| 2010 } else { | 2007 } else { |
| 2011 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); | 2008 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); |
| 2012 XFA_ELEMENT eUI = pUIChild->GetClassID(); | 2009 XFA_ELEMENT eUI = pUIChild->GetClassID(); |
| 2013 CXFA_Value defVal = pWidgetData->GetFormValue(); | 2010 CXFA_Value defVal = pWidgetData->GetFormValue(); |
| (...skipping 3199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5213 pDstModuleData->m_BufferMap.RemoveKey(pKey); | 5210 pDstModuleData->m_BufferMap.RemoveKey(pKey); |
| 5214 pDstModuleData->m_BufferMap.SetAt(pKey, | 5211 pDstModuleData->m_BufferMap.SetAt(pKey, |
| 5215 (XFA_MAPDATABLOCK*)pBufferBlockData); | 5212 (XFA_MAPDATABLOCK*)pBufferBlockData); |
| 5216 } | 5213 } |
| 5217 } | 5214 } |
| 5218 if (pDstModule->GetObjectType() == XFA_OBJECTTYPE_NodeV) { | 5215 if (pDstModule->GetObjectType() == XFA_OBJECTTYPE_NodeV) { |
| 5219 CFX_WideString wsValue = pDstModule->GetScriptContent(FALSE); | 5216 CFX_WideString wsValue = pDstModule->GetScriptContent(FALSE); |
| 5220 CFX_WideString wsFormatValue(wsValue); | 5217 CFX_WideString wsFormatValue(wsValue); |
| 5221 CXFA_WidgetData* pWidgetData = pDstModule->GetContainerWidgetData(); | 5218 CXFA_WidgetData* pWidgetData = pDstModule->GetContainerWidgetData(); |
| 5222 if (pWidgetData) { | 5219 if (pWidgetData) { |
| 5223 pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatValue); | 5220 pWidgetData->GetFormatDataValue(wsValue, wsFormatValue); |
| 5224 } | 5221 } |
| 5225 pDstModule->SetScriptContent(wsValue, wsFormatValue, TRUE, TRUE); | 5222 pDstModule->SetScriptContent(wsValue, wsFormatValue, TRUE, TRUE); |
| 5226 } | 5223 } |
| 5227 } | 5224 } |
| 5228 void CXFA_Node::MoveBufferMapData(CXFA_Node* pSrcModule, | 5225 void CXFA_Node::MoveBufferMapData(CXFA_Node* pSrcModule, |
| 5229 CXFA_Node* pDstModule, | 5226 CXFA_Node* pDstModule, |
| 5230 void* pKey, | 5227 void* pKey, |
| 5231 FX_BOOL bRecursive) { | 5228 FX_BOOL bRecursive) { |
| 5232 if (!pSrcModule || !pDstModule || !pKey) { | 5229 if (!pSrcModule || !pDstModule || !pKey) { |
| 5233 return; | 5230 return; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5410 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); | 5407 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); |
| 5411 } | 5408 } |
| 5412 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { | 5409 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { |
| 5413 return m_pAttachNode->RemoveChild(pNode); | 5410 return m_pAttachNode->RemoveChild(pNode); |
| 5414 } | 5411 } |
| 5415 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { | 5412 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { |
| 5416 return m_pAttachNode->GetChild( | 5413 return m_pAttachNode->GetChild( |
| 5417 iIndex, XFA_ELEMENT_UNKNOWN, | 5414 iIndex, XFA_ELEMENT_UNKNOWN, |
| 5418 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); | 5415 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); |
| 5419 } | 5416 } |
| OLD | NEW |