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/fxfa/parser/xfa_localemgr.h" | 7 #include "xfa/fxfa/parser/xfa_localemgr.h" |
8 | 8 |
9 #include "core/fxcrt/include/fx_xml.h" | 9 #include "core/fxcrt/include/fx_xml.h" |
10 #include "core/include/fxcodec/fx_codec.h" | 10 #include "core/include/fxcodec/fx_codec.h" |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 CFX_GEModule* pGeModule = CFX_GEModule::Get(); | 1041 CFX_GEModule* pGeModule = CFX_GEModule::Get(); |
1042 if (!pGeModule) { | 1042 if (!pGeModule) { |
1043 return NULL; | 1043 return NULL; |
1044 } | 1044 } |
1045 CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule(); | 1045 CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule(); |
1046 if (!pCodecMgr) { | 1046 if (!pCodecMgr) { |
1047 return NULL; | 1047 return NULL; |
1048 } | 1048 } |
1049 CXML_Element* pLocale = NULL; | 1049 CXML_Element* pLocale = NULL; |
1050 uint8_t* pOut = NULL; | 1050 uint8_t* pOut = NULL; |
1051 FX_DWORD dwSize; | 1051 uint32_t dwSize; |
1052 pCodecMgr->GetFlateModule()->FlateOrLZWDecode(FALSE, pBuf, nBufLen, TRUE, 0, | 1052 pCodecMgr->GetFlateModule()->FlateOrLZWDecode(FALSE, pBuf, nBufLen, TRUE, 0, |
1053 0, 0, 0, 0, pOut, dwSize); | 1053 0, 0, 0, 0, pOut, dwSize); |
1054 if (pOut) { | 1054 if (pOut) { |
1055 pLocale = CXML_Element::Parse(pOut, dwSize); | 1055 pLocale = CXML_Element::Parse(pOut, dwSize); |
1056 FX_Free(pOut); | 1056 FX_Free(pOut); |
1057 } | 1057 } |
1058 if (pLocale) { | 1058 if (pLocale) { |
1059 return new CXFA_XMLLocale(pLocale); | 1059 return new CXFA_XMLLocale(pLocale); |
1060 } | 1060 } |
1061 return NULL; | 1061 return NULL; |
1062 } | 1062 } |
1063 static uint16_t XFA_GetLanguage(CFX_WideString wsLanguage) { | 1063 static uint16_t XFA_GetLanguage(CFX_WideString wsLanguage) { |
1064 uint16_t dwLangueID = XFA_LANGID_en_US; | 1064 uint16_t dwLangueID = XFA_LANGID_en_US; |
1065 if (wsLanguage.GetLength() < 2) { | 1065 if (wsLanguage.GetLength() < 2) { |
1066 return dwLangueID; | 1066 return dwLangueID; |
1067 } | 1067 } |
1068 wsLanguage.MakeLower(); | 1068 wsLanguage.MakeLower(); |
1069 FX_DWORD dwIDFirst = wsLanguage.GetAt(0) << 8 | wsLanguage.GetAt(1); | 1069 uint32_t dwIDFirst = wsLanguage.GetAt(0) << 8 | wsLanguage.GetAt(1); |
1070 FX_DWORD dwIDSecond = wsLanguage.GetLength() >= 5 | 1070 uint32_t dwIDSecond = wsLanguage.GetLength() >= 5 |
1071 ? wsLanguage.GetAt(3) << 8 | wsLanguage.GetAt(4) | 1071 ? wsLanguage.GetAt(3) << 8 | wsLanguage.GetAt(4) |
1072 : 0; | 1072 : 0; |
1073 switch (dwIDFirst) { | 1073 switch (dwIDFirst) { |
1074 case FXBSTR_ID(0, 0, 'z', 'h'): { | 1074 case FXBSTR_ID(0, 0, 'z', 'h'): { |
1075 if (dwIDSecond == FXBSTR_ID(0, 0, 'c', 'n')) { | 1075 if (dwIDSecond == FXBSTR_ID(0, 0, 'c', 'n')) { |
1076 dwLangueID = XFA_LANGID_zh_CN; | 1076 dwLangueID = XFA_LANGID_zh_CN; |
1077 } else if (dwIDSecond == FXBSTR_ID(0, 0, 't', 'w')) { | 1077 } else if (dwIDSecond == FXBSTR_ID(0, 0, 't', 'w')) { |
1078 dwLangueID = XFA_LANGID_zh_TW; | 1078 dwLangueID = XFA_LANGID_zh_TW; |
1079 } else if (dwIDSecond == FXBSTR_ID(0, 0, 'h', 'k')) { | 1079 } else if (dwIDSecond == FXBSTR_ID(0, 0, 'h', 'k')) { |
1080 dwLangueID = XFA_LANGID_zh_HK; | 1080 dwLangueID = XFA_LANGID_zh_HK; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 m_tz.tzMinute = (int8_t)((FXSYS_abs((int)timezone) % 3600) / 60); | 1296 m_tz.tzMinute = (int8_t)((FXSYS_abs((int)timezone) % 3600) / 60); |
1297 #endif | 1297 #endif |
1298 } | 1298 } |
1299 CXFA_TimeZoneProvider::~CXFA_TimeZoneProvider() {} | 1299 CXFA_TimeZoneProvider::~CXFA_TimeZoneProvider() {} |
1300 void CXFA_TimeZoneProvider::SetTimeZone(FX_TIMEZONE& tz) { | 1300 void CXFA_TimeZoneProvider::SetTimeZone(FX_TIMEZONE& tz) { |
1301 m_tz = tz; | 1301 m_tz = tz; |
1302 } | 1302 } |
1303 void CXFA_TimeZoneProvider::GetTimeZone(FX_TIMEZONE& tz) { | 1303 void CXFA_TimeZoneProvider::GetTimeZone(FX_TIMEZONE& tz) { |
1304 tz = m_tz; | 1304 tz = m_tz; |
1305 } | 1305 } |
OLD | NEW |