1 // Copyright 2014 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef XFA_FXFA_PARSER_XFA_LOCALEMGR_H_ 8 #define XFA_FXFA_PARSER_XFA_LOCALEMGR_H_ 9 10 #include <memory> 11 #include <vector> 12 13 #include "xfa/fgas/localization/fgas_datetime.h" 14 #include "xfa/fgas/localization/fgas_locale.h" 15 #include "xfa/fxfa/parser/xfa_localemgr.h" 16 17 class CXFA_Node; 18 class IFX_Locale; 19 20 #define XFA_LANGID_zh_CN 0x0804 21 #define XFA_LANGID_zh_TW 0x0404 22 #define XFA_LANGID_zh_HK 0x0c04 23 #define XFA_LANGID_ja_JP 0x0411 24 #define XFA_LANGID_ko_KR 0x0412 25 #define XFA_LANGID_en_US 0x0409 26 #define XFA_LANGID_en_GB 0x0809 27 #define XFA_LANGID_es_ES 0x0c0a 28 #define XFA_LANGID_es_LA 0x080a 29 #define XFA_LANGID_de_DE 0x0407 30 #define XFA_LANGID_fr_FR 0x040c 31 #define XFA_LANGID_it_IT 0x0410 32 #define XFA_LANGID_pt_BR 0x0416 33 #define XFA_LANGID_nl_NL 0x0413 34 #define XFA_LANGID_ru_RU 0x0419 35 36 class CXFA_LocaleMgr : public IFX_LocaleMgr { 37 public: 38 CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid); 39 ~CXFA_LocaleMgr() override; 40 41 // IFX_LocaleMgr 42 uint16_t GetDefLocaleID() const override; 43 IFX_Locale* GetDefLocale() override; 44 IFX_Locale* GetLocaleByName(const CFX_WideString& wsLocaleName) override; 45 46 void SetDefLocale(IFX_Locale* pLocale); 47 CFX_WideStringC GetConfigLocaleName(CXFA_Node* pConfig); 48 49 protected: 50 std::unique_ptr<IFX_Locale> GetLocale(uint16_t lcid) override; 51 52 std::vector<std::unique_ptr<IFX_Locale>> m_LocaleArray; 53 std::vector<std::unique_ptr<IFX_Locale>> m_XMLLocaleArray; 54 IFX_Locale* m_pDefLocale; // owned by m_LocaleArray or m_XMLLocaleArray. 55 CFX_WideString m_wsConfigLocale; 56 uint16_t m_dwDeflcid; 57 uint16_t m_dwLocaleFlags; 58 }; 59 60 class CXFA_TimeZoneProvider { 61 public: 62 CXFA_TimeZoneProvider(); 63 ~CXFA_TimeZoneProvider(); 64 65 void GetTimeZone(FX_TIMEZONE* tz) const; 66 67 private: 68 FX_TIMEZONE m_tz; 69 }; 70 71 #endif // XFA_FXFA_PARSER_XFA_LOCALEMGR_H_ 72