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

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

Issue 927263003: Tidy up JS_Defines.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 10 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
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 "../../include/javascript/JavaScript.h" 7 #include "../../include/javascript/JavaScript.h"
8 #include "../../include/javascript/IJavaScript.h" 8 #include "../../include/javascript/IJavaScript.h"
9 #include "../../include/javascript/JS_Define.h" 9 #include "../../include/javascript/JS_Define.h"
10 #include "../../include/javascript/JS_Object.h" 10 #include "../../include/javascript/JS_Object.h"
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 1043
1044 sRet += sPart; 1044 sRet += sPart;
1045 } 1045 }
1046 1046
1047 return sRet; 1047 return sRet;
1048 } 1048 }
1049 1049
1050 /* -------------------------------------------------------------------------- */ 1050 /* -------------------------------------------------------------------------- */
1051 1051
1052 //function AFNumber_Format(nDec, sepStyle, negStyle, currStyle, strCurrency, bCu rrencyPrepend) 1052 //function AFNumber_Format(nDec, sepStyle, negStyle, currStyle, strCurrency, bCu rrencyPrepend)
1053 FX_BOOL CJS_PublicMethods::AFNumber_Format(OBJ_METHOD_PARAMS) 1053 FX_BOOL CJS_PublicMethods::AFNumber_Format(IFXJS_Context* cc, const CJS_Paramete rs& params, CJS_Value& vRet, JS_ErrorString& sError)
1054 { 1054 {
1055 #if _FX_OS_ != _FX_ANDROID_ 1055 #if _FX_OS_ != _FX_ANDROID_
1056 v8::Isolate* isolate = ::GetIsolate(cc); 1056 v8::Isolate* isolate = ::GetIsolate(cc);
1057 CJS_Context* pContext = (CJS_Context *)cc; 1057 CJS_Context* pContext = (CJS_Context *)cc;
1058 ASSERT(pContext != NULL); 1058 ASSERT(pContext != NULL);
1059 CJS_EventHandler* pEvent = pContext->GetEventHandler(); 1059 CJS_EventHandler* pEvent = pContext->GetEventHandler();
1060 ASSERT(pEvent != NULL); 1060 ASSERT(pEvent != NULL);
1061 1061
1062 if (params.size() != 6) 1062 if (params.size() != 6)
1063 { 1063 {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 } 1252 }
1253 } 1253 }
1254 } 1254 }
1255 } 1255 }
1256 Value = strValue2.c_str(); 1256 Value = strValue2.c_str();
1257 #endif 1257 #endif
1258 return TRUE; 1258 return TRUE;
1259 } 1259 }
1260 1260
1261 //function AFNumber_Keystroke(nDec, sepStyle, negStyle, currStyle, strCurrency, bCurrencyPrepend) 1261 //function AFNumber_Keystroke(nDec, sepStyle, negStyle, currStyle, strCurrency, bCurrencyPrepend)
1262 FX_BOOL CJS_PublicMethods::AFNumber_Keystroke(OBJ_METHOD_PARAMS) 1262 FX_BOOL CJS_PublicMethods::AFNumber_Keystroke(IFXJS_Context* cc, const CJS_Param eters& params, CJS_Value& vRet, JS_ErrorString& sError)
1263 { 1263 {
1264 CJS_Context* pContext = (CJS_Context *)cc; 1264 CJS_Context* pContext = (CJS_Context *)cc;
1265 ASSERT(pContext != NULL); 1265 ASSERT(pContext != NULL);
1266 CJS_EventHandler* pEvent = pContext->GetEventHandler(); 1266 CJS_EventHandler* pEvent = pContext->GetEventHandler();
1267 ASSERT(pEvent != NULL); 1267 ASSERT(pEvent != NULL);
1268 1268
1269 if(params.size() < 2) 1269 if(params.size() < 2)
1270 return FALSE; 1270 return FALSE;
1271 int iSepStyle = params[1]; 1271 int iSepStyle = params[1];
1272 1272
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 if (pEvent->SelEnd()<(int)w_strValue2.length()) 1384 if (pEvent->SelEnd()<(int)w_strValue2.length())
1385 w_postfix = w_strValue2.substr(pEvent->SelEnd()); 1385 w_postfix = w_strValue2.substr(pEvent->SelEnd());
1386 w_strValue2 = w_prefix + w_strChange2 + w_postfix; 1386 w_strValue2 = w_prefix + w_strChange2 + w_postfix;
1387 w_strValue = w_strValue2.c_str(); 1387 w_strValue = w_strValue2.c_str();
1388 val = w_strValue; 1388 val = w_strValue;
1389 return TRUE; 1389 return TRUE;
1390 1390
1391 } 1391 }
1392 1392
1393 //function AFPercent_Format(nDec, sepStyle) 1393 //function AFPercent_Format(nDec, sepStyle)
1394 FX_BOOL CJS_PublicMethods::AFPercent_Format(OBJ_METHOD_PARAMS) 1394 FX_BOOL CJS_PublicMethods::AFPercent_Format(IFXJS_Context* cc, const CJS_Paramet ers& params, CJS_Value& vRet, JS_ErrorString& sError)
1395 { 1395 {
1396 #if _FX_OS_ != _FX_ANDROID_ 1396 #if _FX_OS_ != _FX_ANDROID_
1397 CJS_Context* pContext = (CJS_Context *)cc; 1397 CJS_Context* pContext = (CJS_Context *)cc;
1398 ASSERT(pContext != NULL); 1398 ASSERT(pContext != NULL);
1399 CJS_EventHandler* pEvent = pContext->GetEventHandler(); 1399 CJS_EventHandler* pEvent = pContext->GetEventHandler();
1400 ASSERT(pEvent != NULL); 1400 ASSERT(pEvent != NULL);
1401 1401
1402 if (params.size() != 2) 1402 if (params.size() != 2)
1403 { 1403 {
1404 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); 1404 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 //////////////////////////////////////////////////////////////////// 1503 ////////////////////////////////////////////////////////////////////
1504 //nagative mark 1504 //nagative mark
1505 if(bNagative) 1505 if(bNagative)
1506 strValue = "-" + strValue; 1506 strValue = "-" + strValue;
1507 strValue += "%"; 1507 strValue += "%";
1508 Value = CFX_WideString::FromLocal(strValue); 1508 Value = CFX_WideString::FromLocal(strValue);
1509 #endif 1509 #endif
1510 return TRUE; 1510 return TRUE;
1511 } 1511 }
1512 //AFPercent_Keystroke(nDec, sepStyle) 1512 //AFPercent_Keystroke(nDec, sepStyle)
1513 FX_BOOL CJS_PublicMethods::AFPercent_Keystroke(OBJ_METHOD_PARAMS) 1513 FX_BOOL CJS_PublicMethods::AFPercent_Keystroke(IFXJS_Context* cc, const CJS_Para meters& params, CJS_Value& vRet, JS_ErrorString& sError)
1514 { 1514 {
1515 return AFNumber_Keystroke(cc,params,vRet,sError); 1515 return AFNumber_Keystroke(cc,params,vRet,sError);
1516 } 1516 }
1517 1517
1518 //function AFDate_FormatEx(cFormat) 1518 //function AFDate_FormatEx(cFormat)
1519 FX_BOOL CJS_PublicMethods::AFDate_FormatEx(OBJ_METHOD_PARAMS) 1519 FX_BOOL CJS_PublicMethods::AFDate_FormatEx(IFXJS_Context* cc, const CJS_Paramete rs& params, CJS_Value& vRet, JS_ErrorString& sError)
1520 { 1520 {
1521 CJS_Context* pContext = (CJS_Context *)cc; 1521 CJS_Context* pContext = (CJS_Context *)cc;
1522 ASSERT(pContext != NULL); 1522 ASSERT(pContext != NULL);
1523 CJS_EventHandler* pEvent = pContext->GetEventHandler(); 1523 CJS_EventHandler* pEvent = pContext->GetEventHandler();
1524 ASSERT(pEvent != NULL); 1524 ASSERT(pEvent != NULL);
1525 1525
1526 if (params.size() != 1) 1526 if (params.size() != 1)
1527 { 1527 {
1528 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); 1528 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
1529 return FALSE; 1529 return FALSE;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1618 1618
1619 if (JS_PortIsNan(dRet)) 1619 if (JS_PortIsNan(dRet))
1620 { 1620 {
1621 dRet = JS_DateParse(strValue); 1621 dRet = JS_DateParse(strValue);
1622 } 1622 }
1623 1623
1624 return dRet; 1624 return dRet;
1625 } 1625 }
1626 1626
1627 //AFDate_KeystrokeEx(cFormat) 1627 //AFDate_KeystrokeEx(cFormat)
1628 FX_BOOL CJS_PublicMethods::AFDate_KeystrokeEx(OBJ_METHOD_PARAMS) 1628 FX_BOOL CJS_PublicMethods::AFDate_KeystrokeEx(IFXJS_Context* cc, const CJS_Param eters& params, CJS_Value& vRet, JS_ErrorString& sError)
1629 { 1629 {
1630 CJS_Context* pContext = (CJS_Context *)cc; 1630 CJS_Context* pContext = (CJS_Context *)cc;
1631 ASSERT(pContext != NULL); 1631 ASSERT(pContext != NULL);
1632 CJS_EventHandler* pEvent = pContext->GetEventHandler(); 1632 CJS_EventHandler* pEvent = pContext->GetEventHandler();
1633 ASSERT(pEvent != NULL); 1633 ASSERT(pEvent != NULL);
1634 1634
1635 if (params.size() != 1) 1635 if (params.size() != 1)
1636 { 1636 {
1637 sError = L"AFDate_KeystrokeEx's parameters' size r not correct"; 1637 sError = L"AFDate_KeystrokeEx's parameters' size r not correct";
1638 return FALSE; 1638 return FALSE;
(...skipping 15 matching lines...) Expand all
1654 CFX_WideString swMsg; 1654 CFX_WideString swMsg;
1655 swMsg.Format(JSGetStringFromID(pContext, IDS_STRING_JSPA RSEDATE), sFormat.c_str()); 1655 swMsg.Format(JSGetStringFromID(pContext, IDS_STRING_JSPA RSEDATE), sFormat.c_str());
1656 Alert(pContext, swMsg); 1656 Alert(pContext, swMsg);
1657 pEvent->Rc() = FALSE; 1657 pEvent->Rc() = FALSE;
1658 return TRUE; 1658 return TRUE;
1659 } 1659 }
1660 } 1660 }
1661 return TRUE; 1661 return TRUE;
1662 } 1662 }
1663 1663
1664 FX_BOOL CJS_PublicMethods::AFDate_Format(OBJ_METHOD_PARAMS) 1664 FX_BOOL CJS_PublicMethods::AFDate_Format(IFXJS_Context* cc, const CJS_Parameters & params, CJS_Value& vRet, JS_ErrorString& sError)
1665 { 1665 {
1666 v8::Isolate* isolate = ::GetIsolate(cc); 1666 v8::Isolate* isolate = ::GetIsolate(cc);
1667 1667
1668 if (params.size() != 1) 1668 if (params.size() != 1)
1669 { 1669 {
1670 CJS_Context* pContext = (CJS_Context*)cc; 1670 CJS_Context* pContext = (CJS_Context*)cc;
1671 ASSERT(pContext != NULL); 1671 ASSERT(pContext != NULL);
1672 1672
1673 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); 1673 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
1674 return FALSE; 1674 return FALSE;
(...skipping 10 matching lines...) Expand all
1685 iIndex = 0; 1685 iIndex = 0;
1686 if (iIndex >= FX_ArraySize(cFormats)) 1686 if (iIndex >= FX_ArraySize(cFormats))
1687 iIndex = 0; 1687 iIndex = 0;
1688 CJS_Parameters newParams; 1688 CJS_Parameters newParams;
1689 CJS_Value val(isolate,cFormats[iIndex]); 1689 CJS_Value val(isolate,cFormats[iIndex]);
1690 newParams.push_back(val); 1690 newParams.push_back(val);
1691 return AFDate_FormatEx(cc,newParams,vRet,sError); 1691 return AFDate_FormatEx(cc,newParams,vRet,sError);
1692 } 1692 }
1693 1693
1694 //AFDate_KeystrokeEx(cFormat) 1694 //AFDate_KeystrokeEx(cFormat)
1695 FX_BOOL CJS_PublicMethods::AFDate_Keystroke(OBJ_METHOD_PARAMS) 1695 FX_BOOL CJS_PublicMethods::AFDate_Keystroke(IFXJS_Context* cc, const CJS_Paramet ers& params, CJS_Value& vRet, JS_ErrorString& sError)
1696 { 1696 {
1697 v8::Isolate* isolate = ::GetIsolate(cc); 1697 v8::Isolate* isolate = ::GetIsolate(cc);
1698 1698
1699 if (params.size() != 1) 1699 if (params.size() != 1)
1700 { 1700 {
1701 CJS_Context* pContext = (CJS_Context*)cc; 1701 CJS_Context* pContext = (CJS_Context*)cc;
1702 ASSERT(pContext != NULL); 1702 ASSERT(pContext != NULL);
1703 1703
1704 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); 1704 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
1705 return FALSE; 1705 return FALSE;
(...skipping 10 matching lines...) Expand all
1716 iIndex = 0; 1716 iIndex = 0;
1717 if (iIndex >= FX_ArraySize(cFormats)) 1717 if (iIndex >= FX_ArraySize(cFormats))
1718 iIndex = 0; 1718 iIndex = 0;
1719 CJS_Parameters newParams; 1719 CJS_Parameters newParams;
1720 CJS_Value val(isolate,cFormats[iIndex]); 1720 CJS_Value val(isolate,cFormats[iIndex]);
1721 newParams.push_back(val); 1721 newParams.push_back(val);
1722 return AFDate_KeystrokeEx(cc,newParams,vRet,sError); 1722 return AFDate_KeystrokeEx(cc,newParams,vRet,sError);
1723 } 1723 }
1724 1724
1725 //function AFTime_Format(ptf) 1725 //function AFTime_Format(ptf)
1726 FX_BOOL CJS_PublicMethods::AFTime_Format(OBJ_METHOD_PARAMS) 1726 FX_BOOL CJS_PublicMethods::AFTime_Format(IFXJS_Context* cc, const CJS_Parameters & params, CJS_Value& vRet, JS_ErrorString& sError)
1727 { 1727 {
1728 v8::Isolate* isolate = ::GetIsolate(cc); 1728 v8::Isolate* isolate = ::GetIsolate(cc);
1729 1729
1730 if (params.size() != 1) 1730 if (params.size() != 1)
1731 { 1731 {
1732 CJS_Context* pContext = (CJS_Context*)cc; 1732 CJS_Context* pContext = (CJS_Context*)cc;
1733 ASSERT(pContext != NULL); 1733 ASSERT(pContext != NULL);
1734 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); 1734 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
1735 return FALSE; 1735 return FALSE;
1736 } 1736 }
1737 1737
1738 int iIndex = params[0]; 1738 int iIndex = params[0];
1739 FX_LPCWSTR cFormats[] = {L"HH:MM", L"h:MM tt", L"HH:MM:ss", L"h:MM:ss tt "}; 1739 FX_LPCWSTR cFormats[] = {L"HH:MM", L"h:MM tt", L"HH:MM:ss", L"h:MM:ss tt "};
1740 1740
1741 ASSERT(iIndex<FX_ArraySize(cFormats)); 1741 ASSERT(iIndex<FX_ArraySize(cFormats));
1742 1742
1743 if (iIndex < 0) 1743 if (iIndex < 0)
1744 iIndex = 0; 1744 iIndex = 0;
1745 if (iIndex >= FX_ArraySize(cFormats)) 1745 if (iIndex >= FX_ArraySize(cFormats))
1746 iIndex = 0; 1746 iIndex = 0;
1747 CJS_Parameters newParams; 1747 CJS_Parameters newParams;
1748 CJS_Value val(isolate,cFormats[iIndex]); 1748 CJS_Value val(isolate,cFormats[iIndex]);
1749 newParams.push_back(val); 1749 newParams.push_back(val);
1750 return AFDate_FormatEx(cc,newParams,vRet,sError); 1750 return AFDate_FormatEx(cc,newParams,vRet,sError);
1751 } 1751 }
1752 1752
1753 FX_BOOL CJS_PublicMethods::AFTime_Keystroke(OBJ_METHOD_PARAMS) 1753 FX_BOOL CJS_PublicMethods::AFTime_Keystroke(IFXJS_Context* cc, const CJS_Paramet ers& params, CJS_Value& vRet, JS_ErrorString& sError)
1754 { 1754 {
1755 v8::Isolate* isolate = ::GetIsolate(cc); 1755 v8::Isolate* isolate = ::GetIsolate(cc);
1756 if (params.size() != 1) 1756 if (params.size() != 1)
1757 { 1757 {
1758 CJS_Context* pContext = (CJS_Context*)cc; 1758 CJS_Context* pContext = (CJS_Context*)cc;
1759 ASSERT(pContext != NULL); 1759 ASSERT(pContext != NULL);
1760 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); 1760 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
1761 return FALSE; 1761 return FALSE;
1762 } 1762 }
1763 1763
1764 int iIndex = params[0]; 1764 int iIndex = params[0];
1765 FX_LPCWSTR cFormats[] = {L"HH:MM", L"h:MM tt", L"HH:MM:ss", L"h:MM:ss tt "}; 1765 FX_LPCWSTR cFormats[] = {L"HH:MM", L"h:MM tt", L"HH:MM:ss", L"h:MM:ss tt "};
1766 1766
1767 ASSERT(iIndex<FX_ArraySize(cFormats)); 1767 ASSERT(iIndex<FX_ArraySize(cFormats));
1768 1768
1769 if (iIndex < 0) 1769 if (iIndex < 0)
1770 iIndex = 0; 1770 iIndex = 0;
1771 if (iIndex >= FX_ArraySize(cFormats)) 1771 if (iIndex >= FX_ArraySize(cFormats))
1772 iIndex = 0; 1772 iIndex = 0;
1773 CJS_Parameters newParams; 1773 CJS_Parameters newParams;
1774 CJS_Value val(isolate,cFormats[iIndex]); 1774 CJS_Value val(isolate,cFormats[iIndex]);
1775 newParams.push_back(val); 1775 newParams.push_back(val);
1776 return AFDate_KeystrokeEx(cc,newParams,vRet,sError); 1776 return AFDate_KeystrokeEx(cc,newParams,vRet,sError);
1777 } 1777 }
1778 1778
1779 FX_BOOL CJS_PublicMethods::AFTime_FormatEx(OBJ_METHOD_PARAMS) 1779 FX_BOOL CJS_PublicMethods::AFTime_FormatEx(IFXJS_Context* cc, const CJS_Paramete rs& params, CJS_Value& vRet, JS_ErrorString& sError)
1780 { 1780 {
1781 return AFDate_FormatEx(cc,params,vRet,sError); 1781 return AFDate_FormatEx(cc,params,vRet,sError);
1782 } 1782 }
1783 1783
1784 FX_BOOL CJS_PublicMethods::AFTime_KeystrokeEx(OBJ_METHOD_PARAMS) 1784 FX_BOOL CJS_PublicMethods::AFTime_KeystrokeEx(IFXJS_Context* cc, const CJS_Param eters& params, CJS_Value& vRet, JS_ErrorString& sError)
1785 { 1785 {
1786 return AFDate_KeystrokeEx(cc,params,vRet,sError); 1786 return AFDate_KeystrokeEx(cc,params,vRet,sError);
1787 } 1787 }
1788 1788
1789 //function AFSpecial_Format(psf) 1789 //function AFSpecial_Format(psf)
1790 FX_BOOL CJS_PublicMethods::AFSpecial_Format(OBJ_METHOD_PARAMS) 1790 FX_BOOL CJS_PublicMethods::AFSpecial_Format(IFXJS_Context* cc, const CJS_Paramet ers& params, CJS_Value& vRet, JS_ErrorString& sError)
1791 { 1791 {
1792 CJS_Context* pContext = (CJS_Context *)cc; 1792 CJS_Context* pContext = (CJS_Context *)cc;
1793 ASSERT(pContext != NULL); 1793 ASSERT(pContext != NULL);
1794 1794
1795 if (params.size() != 1) 1795 if (params.size() != 1)
1796 { 1796 {
1797 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); 1797 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
1798 return FALSE; 1798 return FALSE;
1799 } 1799 }
1800 1800
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1833 } 1833 }
1834 1834
1835 std::string strDes; 1835 std::string strDes;
1836 util::printx(cFormat,strSrc,strDes); 1836 util::printx(cFormat,strSrc,strDes);
1837 Value = CFX_WideString::FromLocal(strDes.c_str()); 1837 Value = CFX_WideString::FromLocal(strDes.c_str());
1838 return TRUE; 1838 return TRUE;
1839 } 1839 }
1840 1840
1841 1841
1842 //function AFSpecial_KeystrokeEx(mask) 1842 //function AFSpecial_KeystrokeEx(mask)
1843 FX_BOOL CJS_PublicMethods::AFSpecial_KeystrokeEx(OBJ_METHOD_PARAMS) 1843 FX_BOOL CJS_PublicMethods::AFSpecial_KeystrokeEx(IFXJS_Context* cc, const CJS_Pa rameters& params, CJS_Value& vRet, JS_ErrorString& sError)
1844 { 1844 {
1845 CJS_Context* pContext = (CJS_Context *)cc; 1845 CJS_Context* pContext = (CJS_Context *)cc;
1846 ASSERT(pContext != NULL); 1846 ASSERT(pContext != NULL);
1847 CJS_EventHandler* pEvent = pContext->GetEventHandler(); 1847 CJS_EventHandler* pEvent = pContext->GetEventHandler();
1848 1848
1849 ASSERT(pEvent != NULL); 1849 ASSERT(pEvent != NULL);
1850 1850
1851 if (params.size() < 1) 1851 if (params.size() < 1)
1852 { 1852 {
1853 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); 1853 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 iIndexMask++; 1933 iIndexMask++;
1934 } 1934 }
1935 1935
1936 wideChange = wChange.c_str(); 1936 wideChange = wChange.c_str();
1937 1937
1938 return TRUE; 1938 return TRUE;
1939 } 1939 }
1940 1940
1941 1941
1942 //function AFSpecial_Keystroke(psf) 1942 //function AFSpecial_Keystroke(psf)
1943 FX_BOOL CJS_PublicMethods::AFSpecial_Keystroke(OBJ_METHOD_PARAMS) 1943 FX_BOOL CJS_PublicMethods::AFSpecial_Keystroke(IFXJS_Context* cc, const CJS_Para meters& params, CJS_Value& vRet, JS_ErrorString& sError)
1944 { 1944 {
1945 v8::Isolate* isolate = ::GetIsolate(cc); 1945 v8::Isolate* isolate = ::GetIsolate(cc);
1946 1946
1947 CJS_Context* pContext = (CJS_Context *)cc; 1947 CJS_Context* pContext = (CJS_Context *)cc;
1948 ASSERT(pContext != NULL); 1948 ASSERT(pContext != NULL);
1949 CJS_EventHandler* pEvent = pContext->GetEventHandler(); 1949 CJS_EventHandler* pEvent = pContext->GetEventHandler();
1950 ASSERT(pEvent != NULL); 1950 ASSERT(pEvent != NULL);
1951 1951
1952 if (params.size() != 1) 1952 if (params.size() != 1)
1953 { 1953 {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 break; 1992 break;
1993 } 1993 }
1994 1994
1995 CJS_Parameters params2; 1995 CJS_Parameters params2;
1996 CJS_Value vMask(isolate, cFormat.c_str()); 1996 CJS_Value vMask(isolate, cFormat.c_str());
1997 params2.push_back(vMask); 1997 params2.push_back(vMask);
1998 1998
1999 return AFSpecial_KeystrokeEx(cc,params2,vRet,sError); 1999 return AFSpecial_KeystrokeEx(cc,params2,vRet,sError);
2000 } 2000 }
2001 2001
2002 FX_BOOL CJS_PublicMethods::AFMergeChange(OBJ_METHOD_PARAMS) 2002 FX_BOOL CJS_PublicMethods::AFMergeChange(IFXJS_Context* cc, const CJS_Parameters & params, CJS_Value& vRet, JS_ErrorString& sError)
2003 { 2003 {
2004 CJS_Context* pContext = (CJS_Context *)cc; 2004 CJS_Context* pContext = (CJS_Context *)cc;
2005 ASSERT(pContext != NULL); 2005 ASSERT(pContext != NULL);
2006 CJS_EventHandler* pEventHandler = pContext->GetEventHandler(); 2006 CJS_EventHandler* pEventHandler = pContext->GetEventHandler();
2007 ASSERT(pEventHandler != NULL); 2007 ASSERT(pEventHandler != NULL);
2008 2008
2009 if (params.size() != 1) 2009 if (params.size() != 1)
2010 { 2010 {
2011 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); 2011 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
2012 return FALSE; 2012 return FALSE;
(...skipping 19 matching lines...) Expand all
2032 2032
2033 if (pEventHandler->SelEnd() >= 0 && pEventHandler->SelEnd() <= swValue.G etLength()) 2033 if (pEventHandler->SelEnd() >= 0 && pEventHandler->SelEnd() <= swValue.G etLength())
2034 postfix = swValue.Mid(pEventHandler->SelEnd(), swValue.GetLength () - pEventHandler->SelEnd()); 2034 postfix = swValue.Mid(pEventHandler->SelEnd(), swValue.GetLength () - pEventHandler->SelEnd());
2035 else postfix = L""; 2035 else postfix = L"";
2036 2036
2037 vRet = prefix + pEventHandler->Change() + postfix; 2037 vRet = prefix + pEventHandler->Change() + postfix;
2038 2038
2039 return TRUE; 2039 return TRUE;
2040 } 2040 }
2041 2041
2042 FX_BOOL CJS_PublicMethods::AFParseDateEx(OBJ_METHOD_PARAMS) 2042 FX_BOOL CJS_PublicMethods::AFParseDateEx(IFXJS_Context* cc, const CJS_Parameters & params, CJS_Value& vRet, JS_ErrorString& sError)
2043 { 2043 {
2044 CJS_Context* pContext = (CJS_Context *)cc; 2044 CJS_Context* pContext = (CJS_Context *)cc;
2045 ASSERT(pContext != NULL); 2045 ASSERT(pContext != NULL);
2046 2046
2047 if (params.size() != 2) 2047 if (params.size() != 2)
2048 { 2048 {
2049 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); 2049 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
2050 return FALSE; 2050 return FALSE;
2051 } 2051 }
2052 2052
2053 CFX_WideString sValue = params[0].operator CFX_WideString(); 2053 CFX_WideString sValue = params[0].operator CFX_WideString();
2054 CFX_WideString sFormat = params[1].operator CFX_WideString(); 2054 CFX_WideString sFormat = params[1].operator CFX_WideString();
2055 2055
2056 FX_BOOL bWrongFormat = FALSE; 2056 FX_BOOL bWrongFormat = FALSE;
2057 double dDate = MakeRegularDate(sValue,sFormat,bWrongFormat); 2057 double dDate = MakeRegularDate(sValue,sFormat,bWrongFormat);
2058 2058
2059 if (JS_PortIsNan(dDate)) 2059 if (JS_PortIsNan(dDate))
2060 { 2060 {
2061 CFX_WideString swMsg; 2061 CFX_WideString swMsg;
2062 swMsg.Format(JSGetStringFromID(pContext, IDS_STRING_JSPARSEDATE) , sFormat.c_str()); 2062 swMsg.Format(JSGetStringFromID(pContext, IDS_STRING_JSPARSEDATE) , sFormat.c_str());
2063 Alert((CJS_Context *)cc, swMsg); 2063 Alert((CJS_Context *)cc, swMsg);
2064 return FALSE; 2064 return FALSE;
2065 } 2065 }
2066 2066
2067 vRet = dDate; 2067 vRet = dDate;
2068 2068
2069 return TRUE; 2069 return TRUE;
2070 } 2070 }
2071 2071
2072 FX_BOOL CJS_PublicMethods::AFSimple(OBJ_METHOD_PARAMS) 2072 FX_BOOL CJS_PublicMethods::AFSimple(IFXJS_Context* cc, const CJS_Parameters& par ams, CJS_Value& vRet, JS_ErrorString& sError)
2073 { 2073 {
2074 if (params.size() != 3) 2074 if (params.size() != 3)
2075 { 2075 {
2076 CJS_Context* pContext = (CJS_Context *)cc; 2076 CJS_Context* pContext = (CJS_Context *)cc;
2077 ASSERT(pContext != NULL); 2077 ASSERT(pContext != NULL);
2078 2078
2079 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); 2079 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
2080 return FALSE; 2080 return FALSE;
2081 } 2081 }
2082 2082
2083 vRet = (double)AF_Simple(params[0].operator CFX_WideString(), (double)pa rams[1], (double)params[2]); 2083 vRet = (double)AF_Simple(params[0].operator CFX_WideString(), (double)pa rams[1], (double)params[2]);
2084 return TRUE; 2084 return TRUE;
2085 } 2085 }
2086 2086
2087 FX_BOOL CJS_PublicMethods::AFMakeNumber(OBJ_METHOD_PARAMS) 2087 FX_BOOL CJS_PublicMethods::AFMakeNumber(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, JS_ErrorString& sError)
2088 { 2088 {
2089 if (params.size() != 1) 2089 if (params.size() != 1)
2090 { 2090 {
2091 CJS_Context* pContext = (CJS_Context *)cc; 2091 CJS_Context* pContext = (CJS_Context *)cc;
2092 ASSERT(pContext != NULL); 2092 ASSERT(pContext != NULL);
2093 2093
2094 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); 2094 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
2095 return FALSE; 2095 return FALSE;
2096 } 2096 }
2097 vRet = ParseStringToNumber(params[0].operator CFX_WideString()); 2097 vRet = ParseStringToNumber(params[0].operator CFX_WideString());
2098 return TRUE; 2098 return TRUE;
2099 } 2099 }
2100 2100
2101 FX_BOOL CJS_PublicMethods::AFSimple_Calculate(OBJ_METHOD_PARAMS) 2101 FX_BOOL CJS_PublicMethods::AFSimple_Calculate(IFXJS_Context* cc, const CJS_Param eters& params, CJS_Value& vRet, JS_ErrorString& sError)
2102 { 2102 {
2103 v8::Isolate* isolate = ::GetIsolate(cc); 2103 v8::Isolate* isolate = ::GetIsolate(cc);
2104 2104
2105 CJS_Context* pContext = (CJS_Context *)cc; 2105 CJS_Context* pContext = (CJS_Context *)cc;
2106 ASSERT(pContext != NULL); 2106 ASSERT(pContext != NULL);
2107 2107
2108 if (params.size() != 2) 2108 if (params.size() != 2)
2109 { 2109 {
2110 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); 2110 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
2111 return FALSE; 2111 return FALSE;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2215 CJS_Value jsValue(isolate,dValue); 2215 CJS_Value jsValue(isolate,dValue);
2216 if((CJS_EventHandler*)pContext->GetEventHandler()->m_pValue) 2216 if((CJS_EventHandler*)pContext->GetEventHandler()->m_pValue)
2217 ((CJS_EventHandler*)pContext->GetEventHandler())->Value() = jsVa lue; 2217 ((CJS_EventHandler*)pContext->GetEventHandler())->Value() = jsVa lue;
2218 2218
2219 return TRUE; 2219 return TRUE;
2220 } 2220 }
2221 2221
2222 /* This function validates the current event to ensure that its value is 2222 /* This function validates the current event to ensure that its value is
2223 ** within the specified range. */ 2223 ** within the specified range. */
2224 2224
2225 FX_BOOL CJS_PublicMethods::AFRange_Validate(OBJ_METHOD_PARAMS) 2225 FX_BOOL CJS_PublicMethods::AFRange_Validate(IFXJS_Context* cc, const CJS_Paramet ers& params, CJS_Value& vRet, JS_ErrorString& sError)
2226 { 2226 {
2227 CJS_Context* pContext = (CJS_Context *)cc; 2227 CJS_Context* pContext = (CJS_Context *)cc;
2228 ASSERT(pContext != NULL); 2228 ASSERT(pContext != NULL);
2229 CJS_EventHandler* pEvent = pContext->GetEventHandler(); 2229 CJS_EventHandler* pEvent = pContext->GetEventHandler();
2230 ASSERT(pEvent != NULL); 2230 ASSERT(pEvent != NULL);
2231 2231
2232 if (params.size() != 4) 2232 if (params.size() != 4)
2233 { 2233 {
2234 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); 2234 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
2235 return FALSE; 2235 return FALSE;
(...skipping 29 matching lines...) Expand all
2265 } 2265 }
2266 2266
2267 if (!swMsg.IsEmpty()) 2267 if (!swMsg.IsEmpty())
2268 { 2268 {
2269 Alert(pContext, swMsg); 2269 Alert(pContext, swMsg);
2270 pEvent->Rc() = FALSE; 2270 pEvent->Rc() = FALSE;
2271 } 2271 }
2272 return TRUE; 2272 return TRUE;
2273 } 2273 }
2274 2274
2275 FX_BOOL CJS_PublicMethods::AFExtractNums(OBJ_METHOD_PARAMS) 2275 FX_BOOL CJS_PublicMethods::AFExtractNums(IFXJS_Context* cc, const CJS_Parameters & params, CJS_Value& vRet, JS_ErrorString& sError)
2276 { 2276 {
2277 v8::Isolate* isolate = ::GetIsolate(cc); 2277 v8::Isolate* isolate = ::GetIsolate(cc);
2278 CJS_Context* pContext = (CJS_Context*)cc; 2278 CJS_Context* pContext = (CJS_Context*)cc;
2279 ASSERT(pContext != NULL); 2279 ASSERT(pContext != NULL);
2280 2280
2281 if (params.size() != 1) 2281 if (params.size() != 1)
2282 { 2282 {
2283 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); 2283 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
2284 return FALSE; 2284 return FALSE;
2285 } 2285 }
(...skipping 30 matching lines...) Expand all
2316 nums.SetElement(nIndex,CJS_Value(isolate,sPart.c_str())); 2316 nums.SetElement(nIndex,CJS_Value(isolate,sPart.c_str()));
2317 } 2317 }
2318 2318
2319 if (nums.GetLength() > 0) 2319 if (nums.GetLength() > 0)
2320 vRet = nums; 2320 vRet = nums;
2321 else 2321 else
2322 vRet.SetNull(); 2322 vRet.SetNull();
2323 2323
2324 return TRUE; 2324 return TRUE;
2325 } 2325 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698