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 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 : m_dwLocaleFlags(0x00) { | 1125 : m_dwLocaleFlags(0x00) { |
1126 m_dwDeflcid = XFA_GetLanguage(wsDeflcid); | 1126 m_dwDeflcid = XFA_GetLanguage(wsDeflcid); |
1127 CXFA_Node* pNodeLocale = NULL; | 1127 CXFA_Node* pNodeLocale = NULL; |
1128 if (pLocaleSet && | 1128 if (pLocaleSet && |
1129 (pNodeLocale = pLocaleSet->GetNodeItem(XFA_NODEITEM_FirstChild))) { | 1129 (pNodeLocale = pLocaleSet->GetNodeItem(XFA_NODEITEM_FirstChild))) { |
1130 while (pNodeLocale) { | 1130 while (pNodeLocale) { |
1131 m_LocaleArray.Add(new CXFA_NodeLocale(pNodeLocale)); | 1131 m_LocaleArray.Add(new CXFA_NodeLocale(pNodeLocale)); |
1132 pNodeLocale = pNodeLocale->GetNodeItem(XFA_NODEITEM_NextSibling); | 1132 pNodeLocale = pNodeLocale->GetNodeItem(XFA_NODEITEM_NextSibling); |
1133 } | 1133 } |
1134 } | 1134 } |
1135 m_pDefLocale = GetLocaleByName(wsDeflcid.AsWideStringC()); | 1135 m_pDefLocale = GetLocaleByName(wsDeflcid.AsStringC()); |
1136 } | 1136 } |
1137 CXFA_LocaleMgr::~CXFA_LocaleMgr() { | 1137 CXFA_LocaleMgr::~CXFA_LocaleMgr() { |
1138 int32_t iCount = m_LocaleArray.GetSize(); | 1138 int32_t iCount = m_LocaleArray.GetSize(); |
1139 for (int32_t i = 0; i < iCount; i++) { | 1139 for (int32_t i = 0; i < iCount; i++) { |
1140 ((IFX_Locale*)m_LocaleArray[i])->Release(); | 1140 ((IFX_Locale*)m_LocaleArray[i])->Release(); |
1141 } | 1141 } |
1142 int32_t iXmls = m_XMLLocaleArray.GetSize(); | 1142 int32_t iXmls = m_XMLLocaleArray.GetSize(); |
1143 for (int32_t j = 0; j < iXmls; j++) { | 1143 for (int32_t j = 0; j < iXmls; j++) { |
1144 ((IFX_Locale*)m_XMLLocaleArray[j])->Release(); | 1144 ((IFX_Locale*)m_XMLLocaleArray[j])->Release(); |
1145 } | 1145 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 ? pChildfConfig->GetFirstChildByClass(XFA_ELEMENT_Common) | 1259 ? pChildfConfig->GetFirstChildByClass(XFA_ELEMENT_Common) |
1260 : NULL; | 1260 : NULL; |
1261 CXFA_Node* pLocale = | 1261 CXFA_Node* pLocale = |
1262 pCommon ? pCommon->GetFirstChildByClass(XFA_ELEMENT_Locale) : NULL; | 1262 pCommon ? pCommon->GetFirstChildByClass(XFA_ELEMENT_Locale) : NULL; |
1263 if (pLocale) { | 1263 if (pLocale) { |
1264 pLocale->TryCData(XFA_ATTRIBUTE_Value, m_wsConfigLocale, FALSE); | 1264 pLocale->TryCData(XFA_ATTRIBUTE_Value, m_wsConfigLocale, FALSE); |
1265 } | 1265 } |
1266 } | 1266 } |
1267 m_dwLocaleFlags |= 0x01; | 1267 m_dwLocaleFlags |= 0x01; |
1268 } | 1268 } |
1269 return m_wsConfigLocale.AsWideStringC(); | 1269 return m_wsConfigLocale.AsStringC(); |
1270 } | 1270 } |
1271 static CXFA_TimeZoneProvider* g_pProvider = NULL; | 1271 static CXFA_TimeZoneProvider* g_pProvider = NULL; |
1272 | 1272 |
1273 // Static. | 1273 // Static. |
1274 CXFA_TimeZoneProvider* CXFA_TimeZoneProvider::Create() { | 1274 CXFA_TimeZoneProvider* CXFA_TimeZoneProvider::Create() { |
1275 FXSYS_assert(!g_pProvider); | 1275 FXSYS_assert(!g_pProvider); |
1276 g_pProvider = new CXFA_TimeZoneProvider(); | 1276 g_pProvider = new CXFA_TimeZoneProvider(); |
1277 return g_pProvider; | 1277 return g_pProvider; |
1278 } | 1278 } |
1279 | 1279 |
(...skipping 23 matching lines...) Expand all Loading... |
1303 m_tz.tzMinute = (int8_t)((FXSYS_abs((int)timezone) % 3600) / 60); | 1303 m_tz.tzMinute = (int8_t)((FXSYS_abs((int)timezone) % 3600) / 60); |
1304 #endif | 1304 #endif |
1305 } | 1305 } |
1306 CXFA_TimeZoneProvider::~CXFA_TimeZoneProvider() {} | 1306 CXFA_TimeZoneProvider::~CXFA_TimeZoneProvider() {} |
1307 void CXFA_TimeZoneProvider::SetTimeZone(FX_TIMEZONE& tz) { | 1307 void CXFA_TimeZoneProvider::SetTimeZone(FX_TIMEZONE& tz) { |
1308 m_tz = tz; | 1308 m_tz = tz; |
1309 } | 1309 } |
1310 void CXFA_TimeZoneProvider::GetTimeZone(FX_TIMEZONE& tz) { | 1310 void CXFA_TimeZoneProvider::GetTimeZone(FX_TIMEZONE& tz) { |
1311 tz = m_tz; | 1311 tz = m_tz; |
1312 } | 1312 } |
OLD | NEW |