summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-28 16:04:41 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-28 22:42:05 +0000
commitec1843d2f61a85a7484627b828da317e4dd9c0a4 (patch)
tree78c8a132e1e125c0293a658c6d3e4f9ff32fe8a8 /xfa
parentafc8eb3baef519afde8740fa5ef7acd04ae802a5 (diff)
downloadpdfium-ec1843d2f61a85a7484627b828da317e4dd9c0a4.tar.xz
Renaming and splitting in xfa/fxfa/parser.
This Cl renames several of the files in xfa/fxfa/parser to match the name of the contained classes. Files with multiple clasess are split apart when renamed. Change-Id: Ice8a1279072ee13c2f62a81946be7f42f9ba6007 Reviewed-on: https://pdfium-review.googlesource.com/3250 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fgas/localization/cfx_formatstring.h2
-rw-r--r--xfa/fxfa/app/xfa_fftextedit.cpp2
-rw-r--r--xfa/fxfa/app/xfa_ffwidgetacc.cpp2
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp2
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jscontext.cpp3
-rw-r--r--xfa/fxfa/parser/cscript_datawindow.cpp2
-rw-r--r--xfa/fxfa/parser/cscript_eventpseudomodel.cpp2
-rw-r--r--xfa/fxfa/parser/cscript_hostpseudomodel.cpp2
-rw-r--r--xfa/fxfa/parser/cscript_layoutpseudomodel.cpp2
-rw-r--r--xfa/fxfa/parser/cscript_logpseudomodel.cpp2
-rw-r--r--xfa/fxfa/parser/cscript_signaturepseudomodel.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_document.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_document.h2
-rw-r--r--xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp (renamed from xfa/fxfa/parser/xfa_layout_itemlayout.cpp)5
-rw-r--r--xfa/fxfa/parser/cxfa_itemlayoutprocessor.h (renamed from xfa/fxfa/parser/xfa_layout_itemlayout.h)24
-rw-r--r--xfa/fxfa/parser/cxfa_layoutcontext.h32
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.h6
-rw-r--r--xfa/fxfa/parser/cxfa_layoutprocessor.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_localemgr.cpp (renamed from xfa/fxfa/parser/xfa_localemgr.cpp)31
-rw-r--r--xfa/fxfa/parser/cxfa_localemgr.h (renamed from xfa/fxfa/parser/xfa_localemgr.h)19
-rw-r--r--xfa/fxfa/parser/cxfa_localevalue.cpp (renamed from xfa/fxfa/parser/xfa_localevalue.cpp)4
-rw-r--r--xfa/fxfa/parser/cxfa_localevalue.h (renamed from xfa/fxfa/parser/xfa_localevalue.h)6
-rw-r--r--xfa/fxfa/parser/cxfa_nodehelper.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_nodelocale.cpp193
-rw-r--r--xfa/fxfa/parser/cxfa_nodelocale.h58
-rw-r--r--xfa/fxfa/parser/cxfa_resolveprocessor.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_scriptcontext.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_timezoneprovider.cpp36
-rw-r--r--xfa/fxfa/parser/cxfa_timezoneprovider.h23
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_xmllocale.cpp209
-rw-r--r--xfa/fxfa/parser/cxfa_xmllocale.h (renamed from xfa/fxfa/parser/xfa_locale.h)47
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp2
-rw-r--r--xfa/fxfa/parser/xfa_locale.cpp394
-rw-r--r--xfa/fxfa/parser/xfa_utils.cpp4
36 files changed, 602 insertions, 538 deletions
diff --git a/xfa/fgas/localization/cfx_formatstring.h b/xfa/fgas/localization/cfx_formatstring.h
index b93771d919..39319964aa 100644
--- a/xfa/fgas/localization/cfx_formatstring.h
+++ b/xfa/fgas/localization/cfx_formatstring.h
@@ -10,7 +10,7 @@
#include <vector>
#include "xfa/fgas/localization/fgas_locale.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
class CFX_FormatString {
public:
diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp
index 34c037441e..a8f5a3bcd0 100644
--- a/xfa/fxfa/app/xfa_fftextedit.cpp
+++ b/xfa/fxfa/app/xfa_fftextedit.cpp
@@ -26,7 +26,7 @@
#include "xfa/fxfa/cxfa_ffdocview.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
-#include "xfa/fxfa/parser/xfa_localevalue.h"
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
index 9b531ed4fc..98dee06728 100644
--- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
@@ -27,8 +27,8 @@
#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxfa/cxfa_fontmgr.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localevalue.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index 6e76119115..1db2bcef0f 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -20,8 +20,8 @@
#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxfa/cxfa_fontmgr.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localevalue.h"
#include "xfa/fxfa/parser/xfa_utils.h"
class CXFA_WidgetLayoutData {
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
index 8a42c2619c..218e58b096 100644
--- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
@@ -20,8 +20,9 @@
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/fm2js/xfa_program.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localevalue.h"
+#include "xfa/fxfa/parser/cxfa_timezoneprovider.h"
namespace {
diff --git a/xfa/fxfa/parser/cscript_datawindow.cpp b/xfa/fxfa/parser/cscript_datawindow.cpp
index c0354a112c..e7b4d2c56c 100644
--- a/xfa/fxfa/parser/cscript_datawindow.cpp
+++ b/xfa/fxfa/parser/cscript_datawindow.cpp
@@ -8,7 +8,7 @@
#include "fxjs/cfxjse_arguments.h"
#include "xfa/fxfa/parser/cxfa_document.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_utils.h"
diff --git a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp
index fdfcbbfd42..6ce8114a02 100644
--- a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp
@@ -11,8 +11,8 @@
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/cxfa_ffwidgethandler.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_utils.h"
diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
index 45013ee5d6..2bc6787ae3 100644
--- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
@@ -12,8 +12,8 @@
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
#include "xfa/fxfa/parser/xfa_utils.h"
diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
index 1ebb20d2c1..842617e6e6 100644
--- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
@@ -16,10 +16,10 @@
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_layoutitem.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
#include "xfa/fxfa/parser/cxfa_traversestrategy_contentlayoutitem.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_utils.h"
diff --git a/xfa/fxfa/parser/cscript_logpseudomodel.cpp b/xfa/fxfa/parser/cscript_logpseudomodel.cpp
index 48ccce027f..f9430f5d75 100644
--- a/xfa/fxfa/parser/cscript_logpseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_logpseudomodel.cpp
@@ -8,7 +8,7 @@
#include "fxjs/cfxjse_arguments.h"
#include "xfa/fxfa/parser/cxfa_document.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_utils.h"
diff --git a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp
index e5874a61cc..609b5bd318 100644
--- a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp
@@ -9,8 +9,8 @@
#include "fxjs/cfxjse_arguments.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_utils.h"
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index 8585228b85..0a4e597c93 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -15,8 +15,8 @@
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_document_parser.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
#include "xfa/fxfa/parser/xfa_utils.h"
diff --git a/xfa/fxfa/parser/cxfa_document.h b/xfa/fxfa/parser/cxfa_document.h
index 3446b88382..80cdc1bb0c 100644
--- a/xfa/fxfa/parser/cxfa_document.h
+++ b/xfa/fxfa/parser/cxfa_document.h
@@ -13,7 +13,7 @@
#include <vector>
#include "xfa/fxfa/fxfa.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
enum XFA_VERSION {
diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index 63cd50ac19..50be211bb6 100644
--- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/parser/xfa_layout_itemlayout.h"
+#include "xfa/fxfa/parser/cxfa_itemlayoutprocessor.h"
#include <algorithm>
#include <memory>
@@ -17,10 +17,11 @@
#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_layoutcontext.h"
#include "xfa/fxfa/parser/cxfa_layoutpagemgr.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
#include "xfa/fxfa/parser/cxfa_occur.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_utils.h"
diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.h b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h
index 9b8cd2f31a..d5d706e62e 100644
--- a/xfa/fxfa/parser/xfa_layout_itemlayout.h
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_PARSER_XFA_LAYOUT_ITEMLAYOUT_H_
-#define XFA_FXFA_PARSER_XFA_LAYOUT_ITEMLAYOUT_H_
+#ifndef XFA_FXFA_PARSER_CXFA_ITEMLAYOUTPROCESSOR_H_
+#define XFA_FXFA_PARSER_CXFA_ITEMLAYOUTPROCESSOR_H_
#include <float.h>
@@ -24,6 +24,7 @@
class CXFA_ContainerLayoutItem;
class CXFA_ContentLayoutItem;
class CXFA_ItemLayoutProcessor;
+class CXFA_LayoutContext;
class CXFA_LayoutPageMgr;
class CXFA_LayoutProcessor;
class CXFA_Node;
@@ -46,23 +47,6 @@ enum class XFA_ItemLayoutProcessorStages {
Done,
};
-class CXFA_LayoutContext {
- public:
- CXFA_LayoutContext()
- : m_prgSpecifiedColumnWidths(nullptr),
- m_fCurColumnWidth(0),
- m_bCurColumnWidthAvaiable(false),
- m_pOverflowProcessor(nullptr),
- m_pOverflowNode(nullptr) {}
- ~CXFA_LayoutContext() {}
-
- std::vector<float>* m_prgSpecifiedColumnWidths;
- float m_fCurColumnWidth;
- bool m_bCurColumnWidthAvaiable;
- CXFA_ItemLayoutProcessor* m_pOverflowProcessor;
- CXFA_Node* m_pOverflowNode;
-};
-
bool XFA_ItemLayoutProcessor_IsTakingSpace(CXFA_Node* pNode);
class CXFA_ItemLayoutProcessor {
@@ -185,4 +169,4 @@ class CXFA_ItemLayoutProcessor {
bool m_bHasAvailHeight;
};
-#endif // XFA_FXFA_PARSER_XFA_LAYOUT_ITEMLAYOUT_H_
+#endif // XFA_FXFA_PARSER_CXFA_ITEMLAYOUTPROCESSOR_H_
diff --git a/xfa/fxfa/parser/cxfa_layoutcontext.h b/xfa/fxfa/parser/cxfa_layoutcontext.h
new file mode 100644
index 0000000000..a133ee19d9
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_layoutcontext.h
@@ -0,0 +1,32 @@
+// 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_FXFA_PARSER_CXFA_LAYOUTCONTEXT_H_
+#define XFA_FXFA_PARSER_CXFA_LAYOUTCONTEXT_H_
+
+#include <vector>
+
+class CXFA_ItemLayoutProcess;
+class CXFA_Node;
+
+class CXFA_LayoutContext {
+ public:
+ CXFA_LayoutContext()
+ : m_prgSpecifiedColumnWidths(nullptr),
+ m_fCurColumnWidth(0),
+ m_bCurColumnWidthAvaiable(false),
+ m_pOverflowProcessor(nullptr),
+ m_pOverflowNode(nullptr) {}
+ ~CXFA_LayoutContext() {}
+
+ std::vector<float>* m_prgSpecifiedColumnWidths;
+ float m_fCurColumnWidth;
+ bool m_bCurColumnWidthAvaiable;
+ CXFA_ItemLayoutProcessor* m_pOverflowProcessor;
+ CXFA_Node* m_pOverflowNode;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_LAYOUTCONTEXT_H_
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index a0d67d2053..bee4fe9ae6 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -11,14 +11,14 @@
#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_itemlayoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
#include "xfa/fxfa/parser/cxfa_traversestrategy_contentareacontainerlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_traversestrategy_layoutitem.h"
#include "xfa/fxfa/parser/xfa_document_datamerger_imp.h"
-#include "xfa/fxfa/parser/xfa_layout_itemlayout.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
#include "xfa/fxfa/parser/xfa_utils.h"
@@ -1632,9 +1632,7 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) {
}
}
-CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow(
- CXFA_Node* pFormNode,
- CXFA_LayoutContext* pLayoutContext) {
+CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow(CXFA_Node* pFormNode) {
for (CXFA_Node* pCurNode = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild);
pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) {
if (pCurNode->GetElementType() == XFA_Element::Break) {
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.h b/xfa/fxfa/parser/cxfa_layoutpagemgr.h
index 7428374ae0..085ea89671 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.h
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.h
@@ -12,10 +12,11 @@
#include <map>
#include <vector>
-#include "xfa/fxfa/parser/xfa_layout_itemlayout.h"
+#include "xfa/fxfa/parser/cxfa_itemlayoutprocessor.h"
class CXFA_ContainerRecord;
class CXFA_LayoutItem;
+class CXFA_Node;
class CXFA_LayoutPageMgr {
public:
@@ -46,8 +47,7 @@ class CXFA_LayoutPageMgr {
CXFA_Node*& pTrailerNode,
bool bDataMerge = false,
bool bCreatePage = true);
- CXFA_Node* QueryOverflow(CXFA_Node* pFormNode,
- CXFA_LayoutContext* pLayoutContext = nullptr);
+ CXFA_Node* QueryOverflow(CXFA_Node* pFormNode);
bool ProcessBookendLeaderOrTrailer(CXFA_Node* pBookendNode,
bool bLeader,
CXFA_Node*& pBookendAppendNode);
diff --git a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp
index c97a1cea58..10ae66739b 100644
--- a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp
@@ -10,11 +10,11 @@
#include "third_party/base/stl_util.h"
#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_itemlayoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_layoutpagemgr.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
#include "xfa/fxfa/parser/xfa_document_datamerger_imp.h"
-#include "xfa/fxfa/parser/xfa_layout_itemlayout.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_utils.h"
diff --git a/xfa/fxfa/parser/xfa_localemgr.cpp b/xfa/fxfa/parser/cxfa_localemgr.cpp
index 0cd64ea6dc..b9f2615f41 100644
--- a/xfa/fxfa/parser/xfa_localemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_localemgr.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/parser/xfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include <time.h>
@@ -15,7 +15,8 @@
#include "core/fxcrt/fx_xml.h"
#include "core/fxge/cfx_gemodule.h"
#include "xfa/fxfa/parser/cxfa_document.h"
-#include "xfa/fxfa/parser/xfa_locale.h"
+#include "xfa/fxfa/parser/cxfa_nodelocale.h"
+#include "xfa/fxfa/parser/cxfa_xmllocale.h"
#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_utils.h"
@@ -1246,29 +1247,3 @@ CFX_WideStringC CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) {
}
return m_wsConfigLocale.AsStringC();
}
-
-static bool g_bProviderTimeZoneSet = false;
-
-CXFA_TimeZoneProvider::CXFA_TimeZoneProvider() {
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
- if (!g_bProviderTimeZoneSet) {
- g_bProviderTimeZoneSet = true;
- _tzset();
- }
- m_tz.tzHour = (int8_t)(_timezone / 3600 * -1);
- m_tz.tzMinute = (int8_t)((FXSYS_abs(_timezone) % 3600) / 60);
-#else
- if (!g_bProviderTimeZoneSet) {
- g_bProviderTimeZoneSet = true;
- tzset();
- }
- m_tz.tzHour = (int8_t)(timezone / 3600 * -1);
- m_tz.tzMinute = (int8_t)((FXSYS_abs((int)timezone) % 3600) / 60);
-#endif
-}
-
-CXFA_TimeZoneProvider::~CXFA_TimeZoneProvider() {}
-
-void CXFA_TimeZoneProvider::GetTimeZone(FX_TIMEZONE* tz) const {
- *tz = m_tz;
-}
diff --git a/xfa/fxfa/parser/xfa_localemgr.h b/xfa/fxfa/parser/cxfa_localemgr.h
index 3336d713e0..b3b9635765 100644
--- a/xfa/fxfa/parser/xfa_localemgr.h
+++ b/xfa/fxfa/parser/cxfa_localemgr.h
@@ -4,15 +4,15 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_PARSER_XFA_LOCALEMGR_H_
-#define XFA_FXFA_PARSER_XFA_LOCALEMGR_H_
+#ifndef XFA_FXFA_PARSER_CXFA_LOCALEMGR_H_
+#define XFA_FXFA_PARSER_CXFA_LOCALEMGR_H_
#include <memory>
#include <vector>
#include "xfa/fgas/localization/fgas_datetime.h"
#include "xfa/fgas/localization/fgas_locale.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
class CXFA_Node;
class IFX_Locale;
@@ -56,15 +56,4 @@ class CXFA_LocaleMgr {
uint16_t m_dwLocaleFlags;
};
-class CXFA_TimeZoneProvider {
- public:
- CXFA_TimeZoneProvider();
- ~CXFA_TimeZoneProvider();
-
- void GetTimeZone(FX_TIMEZONE* tz) const;
-
- private:
- FX_TIMEZONE m_tz;
-};
-
-#endif // XFA_FXFA_PARSER_XFA_LOCALEMGR_H_
+#endif // XFA_FXFA_PARSER_CXFA_LOCALEMGR_H_
diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/cxfa_localevalue.cpp
index 770b87ee14..189d7d9605 100644
--- a/xfa/fxfa/parser/xfa_localevalue.cpp
+++ b/xfa/fxfa/parser/cxfa_localevalue.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/parser/xfa_localevalue.h"
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
#include <vector>
@@ -13,7 +13,7 @@
#include "third_party/base/stl_util.h"
#include "xfa/fgas/localization/cfx_formatstring.h"
#include "xfa/fxfa/parser/cxfa_document.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_utils.h"
diff --git a/xfa/fxfa/parser/xfa_localevalue.h b/xfa/fxfa/parser/cxfa_localevalue.h
index dfe758d4a9..75687b4281 100644
--- a/xfa/fxfa/parser/xfa_localevalue.h
+++ b/xfa/fxfa/parser/cxfa_localevalue.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_PARSER_XFA_LOCALEVALUE_H_
-#define XFA_FXFA_PARSER_XFA_LOCALEVALUE_H_
+#ifndef XFA_FXFA_PARSER_CXFA_LOCALEVALUE_H_
+#define XFA_FXFA_PARSER_CXFA_LOCALEVALUE_H_
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
@@ -109,4 +109,4 @@ class CXFA_LocaleValue {
bool m_bValid;
};
-#endif // XFA_FXFA_PARSER_XFA_LOCALEVALUE_H_
+#endif // XFA_FXFA_PARSER_CXFA_LOCALEVALUE_H_
diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp
index 692f0b2338..6a9904af04 100644
--- a/xfa/fxfa/parser/cxfa_nodehelper.cpp
+++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp
@@ -8,8 +8,8 @@
#include "core/fxcrt/fx_ext.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
#include "xfa/fxfa/parser/xfa_utils.h"
diff --git a/xfa/fxfa/parser/cxfa_nodelocale.cpp b/xfa/fxfa/parser/cxfa_nodelocale.cpp
new file mode 100644
index 0000000000..49d55c884c
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_nodelocale.cpp
@@ -0,0 +1,193 @@
+// Copyright 2014 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
+
+#include "xfa/fxfa/parser/cxfa_nodelocale.h"
+
+#include <utility>
+
+#include "core/fxcrt/fx_xml.h"
+#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_timezoneprovider.h"
+#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/xfa_utils.h"
+
+namespace {
+
+const wchar_t g_FX_Percent[] = L"z,zzz,zzz,zzz,zzz,zzz%";
+const wchar_t g_FX_Currency[] = L"$z,zzz,zzz,zzz,zzz,zz9.99";
+const wchar_t g_FX_Decimal[] = L"z,zzz,zzz,zzz,zzz,zz9.zzz";
+const wchar_t g_FX_Integer[] = L"z,zzz,zzz,zzz,zzz,zzz";
+
+} // namespace
+
+CFX_WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category) {
+ switch (category) {
+ case FX_LOCALENUMPATTERN_Percent:
+ return g_FX_Percent;
+ case FX_LOCALENUMPATTERN_Currency:
+ return g_FX_Currency;
+ case FX_LOCALENUMPATTERN_Decimal:
+ return g_FX_Decimal;
+ case FX_LOCALENUMPATTERN_Integer:
+ return g_FX_Integer;
+ }
+ return L"";
+}
+
+CXFA_NodeLocale::CXFA_NodeLocale(CXFA_Node* pLocale) : m_pLocale(pLocale) {}
+
+CXFA_NodeLocale::~CXFA_NodeLocale() {}
+
+CFX_WideString CXFA_NodeLocale::GetName() const {
+ return CFX_WideString(m_pLocale ? m_pLocale->GetCData(XFA_ATTRIBUTE_Name)
+ : nullptr);
+}
+
+void CXFA_NodeLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType,
+ CFX_WideString& wsNumSymbol) const {
+ switch (eType) {
+ case FX_LOCALENUMSYMBOL_Decimal:
+ wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"decimal");
+ break;
+ case FX_LOCALENUMSYMBOL_Grouping:
+ wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"grouping");
+ break;
+ case FX_LOCALENUMSYMBOL_Percent:
+ wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"percent");
+ break;
+ case FX_LOCALENUMSYMBOL_Minus:
+ wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"minus");
+ break;
+ case FX_LOCALENUMSYMBOL_Zero:
+ wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"zero");
+ break;
+ case FX_LOCALENUMSYMBOL_CurrencySymbol:
+ wsNumSymbol = GetSymbol(XFA_Element::CurrencySymbols, L"symbol");
+ break;
+ case FX_LOCALENUMSYMBOL_CurrencyName:
+ wsNumSymbol = GetSymbol(XFA_Element::CurrencySymbols, L"isoname");
+ break;
+ }
+}
+
+void CXFA_NodeLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const {
+ CXFA_Node* pSymbols =
+ m_pLocale ? m_pLocale->GetChild(0, XFA_Element::DateTimeSymbols)
+ : nullptr;
+ wsDtSymbol = pSymbols ? pSymbols->GetContent() : CFX_WideString();
+}
+
+void CXFA_NodeLocale::GetMonthName(int32_t nMonth,
+ CFX_WideString& wsMonthName,
+ bool bAbbr) const {
+ wsMonthName = GetCalendarSymbol(XFA_Element::MonthNames, nMonth, bAbbr);
+}
+
+void CXFA_NodeLocale::GetDayName(int32_t nWeek,
+ CFX_WideString& wsDayName,
+ bool bAbbr) const {
+ wsDayName = GetCalendarSymbol(XFA_Element::DayNames, nWeek, bAbbr);
+}
+
+void CXFA_NodeLocale::GetMeridiemName(CFX_WideString& wsMeridiemName,
+ bool bAM) const {
+ wsMeridiemName =
+ GetCalendarSymbol(XFA_Element::MeridiemNames, bAM ? 0 : 1, false);
+}
+
+void CXFA_NodeLocale::GetTimeZone(FX_TIMEZONE* tz) const {
+ CXFA_TimeZoneProvider provider;
+ provider.GetTimeZone(tz);
+}
+
+void CXFA_NodeLocale::GetEraName(CFX_WideString& wsEraName, bool bAD) const {
+ wsEraName = GetCalendarSymbol(XFA_Element::EraNames, bAD ? 1 : 0, false);
+}
+
+void CXFA_NodeLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
+ CFX_WideString& wsPattern) const {
+ switch (eType) {
+ case FX_LOCALEDATETIMESUBCATEGORY_Short:
+ wsPattern = GetSymbol(XFA_Element::DatePatterns, L"short");
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Medium:
+ case FX_LOCALEDATETIMESUBCATEGORY_Default:
+ wsPattern = GetSymbol(XFA_Element::DatePatterns, L"med");
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Full:
+ wsPattern = GetSymbol(XFA_Element::DatePatterns, L"full");
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Long:
+ wsPattern = GetSymbol(XFA_Element::DatePatterns, L"long");
+ break;
+ }
+}
+
+void CXFA_NodeLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
+ CFX_WideString& wsPattern) const {
+ switch (eType) {
+ case FX_LOCALEDATETIMESUBCATEGORY_Short:
+ wsPattern = GetSymbol(XFA_Element::TimePatterns, L"short");
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Medium:
+ case FX_LOCALEDATETIMESUBCATEGORY_Default:
+ wsPattern = GetSymbol(XFA_Element::TimePatterns, L"med");
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Full:
+ wsPattern = GetSymbol(XFA_Element::TimePatterns, L"full");
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Long:
+ wsPattern = GetSymbol(XFA_Element::TimePatterns, L"long");
+ break;
+ }
+}
+
+void CXFA_NodeLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType,
+ CFX_WideString& wsPattern) const {
+ wsPattern = XFA_PatternToString(eType);
+}
+
+CXFA_Node* CXFA_NodeLocale::GetNodeByName(CXFA_Node* pParent,
+ const CFX_WideStringC& wsName) const {
+ CXFA_Node* pChild =
+ pParent ? pParent->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr;
+ while (pChild) {
+ CFX_WideString wsChild;
+ if (pChild->GetAttribute(XFA_ATTRIBUTE_Name, wsChild)) {
+ if (wsChild == wsName)
+ return pChild;
+ }
+ pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
+ }
+ return nullptr;
+}
+
+CFX_WideString CXFA_NodeLocale::GetSymbol(
+ XFA_Element eElement,
+ const CFX_WideStringC& symbol_type) const {
+ CXFA_Node* pSymbols = m_pLocale ? m_pLocale->GetChild(0, eElement) : nullptr;
+ CXFA_Node* pSymbol = GetNodeByName(pSymbols, symbol_type);
+ return pSymbol ? pSymbol->GetContent() : CFX_WideString();
+}
+
+CFX_WideString CXFA_NodeLocale::GetCalendarSymbol(XFA_Element eElement,
+ int index,
+ bool bAbbr) const {
+ CXFA_Node* pCalendar =
+ m_pLocale ? m_pLocale->GetChild(0, XFA_Element::CalendarSymbols)
+ : nullptr;
+ if (pCalendar) {
+ CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement);
+ for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) {
+ if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) {
+ CXFA_Node* pSymbol = pNode->GetChild(index, XFA_Element::Unknown);
+ return pSymbol ? pSymbol->GetContent() : CFX_WideString();
+ }
+ }
+ }
+ return CFX_WideString();
+}
diff --git a/xfa/fxfa/parser/cxfa_nodelocale.h b/xfa/fxfa/parser/cxfa_nodelocale.h
new file mode 100644
index 0000000000..db3b2303e7
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_nodelocale.h
@@ -0,0 +1,58 @@
+// Copyright 2014 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_FXFA_PARSER_CXFA_NODELOCALE_H_
+#define XFA_FXFA_PARSER_CXFA_NODELOCALE_H_
+
+#include <memory>
+
+#include "xfa/fgas/localization/fgas_locale.h"
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CFX_WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category);
+
+class CXFA_NodeLocale : public IFX_Locale {
+ public:
+ explicit CXFA_NodeLocale(CXFA_Node* pLocale);
+ ~CXFA_NodeLocale() override;
+
+ // IFX_Locale
+ CFX_WideString GetName() const override;
+ void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType,
+ CFX_WideString& wsNumSymbol) const override;
+
+ void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const override;
+ void GetMonthName(int32_t nMonth,
+ CFX_WideString& wsMonthName,
+ bool bAbbr = true) const override;
+ void GetDayName(int32_t nWeek,
+ CFX_WideString& wsDayName,
+ bool bAbbr = true) const override;
+ void GetMeridiemName(CFX_WideString& wsMeridiemName,
+ bool bAM = true) const override;
+ void GetTimeZone(FX_TIMEZONE* tz) const override;
+ void GetEraName(CFX_WideString& wsEraName, bool bAD = true) const override;
+
+ void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
+ CFX_WideString& wsPattern) const override;
+ void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
+ CFX_WideString& wsPattern) const override;
+ void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType,
+ CFX_WideString& wsPattern) const override;
+
+ private:
+ CXFA_Node* GetNodeByName(CXFA_Node* pParent,
+ const CFX_WideStringC& wsName) const;
+ CFX_WideString GetSymbol(XFA_Element eElement,
+ const CFX_WideStringC& symbol_type) const;
+ CFX_WideString GetCalendarSymbol(XFA_Element eElement,
+ int index,
+ bool bAbbr) const;
+
+ CXFA_Node* const m_pLocale;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_NODELOCALE_H_
diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp
index 184cebb120..391e63aac5 100644
--- a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp
@@ -14,9 +14,9 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_nodehelper.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
#include "xfa/fxfa/parser/xfa_utils.h"
diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
index 03fd128332..d62027ef03 100644
--- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp
+++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
@@ -17,10 +17,10 @@
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_nodehelper.h"
#include "xfa/fxfa/parser/cxfa_resolveprocessor.h"
#include "xfa/fxfa/parser/xfa_basic_data.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
#include "xfa/fxfa/parser/xfa_utils.h"
diff --git a/xfa/fxfa/parser/cxfa_timezoneprovider.cpp b/xfa/fxfa/parser/cxfa_timezoneprovider.cpp
new file mode 100644
index 0000000000..65ce61e10b
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_timezoneprovider.cpp
@@ -0,0 +1,36 @@
+// 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
+
+#include "xfa/fxfa/parser/cxfa_timezoneprovider.h"
+
+#include <time.h>
+
+static bool g_bProviderTimeZoneSet = false;
+
+CXFA_TimeZoneProvider::CXFA_TimeZoneProvider() {
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+ if (!g_bProviderTimeZoneSet) {
+ g_bProviderTimeZoneSet = true;
+ _tzset();
+ }
+ m_tz.tzHour = static_cast<int8_t>(_timezone / 3600 * -1);
+ m_tz.tzMinute = static_cast<int8_t>((FXSYS_abs(_timezone) % 3600) / 60);
+#else
+ if (!g_bProviderTimeZoneSet) {
+ g_bProviderTimeZoneSet = true;
+ tzset();
+ }
+ m_tz.tzHour = static_cast<int8_t>(timezone / 3600 * -1);
+ m_tz.tzMinute =
+ static_cast<int8_t>((FXSYS_abs(static_cast<int>(timezone)) % 3600) / 60);
+#endif
+}
+
+CXFA_TimeZoneProvider::~CXFA_TimeZoneProvider() {}
+
+void CXFA_TimeZoneProvider::GetTimeZone(FX_TIMEZONE* tz) const {
+ *tz = m_tz;
+}
diff --git a/xfa/fxfa/parser/cxfa_timezoneprovider.h b/xfa/fxfa/parser/cxfa_timezoneprovider.h
new file mode 100644
index 0000000000..05230cc122
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_timezoneprovider.h
@@ -0,0 +1,23 @@
+// 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_FXFA_PARSER_CXFA_TIMEZONEPROVIDER_H_
+#define XFA_FXFA_PARSER_CXFA_TIMEZONEPROVIDER_H_
+
+#include "xfa/fgas/localization/fgas_datetime.h"
+
+class CXFA_TimeZoneProvider {
+ public:
+ CXFA_TimeZoneProvider();
+ ~CXFA_TimeZoneProvider();
+
+ void GetTimeZone(FX_TIMEZONE* tz) const;
+
+ private:
+ FX_TIMEZONE m_tz;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_TIMEZONEPROVIDER_H_
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index a314bec2b8..e6cd75fe62 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -12,8 +12,8 @@
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_event.h"
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fxfa/parser/xfa_localevalue.h"
#include "xfa/fxfa/parser/xfa_object.h"
namespace {
diff --git a/xfa/fxfa/parser/cxfa_xmllocale.cpp b/xfa/fxfa/parser/cxfa_xmllocale.cpp
new file mode 100644
index 0000000000..c4aae15020
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_xmllocale.cpp
@@ -0,0 +1,209 @@
+// 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
+
+#include "xfa/fxfa/parser/cxfa_xmllocale.h"
+
+#include <utility>
+
+#include "core/fxcrt/fx_xml.h"
+#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_nodelocale.h"
+#include "xfa/fxfa/parser/cxfa_timezoneprovider.h"
+#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/xfa_utils.h"
+
+CXFA_XMLLocale::CXFA_XMLLocale(std::unique_ptr<CXML_Element> pLocaleData)
+ : m_pLocaleData(std::move(pLocaleData)) {}
+
+CXFA_XMLLocale::~CXFA_XMLLocale() {}
+
+CFX_WideString CXFA_XMLLocale::GetName() const {
+ return m_pLocaleData ? m_pLocaleData->GetAttrValue("name") : CFX_WideString();
+}
+
+void CXFA_XMLLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType,
+ CFX_WideString& wsNumSymbol) const {
+ CFX_ByteString bsSymbols;
+ CFX_WideString wsName;
+ switch (eType) {
+ case FX_LOCALENUMSYMBOL_Decimal:
+ bsSymbols = "numberSymbols";
+ wsName = L"decimal";
+ break;
+ case FX_LOCALENUMSYMBOL_Grouping:
+ bsSymbols = "numberSymbols";
+ wsName = L"grouping";
+ break;
+ case FX_LOCALENUMSYMBOL_Percent:
+ bsSymbols = "numberSymbols";
+ wsName = L"percent";
+ break;
+ case FX_LOCALENUMSYMBOL_Minus:
+ bsSymbols = "numberSymbols";
+ wsName = L"minus";
+ break;
+ case FX_LOCALENUMSYMBOL_Zero:
+ bsSymbols = "numberSymbols";
+ wsName = L"zero";
+ break;
+ case FX_LOCALENUMSYMBOL_CurrencySymbol:
+ bsSymbols = "currencySymbols";
+ wsName = L"symbol";
+ break;
+ case FX_LOCALENUMSYMBOL_CurrencyName:
+ bsSymbols = "currencySymbols";
+ wsName = L"isoname";
+ break;
+ default:
+ return;
+ }
+ CXML_Element* pElement = m_pLocaleData->GetElement("", bsSymbols.AsStringC());
+ if (!pElement)
+ return;
+
+ GetPattern(pElement,
+ CFX_ByteStringC(bsSymbols.c_str(), bsSymbols.GetLength() - 1),
+ wsName.AsStringC(), wsNumSymbol);
+}
+
+void CXFA_XMLLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const {
+ if (!m_pLocaleData)
+ return;
+
+ CFX_ByteString bsSpace;
+ CXML_Element* pNumberSymbols =
+ m_pLocaleData->GetElement(bsSpace.AsStringC(), "dateTimeSymbols");
+ if (!pNumberSymbols)
+ return;
+
+ wsDtSymbol = pNumberSymbols->GetContent(0);
+}
+
+void CXFA_XMLLocale::GetMonthName(int32_t nMonth,
+ CFX_WideString& wsMonthName,
+ bool bAbbr) const {
+ wsMonthName = GetCalendarSymbol("month", nMonth, bAbbr);
+}
+
+void CXFA_XMLLocale::GetDayName(int32_t nWeek,
+ CFX_WideString& wsDayName,
+ bool bAbbr) const {
+ wsDayName = GetCalendarSymbol("day", nWeek, bAbbr);
+}
+
+void CXFA_XMLLocale::GetMeridiemName(CFX_WideString& wsMeridiemName,
+ bool bAM) const {
+ wsMeridiemName = GetCalendarSymbol("meridiem", bAM ? 0 : 1, false);
+}
+
+void CXFA_XMLLocale::GetTimeZone(FX_TIMEZONE* tz) const {
+ CXFA_TimeZoneProvider provider;
+ provider.GetTimeZone(tz);
+}
+
+void CXFA_XMLLocale::GetEraName(CFX_WideString& wsEraName, bool bAD) const {
+ wsEraName = GetCalendarSymbol("era", bAD ? 1 : 0, false);
+}
+
+CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol,
+ int index,
+ bool bAbbr) const {
+ CFX_ByteString pstrSymbolNames = symbol + "Names";
+ CFX_WideString wsSymbolName = L"";
+ if (m_pLocaleData) {
+ CXML_Element* pChild = m_pLocaleData->GetElement("", "calendarSymbols");
+ if (pChild) {
+ CXML_Element* pSymbolNames =
+ pChild->GetElement("", pstrSymbolNames.AsStringC());
+ if (pSymbolNames) {
+ if ((!!pSymbolNames->GetAttrInteger("abbr")) != bAbbr) {
+ pSymbolNames = pChild->GetElement("", pstrSymbolNames.AsStringC(), 1);
+ }
+ if (pSymbolNames && (!!pSymbolNames->GetAttrInteger("abbr")) == bAbbr) {
+ CXML_Element* pSymbolName =
+ pSymbolNames->GetElement("", symbol, index);
+ if (pSymbolName)
+ wsSymbolName = pSymbolName->GetContent(0);
+ }
+ }
+ }
+ }
+ return wsSymbolName;
+}
+
+void CXFA_XMLLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
+ CFX_WideString& wsPattern) const {
+ CXML_Element* pElement = m_pLocaleData->GetElement("", "datePatterns");
+ if (!pElement)
+ return;
+
+ CFX_WideString wsName;
+ switch (eType) {
+ case FX_LOCALEDATETIMESUBCATEGORY_Short:
+ wsName = L"short";
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Default:
+ case FX_LOCALEDATETIMESUBCATEGORY_Medium:
+ wsName = L"med";
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Full:
+ wsName = L"full";
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Long:
+ wsName = L"long";
+ break;
+ }
+ GetPattern(pElement, "datePattern", wsName.AsStringC(), wsPattern);
+}
+
+void CXFA_XMLLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
+ CFX_WideString& wsPattern) const {
+ CXML_Element* pElement = m_pLocaleData->GetElement("", "timePatterns");
+ if (!pElement)
+ return;
+
+ CFX_WideString wsName;
+ switch (eType) {
+ case FX_LOCALEDATETIMESUBCATEGORY_Short:
+ wsName = L"short";
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Default:
+ case FX_LOCALEDATETIMESUBCATEGORY_Medium:
+ wsName = L"med";
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Full:
+ wsName = L"full";
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Long:
+ wsName = L"long";
+ break;
+ }
+ GetPattern(pElement, "timePattern", wsName.AsStringC(), wsPattern);
+}
+
+void CXFA_XMLLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType,
+ CFX_WideString& wsPattern) const {
+ CXML_Element* pElement = m_pLocaleData->GetElement("", "numberPatterns");
+ if (!pElement)
+ return;
+
+ wsPattern = XFA_PatternToString(eType);
+}
+
+void CXFA_XMLLocale::GetPattern(CXML_Element* pElement,
+ const CFX_ByteStringC& bsTag,
+ const CFX_WideStringC& wsName,
+ CFX_WideString& wsPattern) const {
+ int32_t iCount = pElement->CountElements("", bsTag);
+ for (int32_t i = 0; i < iCount; i++) {
+ CXML_Element* pChild = pElement->GetElement("", bsTag, i);
+ if (pChild->GetAttrValue("name") == wsName) {
+ wsPattern = pChild->GetContent(0);
+ return;
+ }
+ }
+}
diff --git a/xfa/fxfa/parser/xfa_locale.h b/xfa/fxfa/parser/cxfa_xmllocale.h
index ae3e4bd170..b631697b40 100644
--- a/xfa/fxfa/parser/xfa_locale.h
+++ b/xfa/fxfa/parser/cxfa_xmllocale.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_PARSER_XFA_LOCALE_H_
-#define XFA_FXFA_PARSER_XFA_LOCALE_H_
+#ifndef XFA_FXFA_PARSER_CXFA_XMLLOCALE_H_
+#define XFA_FXFA_PARSER_CXFA_XMLLOCALE_H_
#include <memory>
@@ -53,45 +53,4 @@ class CXFA_XMLLocale : public IFX_Locale {
std::unique_ptr<CXML_Element> m_pLocaleData;
};
-class CXFA_NodeLocale : public IFX_Locale {
- public:
- explicit CXFA_NodeLocale(CXFA_Node* pLocale);
- ~CXFA_NodeLocale() override;
-
- // IFX_Locale
- CFX_WideString GetName() const override;
- void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType,
- CFX_WideString& wsNumSymbol) const override;
-
- void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const override;
- void GetMonthName(int32_t nMonth,
- CFX_WideString& wsMonthName,
- bool bAbbr = true) const override;
- void GetDayName(int32_t nWeek,
- CFX_WideString& wsDayName,
- bool bAbbr = true) const override;
- void GetMeridiemName(CFX_WideString& wsMeridiemName,
- bool bAM = true) const override;
- void GetTimeZone(FX_TIMEZONE* tz) const override;
- void GetEraName(CFX_WideString& wsEraName, bool bAD = true) const override;
-
- void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const override;
- void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const override;
- void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType,
- CFX_WideString& wsPattern) const override;
-
- private:
- CXFA_Node* GetNodeByName(CXFA_Node* pParent,
- const CFX_WideStringC& wsName) const;
- CFX_WideString GetSymbol(XFA_Element eElement,
- const CFX_WideStringC& symbol_type) const;
- CFX_WideString GetCalendarSymbol(XFA_Element eElement,
- int index,
- bool bAbbr) const;
-
- CXFA_Node* const m_pLocale;
-};
-
-#endif // XFA_FXFA_PARSER_XFA_LOCALE_H_
+#endif // XFA_FXFA_PARSER_CXFA_XMLLOCALE_H_
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index b5b2f3c406..7ee11beb01 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -14,9 +14,9 @@
#include "xfa/fde/xml/fde_xml_imp.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_occur.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
#include "xfa/fxfa/parser/xfa_utils.h"
diff --git a/xfa/fxfa/parser/xfa_locale.cpp b/xfa/fxfa/parser/xfa_locale.cpp
deleted file mode 100644
index a9ddbcec3c..0000000000
--- a/xfa/fxfa/parser/xfa_locale.cpp
+++ /dev/null
@@ -1,394 +0,0 @@
-// Copyright 2014 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
-
-#include "xfa/fxfa/parser/xfa_locale.h"
-
-#include <utility>
-
-#include "core/fxcrt/fx_xml.h"
-#include "xfa/fxfa/parser/cxfa_document.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_utils.h"
-
-static const wchar_t g_FX_Percent[] = L"z,zzz,zzz,zzz,zzz,zzz%";
-static const wchar_t g_FX_Currency[] = L"$z,zzz,zzz,zzz,zzz,zz9.99";
-static const wchar_t g_FX_Decimal[] = L"z,zzz,zzz,zzz,zzz,zz9.zzz";
-static const wchar_t g_FX_Integer[] = L"z,zzz,zzz,zzz,zzz,zzz";
-
-CXFA_XMLLocale::CXFA_XMLLocale(std::unique_ptr<CXML_Element> pLocaleData)
- : m_pLocaleData(std::move(pLocaleData)) {}
-
-CXFA_XMLLocale::~CXFA_XMLLocale() {}
-
-CFX_WideString CXFA_XMLLocale::GetName() const {
- return m_pLocaleData ? m_pLocaleData->GetAttrValue("name") : CFX_WideString();
-}
-
-void CXFA_XMLLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType,
- CFX_WideString& wsNumSymbol) const {
- CFX_ByteString bsSymbols;
- CFX_WideString wsName;
- switch (eType) {
- case FX_LOCALENUMSYMBOL_Decimal:
- bsSymbols = "numberSymbols";
- wsName = L"decimal";
- break;
- case FX_LOCALENUMSYMBOL_Grouping:
- bsSymbols = "numberSymbols";
- wsName = L"grouping";
- break;
- case FX_LOCALENUMSYMBOL_Percent:
- bsSymbols = "numberSymbols";
- wsName = L"percent";
- break;
- case FX_LOCALENUMSYMBOL_Minus:
- bsSymbols = "numberSymbols";
- wsName = L"minus";
- break;
- case FX_LOCALENUMSYMBOL_Zero:
- bsSymbols = "numberSymbols";
- wsName = L"zero";
- break;
- case FX_LOCALENUMSYMBOL_CurrencySymbol:
- bsSymbols = "currencySymbols";
- wsName = L"symbol";
- break;
- case FX_LOCALENUMSYMBOL_CurrencyName:
- bsSymbols = "currencySymbols";
- wsName = L"isoname";
- break;
- default:
- return;
- }
- CXML_Element* pElement = m_pLocaleData->GetElement("", bsSymbols.AsStringC());
- if (!pElement) {
- return;
- }
- GetPattern(pElement,
- CFX_ByteStringC(bsSymbols.c_str(), bsSymbols.GetLength() - 1),
- wsName.AsStringC(), wsNumSymbol);
-}
-
-void CXFA_XMLLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const {
- if (!m_pLocaleData) {
- return;
- }
- CFX_ByteString bsSpace;
- CXML_Element* pNumberSymbols =
- m_pLocaleData->GetElement(bsSpace.AsStringC(), "dateTimeSymbols");
- if (!pNumberSymbols) {
- return;
- }
- wsDtSymbol = pNumberSymbols->GetContent(0);
-}
-
-void CXFA_XMLLocale::GetMonthName(int32_t nMonth,
- CFX_WideString& wsMonthName,
- bool bAbbr) const {
- wsMonthName = GetCalendarSymbol("month", nMonth, bAbbr);
-}
-
-void CXFA_XMLLocale::GetDayName(int32_t nWeek,
- CFX_WideString& wsDayName,
- bool bAbbr) const {
- wsDayName = GetCalendarSymbol("day", nWeek, bAbbr);
-}
-
-void CXFA_XMLLocale::GetMeridiemName(CFX_WideString& wsMeridiemName,
- bool bAM) const {
- wsMeridiemName = GetCalendarSymbol("meridiem", bAM ? 0 : 1, false);
-}
-
-void CXFA_XMLLocale::GetTimeZone(FX_TIMEZONE* tz) const {
- CXFA_TimeZoneProvider provider;
- provider.GetTimeZone(tz);
-}
-
-void CXFA_XMLLocale::GetEraName(CFX_WideString& wsEraName, bool bAD) const {
- wsEraName = GetCalendarSymbol("era", bAD ? 1 : 0, false);
-}
-
-CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol,
- int index,
- bool bAbbr) const {
- CFX_ByteString pstrSymbolNames = symbol + "Names";
- CFX_WideString wsSymbolName = L"";
- if (m_pLocaleData) {
- CXML_Element* pChild = m_pLocaleData->GetElement("", "calendarSymbols");
- if (pChild) {
- CXML_Element* pSymbolNames =
- pChild->GetElement("", pstrSymbolNames.AsStringC());
- if (pSymbolNames) {
- if ((!!pSymbolNames->GetAttrInteger("abbr")) != bAbbr) {
- pSymbolNames = pChild->GetElement("", pstrSymbolNames.AsStringC(), 1);
- }
- if (pSymbolNames && (!!pSymbolNames->GetAttrInteger("abbr")) == bAbbr) {
- CXML_Element* pSymbolName =
- pSymbolNames->GetElement("", symbol, index);
- if (pSymbolName) {
- wsSymbolName = pSymbolName->GetContent(0);
- }
- }
- }
- }
- }
- return wsSymbolName;
-}
-
-void CXFA_XMLLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const {
- CXML_Element* pElement = m_pLocaleData->GetElement("", "datePatterns");
- if (!pElement) {
- return;
- }
- CFX_WideString wsName;
- switch (eType) {
- case FX_LOCALEDATETIMESUBCATEGORY_Short:
- wsName = L"short";
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Default:
- case FX_LOCALEDATETIMESUBCATEGORY_Medium:
- wsName = L"med";
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Full:
- wsName = L"full";
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Long:
- wsName = L"long";
- break;
- }
- GetPattern(pElement, "datePattern", wsName.AsStringC(), wsPattern);
-}
-
-void CXFA_XMLLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const {
- CXML_Element* pElement = m_pLocaleData->GetElement("", "timePatterns");
- if (!pElement) {
- return;
- }
- CFX_WideString wsName;
- switch (eType) {
- case FX_LOCALEDATETIMESUBCATEGORY_Short:
- wsName = L"short";
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Default:
- case FX_LOCALEDATETIMESUBCATEGORY_Medium:
- wsName = L"med";
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Full:
- wsName = L"full";
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Long:
- wsName = L"long";
- break;
- }
- GetPattern(pElement, "timePattern", wsName.AsStringC(), wsPattern);
-}
-
-void CXFA_XMLLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType,
- CFX_WideString& wsPattern) const {
- CXML_Element* pElement = m_pLocaleData->GetElement("", "numberPatterns");
- if (!pElement) {
- return;
- }
- switch (eType) {
- case FX_LOCALENUMPATTERN_Percent:
- wsPattern = g_FX_Percent;
- break;
- case FX_LOCALENUMPATTERN_Currency:
- wsPattern = g_FX_Currency;
- break;
- case FX_LOCALENUMPATTERN_Decimal:
- wsPattern = g_FX_Decimal;
- break;
- case FX_LOCALENUMPATTERN_Integer:
- wsPattern = g_FX_Integer;
- break;
- }
-}
-
-void CXFA_XMLLocale::GetPattern(CXML_Element* pElement,
- const CFX_ByteStringC& bsTag,
- const CFX_WideStringC& wsName,
- CFX_WideString& wsPattern) const {
- int32_t iCount = pElement->CountElements("", bsTag);
- for (int32_t i = 0; i < iCount; i++) {
- CXML_Element* pChild = pElement->GetElement("", bsTag, i);
- if (pChild->GetAttrValue("name") == wsName) {
- wsPattern = pChild->GetContent(0);
- return;
- }
- }
-}
-
-CXFA_NodeLocale::CXFA_NodeLocale(CXFA_Node* pLocale) : m_pLocale(pLocale) {}
-
-CXFA_NodeLocale::~CXFA_NodeLocale() {}
-
-CFX_WideString CXFA_NodeLocale::GetName() const {
- return CFX_WideString(m_pLocale ? m_pLocale->GetCData(XFA_ATTRIBUTE_Name)
- : nullptr);
-}
-
-void CXFA_NodeLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType,
- CFX_WideString& wsNumSymbol) const {
- switch (eType) {
- case FX_LOCALENUMSYMBOL_Decimal:
- wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"decimal");
- break;
- case FX_LOCALENUMSYMBOL_Grouping:
- wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"grouping");
- break;
- case FX_LOCALENUMSYMBOL_Percent:
- wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"percent");
- break;
- case FX_LOCALENUMSYMBOL_Minus:
- wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"minus");
- break;
- case FX_LOCALENUMSYMBOL_Zero:
- wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"zero");
- break;
- case FX_LOCALENUMSYMBOL_CurrencySymbol:
- wsNumSymbol = GetSymbol(XFA_Element::CurrencySymbols, L"symbol");
- break;
- case FX_LOCALENUMSYMBOL_CurrencyName:
- wsNumSymbol = GetSymbol(XFA_Element::CurrencySymbols, L"isoname");
- break;
- }
-}
-
-void CXFA_NodeLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const {
- CXFA_Node* pSymbols =
- m_pLocale ? m_pLocale->GetChild(0, XFA_Element::DateTimeSymbols)
- : nullptr;
- wsDtSymbol = pSymbols ? pSymbols->GetContent() : CFX_WideString();
-}
-
-void CXFA_NodeLocale::GetMonthName(int32_t nMonth,
- CFX_WideString& wsMonthName,
- bool bAbbr) const {
- wsMonthName = GetCalendarSymbol(XFA_Element::MonthNames, nMonth, bAbbr);
-}
-
-void CXFA_NodeLocale::GetDayName(int32_t nWeek,
- CFX_WideString& wsDayName,
- bool bAbbr) const {
- wsDayName = GetCalendarSymbol(XFA_Element::DayNames, nWeek, bAbbr);
-}
-
-void CXFA_NodeLocale::GetMeridiemName(CFX_WideString& wsMeridiemName,
- bool bAM) const {
- wsMeridiemName =
- GetCalendarSymbol(XFA_Element::MeridiemNames, bAM ? 0 : 1, false);
-}
-
-void CXFA_NodeLocale::GetTimeZone(FX_TIMEZONE* tz) const {
- CXFA_TimeZoneProvider provider;
- provider.GetTimeZone(tz);
-}
-
-void CXFA_NodeLocale::GetEraName(CFX_WideString& wsEraName, bool bAD) const {
- wsEraName = GetCalendarSymbol(XFA_Element::EraNames, bAD ? 1 : 0, false);
-}
-
-void CXFA_NodeLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const {
- switch (eType) {
- case FX_LOCALEDATETIMESUBCATEGORY_Short:
- wsPattern = GetSymbol(XFA_Element::DatePatterns, L"short");
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Medium:
- case FX_LOCALEDATETIMESUBCATEGORY_Default:
- wsPattern = GetSymbol(XFA_Element::DatePatterns, L"med");
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Full:
- wsPattern = GetSymbol(XFA_Element::DatePatterns, L"full");
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Long:
- wsPattern = GetSymbol(XFA_Element::DatePatterns, L"long");
- break;
- }
-}
-
-void CXFA_NodeLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const {
- switch (eType) {
- case FX_LOCALEDATETIMESUBCATEGORY_Short:
- wsPattern = GetSymbol(XFA_Element::TimePatterns, L"short");
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Medium:
- case FX_LOCALEDATETIMESUBCATEGORY_Default:
- wsPattern = GetSymbol(XFA_Element::TimePatterns, L"med");
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Full:
- wsPattern = GetSymbol(XFA_Element::TimePatterns, L"full");
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Long:
- wsPattern = GetSymbol(XFA_Element::TimePatterns, L"long");
- break;
- }
-}
-
-void CXFA_NodeLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType,
- CFX_WideString& wsPattern) const {
- switch (eType) {
- case FX_LOCALENUMPATTERN_Percent:
- wsPattern = g_FX_Percent;
- break;
- case FX_LOCALENUMPATTERN_Currency:
- wsPattern = g_FX_Currency;
- break;
- case FX_LOCALENUMPATTERN_Decimal:
- wsPattern = g_FX_Decimal;
- break;
- case FX_LOCALENUMPATTERN_Integer:
- wsPattern = g_FX_Integer;
- break;
- }
-}
-
-CXFA_Node* CXFA_NodeLocale::GetNodeByName(CXFA_Node* pParent,
- const CFX_WideStringC& wsName) const {
- CXFA_Node* pChild =
- pParent ? pParent->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr;
- while (pChild) {
- CFX_WideString wsChild;
- if (pChild->GetAttribute(XFA_ATTRIBUTE_Name, wsChild)) {
- if (wsChild == wsName) {
- return pChild;
- }
- }
- pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
- }
- return nullptr;
-}
-
-CFX_WideString CXFA_NodeLocale::GetSymbol(
- XFA_Element eElement,
- const CFX_WideStringC& symbol_type) const {
- CXFA_Node* pSymbols = m_pLocale ? m_pLocale->GetChild(0, eElement) : nullptr;
- CXFA_Node* pSymbol = GetNodeByName(pSymbols, symbol_type);
- return pSymbol ? pSymbol->GetContent() : CFX_WideString();
-}
-
-CFX_WideString CXFA_NodeLocale::GetCalendarSymbol(XFA_Element eElement,
- int index,
- bool bAbbr) const {
- CXFA_Node* pCalendar =
- m_pLocale ? m_pLocale->GetChild(0, XFA_Element::CalendarSymbols)
- : nullptr;
- if (pCalendar) {
- CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement);
- for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) {
- if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) {
- CXFA_Node* pSymbol = pNode->GetChild(index, XFA_Element::Unknown);
- return pSymbol ? pSymbol->GetContent() : CFX_WideString();
- }
- }
- }
- return CFX_WideString();
-}
diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp
index 5216d0cdd5..fd5728e5f6 100644
--- a/xfa/fxfa/parser/xfa_utils.cpp
+++ b/xfa/fxfa/parser/xfa_utils.cpp
@@ -9,10 +9,10 @@
#include "core/fxcrt/fx_ext.h"
#include "xfa/fde/xml/fde_xml_imp.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
#include "xfa/fxfa/parser/xfa_basic_data.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_localevalue.h"
#include "xfa/fxfa/parser/xfa_object.h"
namespace {