| 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 "fpdfsdk/javascript/PublicMethods.h" | 7 #include "fpdfsdk/javascript/PublicMethods.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 else | 830 else |
| 831 cSeperator = '.'; | 831 cSeperator = '.'; |
| 832 | 832 |
| 833 for (int iDecPositive = iDec2 - 3; iDecPositive > 0; iDecPositive -= 3) { | 833 for (int iDecPositive = iDec2 - 3; iDecPositive > 0; iDecPositive -= 3) { |
| 834 strValue.Insert(iDecPositive, cSeperator); | 834 strValue.Insert(iDecPositive, cSeperator); |
| 835 iMax++; | 835 iMax++; |
| 836 } | 836 } |
| 837 } | 837 } |
| 838 | 838 |
| 839 // for processing currency string | 839 // for processing currency string |
| 840 Value = CFX_WideString::FromLocal(strValue); | 840 Value = CFX_WideString::FromLocal(strValue.AsByteStringC()); |
| 841 std::wstring strValue2 = Value.c_str(); | 841 std::wstring strValue2 = Value.c_str(); |
| 842 | 842 |
| 843 if (bCurrencyPrepend) | 843 if (bCurrencyPrepend) |
| 844 strValue2 = wstrCurrency + strValue2; | 844 strValue2 = wstrCurrency + strValue2; |
| 845 else | 845 else |
| 846 strValue2 = strValue2 + wstrCurrency; | 846 strValue2 = strValue2 + wstrCurrency; |
| 847 | 847 |
| 848 // for processing negative style | 848 // for processing negative style |
| 849 if (iNegative) { | 849 if (iNegative) { |
| 850 if (iNegStyle == 0) { | 850 if (iNegStyle == 0) { |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1113 for (int iDecPositive = iDec2 - 3; iDecPositive > 0; iDecPositive -= 3) { | 1113 for (int iDecPositive = iDec2 - 3; iDecPositive > 0; iDecPositive -= 3) { |
| 1114 strValue.Insert(iDecPositive, cSeperator); | 1114 strValue.Insert(iDecPositive, cSeperator); |
| 1115 iMax++; | 1115 iMax++; |
| 1116 } | 1116 } |
| 1117 } | 1117 } |
| 1118 | 1118 |
| 1119 // negative mark | 1119 // negative mark |
| 1120 if (iNegative) | 1120 if (iNegative) |
| 1121 strValue = "-" + strValue; | 1121 strValue = "-" + strValue; |
| 1122 strValue += "%"; | 1122 strValue += "%"; |
| 1123 Value = CFX_WideString::FromLocal(strValue); | 1123 Value = CFX_WideString::FromLocal(strValue.AsByteStringC()); |
| 1124 #endif | 1124 #endif |
| 1125 return TRUE; | 1125 return TRUE; |
| 1126 } | 1126 } |
| 1127 // AFPercent_Keystroke(nDec, sepStyle) | 1127 // AFPercent_Keystroke(nDec, sepStyle) |
| 1128 FX_BOOL CJS_PublicMethods::AFPercent_Keystroke( | 1128 FX_BOOL CJS_PublicMethods::AFPercent_Keystroke( |
| 1129 IJS_Context* cc, | 1129 IJS_Context* cc, |
| 1130 const std::vector<CJS_Value>& params, | 1130 const std::vector<CJS_Value>& params, |
| 1131 CJS_Value& vRet, | 1131 CJS_Value& vRet, |
| 1132 CFX_WideString& sError) { | 1132 CFX_WideString& sError) { |
| 1133 return AFNumber_Keystroke(cc, params, vRet, sError); | 1133 return AFNumber_Keystroke(cc, params, vRet, sError); |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1867 nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str())); | 1867 nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str())); |
| 1868 } | 1868 } |
| 1869 | 1869 |
| 1870 if (nums.GetLength() > 0) | 1870 if (nums.GetLength() > 0) |
| 1871 vRet = nums; | 1871 vRet = nums; |
| 1872 else | 1872 else |
| 1873 vRet.SetNull(); | 1873 vRet.SetNull(); |
| 1874 | 1874 |
| 1875 return TRUE; | 1875 return TRUE; |
| 1876 } | 1876 } |
| OLD | NEW |