| 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 "xfa_fm2js.h" | 7 #include "xfa_fm2js.h" |
| 8 #include <time.h> | 8 #include <time.h> |
| 9 #define FINANCIAL_PRECISION 0.00000001 | 9 #define FINANCIAL_PRECISION 0.00000001 |
| 10 struct XFA_FMHtmlReserveCode { | 10 struct XFA_FMHtmlReserveCode { |
| (...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1542 HValueToUTF8String(localValue, localString); | 1542 HValueToUTF8String(localValue, localString); |
| 1543 } | 1543 } |
| 1544 } | 1544 } |
| 1545 if (!bFlags) { | 1545 if (!bFlags) { |
| 1546 CXFA_FM2JSContext* pContext = | 1546 CXFA_FM2JSContext* pContext = |
| 1547 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1547 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 1548 CXFA_Document* pDoc = pContext->GetDocument(); | 1548 CXFA_Document* pDoc = pContext->GetDocument(); |
| 1549 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 1549 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 1550 IFX_Locale* pLocale = NULL; | 1550 IFX_Locale* pLocale = NULL; |
| 1551 if (localString.IsEmpty()) { | 1551 if (localString.IsEmpty()) { |
| 1552 CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject(); | 1552 CXFA_Node* pThisNode = |
| 1553 FXSYS_assert(pThisNode->IsNode()); | 1553 ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 1554 CXFA_WidgetData widgetData((CXFA_Node*)pThisNode); | 1554 FXSYS_assert(pThisNode); |
| 1555 CXFA_WidgetData widgetData(pThisNode); |
| 1555 pLocale = widgetData.GetLocal(); | 1556 pLocale = widgetData.GetLocal(); |
| 1556 } else { | 1557 } else { |
| 1557 pLocale = pMgr->GetLocaleByName( | 1558 pLocale = pMgr->GetLocaleByName( |
| 1558 CFX_WideString::FromUTF8(localString, localString.GetLength())); | 1559 CFX_WideString::FromUTF8(localString, localString.GetLength())); |
| 1559 } | 1560 } |
| 1560 CFX_WideString wsFormat; | 1561 CFX_WideString wsFormat; |
| 1561 if (formatString.IsEmpty()) { | 1562 if (formatString.IsEmpty()) { |
| 1562 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); | 1563 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); |
| 1563 } else { | 1564 } else { |
| 1564 wsFormat = | 1565 wsFormat = |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1991 CFX_ByteString& strIsoDate) { | 1992 CFX_ByteString& strIsoDate) { |
| 1992 CXFA_FM2JSContext* pContext = | 1993 CXFA_FM2JSContext* pContext = |
| 1993 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1994 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 1994 CXFA_Document* pDoc = pContext->GetDocument(); | 1995 CXFA_Document* pDoc = pContext->GetDocument(); |
| 1995 if (!pDoc) { | 1996 if (!pDoc) { |
| 1996 return FALSE; | 1997 return FALSE; |
| 1997 } | 1998 } |
| 1998 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 1999 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 1999 IFX_Locale* pLocale = NULL; | 2000 IFX_Locale* pLocale = NULL; |
| 2000 if (szLocale.IsEmpty()) { | 2001 if (szLocale.IsEmpty()) { |
| 2001 CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject(); | 2002 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2002 FXSYS_assert(pThisNode->IsNode()); | 2003 FXSYS_assert(pThisNode); |
| 2003 CXFA_WidgetData widgetData((CXFA_Node*)pThisNode); | 2004 CXFA_WidgetData widgetData(pThisNode); |
| 2004 pLocale = widgetData.GetLocal(); | 2005 pLocale = widgetData.GetLocal(); |
| 2005 } else { | 2006 } else { |
| 2006 pLocale = pMgr->GetLocaleByName( | 2007 pLocale = pMgr->GetLocaleByName( |
| 2007 CFX_WideString::FromUTF8(szLocale.GetCStr(), szLocale.GetLength())); | 2008 CFX_WideString::FromUTF8(szLocale.GetCStr(), szLocale.GetLength())); |
| 2008 } | 2009 } |
| 2009 if (!pLocale) { | 2010 if (!pLocale) { |
| 2010 return FALSE; | 2011 return FALSE; |
| 2011 } | 2012 } |
| 2012 CFX_WideString wsFormat; | 2013 CFX_WideString wsFormat; |
| 2013 if (szFormat.IsEmpty()) { | 2014 if (szFormat.IsEmpty()) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2031 CFX_ByteString& strIsoTime) { | 2032 CFX_ByteString& strIsoTime) { |
| 2032 CXFA_FM2JSContext* pContext = | 2033 CXFA_FM2JSContext* pContext = |
| 2033 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 2034 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 2034 CXFA_Document* pDoc = pContext->GetDocument(); | 2035 CXFA_Document* pDoc = pContext->GetDocument(); |
| 2035 if (!pDoc) { | 2036 if (!pDoc) { |
| 2036 return FALSE; | 2037 return FALSE; |
| 2037 } | 2038 } |
| 2038 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2039 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2039 IFX_Locale* pLocale = NULL; | 2040 IFX_Locale* pLocale = NULL; |
| 2040 if (szLocale.IsEmpty()) { | 2041 if (szLocale.IsEmpty()) { |
| 2041 CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject(); | 2042 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2042 FXSYS_assert(pThisNode->IsNode()); | 2043 FXSYS_assert(pThisNode); |
| 2043 CXFA_WidgetData widgetData((CXFA_Node*)pThisNode); | 2044 CXFA_WidgetData widgetData(pThisNode); |
| 2044 pLocale = widgetData.GetLocal(); | 2045 pLocale = widgetData.GetLocal(); |
| 2045 } else { | 2046 } else { |
| 2046 pLocale = pMgr->GetLocaleByName( | 2047 pLocale = pMgr->GetLocaleByName( |
| 2047 CFX_WideString::FromUTF8(szLocale.GetCStr(), szLocale.GetLength())); | 2048 CFX_WideString::FromUTF8(szLocale.GetCStr(), szLocale.GetLength())); |
| 2048 } | 2049 } |
| 2049 if (!pLocale) { | 2050 if (!pLocale) { |
| 2050 return FALSE; | 2051 return FALSE; |
| 2051 } | 2052 } |
| 2052 CFX_WideString wsFormat; | 2053 CFX_WideString wsFormat; |
| 2053 if (szFormat.IsEmpty()) { | 2054 if (szFormat.IsEmpty()) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2074 CFX_ByteString& strLocalDate) { | 2075 CFX_ByteString& strLocalDate) { |
| 2075 CXFA_FM2JSContext* pContext = | 2076 CXFA_FM2JSContext* pContext = |
| 2076 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 2077 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 2077 CXFA_Document* pDoc = pContext->GetDocument(); | 2078 CXFA_Document* pDoc = pContext->GetDocument(); |
| 2078 if (!pDoc) { | 2079 if (!pDoc) { |
| 2079 return FALSE; | 2080 return FALSE; |
| 2080 } | 2081 } |
| 2081 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2082 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2082 IFX_Locale* pLocale = NULL; | 2083 IFX_Locale* pLocale = NULL; |
| 2083 if (szLocale.IsEmpty()) { | 2084 if (szLocale.IsEmpty()) { |
| 2084 CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject(); | 2085 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2085 FXSYS_assert(pThisNode->IsNode()); | 2086 FXSYS_assert(pThisNode); |
| 2086 CXFA_WidgetData widgetData((CXFA_Node*)pThisNode); | 2087 CXFA_WidgetData widgetData(pThisNode); |
| 2087 pLocale = widgetData.GetLocal(); | 2088 pLocale = widgetData.GetLocal(); |
| 2088 } else { | 2089 } else { |
| 2089 pLocale = pMgr->GetLocaleByName( | 2090 pLocale = pMgr->GetLocaleByName( |
| 2090 CFX_WideString::FromUTF8(szLocale.GetCStr(), szLocale.GetLength())); | 2091 CFX_WideString::FromUTF8(szLocale.GetCStr(), szLocale.GetLength())); |
| 2091 } | 2092 } |
| 2092 if (!pLocale) { | 2093 if (!pLocale) { |
| 2093 return FALSE; | 2094 return FALSE; |
| 2094 } | 2095 } |
| 2095 CFX_WideString wsFormat; | 2096 CFX_WideString wsFormat; |
| 2096 if (szFormat.IsEmpty()) { | 2097 if (szFormat.IsEmpty()) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2116 CFX_ByteString& strLocalTime) { | 2117 CFX_ByteString& strLocalTime) { |
| 2117 CXFA_FM2JSContext* pContext = | 2118 CXFA_FM2JSContext* pContext = |
| 2118 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 2119 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 2119 CXFA_Document* pDoc = pContext->GetDocument(); | 2120 CXFA_Document* pDoc = pContext->GetDocument(); |
| 2120 if (!pDoc) { | 2121 if (!pDoc) { |
| 2121 return FALSE; | 2122 return FALSE; |
| 2122 } | 2123 } |
| 2123 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2124 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2124 IFX_Locale* pLocale = NULL; | 2125 IFX_Locale* pLocale = NULL; |
| 2125 if (szLocale.IsEmpty()) { | 2126 if (szLocale.IsEmpty()) { |
| 2126 CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject(); | 2127 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2127 FXSYS_assert(pThisNode->IsNode()); | 2128 FXSYS_assert(pThisNode); |
| 2128 CXFA_WidgetData widgetData((CXFA_Node*)pThisNode); | 2129 CXFA_WidgetData widgetData(pThisNode); |
| 2129 pLocale = widgetData.GetLocal(); | 2130 pLocale = widgetData.GetLocal(); |
| 2130 } else { | 2131 } else { |
| 2131 pLocale = pMgr->GetLocaleByName( | 2132 pLocale = pMgr->GetLocaleByName( |
| 2132 CFX_WideString::FromUTF8(szLocale.GetCStr(), szLocale.GetLength())); | 2133 CFX_WideString::FromUTF8(szLocale.GetCStr(), szLocale.GetLength())); |
| 2133 } | 2134 } |
| 2134 if (!pLocale) { | 2135 if (!pLocale) { |
| 2135 return FALSE; | 2136 return FALSE; |
| 2136 } | 2137 } |
| 2137 CFX_WideString wsFormat; | 2138 CFX_WideString wsFormat; |
| 2138 if (szFormat.IsEmpty()) { | 2139 if (szFormat.IsEmpty()) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2160 CFX_ByteString& strGMTTime) { | 2161 CFX_ByteString& strGMTTime) { |
| 2161 CXFA_FM2JSContext* pContext = | 2162 CXFA_FM2JSContext* pContext = |
| 2162 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 2163 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 2163 CXFA_Document* pDoc = pContext->GetDocument(); | 2164 CXFA_Document* pDoc = pContext->GetDocument(); |
| 2164 if (!pDoc) { | 2165 if (!pDoc) { |
| 2165 return FALSE; | 2166 return FALSE; |
| 2166 } | 2167 } |
| 2167 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2168 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2168 IFX_Locale* pLocale = NULL; | 2169 IFX_Locale* pLocale = NULL; |
| 2169 if (szLocale.IsEmpty()) { | 2170 if (szLocale.IsEmpty()) { |
| 2170 CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject(); | 2171 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2171 FXSYS_assert(pThisNode->IsNode()); | 2172 FXSYS_assert(pThisNode); |
| 2172 CXFA_WidgetData widgetData((CXFA_Node*)pThisNode); | 2173 CXFA_WidgetData widgetData(pThisNode); |
| 2173 pLocale = widgetData.GetLocal(); | 2174 pLocale = widgetData.GetLocal(); |
| 2174 } else { | 2175 } else { |
| 2175 pLocale = pMgr->GetLocaleByName( | 2176 pLocale = pMgr->GetLocaleByName( |
| 2176 CFX_WideString::FromUTF8(szLocale.GetCStr(), szLocale.GetLength())); | 2177 CFX_WideString::FromUTF8(szLocale.GetCStr(), szLocale.GetLength())); |
| 2177 } | 2178 } |
| 2178 if (!pLocale) { | 2179 if (!pLocale) { |
| 2179 return FALSE; | 2180 return FALSE; |
| 2180 } | 2181 } |
| 2181 CFX_WideString wsFormat; | 2182 CFX_WideString wsFormat; |
| 2182 if (szFormat.IsEmpty()) { | 2183 if (szFormat.IsEmpty()) { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2345 } | 2346 } |
| 2346 CXFA_FM2JSContext* pContext = | 2347 CXFA_FM2JSContext* pContext = |
| 2347 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 2348 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 2348 CXFA_Document* pDoc = pContext->GetDocument(); | 2349 CXFA_Document* pDoc = pContext->GetDocument(); |
| 2349 if (!pDoc) { | 2350 if (!pDoc) { |
| 2350 return; | 2351 return; |
| 2351 } | 2352 } |
| 2352 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2353 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2353 IFX_Locale* pLocale = NULL; | 2354 IFX_Locale* pLocale = NULL; |
| 2354 if (szLocalStr.IsEmpty()) { | 2355 if (szLocalStr.IsEmpty()) { |
| 2355 CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject(); | 2356 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2356 FXSYS_assert(pThisNode->IsNode()); | 2357 FXSYS_assert(pThisNode); |
| 2357 CXFA_WidgetData widgetData((CXFA_Node*)pThisNode); | 2358 CXFA_WidgetData widgetData(pThisNode); |
| 2358 pLocale = widgetData.GetLocal(); | 2359 pLocale = widgetData.GetLocal(); |
| 2359 } else { | 2360 } else { |
| 2360 pLocale = pMgr->GetLocaleByName( | 2361 pLocale = pMgr->GetLocaleByName( |
| 2361 CFX_WideString::FromUTF8(szLocalStr.GetCStr(), szLocalStr.GetLength())); | 2362 CFX_WideString::FromUTF8(szLocalStr.GetCStr(), szLocalStr.GetLength())); |
| 2362 } | 2363 } |
| 2363 if (!pLocale) { | 2364 if (!pLocale) { |
| 2364 return; | 2365 return; |
| 2365 } | 2366 } |
| 2366 CFX_WideString strRet; | 2367 CFX_WideString strRet; |
| 2367 pLocale->GetDatePattern(strStyle, strRet); | 2368 pLocale->GetDatePattern(strStyle, strRet); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2400 } | 2401 } |
| 2401 CXFA_FM2JSContext* pContext = | 2402 CXFA_FM2JSContext* pContext = |
| 2402 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 2403 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 2403 CXFA_Document* pDoc = pContext->GetDocument(); | 2404 CXFA_Document* pDoc = pContext->GetDocument(); |
| 2404 if (!pDoc) { | 2405 if (!pDoc) { |
| 2405 return; | 2406 return; |
| 2406 } | 2407 } |
| 2407 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2408 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2408 IFX_Locale* pLocale = NULL; | 2409 IFX_Locale* pLocale = NULL; |
| 2409 if (szLocalStr.IsEmpty()) { | 2410 if (szLocalStr.IsEmpty()) { |
| 2410 CXFA_Object* pThisObject = pDoc->GetScriptContext()->GetThisObject(); | 2411 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2411 FXSYS_assert(pThisObject->IsNode()); | 2412 FXSYS_assert(pThisNode); |
| 2412 CXFA_Node* pThisNode = (CXFA_Node*)pThisObject; | |
| 2413 CXFA_WidgetData widgetData(pThisNode); | 2413 CXFA_WidgetData widgetData(pThisNode); |
| 2414 pLocale = widgetData.GetLocal(); | 2414 pLocale = widgetData.GetLocal(); |
| 2415 } else { | 2415 } else { |
| 2416 pLocale = pMgr->GetLocaleByName( | 2416 pLocale = pMgr->GetLocaleByName( |
| 2417 CFX_WideString::FromUTF8(szLocalStr.GetCStr(), szLocalStr.GetLength())); | 2417 CFX_WideString::FromUTF8(szLocalStr.GetCStr(), szLocalStr.GetLength())); |
| 2418 } | 2418 } |
| 2419 if (!pLocale) { | 2419 if (!pLocale) { |
| 2420 return; | 2420 return; |
| 2421 } | 2421 } |
| 2422 CFX_WideString strRet; | 2422 CFX_WideString strRet; |
| (...skipping 1929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4352 int32_t argc = args.GetLength(); | 4352 int32_t argc = args.GetLength(); |
| 4353 if (argc >= 2) { | 4353 if (argc >= 2) { |
| 4354 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 4354 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 4355 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 4355 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
| 4356 CFX_ByteString szPattern; | 4356 CFX_ByteString szPattern; |
| 4357 HValueToUTF8String(argOne, szPattern); | 4357 HValueToUTF8String(argOne, szPattern); |
| 4358 CFX_ByteString szValue; | 4358 CFX_ByteString szValue; |
| 4359 HValueToUTF8String(argTwo, szValue); | 4359 HValueToUTF8String(argTwo, szValue); |
| 4360 CXFA_Document* pDoc = pContext->GetDocument(); | 4360 CXFA_Document* pDoc = pContext->GetDocument(); |
| 4361 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 4361 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 4362 CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject(); | 4362 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 4363 FXSYS_assert(pThisNode->IsNode()); | 4363 FXSYS_assert(pThisNode); |
| 4364 CXFA_WidgetData widgetData((CXFA_Node*)pThisNode); | 4364 CXFA_WidgetData widgetData(pThisNode); |
| 4365 IFX_Locale* pLocale = widgetData.GetLocal(); | 4365 IFX_Locale* pLocale = widgetData.GetLocal(); |
| 4366 FX_DWORD patternType; | 4366 FX_DWORD patternType; |
| 4367 FX_BOOL bCompelte = XFA_PATTERN_STRING_Type(szPattern, patternType); | 4367 FX_BOOL bCompelte = XFA_PATTERN_STRING_Type(szPattern, patternType); |
| 4368 CFX_WideString wsPattern = | 4368 CFX_WideString wsPattern = |
| 4369 CFX_WideString::FromUTF8(szPattern, szPattern.GetLength()); | 4369 CFX_WideString::FromUTF8(szPattern, szPattern.GetLength()); |
| 4370 CFX_WideString wsValue = | 4370 CFX_WideString wsValue = |
| 4371 CFX_WideString::FromUTF8(szValue, szValue.GetLength()); | 4371 CFX_WideString::FromUTF8(szValue, szValue.GetLength()); |
| 4372 if (!bCompelte) { | 4372 if (!bCompelte) { |
| 4373 switch (patternType) { | 4373 switch (patternType) { |
| 4374 case XFA_VT_DATETIME: { | 4374 case XFA_VT_DATETIME: { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4564 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 4564 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
| 4565 if (HValueIsNull(hThis, argTwo)) { | 4565 if (HValueIsNull(hThis, argTwo)) { |
| 4566 FXJSE_Value_SetNull(args.GetReturnValue()); | 4566 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 4567 } else { | 4567 } else { |
| 4568 CFX_ByteString szPattern; | 4568 CFX_ByteString szPattern; |
| 4569 HValueToUTF8String(argOne, szPattern); | 4569 HValueToUTF8String(argOne, szPattern); |
| 4570 CFX_ByteString szValue; | 4570 CFX_ByteString szValue; |
| 4571 HValueToUTF8String(argTwo, szValue); | 4571 HValueToUTF8String(argTwo, szValue); |
| 4572 CXFA_Document* pDoc = pContext->GetDocument(); | 4572 CXFA_Document* pDoc = pContext->GetDocument(); |
| 4573 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 4573 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 4574 CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject(); | 4574 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 4575 FXSYS_assert(pThisNode->IsNode()); | 4575 FXSYS_assert(pThisNode); |
| 4576 CXFA_WidgetData widgetData((CXFA_Node*)pThisNode); | 4576 CXFA_WidgetData widgetData(pThisNode); |
| 4577 IFX_Locale* pLocale = widgetData.GetLocal(); | 4577 IFX_Locale* pLocale = widgetData.GetLocal(); |
| 4578 FX_DWORD patternType; | 4578 FX_DWORD patternType; |
| 4579 FX_BOOL bCompletePattern = | 4579 FX_BOOL bCompletePattern = |
| 4580 XFA_PATTERN_STRING_Type(szPattern, patternType); | 4580 XFA_PATTERN_STRING_Type(szPattern, patternType); |
| 4581 CFX_WideString wsPattern = | 4581 CFX_WideString wsPattern = |
| 4582 CFX_WideString::FromUTF8(szPattern, szPattern.GetLength()); | 4582 CFX_WideString::FromUTF8(szPattern, szPattern.GetLength()); |
| 4583 CFX_WideString wsValue = | 4583 CFX_WideString wsValue = |
| 4584 CFX_WideString::FromUTF8(szValue, szValue.GetLength()); | 4584 CFX_WideString::FromUTF8(szValue, szValue.GetLength()); |
| 4585 CFX_ByteString szParsedValue; | 4585 CFX_ByteString szParsedValue; |
| 4586 if (bCompletePattern) { | 4586 if (bCompletePattern) { |
| (...skipping 2159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6746 index++; | 6746 index++; |
| 6747 } | 6747 } |
| 6748 } | 6748 } |
| 6749 for (int32_t i = iStart; i < argc; i++) { | 6749 for (int32_t i = iStart; i < argc; i++) { |
| 6750 FXJSE_Value_Release(argsValue[i]); | 6750 FXJSE_Value_Release(argsValue[i]); |
| 6751 } | 6751 } |
| 6752 FX_Free(argsValue); | 6752 FX_Free(argsValue); |
| 6753 } | 6753 } |
| 6754 void CXFA_FM2JSContext::GetObjectDefaultValue(FXJSE_HVALUE hObjectValue, | 6754 void CXFA_FM2JSContext::GetObjectDefaultValue(FXJSE_HVALUE hObjectValue, |
| 6755 FXJSE_HVALUE hDefaultValue) { | 6755 FXJSE_HVALUE hDefaultValue) { |
| 6756 CXFA_Object* pNode = (CXFA_Object*)FXJSE_Value_ToObject(hObjectValue, NULL); | 6756 CXFA_Node* pNode = |
| 6757 if (pNode && pNode->IsNode()) { | 6757 ToNode((CXFA_Object*)FXJSE_Value_ToObject(hObjectValue, NULL)); |
| 6758 ((CXFA_Node*)pNode) | 6758 if (pNode) { |
| 6759 ->Script_Som_DefaultValue(hDefaultValue, FALSE, (XFA_ATTRIBUTE)-1); | 6759 pNode->Script_Som_DefaultValue(hDefaultValue, FALSE, (XFA_ATTRIBUTE)-1); |
| 6760 } else { | 6760 } else { |
| 6761 FXJSE_Value_SetNull(hDefaultValue); | 6761 FXJSE_Value_SetNull(hDefaultValue); |
| 6762 } | 6762 } |
| 6763 } | 6763 } |
| 6764 FX_BOOL CXFA_FM2JSContext::SetObjectDefaultValue(FXJSE_HVALUE hObjectValue, | 6764 FX_BOOL CXFA_FM2JSContext::SetObjectDefaultValue(FXJSE_HVALUE hObjectValue, |
| 6765 FXJSE_HVALUE hNewValue) { | 6765 FXJSE_HVALUE hNewValue) { |
| 6766 FX_BOOL bSuccess = FALSE; | 6766 CXFA_Node* pNode = |
| 6767 CXFA_Object* pNode = (CXFA_Object*)FXJSE_Value_ToObject(hObjectValue, NULL); | 6767 ToNode((CXFA_Object*)FXJSE_Value_ToObject(hObjectValue, NULL)); |
| 6768 if (pNode && pNode->IsNode()) { | 6768 if (pNode) { |
| 6769 ((CXFA_Node*)pNode) | 6769 pNode->Script_Som_DefaultValue(hNewValue, TRUE, (XFA_ATTRIBUTE)-1); |
| 6770 ->Script_Som_DefaultValue(hNewValue, TRUE, (XFA_ATTRIBUTE)-1); | 6770 return TRUE; |
| 6771 bSuccess = TRUE; | |
| 6772 } | 6771 } |
| 6773 return bSuccess; | 6772 return FALSE; |
| 6774 } | 6773 } |
| 6775 void CXFA_FM2JSContext::GenerateSomExpression(const CFX_ByteStringC& szName, | 6774 void CXFA_FM2JSContext::GenerateSomExpression(const CFX_ByteStringC& szName, |
| 6776 int32_t iIndexFlags, | 6775 int32_t iIndexFlags, |
| 6777 int32_t iIndexValue, | 6776 int32_t iIndexValue, |
| 6778 FX_BOOL bIsStar, | 6777 FX_BOOL bIsStar, |
| 6779 CFX_ByteString& szSomExp) { | 6778 CFX_ByteString& szSomExp) { |
| 6780 if (bIsStar) { | 6779 if (bIsStar) { |
| 6781 szSomExp = szName + "[*]"; | 6780 szSomExp = szName + "[*]"; |
| 6782 return; | 6781 return; |
| 6783 } | 6782 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6848 FX_DWORD dFlags = 0UL; | 6847 FX_DWORD dFlags = 0UL; |
| 6849 if (bdotAccessor) { | 6848 if (bdotAccessor) { |
| 6850 if (FXJSE_Value_IsNull(hRefValue)) { | 6849 if (FXJSE_Value_IsNull(hRefValue)) { |
| 6851 pNode = pScriptContext->GetThisObject(); | 6850 pNode = pScriptContext->GetThisObject(); |
| 6852 dFlags = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; | 6851 dFlags = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; |
| 6853 } else { | 6852 } else { |
| 6854 pNode = (CXFA_Object*)FXJSE_Value_ToObject(hRefValue, NULL); | 6853 pNode = (CXFA_Object*)FXJSE_Value_ToObject(hRefValue, NULL); |
| 6855 FXSYS_assert(pNode); | 6854 FXSYS_assert(pNode); |
| 6856 if (bHasNoResolveName) { | 6855 if (bHasNoResolveName) { |
| 6857 CFX_WideString wsName; | 6856 CFX_WideString wsName; |
| 6858 if (pNode->IsNode()) { | 6857 if (CXFA_Node* pXFANode = pNode->AsNode()) { |
| 6859 CXFA_Node* pXFANode = (CXFA_Node*)pNode; | |
| 6860 pXFANode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); | 6858 pXFANode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); |
| 6861 } | 6859 } |
| 6862 if (wsName.IsEmpty()) { | 6860 if (wsName.IsEmpty()) { |
| 6863 CFX_WideStringC className; | 6861 CFX_WideStringC className; |
| 6864 pNode->GetClassName(className); | 6862 pNode->GetClassName(className); |
| 6865 wsName = FX_WSTRC(L"#") + className; | 6863 wsName = FX_WSTRC(L"#") + className; |
| 6866 } | 6864 } |
| 6867 wsSomExpression = wsName + wsSomExpression; | 6865 wsSomExpression = wsName + wsSomExpression; |
| 6868 dFlags = XFA_RESOLVENODE_Siblings; | 6866 dFlags = XFA_RESOLVENODE_Siblings; |
| 6869 } else { | 6867 } else { |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7193 FXSYS_assert(pAppProvider); | 7191 FXSYS_assert(pAppProvider); |
| 7194 CFX_WideString wsFormat; | 7192 CFX_WideString wsFormat; |
| 7195 pAppProvider->LoadString(iStringID, wsFormat); | 7193 pAppProvider->LoadString(iStringID, wsFormat); |
| 7196 CFX_WideString wsMessage; | 7194 CFX_WideString wsMessage; |
| 7197 va_list arg_ptr; | 7195 va_list arg_ptr; |
| 7198 va_start(arg_ptr, iStringID); | 7196 va_start(arg_ptr, iStringID); |
| 7199 wsMessage.FormatV((const FX_WCHAR*)wsFormat, arg_ptr); | 7197 wsMessage.FormatV((const FX_WCHAR*)wsFormat, arg_ptr); |
| 7200 va_end(arg_ptr); | 7198 va_end(arg_ptr); |
| 7201 FXJSE_ThrowMessage("", FX_UTF8Encode(wsMessage, wsMessage.GetLength())); | 7199 FXJSE_ThrowMessage("", FX_UTF8Encode(wsMessage, wsMessage.GetLength())); |
| 7202 } | 7200 } |
| OLD | NEW |