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 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1732 if (widgetValue.ValidateValue(wsValue, wsPicture, pLocale, &wsPicture)) { | 1732 if (widgetValue.ValidateValue(wsValue, wsPicture, pLocale, &wsPicture)) { |
1733 widgetValue = CXFA_LocaleValue(widgetValue.GetType(), wsNormalizeValue, | 1733 widgetValue = CXFA_LocaleValue(widgetValue.GetType(), wsNormalizeValue, |
1734 wsPicture, pLocale, pLocalMgr); | 1734 wsPicture, pLocale, pLocalMgr); |
1735 wsNormalizeValue = widgetValue.GetValue(); | 1735 wsNormalizeValue = widgetValue.GetValue(); |
1736 return TRUE; | 1736 return TRUE; |
1737 } | 1737 } |
1738 return FALSE; | 1738 return FALSE; |
1739 } | 1739 } |
1740 | 1740 |
1741 FX_BOOL CXFA_WidgetData::GetFormatDataValue(const CFX_WideString& wsValue, | 1741 FX_BOOL CXFA_WidgetData::GetFormatDataValue(const CFX_WideString& wsValue, |
1742 CFX_WideString& wsFormatedValue) { | 1742 CFX_WideString& wsFormattedValue) { |
1743 wsFormatedValue = wsValue; | 1743 wsFormattedValue = wsValue; |
1744 if (wsValue.IsEmpty()) | 1744 if (wsValue.IsEmpty()) |
1745 return TRUE; | 1745 return TRUE; |
1746 | 1746 |
1747 CFX_WideString wsPicture; | 1747 CFX_WideString wsPicture; |
1748 GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind); | 1748 GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind); |
1749 if (wsPicture.IsEmpty()) | 1749 if (wsPicture.IsEmpty()) |
1750 return TRUE; | 1750 return TRUE; |
1751 | 1751 |
1752 if (IFX_Locale* pLocale = GetLocal()) { | 1752 if (IFX_Locale* pLocale = GetLocal()) { |
1753 ASSERT(GetNode()); | 1753 ASSERT(GetNode()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1789 iVTType = XFA_VT_NULL; | 1789 iVTType = XFA_VT_NULL; |
1790 break; | 1790 break; |
1791 } | 1791 } |
1792 CXFA_LocaleMgr* pLocalMgr = GetNode()->GetDocument()->GetLocalMgr(); | 1792 CXFA_LocaleMgr* pLocalMgr = GetNode()->GetDocument()->GetLocalMgr(); |
1793 CXFA_LocaleValue widgetValue(iVTType, wsValue, pLocalMgr); | 1793 CXFA_LocaleValue widgetValue(iVTType, wsValue, pLocalMgr); |
1794 switch (widgetValue.GetType()) { | 1794 switch (widgetValue.GetType()) { |
1795 case XFA_VT_DATE: { | 1795 case XFA_VT_DATE: { |
1796 CFX_WideString wsDate, wsTime; | 1796 CFX_WideString wsDate, wsTime; |
1797 if (SplitDateTime(wsValue, wsDate, wsTime)) { | 1797 if (SplitDateTime(wsValue, wsDate, wsTime)) { |
1798 CXFA_LocaleValue date(XFA_VT_DATE, wsDate, pLocalMgr); | 1798 CXFA_LocaleValue date(XFA_VT_DATE, wsDate, pLocalMgr); |
1799 if (date.FormatPatterns(wsFormatedValue, wsPicture, pLocale, | 1799 if (date.FormatPatterns(wsFormattedValue, wsPicture, pLocale, |
1800 XFA_VALUEPICTURE_DataBind)) { | 1800 XFA_VALUEPICTURE_DataBind)) { |
1801 return TRUE; | 1801 return TRUE; |
1802 } | 1802 } |
1803 } | 1803 } |
1804 break; | 1804 break; |
1805 } | 1805 } |
1806 case XFA_VT_TIME: { | 1806 case XFA_VT_TIME: { |
1807 CFX_WideString wsDate, wsTime; | 1807 CFX_WideString wsDate, wsTime; |
1808 if (SplitDateTime(wsValue, wsDate, wsTime)) { | 1808 if (SplitDateTime(wsValue, wsDate, wsTime)) { |
1809 CXFA_LocaleValue time(XFA_VT_TIME, wsTime, pLocalMgr); | 1809 CXFA_LocaleValue time(XFA_VT_TIME, wsTime, pLocalMgr); |
1810 if (time.FormatPatterns(wsFormatedValue, wsPicture, pLocale, | 1810 if (time.FormatPatterns(wsFormattedValue, wsPicture, pLocale, |
1811 XFA_VALUEPICTURE_DataBind)) { | 1811 XFA_VALUEPICTURE_DataBind)) { |
1812 return TRUE; | 1812 return TRUE; |
1813 } | 1813 } |
1814 } | 1814 } |
1815 break; | 1815 break; |
1816 } | 1816 } |
1817 default: | 1817 default: |
1818 break; | 1818 break; |
1819 } | 1819 } |
1820 widgetValue.FormatPatterns(wsFormatedValue, wsPicture, pLocale, | 1820 widgetValue.FormatPatterns(wsFormattedValue, wsPicture, pLocale, |
1821 XFA_VALUEPICTURE_DataBind); | 1821 XFA_VALUEPICTURE_DataBind); |
1822 } | 1822 } |
1823 return FALSE; | 1823 return FALSE; |
1824 } | 1824 } |
1825 | 1825 |
1826 void CXFA_WidgetData::NormalizeNumStr(const CFX_WideString& wsValue, | 1826 void CXFA_WidgetData::NormalizeNumStr(const CFX_WideString& wsValue, |
1827 CFX_WideString& wsOutput) { | 1827 CFX_WideString& wsOutput) { |
1828 if (wsValue.IsEmpty()) | 1828 if (wsValue.IsEmpty()) |
1829 return; | 1829 return; |
1830 | 1830 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1940 } | 1940 } |
1941 } | 1941 } |
1942 } else if (wc == L'.') { | 1942 } else if (wc == L'.') { |
1943 iTread_ = 0; | 1943 iTread_ = 0; |
1944 iLead = -1; | 1944 iLead = -1; |
1945 } | 1945 } |
1946 wsRet += wc; | 1946 wsRet += wc; |
1947 } | 1947 } |
1948 return wsRet; | 1948 return wsRet; |
1949 } | 1949 } |
OLD | NEW |