Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: fpdfsdk/javascript/PublicMethods.cpp

Issue 1936383002: Remove std::string usage in PublicMethods.cpp. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 #include <vector> 10 #include <vector>
12 11
13 #include "core/fxcrt/include/fx_ext.h" 12 #include "core/fxcrt/include/fx_ext.h"
14 #include "fpdfsdk/include/fsdk_mgr.h" 13 #include "fpdfsdk/include/fsdk_mgr.h"
15 #include "fpdfsdk/javascript/Field.h" 14 #include "fpdfsdk/javascript/Field.h"
16 #include "fpdfsdk/javascript/JS_Define.h" 15 #include "fpdfsdk/javascript/JS_Define.h"
17 #include "fpdfsdk/javascript/JS_EventHandler.h" 16 #include "fpdfsdk/javascript/JS_EventHandler.h"
18 #include "fpdfsdk/javascript/JS_Object.h" 17 #include "fpdfsdk/javascript/JS_Object.h"
19 #include "fpdfsdk/javascript/JS_Value.h" 18 #include "fpdfsdk/javascript/JS_Value.h"
20 #include "fpdfsdk/javascript/cjs_context.h" 19 #include "fpdfsdk/javascript/cjs_context.h"
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 731
733 CFX_WideString& Value = pEvent->Value(); 732 CFX_WideString& Value = pEvent->Value();
734 CFX_ByteString strValue = StrTrim(CFX_ByteString::FromUnicode(Value)); 733 CFX_ByteString strValue = StrTrim(CFX_ByteString::FromUnicode(Value));
735 if (strValue.IsEmpty()) 734 if (strValue.IsEmpty())
736 return TRUE; 735 return TRUE;
737 736
738 int iDec = params[0].ToInt(); 737 int iDec = params[0].ToInt();
739 int iSepStyle = params[1].ToInt(); 738 int iSepStyle = params[1].ToInt();
740 int iNegStyle = params[2].ToInt(); 739 int iNegStyle = params[2].ToInt();
741 // params[3] is iCurrStyle, it's not used. 740 // params[3] is iCurrStyle, it's not used.
742 std::wstring wstrCurrency(params[4].ToCFXWideString().c_str()); 741 CFX_WideString wstrCurrency = params[4].ToCFXWideString();
743 FX_BOOL bCurrencyPrepend = params[5].ToBool(); 742 FX_BOOL bCurrencyPrepend = params[5].ToBool();
744 743
745 if (iDec < 0) 744 if (iDec < 0)
746 iDec = -iDec; 745 iDec = -iDec;
747 746
748 if (iSepStyle < 0 || iSepStyle > 3) 747 if (iSepStyle < 0 || iSepStyle > 3)
749 iSepStyle = 0; 748 iSepStyle = 0;
750 749
751 if (iNegStyle < 0 || iNegStyle > 3) 750 if (iNegStyle < 0 || iNegStyle > 3)
752 iNegStyle = 0; 751 iNegStyle = 0;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 cSeperator = '.'; 804 cSeperator = '.';
806 805
807 for (int iDecPositive = iDec2 - 3; iDecPositive > 0; iDecPositive -= 3) { 806 for (int iDecPositive = iDec2 - 3; iDecPositive > 0; iDecPositive -= 3) {
808 strValue.Insert(iDecPositive, cSeperator); 807 strValue.Insert(iDecPositive, cSeperator);
809 iMax++; 808 iMax++;
810 } 809 }
811 } 810 }
812 811
813 // for processing currency string 812 // for processing currency string
814 Value = CFX_WideString::FromLocal(strValue.AsStringC()); 813 Value = CFX_WideString::FromLocal(strValue.AsStringC());
815 std::wstring strValue2 = Value.c_str();
816 814
817 if (bCurrencyPrepend) 815 if (bCurrencyPrepend)
818 strValue2 = wstrCurrency + strValue2; 816 Value = wstrCurrency + Value;
819 else 817 else
820 strValue2 = strValue2 + wstrCurrency; 818 Value = Value + wstrCurrency;
821 819
822 // for processing negative style 820 // for processing negative style
823 if (iNegative) { 821 if (iNegative) {
824 if (iNegStyle == 0) { 822 if (iNegStyle == 0) {
825 strValue2.insert(0, L"-"); 823 Value = L"-" + Value;
826 } 824 } else if (iNegStyle == 2 || iNegStyle == 3) {
827 if (iNegStyle == 2 || iNegStyle == 3) { 825 Value = L"(" + Value + L")";
828 strValue2.insert(0, L"(");
829 strValue2.insert(strValue2.length(), L")");
830 } 826 }
831 if (iNegStyle == 1 || iNegStyle == 3) { 827 if (iNegStyle == 1 || iNegStyle == 3) {
832 if (Field* fTarget = pEvent->Target_Field()) { 828 if (Field* fTarget = pEvent->Target_Field()) {
833 CJS_Array arColor(pRuntime); 829 CJS_Array arColor(pRuntime);
834 CJS_Value vColElm(pRuntime); 830 CJS_Value vColElm(pRuntime);
835 vColElm = L"RGB"; 831 vColElm = L"RGB";
836 arColor.SetElement(0, vColElm); 832 arColor.SetElement(0, vColElm);
837 vColElm = 1; 833 vColElm = 1;
838 arColor.SetElement(1, vColElm); 834 arColor.SetElement(1, vColElm);
839 vColElm = 0; 835 vColElm = 0;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 if (crColor != crProp) { 871 if (crColor != crProp) {
876 CJS_PropValue vProp2(pRuntime); 872 CJS_PropValue vProp2(pRuntime);
877 vProp2.StartGetting(); 873 vProp2.StartGetting();
878 vProp2 << arColor; 874 vProp2 << arColor;
879 vProp2.StartSetting(); 875 vProp2.StartSetting();
880 fTarget->textColor(cc, vProp2, sError); 876 fTarget->textColor(cc, vProp2, sError);
881 } 877 }
882 } 878 }
883 } 879 }
884 } 880 }
885 Value = strValue2.c_str();
886 #endif 881 #endif
887 return TRUE; 882 return TRUE;
888 } 883 }
889 884
890 // function AFNumber_Keystroke(nDec, sepStyle, negStyle, currStyle, strCurrency, 885 // function AFNumber_Keystroke(nDec, sepStyle, negStyle, currStyle, strCurrency,
891 // bCurrencyPrepend) 886 // bCurrencyPrepend)
892 FX_BOOL CJS_PublicMethods::AFNumber_Keystroke( 887 FX_BOOL CJS_PublicMethods::AFNumber_Keystroke(
893 IJS_Context* cc, 888 IJS_Context* cc,
894 const std::vector<CJS_Value>& params, 889 const std::vector<CJS_Value>& params,
895 CJS_Value& vRet, 890 CJS_Value& vRet,
896 CFX_WideString& sError) { 891 CFX_WideString& sError) {
897 CJS_Context* pContext = (CJS_Context*)cc; 892 CJS_Context* pContext = (CJS_Context*)cc;
898 CJS_EventHandler* pEvent = pContext->GetEventHandler(); 893 CJS_EventHandler* pEvent = pContext->GetEventHandler();
899 894
900 if (params.size() < 2) 895 if (params.size() < 2)
901 return FALSE; 896 return FALSE;
902 int iSepStyle = params[1].ToInt();
903 897
904 if (iSepStyle < 0 || iSepStyle > 3)
905 iSepStyle = 0;
906 if (!pEvent->m_pValue) 898 if (!pEvent->m_pValue)
907 return FALSE; 899 return FALSE;
900
908 CFX_WideString& val = pEvent->Value(); 901 CFX_WideString& val = pEvent->Value();
909 CFX_WideString& w_strChange = pEvent->Change(); 902 CFX_WideString& wstrChange = pEvent->Change();
910 CFX_WideString w_strValue = val; 903 CFX_WideString wstrValue = val;
911 904
912 if (pEvent->WillCommit()) { 905 if (pEvent->WillCommit()) {
913 CFX_WideString wstrChange = w_strChange; 906 CFX_WideString wstrValue = StrTrim(wstrValue);
914 CFX_WideString wstrValue = StrTrim(w_strValue);
915 if (wstrValue.IsEmpty()) 907 if (wstrValue.IsEmpty())
916 return TRUE; 908 return TRUE;
917 909
918 CFX_WideString swTemp = wstrValue; 910 CFX_WideString swTemp = wstrValue;
919 swTemp.Replace(L",", L"."); 911 swTemp.Replace(L",", L".");
920 if (!IsNumber(swTemp.c_str())) { 912 if (!IsNumber(swTemp.c_str())) {
921 pEvent->Rc() = FALSE; 913 pEvent->Rc() = FALSE;
922 sError = JSGetStringFromID(pContext, IDS_STRING_JSAFNUMBER_KEYSTROKE); 914 sError = JSGetStringFromID(pContext, IDS_STRING_JSAFNUMBER_KEYSTROKE);
923 Alert(pContext, sError.c_str()); 915 Alert(pContext, sError.c_str());
924 return TRUE;
925 } 916 }
926 return TRUE; // it happens after the last keystroke and before validating, 917 return TRUE; // it happens after the last keystroke and before validating,
927 } 918 }
928 919
929 std::wstring w_strValue2 = w_strValue.c_str(); 920 CFX_WideString wstrSelected;
930 std::wstring w_strChange2 = w_strChange.c_str(); 921 if (pEvent->SelStart() != -1) {
931 std::wstring w_strSelected; 922 wstrSelected = wstrValue.Mid(pEvent->SelStart(),
932 if (-1 != pEvent->SelStart()) 923 pEvent->SelEnd() - pEvent->SelStart());
933 w_strSelected = w_strValue2.substr(pEvent->SelStart(), 924 }
934 (pEvent->SelEnd() - pEvent->SelStart())); 925
935 bool bHasSign = (w_strValue2.find('-') != std::wstring::npos) && 926 bool bHasSign = wstrValue.Find(L'-') != -1 && wstrSelected.Find(L'-') == -1;
936 (w_strSelected.find('-') == std::wstring::npos);
937 if (bHasSign) { 927 if (bHasSign) {
938 // can't insert "change" in front to sign postion. 928 // can't insert "change" in front to sign postion.
939 if (pEvent->SelStart() == 0) { 929 if (pEvent->SelStart() == 0) {
940 FX_BOOL& bRc = pEvent->Rc(); 930 FX_BOOL& bRc = pEvent->Rc();
941 bRc = FALSE; 931 bRc = FALSE;
942 return TRUE; 932 return TRUE;
943 } 933 }
944 } 934 }
945 935
946 char cSep = L'.'; 936 int iSepStyle = params[1].ToInt();
937 if (iSepStyle < 0 || iSepStyle > 3)
938 iSepStyle = 0;
939 const FX_WCHAR cSep = iSepStyle < 2 ? L'.' : L',';
947 940
948 switch (iSepStyle) { 941 bool bHasSep = wstrValue.Find(cSep) != -1;
949 case 0: 942 for (FX_STRSIZE i = 0; i < wstrChange.GetLength(); ++i) {
950 case 1: 943 if (wstrChange[i] == cSep) {
951 cSep = L'.';
952 break;
953 case 2:
954 case 3:
955 cSep = L',';
956 break;
957 }
958
959 bool bHasSep = (w_strValue2.find(cSep) != std::wstring::npos);
960 for (std::wstring::iterator it = w_strChange2.begin();
961 it != w_strChange2.end(); it++) {
962 if (*it == cSep) {
963 if (bHasSep) { 944 if (bHasSep) {
964 FX_BOOL& bRc = pEvent->Rc(); 945 FX_BOOL& bRc = pEvent->Rc();
965 bRc = FALSE; 946 bRc = FALSE;
966 return TRUE; 947 return TRUE;
967 } 948 }
968 bHasSep = TRUE; 949 bHasSep = TRUE;
969 continue; 950 continue;
970 } 951 }
971 if (*it == L'-') { 952 if (wstrChange[i] == L'-') {
972 if (bHasSign) { 953 if (bHasSign) {
973 FX_BOOL& bRc = pEvent->Rc(); 954 FX_BOOL& bRc = pEvent->Rc();
974 bRc = FALSE; 955 bRc = FALSE;
975 return TRUE; 956 return TRUE;
976 } 957 }
977 // sign's position is not correct 958 // sign's position is not correct
978 if (it != w_strChange2.begin()) { 959 if (i != 0) {
979 FX_BOOL& bRc = pEvent->Rc(); 960 FX_BOOL& bRc = pEvent->Rc();
980 bRc = FALSE; 961 bRc = FALSE;
981 return TRUE; 962 return TRUE;
982 } 963 }
983 if (pEvent->SelStart() != 0) { 964 if (pEvent->SelStart() != 0) {
984 FX_BOOL& bRc = pEvent->Rc(); 965 FX_BOOL& bRc = pEvent->Rc();
985 bRc = FALSE; 966 bRc = FALSE;
986 return TRUE; 967 return TRUE;
987 } 968 }
988 bHasSign = TRUE; 969 bHasSign = TRUE;
989 continue; 970 continue;
990 } 971 }
991 972
992 if (!FXSYS_iswdigit(*it)) { 973 if (!FXSYS_iswdigit(wstrChange[i])) {
993 FX_BOOL& bRc = pEvent->Rc(); 974 FX_BOOL& bRc = pEvent->Rc();
994 bRc = FALSE; 975 bRc = FALSE;
995 return TRUE; 976 return TRUE;
996 } 977 }
997 } 978 }
998 979
999 std::wstring w_prefix = w_strValue2.substr(0, pEvent->SelStart()); 980 CFX_WideString wprefix = wstrValue.Mid(0, pEvent->SelStart());
1000 std::wstring w_postfix; 981 CFX_WideString wpostfix;
1001 if (pEvent->SelEnd() < (int)w_strValue2.length()) 982 if (pEvent->SelEnd() < wstrValue.GetLength())
1002 w_postfix = w_strValue2.substr(pEvent->SelEnd()); 983 wpostfix = wstrValue.Mid(pEvent->SelEnd());
1003 w_strValue2 = w_prefix + w_strChange2 + w_postfix; 984 val = wprefix + wstrChange + wpostfix;
1004 w_strValue = w_strValue2.c_str();
1005 val = w_strValue;
1006 return TRUE; 985 return TRUE;
1007 } 986 }
1008 987
1009 // function AFPercent_Format(nDec, sepStyle) 988 // function AFPercent_Format(nDec, sepStyle)
1010 FX_BOOL CJS_PublicMethods::AFPercent_Format( 989 FX_BOOL CJS_PublicMethods::AFPercent_Format(
1011 IJS_Context* cc, 990 IJS_Context* cc,
1012 const std::vector<CJS_Value>& params, 991 const std::vector<CJS_Value>& params,
1013 CJS_Value& vRet, 992 CJS_Value& vRet,
1014 CFX_WideString& sError) { 993 CFX_WideString& sError) {
1015 #if _FX_OS_ != _FX_ANDROID_ 994 #if _FX_OS_ != _FX_ANDROID_
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 } 1412 }
1434 1413
1435 if (!pEvent->m_pValue) 1414 if (!pEvent->m_pValue)
1436 return FALSE; 1415 return FALSE;
1437 CFX_WideString& valEvent = pEvent->Value(); 1416 CFX_WideString& valEvent = pEvent->Value();
1438 1417
1439 CFX_WideString wstrMask = params[0].ToCFXWideString(); 1418 CFX_WideString wstrMask = params[0].ToCFXWideString();
1440 if (wstrMask.IsEmpty()) 1419 if (wstrMask.IsEmpty())
1441 return TRUE; 1420 return TRUE;
1442 1421
1443 const size_t wstrMaskLen = wstrMask.GetLength(); 1422 if (pEvent->WillCommit()) {
1444 const std::wstring wstrValue = valEvent.c_str(); 1423 if (valEvent.IsEmpty())
1424 return TRUE;
1445 1425
1446 if (pEvent->WillCommit()) { 1426 FX_STRSIZE iIndexMask = 0;
1447 if (wstrValue.empty()) 1427 for (; iIndexMask < valEvent.GetLength(); ++iIndexMask) {
1448 return TRUE; 1428 if (!maskSatisfied(valEvent[iIndexMask], wstrMask[iIndexMask]))
1449 size_t iIndexMask = 0;
1450 for (const auto& w_Value : wstrValue) {
1451 if (!maskSatisfied(w_Value, wstrMask[iIndexMask]))
1452 break; 1429 break;
1453 iIndexMask++;
1454 } 1430 }
1455 1431
1456 if (iIndexMask != wstrMaskLen || 1432 if (iIndexMask != wstrMask.GetLength() ||
1457 (iIndexMask != wstrValue.size() && wstrMaskLen != 0)) { 1433 (iIndexMask != valEvent.GetLength() && wstrMask.GetLength() != 0)) {
1458 Alert( 1434 Alert(
1459 pContext, 1435 pContext,
1460 JSGetStringFromID(pContext, IDS_STRING_JSAFNUMBER_KEYSTROKE).c_str()); 1436 JSGetStringFromID(pContext, IDS_STRING_JSAFNUMBER_KEYSTROKE).c_str());
1461 pEvent->Rc() = FALSE; 1437 pEvent->Rc() = FALSE;
1462 } 1438 }
1463 return TRUE; 1439 return TRUE;
1464 } 1440 }
1465 1441
1466 CFX_WideString& wideChange = pEvent->Change(); 1442 CFX_WideString& wideChange = pEvent->Change();
1467 std::wstring wChange = wideChange.c_str(); 1443 if (wideChange.IsEmpty())
1468 if (wChange.empty())
1469 return TRUE; 1444 return TRUE;
1470 1445
1471 size_t iIndexMask = pEvent->SelStart(); 1446 CFX_WideString wChange = wideChange;
1472 1447 FX_STRSIZE iIndexMask = pEvent->SelStart();
1473 size_t combined_len = wstrValue.length() + wChange.length() - 1448 FX_STRSIZE combined_len = valEvent.GetLength() + wChange.GetLength() +
1474 (pEvent->SelEnd() - pEvent->SelStart()); 1449 pEvent->SelStart() - pEvent->SelEnd();
1475 if (combined_len > wstrMaskLen) { 1450 if (combined_len > wstrMask.GetLength()) {
1476 Alert(pContext, 1451 Alert(pContext,
1477 JSGetStringFromID(pContext, IDS_STRING_JSPARAM_TOOLONG).c_str()); 1452 JSGetStringFromID(pContext, IDS_STRING_JSPARAM_TOOLONG).c_str());
1478 pEvent->Rc() = FALSE; 1453 pEvent->Rc() = FALSE;
1479 return TRUE; 1454 return TRUE;
1480 } 1455 }
1481 1456
1482 if (iIndexMask >= wstrMaskLen && (!wChange.empty())) { 1457 if (iIndexMask >= wstrMask.GetLength() && !wChange.IsEmpty()) {
1483 Alert(pContext, 1458 Alert(pContext,
1484 JSGetStringFromID(pContext, IDS_STRING_JSPARAM_TOOLONG).c_str()); 1459 JSGetStringFromID(pContext, IDS_STRING_JSPARAM_TOOLONG).c_str());
1485 pEvent->Rc() = FALSE; 1460 pEvent->Rc() = FALSE;
1486 return TRUE; 1461 return TRUE;
1487 } 1462 }
1488 1463
1489 for (std::wstring::iterator it = wChange.begin(); it != wChange.end(); it++) { 1464 for (FX_STRSIZE i = 0; i < wChange.GetLength(); ++i) {
1490 if (iIndexMask >= wstrMaskLen) { 1465 if (iIndexMask >= wstrMask.GetLength()) {
1491 Alert(pContext, 1466 Alert(pContext,
1492 JSGetStringFromID(pContext, IDS_STRING_JSPARAM_TOOLONG).c_str()); 1467 JSGetStringFromID(pContext, IDS_STRING_JSPARAM_TOOLONG).c_str());
1493 pEvent->Rc() = FALSE; 1468 pEvent->Rc() = FALSE;
1494 return TRUE; 1469 return TRUE;
1495 } 1470 }
1496 wchar_t w_Mask = wstrMask[iIndexMask]; 1471 FX_WCHAR wMask = wstrMask[iIndexMask];
1497 if (!isReservedMaskChar(w_Mask)) { 1472 if (!isReservedMaskChar(wMask))
1498 *it = w_Mask; 1473 wChange.SetAt(i, wMask);
1499 } 1474
1500 wchar_t w_Change = *it; 1475 if (!maskSatisfied(wChange[i], wMask)) {
1501 if (!maskSatisfied(w_Change, w_Mask)) {
1502 pEvent->Rc() = FALSE; 1476 pEvent->Rc() = FALSE;
1503 return TRUE; 1477 return TRUE;
1504 } 1478 }
1505 iIndexMask++; 1479 iIndexMask++;
1506 } 1480 }
1507 1481 wideChange = wChange;
1508 wideChange = wChange.c_str();
1509 return TRUE; 1482 return TRUE;
1510 } 1483 }
1511 1484
1512 // function AFSpecial_Keystroke(psf) 1485 // function AFSpecial_Keystroke(psf)
1513 FX_BOOL CJS_PublicMethods::AFSpecial_Keystroke( 1486 FX_BOOL CJS_PublicMethods::AFSpecial_Keystroke(
1514 IJS_Context* cc, 1487 IJS_Context* cc,
1515 const std::vector<CJS_Value>& params, 1488 const std::vector<CJS_Value>& params,
1516 CJS_Value& vRet, 1489 CJS_Value& vRet,
1517 CFX_WideString& sError) { 1490 CFX_WideString& sError) {
1518 CJS_Context* pContext = (CJS_Context*)cc; 1491 CJS_Context* pContext = (CJS_Context*)cc;
1519 if (params.size() != 1) { 1492 if (params.size() != 1) {
1520 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); 1493 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
1521 return FALSE; 1494 return FALSE;
1522 } 1495 }
1523 1496
1524 CJS_EventHandler* pEvent = pContext->GetEventHandler(); 1497 CJS_EventHandler* pEvent = pContext->GetEventHandler();
1525 if (!pEvent->m_pValue) 1498 if (!pEvent->m_pValue)
1526 return FALSE; 1499 return FALSE;
1527 1500
1528 std::string cFormat; 1501 const char* cFormat = "";
1529 int iIndex = params[0].ToInt(); 1502 switch (params[0].ToInt()) {
1530 CFX_WideString& val = pEvent->Value();
1531 std::string strSrc = CFX_ByteString::FromUnicode(val).c_str();
1532 std::wstring wstrChange = pEvent->Change().c_str();
1533
1534 switch (iIndex) {
1535 case 0: 1503 case 0:
1536 cFormat = "99999"; 1504 cFormat = "99999";
1537 break; 1505 break;
1538 case 1: 1506 case 1:
1539 cFormat = "999999999"; 1507 cFormat = "999999999";
1540 break; 1508 break;
1541 case 2: 1509 case 2:
1542 if (strSrc.length() + wstrChange.length() > 7) 1510 if (pEvent->Value().GetLength() + pEvent->Change().GetLength() > 7)
1543 cFormat = "9999999999"; 1511 cFormat = "9999999999";
1544 else 1512 else
1545 cFormat = "9999999"; 1513 cFormat = "9999999";
1546 break; 1514 break;
1547 case 3: 1515 case 3:
1548 cFormat = "999999999"; 1516 cFormat = "999999999";
1549 break; 1517 break;
1550 } 1518 }
1551 1519
1552 std::vector<CJS_Value> params2; 1520 std::vector<CJS_Value> params2;
1553 params2.push_back(CJS_Value(CJS_Runtime::FromContext(cc), cFormat.c_str())); 1521 params2.push_back(CJS_Value(CJS_Runtime::FromContext(cc), cFormat));
1554 return AFSpecial_KeystrokeEx(cc, params2, vRet, sError); 1522 return AFSpecial_KeystrokeEx(cc, params2, vRet, sError);
1555 } 1523 }
1556 1524
1557 FX_BOOL CJS_PublicMethods::AFMergeChange(IJS_Context* cc, 1525 FX_BOOL CJS_PublicMethods::AFMergeChange(IJS_Context* cc,
1558 const std::vector<CJS_Value>& params, 1526 const std::vector<CJS_Value>& params,
1559 CJS_Value& vRet, 1527 CJS_Value& vRet,
1560 CFX_WideString& sError) { 1528 CFX_WideString& sError) {
1561 CJS_Context* pContext = (CJS_Context*)cc; 1529 CJS_Context* pContext = (CJS_Context*)cc;
1562 CJS_EventHandler* pEventHandler = pContext->GetEventHandler(); 1530 CJS_EventHandler* pEventHandler = pContext->GetEventHandler();
1563 1531
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1842 nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str())); 1810 nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str()));
1843 } 1811 }
1844 1812
1845 if (nums.GetLength() > 0) 1813 if (nums.GetLength() > 0)
1846 vRet = nums; 1814 vRet = nums;
1847 else 1815 else
1848 vRet.SetNull(); 1816 vRet.SetNull();
1849 1817
1850 return TRUE; 1818 return TRUE;
1851 } 1819 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698