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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 default: | 72 default: |
73 return; | 73 return; |
74 } | 74 } |
75 CXML_Element* pElement = | 75 CXML_Element* pElement = |
76 m_pLocaleData->GetElement("", bsSymbols.AsByteStringC()); | 76 m_pLocaleData->GetElement("", bsSymbols.AsByteStringC()); |
77 if (!pElement) { | 77 if (!pElement) { |
78 return; | 78 return; |
79 } | 79 } |
80 GetPattern(pElement, CFX_ByteStringC((const FX_CHAR*)bsSymbols, | 80 GetPattern(pElement, CFX_ByteStringC((const FX_CHAR*)bsSymbols, |
81 bsSymbols.GetLength() - 1), | 81 bsSymbols.GetLength() - 1), |
82 wsName, wsNumSymbol); | 82 wsName.AsWideStringC(), wsNumSymbol); |
83 } | 83 } |
84 void CXFA_XMLLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const { | 84 void CXFA_XMLLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const { |
85 if (!m_pLocaleData) { | 85 if (!m_pLocaleData) { |
86 return; | 86 return; |
87 } | 87 } |
88 CFX_ByteString bsSpace; | 88 CFX_ByteString bsSpace; |
89 CXML_Element* pNumberSymbols = | 89 CXML_Element* pNumberSymbols = |
90 m_pLocaleData->GetElement(bsSpace.AsByteStringC(), "dateTimeSymbols"); | 90 m_pLocaleData->GetElement(bsSpace.AsByteStringC(), "dateTimeSymbols"); |
91 if (!pNumberSymbols) { | 91 if (!pNumberSymbols) { |
92 return; | 92 return; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 case FX_LOCALEDATETIMESUBCATEGORY_Medium: | 155 case FX_LOCALEDATETIMESUBCATEGORY_Medium: |
156 wsName = L"med"; | 156 wsName = L"med"; |
157 break; | 157 break; |
158 case FX_LOCALEDATETIMESUBCATEGORY_Full: | 158 case FX_LOCALEDATETIMESUBCATEGORY_Full: |
159 wsName = L"full"; | 159 wsName = L"full"; |
160 break; | 160 break; |
161 case FX_LOCALEDATETIMESUBCATEGORY_Long: | 161 case FX_LOCALEDATETIMESUBCATEGORY_Long: |
162 wsName = L"long"; | 162 wsName = L"long"; |
163 break; | 163 break; |
164 } | 164 } |
165 GetPattern(pElement, "datePattern", wsName, wsPattern); | 165 GetPattern(pElement, "datePattern", wsName.AsWideStringC(), wsPattern); |
166 } | 166 } |
167 void CXFA_XMLLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, | 167 void CXFA_XMLLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, |
168 CFX_WideString& wsPattern) const { | 168 CFX_WideString& wsPattern) const { |
169 CXML_Element* pElement = m_pLocaleData->GetElement("", "timePatterns"); | 169 CXML_Element* pElement = m_pLocaleData->GetElement("", "timePatterns"); |
170 if (pElement == NULL) { | 170 if (pElement == NULL) { |
171 return; | 171 return; |
172 } | 172 } |
173 CFX_WideString wsName; | 173 CFX_WideString wsName; |
174 switch (eType) { | 174 switch (eType) { |
175 case FX_LOCALEDATETIMESUBCATEGORY_Short: | 175 case FX_LOCALEDATETIMESUBCATEGORY_Short: |
176 wsName = L"short"; | 176 wsName = L"short"; |
177 break; | 177 break; |
178 case FX_LOCALEDATETIMESUBCATEGORY_Default: | 178 case FX_LOCALEDATETIMESUBCATEGORY_Default: |
179 case FX_LOCALEDATETIMESUBCATEGORY_Medium: | 179 case FX_LOCALEDATETIMESUBCATEGORY_Medium: |
180 wsName = L"med"; | 180 wsName = L"med"; |
181 break; | 181 break; |
182 case FX_LOCALEDATETIMESUBCATEGORY_Full: | 182 case FX_LOCALEDATETIMESUBCATEGORY_Full: |
183 wsName = L"full"; | 183 wsName = L"full"; |
184 break; | 184 break; |
185 case FX_LOCALEDATETIMESUBCATEGORY_Long: | 185 case FX_LOCALEDATETIMESUBCATEGORY_Long: |
186 wsName = L"long"; | 186 wsName = L"long"; |
187 break; | 187 break; |
188 } | 188 } |
189 GetPattern(pElement, "timePattern", wsName, wsPattern); | 189 GetPattern(pElement, "timePattern", wsName.AsWideStringC(), wsPattern); |
190 } | 190 } |
191 void CXFA_XMLLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, | 191 void CXFA_XMLLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, |
192 CFX_WideString& wsPattern) const { | 192 CFX_WideString& wsPattern) const { |
193 CXML_Element* pElement = m_pLocaleData->GetElement("", "numberPatterns"); | 193 CXML_Element* pElement = m_pLocaleData->GetElement("", "numberPatterns"); |
194 if (pElement == NULL) { | 194 if (pElement == NULL) { |
195 return; | 195 return; |
196 } | 196 } |
197 switch (eType) { | 197 switch (eType) { |
198 case FX_LOCALENUMPATTERN_Percent: | 198 case FX_LOCALENUMPATTERN_Percent: |
199 wsPattern = g_FX_Percent; | 199 wsPattern = g_FX_Percent; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement); | 369 CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement); |
370 for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) { | 370 for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) { |
371 if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) { | 371 if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) { |
372 CXFA_Node* pSymbol = pNode->GetChild(index, XFA_ELEMENT_UNKNOWN); | 372 CXFA_Node* pSymbol = pNode->GetChild(index, XFA_ELEMENT_UNKNOWN); |
373 return pSymbol ? pSymbol->GetContent() : CFX_WideString(); | 373 return pSymbol ? pSymbol->GetContent() : CFX_WideString(); |
374 } | 374 } |
375 } | 375 } |
376 } | 376 } |
377 return CFX_WideString(); | 377 return CFX_WideString(); |
378 } | 378 } |
OLD | NEW |