| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/cxfa_widgetdata.h" | 7 #include "xfa/fxfa/parser/cxfa_widgetdata.h" |
| 8 | 8 |
| 9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
| 10 #include "xfa/fxbarcode/include/BC_Library.h" | 10 #include "xfa/fxbarcode/include/BC_Library.h" |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 if (!pItemchild) | 406 if (!pItemchild) |
| 407 continue; | 407 continue; |
| 408 | 408 |
| 409 CFX_WideString text = pItemchild->GetContent(); | 409 CFX_WideString text = pItemchild->GetContent(); |
| 410 CFX_WideString wsChildValue = text; | 410 CFX_WideString wsChildValue = text; |
| 411 if (wsValue != text) { | 411 if (wsValue != text) { |
| 412 pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling); | 412 pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 413 if (pItemchild) | 413 if (pItemchild) |
| 414 wsChildValue = pItemchild->GetContent(); | 414 wsChildValue = pItemchild->GetContent(); |
| 415 else | 415 else |
| 416 wsChildValue.Empty(); | 416 wsChildValue.clear(); |
| 417 } | 417 } |
| 418 CXFA_WidgetData ch(pChild); | 418 CXFA_WidgetData ch(pChild); |
| 419 ch.SyncValue(wsChildValue, bNotify); | 419 ch.SyncValue(wsChildValue, bNotify); |
| 420 } | 420 } |
| 421 exclGroup.SyncValue(wsValue, bNotify); | 421 exclGroup.SyncValue(wsValue, bNotify); |
| 422 } else { | 422 } else { |
| 423 CXFA_Node* pItems = m_pNode->GetChild(0, XFA_ELEMENT_Items); | 423 CXFA_Node* pItems = m_pNode->GetChild(0, XFA_ELEMENT_Items); |
| 424 if (!pItems) | 424 if (!pItems) |
| 425 return; | 425 return; |
| 426 | 426 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 CXFA_Node* pItemchild = pItem->GetNodeItem(XFA_NODEITEM_FirstChild); | 497 CXFA_Node* pItemchild = pItem->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 498 if (!pItemchild) | 498 if (!pItemchild) |
| 499 continue; | 499 continue; |
| 500 | 500 |
| 501 CFX_WideString wsChildValue = pItemchild->GetContent(); | 501 CFX_WideString wsChildValue = pItemchild->GetContent(); |
| 502 if (wsValue != wsChildValue) { | 502 if (wsValue != wsChildValue) { |
| 503 pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling); | 503 pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 504 if (pItemchild) | 504 if (pItemchild) |
| 505 wsChildValue = pItemchild->GetContent(); | 505 wsChildValue = pItemchild->GetContent(); |
| 506 else | 506 else |
| 507 wsChildValue.Empty(); | 507 wsChildValue.clear(); |
| 508 } else { | 508 } else { |
| 509 wsExclGroup = wsValue; | 509 wsExclGroup = wsValue; |
| 510 } | 510 } |
| 511 pNode->SetContent(wsChildValue, wsChildValue, bNotify, bScriptModify, | 511 pNode->SetContent(wsChildValue, wsChildValue, bNotify, bScriptModify, |
| 512 FALSE); | 512 FALSE); |
| 513 } | 513 } |
| 514 if (m_pNode) { | 514 if (m_pNode) { |
| 515 m_pNode->SetContent(wsExclGroup, wsExclGroup, bNotify, bScriptModify, | 515 m_pNode->SetContent(wsExclGroup, wsExclGroup, bNotify, bScriptModify, |
| 516 bSyncData); | 516 bSyncData); |
| 517 } | 517 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave) | 599 if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave) |
| 600 pItem = pItems[1]; | 600 pItem = pItems[1]; |
| 601 } | 601 } |
| 602 pItems.RemoveAll(); | 602 pItems.RemoveAll(); |
| 603 return pItem->CountChildren(XFA_ELEMENT_UNKNOWN); | 603 return pItem->CountChildren(XFA_ELEMENT_UNKNOWN); |
| 604 } | 604 } |
| 605 | 605 |
| 606 FX_BOOL CXFA_WidgetData::GetChoiceListItem(CFX_WideString& wsText, | 606 FX_BOOL CXFA_WidgetData::GetChoiceListItem(CFX_WideString& wsText, |
| 607 int32_t nIndex, | 607 int32_t nIndex, |
| 608 FX_BOOL bSaveValue) { | 608 FX_BOOL bSaveValue) { |
| 609 wsText.Empty(); | 609 wsText.clear(); |
| 610 CXFA_NodeArray pItemsArray; | 610 CXFA_NodeArray pItemsArray; |
| 611 CXFA_Node* pItems = NULL; | 611 CXFA_Node* pItems = NULL; |
| 612 int32_t iCount = 0; | 612 int32_t iCount = 0; |
| 613 CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 613 CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 614 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 614 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 615 if (pNode->GetClassID() != XFA_ELEMENT_Items) | 615 if (pNode->GetClassID() != XFA_ELEMENT_Items) |
| 616 continue; | 616 continue; |
| 617 | 617 |
| 618 iCount++; | 618 iCount++; |
| 619 pItemsArray.Add(pNode); | 619 pItemsArray.Add(pNode); |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1500 if (!pNode) | 1500 if (!pNode) |
| 1501 return TRUE; | 1501 return TRUE; |
| 1502 | 1502 |
| 1503 XFA_ELEMENT uiType = GetUIChild()->GetClassID(); | 1503 XFA_ELEMENT uiType = GetUIChild()->GetClassID(); |
| 1504 switch (uiType) { | 1504 switch (uiType) { |
| 1505 case XFA_ELEMENT_ChoiceList: { | 1505 case XFA_ELEMENT_ChoiceList: { |
| 1506 if (eValueType == XFA_VALUEPICTURE_Display) { | 1506 if (eValueType == XFA_VALUEPICTURE_Display) { |
| 1507 int32_t iSelItemIndex = GetSelectedItem(0); | 1507 int32_t iSelItemIndex = GetSelectedItem(0); |
| 1508 if (iSelItemIndex >= 0) { | 1508 if (iSelItemIndex >= 0) { |
| 1509 GetChoiceListItem(wsValue, iSelItemIndex); | 1509 GetChoiceListItem(wsValue, iSelItemIndex); |
| 1510 wsPicture.Empty(); | 1510 wsPicture.clear(); |
| 1511 } | 1511 } |
| 1512 } | 1512 } |
| 1513 } break; | 1513 } break; |
| 1514 case XFA_ELEMENT_NumericEdit: | 1514 case XFA_ELEMENT_NumericEdit: |
| 1515 if (eValueType != XFA_VALUEPICTURE_Raw && wsPicture.IsEmpty()) { | 1515 if (eValueType != XFA_VALUEPICTURE_Raw && wsPicture.IsEmpty()) { |
| 1516 IFX_Locale* pLocale = GetLocal(); | 1516 IFX_Locale* pLocale = GetLocal(); |
| 1517 if (eValueType == XFA_VALUEPICTURE_Display && pLocale) { | 1517 if (eValueType == XFA_VALUEPICTURE_Display && pLocale) { |
| 1518 CFX_WideString wsOutput; | 1518 CFX_WideString wsOutput; |
| 1519 NormalizeNumStr(wsValue, wsOutput); | 1519 NormalizeNumStr(wsValue, wsOutput); |
| 1520 FormatNumStr(wsOutput, pLocale, wsOutput); | 1520 FormatNumStr(wsOutput, pLocale, wsOutput); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 wsSrcNum.Delete(0, 1); | 1702 wsSrcNum.Delete(0, 1); |
| 1703 } | 1703 } |
| 1704 int32_t len = wsSrcNum.GetLength(); | 1704 int32_t len = wsSrcNum.GetLength(); |
| 1705 int32_t dot_index = wsSrcNum.Find('.'); | 1705 int32_t dot_index = wsSrcNum.Find('.'); |
| 1706 if (dot_index == -1) | 1706 if (dot_index == -1) |
| 1707 dot_index = len; | 1707 dot_index = len; |
| 1708 | 1708 |
| 1709 int32_t cc = dot_index - 1; | 1709 int32_t cc = dot_index - 1; |
| 1710 if (cc >= 0) { | 1710 if (cc >= 0) { |
| 1711 int nPos = dot_index % 3; | 1711 int nPos = dot_index % 3; |
| 1712 wsOutput.Empty(); | 1712 wsOutput.clear(); |
| 1713 for (int32_t i = 0; i < dot_index; i++) { | 1713 for (int32_t i = 0; i < dot_index; i++) { |
| 1714 if (i % 3 == nPos && i != 0) | 1714 if (i % 3 == nPos && i != 0) |
| 1715 wsOutput += wsGroupSymbol; | 1715 wsOutput += wsGroupSymbol; |
| 1716 | 1716 |
| 1717 wsOutput += wsSrcNum[i]; | 1717 wsOutput += wsSrcNum[i]; |
| 1718 } | 1718 } |
| 1719 if (dot_index < len) { | 1719 if (dot_index < len) { |
| 1720 CFX_WideString wsSymbol; | 1720 CFX_WideString wsSymbol; |
| 1721 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsSymbol); | 1721 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsSymbol); |
| 1722 wsOutput += wsSymbol; | 1722 wsOutput += wsSymbol; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1788 } | 1788 } |
| 1789 } | 1789 } |
| 1790 } else if (wc == L'.') { | 1790 } else if (wc == L'.') { |
| 1791 iTread_ = 0; | 1791 iTread_ = 0; |
| 1792 iLead = -1; | 1792 iLead = -1; |
| 1793 } | 1793 } |
| 1794 wsRet += wc; | 1794 wsRet += wc; |
| 1795 } | 1795 } |
| 1796 return wsRet; | 1796 return wsRet; |
| 1797 } | 1797 } |
| OLD | NEW |