diff options
-rw-r--r-- | BUILD.gn | 5 | ||||
-rw-r--r-- | xfa/fgas/localization/cfx_decimal.cpp | 4 | ||||
-rw-r--r-- | xfa/fgas/localization/cfx_decimal.h | 42 | ||||
-rw-r--r-- | xfa/fgas/localization/cfx_formatstring.cpp (renamed from xfa/fgas/localization/fgas_locale.cpp) | 4 | ||||
-rw-r--r-- | xfa/fgas/localization/cfx_formatstring.h | 7 | ||||
-rw-r--r-- | xfa/fgas/localization/ifx_locale.h (renamed from xfa/fgas/localization/fgas_locale.h) | 48 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_localemgr.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 1 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_nodelocale.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_widgetdata.cpp | 1 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_xmllocale.h | 4 |
12 files changed, 71 insertions, 51 deletions
@@ -1255,9 +1255,10 @@ if (pdf_enable_xfa) { "xfa/fgas/localization/cfx_datetime.cpp", "xfa/fgas/localization/cfx_datetime.h", "xfa/fgas/localization/cfx_decimal.cpp", + "xfa/fgas/localization/cfx_decimal.h", + "xfa/fgas/localization/cfx_formatstring.cpp", "xfa/fgas/localization/cfx_formatstring.h", - "xfa/fgas/localization/fgas_locale.cpp", - "xfa/fgas/localization/fgas_locale.h", + "xfa/fgas/localization/ifx_locale.h", "xfa/fwl/cfwl_app.cpp", "xfa/fwl/cfwl_app.h", "xfa/fwl/cfwl_barcode.cpp", diff --git a/xfa/fgas/localization/cfx_decimal.cpp b/xfa/fgas/localization/cfx_decimal.cpp index ba70be8230..b3296f30cd 100644 --- a/xfa/fgas/localization/cfx_decimal.cpp +++ b/xfa/fgas/localization/cfx_decimal.cpp @@ -4,11 +4,11 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "xfa/fgas/localization/cfx_decimal.h" + #include <algorithm> #include <utility> -#include "xfa/fgas/localization/fgas_locale.h" - #define FXMATH_DECIMAL_SCALELIMIT 0x1c #define FXMATH_DECIMAL_NEGMASK (0x80000000L) #define FXMATH_DECIMAL_FORCEBOOL(x) (!!(x)) diff --git a/xfa/fgas/localization/cfx_decimal.h b/xfa/fgas/localization/cfx_decimal.h new file mode 100644 index 0000000000..36b898dc7d --- /dev/null +++ b/xfa/fgas/localization/cfx_decimal.h @@ -0,0 +1,42 @@ +// Copyright 2017 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_FGAS_LOCALIZATION_CFX_DECIMAL_H_ +#define XFA_FGAS_LOCALIZATION_CFX_DECIMAL_H_ + +#include "core/fxcrt/fx_string.h" + +class CFX_Decimal { + public: + CFX_Decimal(); + explicit CFX_Decimal(uint32_t val); + explicit CFX_Decimal(uint64_t val); + explicit CFX_Decimal(int32_t val); + CFX_Decimal(float val, uint8_t scale); + explicit CFX_Decimal(const CFX_WideStringC& str); + + operator CFX_WideString() const; + operator double() const; + + CFX_Decimal operator*(const CFX_Decimal& val) const; + CFX_Decimal operator/(const CFX_Decimal& val) const; + + void SetScale(uint8_t newScale); + uint8_t GetScale(); + void SetNegate(); + + private: + CFX_Decimal(uint32_t hi, uint32_t mid, uint32_t lo, bool neg, uint8_t scale); + bool IsNotZero() const { return m_uHi || m_uMid || m_uLo; } + void Swap(CFX_Decimal& val); + + uint32_t m_uHi; + uint32_t m_uLo; + uint32_t m_uMid; + uint32_t m_uFlags; +}; + +#endif // XFA_FGAS_LOCALIZATION_CFX_DECIMAL_H_ diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/cfx_formatstring.cpp index 4747aafcf5..01e10960b8 100644 --- a/xfa/fgas/localization/fgas_locale.cpp +++ b/xfa/fgas/localization/cfx_formatstring.cpp @@ -4,14 +4,14 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fgas/localization/fgas_locale.h" +#include "xfa/fgas/localization/cfx_formatstring.h" #include <algorithm> #include <vector> #include "core/fxcrt/fx_ext.h" #include "core/fxcrt/fx_xml.h" -#include "xfa/fgas/localization/cfx_formatstring.h" +#include "xfa/fgas/localization/cfx_decimal.h" #define FX_LOCALECATEGORY_DateHash 0xbde9abde #define FX_LOCALECATEGORY_TimeHash 0x2d71b00f diff --git a/xfa/fgas/localization/cfx_formatstring.h b/xfa/fgas/localization/cfx_formatstring.h index 5fd60aac97..80e036fa3e 100644 --- a/xfa/fgas/localization/cfx_formatstring.h +++ b/xfa/fgas/localization/cfx_formatstring.h @@ -9,9 +9,14 @@ #include <vector> -#include "xfa/fgas/localization/fgas_locale.h" +#include "xfa/fgas/localization/ifx_locale.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" +bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_DateTime* datetime); +bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime, + CFX_DateTime* datetime, + IFX_Locale* pLocale); + class CFX_FormatString { public: explicit CFX_FormatString(CXFA_LocaleMgr* pLocaleMgr); diff --git a/xfa/fgas/localization/fgas_locale.h b/xfa/fgas/localization/ifx_locale.h index aecd4d62d4..b9079d0462 100644 --- a/xfa/fgas/localization/fgas_locale.h +++ b/xfa/fgas/localization/ifx_locale.h @@ -4,12 +4,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef XFA_FGAS_LOCALIZATION_FGAS_LOCALE_H_ -#define XFA_FGAS_LOCALIZATION_FGAS_LOCALE_H_ +#ifndef XFA_FGAS_LOCALIZATION_IFX_LOCALE_H_ +#define XFA_FGAS_LOCALIZATION_IFX_LOCALE_H_ -#include <memory> - -#include "core/fxcrt/fx_xml.h" +#include "core/fxcrt/fx_string.h" #include "xfa/fgas/localization/cfx_datetime.h" enum FX_LOCALENUMSYMBOL { @@ -21,6 +19,7 @@ enum FX_LOCALENUMSYMBOL { FX_LOCALENUMSYMBOL_CurrencySymbol, FX_LOCALENUMSYMBOL_CurrencyName, }; + enum FX_LOCALEDATETIMESUBCATEGORY { FX_LOCALEDATETIMESUBCATEGORY_Default, FX_LOCALEDATETIMESUBCATEGORY_Short, @@ -28,12 +27,14 @@ enum FX_LOCALEDATETIMESUBCATEGORY { FX_LOCALEDATETIMESUBCATEGORY_Full, FX_LOCALEDATETIMESUBCATEGORY_Long, }; + enum FX_LOCALENUMSUBCATEGORY { FX_LOCALENUMPATTERN_Percent, FX_LOCALENUMPATTERN_Currency, FX_LOCALENUMPATTERN_Decimal, FX_LOCALENUMPATTERN_Integer, }; + enum FX_LOCALECATEGORY { FX_LOCALECATEGORY_Unknown, FX_LOCALECATEGORY_Date, @@ -44,6 +45,7 @@ enum FX_LOCALECATEGORY { FX_LOCALECATEGORY_Zero, FX_LOCALECATEGORY_Null, }; + enum FX_DATETIMETYPE { FX_DATETIMETYPE_Unknown, FX_DATETIMETYPE_Date, @@ -71,38 +73,4 @@ class IFX_Locale { virtual CFX_WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const = 0; }; -bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_DateTime* datetime); -bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime, - CFX_DateTime* datetime, - IFX_Locale* pLocale); -class CFX_Decimal { - public: - CFX_Decimal(); - explicit CFX_Decimal(uint32_t val); - explicit CFX_Decimal(uint64_t val); - explicit CFX_Decimal(int32_t val); - explicit CFX_Decimal(float val, uint8_t scale); - explicit CFX_Decimal(const CFX_WideStringC& str); - - operator CFX_WideString() const; - operator double() const; - - CFX_Decimal operator*(const CFX_Decimal& val) const; - CFX_Decimal operator/(const CFX_Decimal& val) const; - - void SetScale(uint8_t newScale); - uint8_t GetScale(); - void SetNegate(); - - private: - CFX_Decimal(uint32_t hi, uint32_t mid, uint32_t lo, bool neg, uint8_t scale); - bool IsNotZero() const { return m_uHi || m_uMid || m_uLo; } - void Swap(CFX_Decimal& val); - - uint32_t m_uHi; - uint32_t m_uLo; - uint32_t m_uMid; - uint32_t m_uFlags; -}; - -#endif // XFA_FGAS_LOCALIZATION_FGAS_LOCALE_H_ +#endif // XFA_FGAS_LOCALIZATION_IFX_LOCALE_H_ diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 8879f2bfa7..bbda9ee9f4 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -16,7 +16,7 @@ #include "fxjs/cfxjse_value.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" -#include "xfa/fgas/localization/fgas_locale.h" +#include "xfa/fgas/localization/cfx_decimal.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_program.h" #include "xfa/fxfa/parser/cxfa_document.h" diff --git a/xfa/fxfa/parser/cxfa_localemgr.h b/xfa/fxfa/parser/cxfa_localemgr.h index 6d360112f0..4151317300 100644 --- a/xfa/fxfa/parser/cxfa_localemgr.h +++ b/xfa/fxfa/parser/cxfa_localemgr.h @@ -11,7 +11,7 @@ #include <vector> #include "xfa/fgas/localization/cfx_datetime.h" -#include "xfa/fgas/localization/fgas_locale.h" +#include "xfa/fgas/localization/ifx_locale.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" class CXFA_Node; diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 86249c0718..cd65f6a798 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -18,6 +18,7 @@ #include "third_party/base/stl_util.h" #include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fgas/crt/fgas_codepage.h" +#include "xfa/fgas/localization/cfx_decimal.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/cxfa_eventparam.h" #include "xfa/fxfa/cxfa_ffwidget.h" diff --git a/xfa/fxfa/parser/cxfa_nodelocale.h b/xfa/fxfa/parser/cxfa_nodelocale.h index 6758ad4eb3..dbecdca6a0 100644 --- a/xfa/fxfa/parser/cxfa_nodelocale.h +++ b/xfa/fxfa/parser/cxfa_nodelocale.h @@ -9,7 +9,7 @@ #include <memory> -#include "xfa/fgas/localization/fgas_locale.h" +#include "xfa/fgas/localization/ifx_locale.h" #include "xfa/fxfa/fxfa_basic.h" class CXFA_Node; diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index d98b86c086..d6fb3a9757 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -8,6 +8,7 @@ #include "core/fxcrt/fx_ext.h" #include "third_party/base/stl_util.h" +#include "xfa/fgas/localization/cfx_decimal.h" #include "xfa/fxbarcode/BC_Library.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_document.h" diff --git a/xfa/fxfa/parser/cxfa_xmllocale.h b/xfa/fxfa/parser/cxfa_xmllocale.h index 592b0b5bab..374dab0197 100644 --- a/xfa/fxfa/parser/cxfa_xmllocale.h +++ b/xfa/fxfa/parser/cxfa_xmllocale.h @@ -9,7 +9,9 @@ #include <memory> -#include "xfa/fgas/localization/fgas_locale.h" +#include "xfa/fgas/localization/ifx_locale.h" + +class CXML_Element; class CXFA_XMLLocale : public IFX_Locale { public: |