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/fxcodec/include/fx_codec.h" | 9 #include "core/fxcodec/include/fx_codec.h" |
10 #include "core/fxcrt/include/fx_xml.h" | 10 #include "core/fxcrt/include/fx_xml.h" |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 : m_dwLocaleFlags(0x00) { | 1124 : m_dwLocaleFlags(0x00) { |
1125 m_dwDeflcid = XFA_GetLanguage(wsDeflcid); | 1125 m_dwDeflcid = XFA_GetLanguage(wsDeflcid); |
1126 CXFA_Node* pNodeLocale = NULL; | 1126 CXFA_Node* pNodeLocale = NULL; |
1127 if (pLocaleSet && | 1127 if (pLocaleSet && |
1128 (pNodeLocale = pLocaleSet->GetNodeItem(XFA_NODEITEM_FirstChild))) { | 1128 (pNodeLocale = pLocaleSet->GetNodeItem(XFA_NODEITEM_FirstChild))) { |
1129 while (pNodeLocale) { | 1129 while (pNodeLocale) { |
1130 m_LocaleArray.Add(new CXFA_NodeLocale(pNodeLocale)); | 1130 m_LocaleArray.Add(new CXFA_NodeLocale(pNodeLocale)); |
1131 pNodeLocale = pNodeLocale->GetNodeItem(XFA_NODEITEM_NextSibling); | 1131 pNodeLocale = pNodeLocale->GetNodeItem(XFA_NODEITEM_NextSibling); |
1132 } | 1132 } |
1133 } | 1133 } |
1134 m_pDefLocale = GetLocaleByName(wsDeflcid.AsStringC()); | 1134 m_pDefLocale = GetLocaleByName(wsDeflcid); |
1135 } | 1135 } |
1136 CXFA_LocaleMgr::~CXFA_LocaleMgr() { | 1136 CXFA_LocaleMgr::~CXFA_LocaleMgr() { |
1137 for (int32_t i = 0; i < m_LocaleArray.GetSize(); i++) | 1137 for (int32_t i = 0; i < m_LocaleArray.GetSize(); i++) |
1138 m_LocaleArray[i]->Release(); | 1138 m_LocaleArray[i]->Release(); |
1139 | 1139 |
1140 for (int32_t j = 0; j < m_XMLLocaleArray.GetSize(); j++) | 1140 for (int32_t j = 0; j < m_XMLLocaleArray.GetSize(); j++) |
1141 m_XMLLocaleArray[j]->Release(); | 1141 m_XMLLocaleArray[j]->Release(); |
1142 } | 1142 } |
1143 void CXFA_LocaleMgr::Release() { | 1143 void CXFA_LocaleMgr::Release() { |
1144 delete this; | 1144 delete this; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 pLocal = XFA_GetLocaleFromBuffer(g_ruRU_Locale, sizeof(g_ruRU_Locale)); | 1210 pLocal = XFA_GetLocaleFromBuffer(g_ruRU_Locale, sizeof(g_ruRU_Locale)); |
1211 break; | 1211 break; |
1212 case XFA_LANGID_en_US: | 1212 case XFA_LANGID_en_US: |
1213 default: | 1213 default: |
1214 pLocal = XFA_GetLocaleFromBuffer(g_enUS_Locale, sizeof(g_enUS_Locale)); | 1214 pLocal = XFA_GetLocaleFromBuffer(g_enUS_Locale, sizeof(g_enUS_Locale)); |
1215 break; | 1215 break; |
1216 } | 1216 } |
1217 return pLocal; | 1217 return pLocal; |
1218 } | 1218 } |
1219 IFX_Locale* CXFA_LocaleMgr::GetLocaleByName( | 1219 IFX_Locale* CXFA_LocaleMgr::GetLocaleByName( |
1220 const CFX_WideStringC& wsLocaleName) { | 1220 const CFX_WideString& wsLocaleName) { |
1221 int32_t iCount = m_LocaleArray.GetSize(); | 1221 int32_t iCount = m_LocaleArray.GetSize(); |
1222 int32_t i = 0; | 1222 int32_t i = 0; |
1223 for (i = 0; i < iCount; i++) { | 1223 for (i = 0; i < iCount; i++) { |
1224 IFX_Locale* pLocale = m_LocaleArray[i]; | 1224 IFX_Locale* pLocale = m_LocaleArray[i]; |
1225 if (pLocale->GetName() == wsLocaleName) { | 1225 if (pLocale->GetName() == wsLocaleName) { |
1226 return pLocale; | 1226 return pLocale; |
1227 } | 1227 } |
1228 } | 1228 } |
1229 int32_t iLen = wsLocaleName.GetLength(); | 1229 int32_t iLen = wsLocaleName.GetLength(); |
1230 if (iLen < 2) { | 1230 if (iLen < 2) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 m_tz.tzMinute = (int8_t)((FXSYS_abs((int)timezone) % 3600) / 60); | 1304 m_tz.tzMinute = (int8_t)((FXSYS_abs((int)timezone) % 3600) / 60); |
1305 #endif | 1305 #endif |
1306 } | 1306 } |
1307 CXFA_TimeZoneProvider::~CXFA_TimeZoneProvider() {} | 1307 CXFA_TimeZoneProvider::~CXFA_TimeZoneProvider() {} |
1308 void CXFA_TimeZoneProvider::SetTimeZone(FX_TIMEZONE& tz) { | 1308 void CXFA_TimeZoneProvider::SetTimeZone(FX_TIMEZONE& tz) { |
1309 m_tz = tz; | 1309 m_tz = tz; |
1310 } | 1310 } |
1311 void CXFA_TimeZoneProvider::GetTimeZone(FX_TIMEZONE& tz) { | 1311 void CXFA_TimeZoneProvider::GetTimeZone(FX_TIMEZONE& tz) { |
1312 tz = m_tz; | 1312 tz = m_tz; |
1313 } | 1313 } |
OLD | NEW |