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_locale.h" | 7 #include "xfa/fxfa/parser/xfa_locale.h" |
8 | 8 |
9 #include "core/fxcrt/include/fx_xml.h" | 9 #include "core/fxcrt/include/fx_xml.h" |
10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" | 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 void CXFA_XMLLocale::GetDayName(int32_t nWeek, | 100 void CXFA_XMLLocale::GetDayName(int32_t nWeek, |
101 CFX_WideString& wsDayName, | 101 CFX_WideString& wsDayName, |
102 FX_BOOL bAbbr) const { | 102 FX_BOOL bAbbr) const { |
103 wsDayName = GetCalendarSymbol("day", nWeek, bAbbr); | 103 wsDayName = GetCalendarSymbol("day", nWeek, bAbbr); |
104 } | 104 } |
105 void CXFA_XMLLocale::GetMeridiemName(CFX_WideString& wsMeridiemName, | 105 void CXFA_XMLLocale::GetMeridiemName(CFX_WideString& wsMeridiemName, |
106 FX_BOOL bAM) const { | 106 FX_BOOL bAM) const { |
107 wsMeridiemName = GetCalendarSymbol("meridiem", bAM ? 0 : 1, FALSE); | 107 wsMeridiemName = GetCalendarSymbol("meridiem", bAM ? 0 : 1, FALSE); |
108 } | 108 } |
109 void CXFA_XMLLocale::GetTimeZone(FX_TIMEZONE& tz) const { | 109 void CXFA_XMLLocale::GetTimeZone(FX_TIMEZONE& tz) const { |
110 IXFA_TimeZoneProvider* pProvider = IXFA_TimeZoneProvider::Get(); | 110 CXFA_TimeZoneProvider::Get()->GetTimeZone(tz); |
111 pProvider->GetTimeZone(tz); | |
112 } | 111 } |
113 void CXFA_XMLLocale::GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD) const { | 112 void CXFA_XMLLocale::GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD) const { |
114 wsEraName = GetCalendarSymbol("era", bAD ? 1 : 0, FALSE); | 113 wsEraName = GetCalendarSymbol("era", bAD ? 1 : 0, FALSE); |
115 } | 114 } |
116 CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol, | 115 CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol, |
117 int index, | 116 int index, |
118 FX_BOOL bAbbr) const { | 117 FX_BOOL bAbbr) const { |
119 CFX_ByteString pstrSymbolNames = symbol + "Names"; | 118 CFX_ByteString pstrSymbolNames = symbol + "Names"; |
120 CFX_WideString wsSymbolName = L""; | 119 CFX_WideString wsSymbolName = L""; |
121 if (m_pLocaleData) { | 120 if (m_pLocaleData) { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 CFX_WideString& wsDayName, | 270 CFX_WideString& wsDayName, |
272 FX_BOOL bAbbr) const { | 271 FX_BOOL bAbbr) const { |
273 wsDayName = GetCalendarSymbol(XFA_ELEMENT_DayNames, nWeek, bAbbr); | 272 wsDayName = GetCalendarSymbol(XFA_ELEMENT_DayNames, nWeek, bAbbr); |
274 } | 273 } |
275 void CXFA_NodeLocale::GetMeridiemName(CFX_WideString& wsMeridiemName, | 274 void CXFA_NodeLocale::GetMeridiemName(CFX_WideString& wsMeridiemName, |
276 FX_BOOL bAM) const { | 275 FX_BOOL bAM) const { |
277 wsMeridiemName = | 276 wsMeridiemName = |
278 GetCalendarSymbol(XFA_ELEMENT_MeridiemNames, bAM ? 0 : 1, FALSE); | 277 GetCalendarSymbol(XFA_ELEMENT_MeridiemNames, bAM ? 0 : 1, FALSE); |
279 } | 278 } |
280 void CXFA_NodeLocale::GetTimeZone(FX_TIMEZONE& tz) const { | 279 void CXFA_NodeLocale::GetTimeZone(FX_TIMEZONE& tz) const { |
281 IXFA_TimeZoneProvider* pProvider = IXFA_TimeZoneProvider::Get(); | 280 CXFA_TimeZoneProvider::Get()->GetTimeZone(tz); |
282 pProvider->GetTimeZone(tz); | |
283 } | 281 } |
284 void CXFA_NodeLocale::GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD) const { | 282 void CXFA_NodeLocale::GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD) const { |
285 wsEraName = GetCalendarSymbol(XFA_ELEMENT_EraNames, bAD ? 1 : 0, FALSE); | 283 wsEraName = GetCalendarSymbol(XFA_ELEMENT_EraNames, bAD ? 1 : 0, FALSE); |
286 } | 284 } |
287 void CXFA_NodeLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, | 285 void CXFA_NodeLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, |
288 CFX_WideString& wsPattern) const { | 286 CFX_WideString& wsPattern) const { |
289 switch (eType) { | 287 switch (eType) { |
290 case FX_LOCALEDATETIMESUBCATEGORY_Short: | 288 case FX_LOCALEDATETIMESUBCATEGORY_Short: |
291 wsPattern = GetSymbol(XFA_ELEMENT_DatePatterns, FX_WSTRC(L"short")); | 289 wsPattern = GetSymbol(XFA_ELEMENT_DatePatterns, FX_WSTRC(L"short")); |
292 break; | 290 break; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement); | 366 CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement); |
369 for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) { | 367 for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) { |
370 if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) { | 368 if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) { |
371 CXFA_Node* pSymbol = pNode->GetChild(index, XFA_ELEMENT_UNKNOWN); | 369 CXFA_Node* pSymbol = pNode->GetChild(index, XFA_ELEMENT_UNKNOWN); |
372 return pSymbol ? pSymbol->GetContent() : CFX_WideString(); | 370 return pSymbol ? pSymbol->GetContent() : CFX_WideString(); |
373 } | 371 } |
374 } | 372 } |
375 } | 373 } |
376 return CFX_WideString(); | 374 return CFX_WideString(); |
377 } | 375 } |
OLD | NEW |