summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-06 10:23:46 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-06 10:23:46 -0700
commit44d054c6449edb63d9760ac6602b036ffec75a84 (patch)
tree846b0da4fb6d90fad87b97a3c938fe94f7c9243d
parent48baa5f230a886b0579a9626711e7d71376b085e (diff)
downloadpdfium-44d054c6449edb63d9760ac6602b036ffec75a84.tar.xz
Split fxfa_objectacc.h into pieces.
This Cl splits apart the fxfa_objectacc.h file and moves the individual classes into the xfa/fxfa/parser directory. Review URL: https://codereview.chromium.org/1861353002
-rw-r--r--BUILD.gn55
-rw-r--r--xfa.gyp55
-rw-r--r--xfa/fxfa/app/xfa_ffdocview.cpp1
-rw-r--r--xfa/fxfa/app/xfa_ffwidget.cpp1
-rw-r--r--xfa/fxfa/parser/cxfa_arc.h19
-rw-r--r--xfa/fxfa/parser/cxfa_assist.cpp15
-rw-r--r--xfa/fxfa/parser/cxfa_assist.h22
-rw-r--r--xfa/fxfa/parser/cxfa_bind.cpp16
-rw-r--r--xfa/fxfa/parser/cxfa_bind.h22
-rw-r--r--xfa/fxfa/parser/cxfa_binditems.cpp27
-rw-r--r--xfa/fxfa/parser/cxfa_binditems.h25
-rw-r--r--xfa/fxfa/parser/cxfa_border.h19
-rw-r--r--xfa/fxfa/parser/cxfa_box.cpp168
-rw-r--r--xfa/fxfa/parser/cxfa_box.h50
-rw-r--r--xfa/fxfa/parser/cxfa_calculate.cpp32
-rw-r--r--xfa/fxfa/parser/cxfa_calculate.h25
-rw-r--r--xfa/fxfa/parser/cxfa_caption.cpp41
-rw-r--r--xfa/fxfa/parser/cxfa_caption.h29
-rw-r--r--xfa/fxfa/parser/cxfa_corner.h19
-rw-r--r--xfa/fxfa/parser/cxfa_data.cpp80
-rw-r--r--xfa/fxfa/parser/cxfa_data.h35
-rw-r--r--xfa/fxfa/parser/cxfa_edge.h19
-rw-r--r--xfa/fxfa/parser/cxfa_event.cpp49
-rw-r--r--xfa/fxfa/parser/cxfa_event.h33
-rw-r--r--xfa/fxfa/parser/cxfa_exdata.cpp15
-rw-r--r--xfa/fxfa/parser/cxfa_exdata.h22
-rw-r--r--xfa/fxfa/parser/cxfa_fill.cpp103
-rw-r--r--xfa/fxfa/parser/cxfa_fill.h31
-rw-r--r--xfa/fxfa/parser/cxfa_font.cpp92
-rw-r--r--xfa/fxfa/parser/cxfa_font.h36
-rw-r--r--xfa/fxfa/parser/cxfa_image.cpp54
-rw-r--r--xfa/fxfa/parser/cxfa_image.h33
-rw-r--r--xfa/fxfa/parser/cxfa_line.cpp22
-rw-r--r--xfa/fxfa/parser/cxfa_line.h25
-rw-r--r--xfa/fxfa/parser/cxfa_margin.cpp32
-rw-r--r--xfa/fxfa/parser/cxfa_margin.h25
-rw-r--r--xfa/fxfa/parser/cxfa_occur.cpp67
-rw-r--r--xfa/fxfa/parser/cxfa_occur.h26
-rw-r--r--xfa/fxfa/parser/cxfa_para.cpp59
-rw-r--r--xfa/fxfa/parser/cxfa_para.h29
-rw-r--r--xfa/fxfa/parser/cxfa_rectangle.h19
-rw-r--r--xfa/fxfa/parser/cxfa_script.cpp31
-rw-r--r--xfa/fxfa/parser/cxfa_script.h32
-rw-r--r--xfa/fxfa/parser/cxfa_stroke.cpp105
-rw-r--r--xfa/fxfa/parser/cxfa_stroke.h45
-rw-r--r--xfa/fxfa/parser/cxfa_submit.cpp27
-rw-r--r--xfa/fxfa/parser/cxfa_submit.h26
-rw-r--r--xfa/fxfa/parser/cxfa_text.cpp15
-rw-r--r--xfa/fxfa/parser/cxfa_text.h22
-rw-r--r--xfa/fxfa/parser/cxfa_tooltip.cpp15
-rw-r--r--xfa/fxfa/parser/cxfa_tooltip.h22
-rw-r--r--xfa/fxfa/parser/cxfa_validate.cpp119
-rw-r--r--xfa/fxfa/parser/cxfa_validate.h44
-rw-r--r--xfa/fxfa/parser/cxfa_value.cpp56
-rw-r--r--xfa/fxfa/parser/cxfa_value.h35
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp (renamed from xfa/fxfa/parser/xfa_objectacc_imp.cpp)1590
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.h181
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_layout_itemlayout.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_localemgr.h1
-rw-r--r--xfa/fxfa/parser/xfa_localevalue.h4
-rw-r--r--xfa/fxfa/parser/xfa_object.h1
-rw-r--r--xfa/fxfa/parser/xfa_object_imp.cpp4
-rw-r--r--xfa/fxfa/parser/xfa_script.h1
-rw-r--r--xfa/fxfa/parser/xfa_script_resolveprocessor.h1
-rw-r--r--xfa/fxfa/parser/xfa_utils.h10
-rw-r--r--xfa/include/fxfa/fxfa_objectacc.h561
-rw-r--r--xfa/include/fxfa/fxfa_widget.h10
-rw-r--r--xfa/include/fxfa/xfa_ffwidget.h3
69 files changed, 2707 insertions, 1803 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 711ab98e08..f5c445cf95 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1466,6 +1466,59 @@ if (pdf_enable_xfa) {
"xfa/fxfa/fm2js/xfa_program.h",
"xfa/fxfa/fm2js/xfa_simpleexpression.cpp",
"xfa/fxfa/fm2js/xfa_simpleexpression.h",
+ "xfa/fxfa/parser/cxfa_arc.h",
+ "xfa/fxfa/parser/cxfa_assist.cpp",
+ "xfa/fxfa/parser/cxfa_assist.h",
+ "xfa/fxfa/parser/cxfa_bind.cpp",
+ "xfa/fxfa/parser/cxfa_bind.h",
+ "xfa/fxfa/parser/cxfa_binditems.cpp",
+ "xfa/fxfa/parser/cxfa_binditems.h",
+ "xfa/fxfa/parser/cxfa_border.h",
+ "xfa/fxfa/parser/cxfa_box.cpp",
+ "xfa/fxfa/parser/cxfa_box.h",
+ "xfa/fxfa/parser/cxfa_calculate.cpp",
+ "xfa/fxfa/parser/cxfa_calculate.h",
+ "xfa/fxfa/parser/cxfa_caption.cpp",
+ "xfa/fxfa/parser/cxfa_caption.h",
+ "xfa/fxfa/parser/cxfa_corner.h",
+ "xfa/fxfa/parser/cxfa_data.cpp",
+ "xfa/fxfa/parser/cxfa_data.h",
+ "xfa/fxfa/parser/cxfa_edge.h",
+ "xfa/fxfa/parser/cxfa_event.cpp",
+ "xfa/fxfa/parser/cxfa_event.h",
+ "xfa/fxfa/parser/cxfa_exdata.cpp",
+ "xfa/fxfa/parser/cxfa_exdata.h",
+ "xfa/fxfa/parser/cxfa_fill.cpp",
+ "xfa/fxfa/parser/cxfa_fill.h",
+ "xfa/fxfa/parser/cxfa_font.cpp",
+ "xfa/fxfa/parser/cxfa_font.h",
+ "xfa/fxfa/parser/cxfa_image.cpp",
+ "xfa/fxfa/parser/cxfa_image.h",
+ "xfa/fxfa/parser/cxfa_line.cpp",
+ "xfa/fxfa/parser/cxfa_line.h",
+ "xfa/fxfa/parser/cxfa_margin.cpp",
+ "xfa/fxfa/parser/cxfa_margin.h",
+ "xfa/fxfa/parser/cxfa_occur.cpp",
+ "xfa/fxfa/parser/cxfa_occur.h",
+ "xfa/fxfa/parser/cxfa_para.cpp",
+ "xfa/fxfa/parser/cxfa_para.h",
+ "xfa/fxfa/parser/cxfa_rectangle.h",
+ "xfa/fxfa/parser/cxfa_script.cpp",
+ "xfa/fxfa/parser/cxfa_script.h",
+ "xfa/fxfa/parser/cxfa_stroke.cpp",
+ "xfa/fxfa/parser/cxfa_stroke.h",
+ "xfa/fxfa/parser/cxfa_submit.cpp",
+ "xfa/fxfa/parser/cxfa_submit.h",
+ "xfa/fxfa/parser/cxfa_text.cpp",
+ "xfa/fxfa/parser/cxfa_text.h",
+ "xfa/fxfa/parser/cxfa_tooltip.cpp",
+ "xfa/fxfa/parser/cxfa_tooltip.h",
+ "xfa/fxfa/parser/cxfa_validate.cpp",
+ "xfa/fxfa/parser/cxfa_validate.h",
+ "xfa/fxfa/parser/cxfa_value.cpp",
+ "xfa/fxfa/parser/cxfa_value.h",
+ "xfa/fxfa/parser/cxfa_widgetdata.cpp",
+ "xfa/fxfa/parser/cxfa_widgetdata.h",
"xfa/fxfa/parser/xfa_basic_data.cpp",
"xfa/fxfa/parser/xfa_basic_data.h",
"xfa/fxfa/parser/xfa_basic_imp.cpp",
@@ -1496,7 +1549,6 @@ if (pdf_enable_xfa) {
"xfa/fxfa/parser/xfa_localevalue.h",
"xfa/fxfa/parser/xfa_object.h",
"xfa/fxfa/parser/xfa_object_imp.cpp",
- "xfa/fxfa/parser/xfa_objectacc_imp.cpp",
"xfa/fxfa/parser/xfa_parser.h",
"xfa/fxfa/parser/xfa_parser_imp.cpp",
"xfa/fxfa/parser/xfa_parser_imp.h",
@@ -1538,7 +1590,6 @@ if (pdf_enable_xfa) {
"xfa/fxjse/include/fxjse.h",
"xfa/include/fxfa/fxfa.h",
"xfa/include/fxfa/fxfa_basic.h",
- "xfa/include/fxfa/fxfa_objectacc.h",
"xfa/include/fxfa/fxfa_widget.h",
"xfa/include/fxfa/xfa_checksum.h",
"xfa/include/fxfa/xfa_ffapp.h",
diff --git a/xfa.gyp b/xfa.gyp
index 1d0c828151..9d3e57868f 100644
--- a/xfa.gyp
+++ b/xfa.gyp
@@ -37,7 +37,6 @@
"sources":[
"xfa/include/fxfa/fxfa.h",
"xfa/include/fxfa/fxfa_basic.h",
- "xfa/include/fxfa/fxfa_objectacc.h",
"xfa/include/fxfa/fxfa_widget.h",
"xfa/include/fxfa/xfa_checksum.h",
"xfa/include/fxfa/xfa_ffapp.h",
@@ -621,6 +620,59 @@
"xfa/fxfa/fm2js/xfa_program.h",
"xfa/fxfa/fm2js/xfa_simpleexpression.cpp",
"xfa/fxfa/fm2js/xfa_simpleexpression.h",
+ "xfa/fxfa/parser/cxfa_arc.h",
+ "xfa/fxfa/parser/cxfa_assist.cpp",
+ "xfa/fxfa/parser/cxfa_assist.h",
+ "xfa/fxfa/parser/cxfa_bind.cpp",
+ "xfa/fxfa/parser/cxfa_bind.h",
+ "xfa/fxfa/parser/cxfa_binditems.cpp",
+ "xfa/fxfa/parser/cxfa_binditems.h",
+ "xfa/fxfa/parser/cxfa_border.h",
+ "xfa/fxfa/parser/cxfa_box.cpp",
+ "xfa/fxfa/parser/cxfa_box.h",
+ "xfa/fxfa/parser/cxfa_calculate.cpp",
+ "xfa/fxfa/parser/cxfa_calculate.h",
+ "xfa/fxfa/parser/cxfa_caption.cpp",
+ "xfa/fxfa/parser/cxfa_caption.h",
+ "xfa/fxfa/parser/cxfa_corner.h",
+ "xfa/fxfa/parser/cxfa_data.cpp",
+ "xfa/fxfa/parser/cxfa_data.h",
+ "xfa/fxfa/parser/cxfa_edge.h",
+ "xfa/fxfa/parser/cxfa_event.cpp",
+ "xfa/fxfa/parser/cxfa_event.h",
+ "xfa/fxfa/parser/cxfa_exdata.cpp",
+ "xfa/fxfa/parser/cxfa_exdata.h",
+ "xfa/fxfa/parser/cxfa_fill.cpp",
+ "xfa/fxfa/parser/cxfa_fill.h",
+ "xfa/fxfa/parser/cxfa_font.cpp",
+ "xfa/fxfa/parser/cxfa_font.h",
+ "xfa/fxfa/parser/cxfa_image.cpp",
+ "xfa/fxfa/parser/cxfa_image.h",
+ "xfa/fxfa/parser/cxfa_line.cpp",
+ "xfa/fxfa/parser/cxfa_line.h",
+ "xfa/fxfa/parser/cxfa_margin.cpp",
+ "xfa/fxfa/parser/cxfa_margin.h",
+ "xfa/fxfa/parser/cxfa_occur.cpp",
+ "xfa/fxfa/parser/cxfa_occur.h",
+ "xfa/fxfa/parser/cxfa_para.cpp",
+ "xfa/fxfa/parser/cxfa_para.h",
+ "xfa/fxfa/parser/cxfa_rectangle.h",
+ "xfa/fxfa/parser/cxfa_script.cpp",
+ "xfa/fxfa/parser/cxfa_script.h",
+ "xfa/fxfa/parser/cxfa_stroke.cpp",
+ "xfa/fxfa/parser/cxfa_stroke.h",
+ "xfa/fxfa/parser/cxfa_submit.cpp",
+ "xfa/fxfa/parser/cxfa_submit.h",
+ "xfa/fxfa/parser/cxfa_text.cpp",
+ "xfa/fxfa/parser/cxfa_text.h",
+ "xfa/fxfa/parser/cxfa_tooltip.cpp",
+ "xfa/fxfa/parser/cxfa_tooltip.h",
+ "xfa/fxfa/parser/cxfa_validate.cpp",
+ "xfa/fxfa/parser/cxfa_validate.h",
+ "xfa/fxfa/parser/cxfa_value.cpp",
+ "xfa/fxfa/parser/cxfa_value.h",
+ "xfa/fxfa/parser/cxfa_widgetdata.cpp",
+ "xfa/fxfa/parser/cxfa_widgetdata.h",
"xfa/fxfa/parser/xfa_basic_data.cpp",
"xfa/fxfa/parser/xfa_basic_data.h",
"xfa/fxfa/parser/xfa_basic_imp.cpp",
@@ -650,7 +702,6 @@
"xfa/fxfa/parser/xfa_localevalue.cpp",
"xfa/fxfa/parser/xfa_localevalue.h",
"xfa/fxfa/parser/xfa_object.h",
- "xfa/fxfa/parser/xfa_objectacc_imp.cpp",
"xfa/fxfa/parser/xfa_object_imp.cpp",
"xfa/fxfa/parser/xfa_parser.h",
"xfa/fxfa/parser/xfa_parser_imp.cpp",
diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp
index c82fd53bc2..dbedbad2e3 100644
--- a/xfa/fxfa/app/xfa_ffdocview.cpp
+++ b/xfa/fxfa/app/xfa_ffdocview.cpp
@@ -24,6 +24,7 @@
#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
#include "xfa/fxfa/app/xfa_fwladapter.h"
#include "xfa/fxfa/app/xfa_textlayout.h"
+#include "xfa/fxfa/parser/cxfa_binditems.h"
#include "xfa/fxfa/parser/xfa_document_layout_imp.h"
#include "xfa/fxfa/parser/xfa_script.h"
#include "xfa/fxfa/parser/xfa_script_imp.h"
diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp
index 3a238ad0f3..2b859ab83a 100644
--- a/xfa/fxfa/app/xfa_ffwidget.cpp
+++ b/xfa/fxfa/app/xfa_ffwidget.cpp
@@ -11,6 +11,7 @@
#include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h"
#include "core/include/fxcodec/fx_codec.h"
#include "xfa/fxfa/app/xfa_textlayout.h"
+#include "xfa/fxfa/parser/cxfa_corner.h"
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"
#include "xfa/fxgraphics/cfx_pattern.h"
diff --git a/xfa/fxfa/parser/cxfa_arc.h b/xfa/fxfa/parser/cxfa_arc.h
new file mode 100644
index 0000000000..e712d806a7
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_arc.h
@@ -0,0 +1,19 @@
+// Copyright 2016 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_ARC_H_
+#define XFA_FXFA_PARSER_CXFA_ARC_H_
+
+#include "xfa/fxfa/parser/cxfa_box.h"
+
+class CXFA_Node;
+
+class CXFA_Arc : public CXFA_Box {
+ public:
+ explicit CXFA_Arc(CXFA_Node* pNode) : CXFA_Box(pNode) {}
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_ARC_H_
diff --git a/xfa/fxfa/parser/cxfa_assist.cpp b/xfa/fxfa/parser/cxfa_assist.cpp
new file mode 100644
index 0000000000..e19be348ab
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_assist.cpp
@@ -0,0 +1,15 @@
+// Copyright 2016 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_assist.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_Assist::CXFA_Assist(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+CXFA_ToolTip CXFA_Assist::GetToolTip() {
+ return CXFA_ToolTip(m_pNode->GetChild(0, XFA_ELEMENT_ToolTip));
+}
diff --git a/xfa/fxfa/parser/cxfa_assist.h b/xfa/fxfa/parser/cxfa_assist.h
new file mode 100644
index 0000000000..c583ff59d5
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_assist.h
@@ -0,0 +1,22 @@
+// Copyright 2016 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_ASSIST_H_
+#define XFA_FXFA_PARSER_CXFA_ASSIST_H_
+
+#include "xfa/fxfa/parser/cxfa_data.h"
+#include "xfa/fxfa/parser/cxfa_tooltip.h"
+
+class CXFA_Node;
+
+class CXFA_Assist : public CXFA_Data {
+ public:
+ explicit CXFA_Assist(CXFA_Node* pNode);
+
+ CXFA_ToolTip GetToolTip();
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_ASSIST_H_
diff --git a/xfa/fxfa/parser/cxfa_bind.cpp b/xfa/fxfa/parser/cxfa_bind.cpp
new file mode 100644
index 0000000000..e27a8b1e0d
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_bind.cpp
@@ -0,0 +1,16 @@
+// Copyright 2016 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_bind.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_Bind::CXFA_Bind(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+void CXFA_Bind::GetPicture(CFX_WideString& wsPicture) {
+ if (CXFA_Node* pPicture = m_pNode->GetChild(0, XFA_ELEMENT_Picture))
+ pPicture->TryContent(wsPicture);
+}
diff --git a/xfa/fxfa/parser/cxfa_bind.h b/xfa/fxfa/parser/cxfa_bind.h
new file mode 100644
index 0000000000..2e2954eae2
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_bind.h
@@ -0,0 +1,22 @@
+// Copyright 2016 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_BIND_H_
+#define XFA_FXFA_PARSER_CXFA_BIND_H_
+
+#include "core/fxcrt/include/fx_string.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+
+class CXFA_Node;
+
+class CXFA_Bind : public CXFA_Data {
+ public:
+ explicit CXFA_Bind(CXFA_Node* pNode);
+
+ void GetPicture(CFX_WideString& wsPicture);
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_BIND_H_
diff --git a/xfa/fxfa/parser/cxfa_binditems.cpp b/xfa/fxfa/parser/cxfa_binditems.cpp
new file mode 100644
index 0000000000..fa691fe38b
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_binditems.cpp
@@ -0,0 +1,27 @@
+// Copyright 2016 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_binditems.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_BindItems::CXFA_BindItems(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+void CXFA_BindItems::GetLabelRef(CFX_WideStringC& wsLabelRef) {
+ m_pNode->TryCData(XFA_ATTRIBUTE_LabelRef, wsLabelRef);
+}
+
+void CXFA_BindItems::GetValueRef(CFX_WideStringC& wsValueRef) {
+ m_pNode->TryCData(XFA_ATTRIBUTE_ValueRef, wsValueRef);
+}
+
+void CXFA_BindItems::GetRef(CFX_WideStringC& wsRef) {
+ m_pNode->TryCData(XFA_ATTRIBUTE_Ref, wsRef);
+}
+
+FX_BOOL CXFA_BindItems::SetConnection(const CFX_WideString& wsConnection) {
+ return m_pNode->SetCData(XFA_ATTRIBUTE_Connection, wsConnection);
+}
diff --git a/xfa/fxfa/parser/cxfa_binditems.h b/xfa/fxfa/parser/cxfa_binditems.h
new file mode 100644
index 0000000000..3dc0b28878
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_binditems.h
@@ -0,0 +1,25 @@
+// Copyright 2016 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_BINDITEMS_H_
+#define XFA_FXFA_PARSER_CXFA_BINDITEMS_H_
+
+#include "core/fxcrt/include/fx_string.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+
+class CXFA_Node;
+
+class CXFA_BindItems : public CXFA_Data {
+ public:
+ explicit CXFA_BindItems(CXFA_Node* pNode);
+
+ void GetLabelRef(CFX_WideStringC& wsLabelRef);
+ void GetValueRef(CFX_WideStringC& wsValueRef);
+ void GetRef(CFX_WideStringC& wsRef);
+ FX_BOOL SetConnection(const CFX_WideString& wsConnection);
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_BINDITEMS_H_
diff --git a/xfa/fxfa/parser/cxfa_border.h b/xfa/fxfa/parser/cxfa_border.h
new file mode 100644
index 0000000000..27b469cd2f
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_border.h
@@ -0,0 +1,19 @@
+// Copyright 2016 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_BORDER_H_
+#define XFA_FXFA_PARSER_CXFA_BORDER_H_
+
+#include "xfa/fxfa/parser/cxfa_box.h"
+
+class CXFA_Node;
+
+class CXFA_Border : public CXFA_Box {
+ public:
+ explicit CXFA_Border(CXFA_Node* pNode) : CXFA_Box(pNode) {}
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_BORDER_H_
diff --git a/xfa/fxfa/parser/cxfa_box.cpp b/xfa/fxfa/parser/cxfa_box.cpp
new file mode 100644
index 0000000000..fc57201750
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_box.cpp
@@ -0,0 +1,168 @@
+// Copyright 2016 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_box.h"
+
+#include "xfa/fxfa/parser/cxfa_corner.h"
+#include "xfa/fxfa/parser/xfa_object.h"
+
+namespace {
+
+void GetStrokesInternal(CXFA_Node* pNode,
+ CXFA_StrokeArray& strokes,
+ FX_BOOL bNULL) {
+ strokes.RemoveAll();
+ if (!pNode)
+ return;
+
+ strokes.SetSize(8);
+ int32_t i, j;
+ for (i = 0, j = 0; i < 4; i++) {
+ CXFA_Corner corner =
+ CXFA_Corner(pNode->GetProperty(i, XFA_ELEMENT_Corner, i == 0));
+ if (corner || i == 0)
+ strokes.SetAt(j, corner);
+ else if (bNULL)
+ strokes.SetAt(j, CXFA_Stroke(nullptr));
+ else if (i == 1)
+ strokes.SetAt(j, strokes[0]);
+ else if (i == 2)
+ strokes.SetAt(j, strokes[0]);
+ else
+ strokes.SetAt(j, strokes[2]);
+
+ j++;
+ CXFA_Edge edge = CXFA_Edge(pNode->GetProperty(i, XFA_ELEMENT_Edge, i == 0));
+ if (edge || i == 0)
+ strokes.SetAt(j, edge);
+ else if (bNULL)
+ strokes.SetAt(j, CXFA_Stroke(nullptr));
+ else if (i == 1)
+ strokes.SetAt(j, strokes[1]);
+ else if (i == 2)
+ strokes.SetAt(j, strokes[1]);
+ else
+ strokes.SetAt(j, strokes[3]);
+
+ j++;
+ }
+}
+
+static int32_t Style3D(const CXFA_StrokeArray& strokes, CXFA_Stroke& stroke) {
+ int32_t iCount = strokes.GetSize();
+ if (iCount < 1)
+ return 0;
+
+ stroke = strokes[0];
+ for (int32_t i = 1; i < iCount; i++) {
+ CXFA_Stroke find = strokes[i];
+ if (!find)
+ continue;
+
+ if (!stroke)
+ stroke = find;
+ else if (stroke.GetStrokeType() != find.GetStrokeType())
+ stroke = find;
+ break;
+ }
+ int32_t iType = stroke.GetStrokeType();
+ if (iType == XFA_ATTRIBUTEENUM_Lowered || iType == XFA_ATTRIBUTEENUM_Raised ||
+ iType == XFA_ATTRIBUTEENUM_Etched ||
+ iType == XFA_ATTRIBUTEENUM_Embossed) {
+ return iType;
+ }
+ return 0;
+}
+
+} // namespace
+
+int32_t CXFA_Box::GetHand() const {
+ if (!m_pNode)
+ return XFA_ATTRIBUTEENUM_Even;
+ return m_pNode->GetEnum(XFA_ATTRIBUTE_Hand);
+}
+
+int32_t CXFA_Box::GetPresence() const {
+ if (!m_pNode)
+ return XFA_ATTRIBUTEENUM_Hidden;
+ return m_pNode->GetEnum(XFA_ATTRIBUTE_Presence);
+}
+
+int32_t CXFA_Box::CountEdges() const {
+ if (!m_pNode)
+ return 0;
+ return m_pNode->CountChildren(XFA_ELEMENT_Edge);
+}
+
+CXFA_Edge CXFA_Box::GetEdge(int32_t nIndex) const {
+ return CXFA_Edge(
+ m_pNode ? m_pNode->GetProperty(nIndex, XFA_ELEMENT_Edge, nIndex == 0)
+ : nullptr);
+}
+
+void CXFA_Box::GetStrokes(CXFA_StrokeArray& strokes) const {
+ GetStrokesInternal(m_pNode, strokes, FALSE);
+}
+
+FX_BOOL CXFA_Box::IsCircular() const {
+ if (!m_pNode)
+ return FALSE;
+ return m_pNode->GetBoolean(XFA_ATTRIBUTE_Circular);
+}
+
+FX_BOOL CXFA_Box::GetStartAngle(FX_FLOAT& fStartAngle) const {
+ fStartAngle = 0;
+ if (!m_pNode)
+ return FALSE;
+
+ CXFA_Measurement ms;
+ FX_BOOL bRet = m_pNode->TryMeasure(XFA_ATTRIBUTE_StartAngle, ms, FALSE);
+ if (bRet)
+ fStartAngle = ms.GetValue();
+
+ return bRet;
+}
+
+FX_BOOL CXFA_Box::GetSweepAngle(FX_FLOAT& fSweepAngle) const {
+ fSweepAngle = 360;
+ if (!m_pNode)
+ return FALSE;
+
+ CXFA_Measurement ms;
+ FX_BOOL bRet = m_pNode->TryMeasure(XFA_ATTRIBUTE_SweepAngle, ms, FALSE);
+ if (bRet)
+ fSweepAngle = ms.GetValue();
+
+ return bRet;
+}
+
+CXFA_Fill CXFA_Box::GetFill(FX_BOOL bModified) const {
+ if (!m_pNode)
+ return CXFA_Fill(nullptr);
+
+ CXFA_Node* pFillNode = m_pNode->GetProperty(0, XFA_ELEMENT_Fill, bModified);
+ return CXFA_Fill(pFillNode);
+}
+
+CXFA_Margin CXFA_Box::GetMargin() const {
+ return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_ELEMENT_Margin)
+ : nullptr);
+}
+
+int32_t CXFA_Box::Get3DStyle(FX_BOOL& bVisible, FX_FLOAT& fThickness) const {
+ if (IsArc())
+ return 0;
+
+ CXFA_StrokeArray strokes;
+ GetStrokesInternal(m_pNode, strokes, TRUE);
+ CXFA_Stroke stroke(NULL);
+ int32_t iType = Style3D(strokes, stroke);
+ if (iType) {
+ bVisible = stroke.IsVisible();
+ fThickness = stroke.GetThickness();
+ }
+ return iType;
+}
diff --git a/xfa/fxfa/parser/cxfa_box.h b/xfa/fxfa/parser/cxfa_box.h
new file mode 100644
index 0000000000..6123f946bd
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_box.h
@@ -0,0 +1,50 @@
+// Copyright 2016 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_BOX_H_
+#define XFA_FXFA_PARSER_CXFA_BOX_H_
+
+#include "core/fxcrt/include/fx_system.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+#include "xfa/fxfa/parser/cxfa_edge.h"
+#include "xfa/fxfa/parser/cxfa_fill.h"
+#include "xfa/fxfa/parser/cxfa_margin.h"
+
+class CXFA_Node;
+
+class CXFA_Box : public CXFA_Data {
+ public:
+ explicit CXFA_Box(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+ bool IsArc() const { return GetClassID() == XFA_ELEMENT_Arc; }
+ bool IsBorder() const { return GetClassID() == XFA_ELEMENT_Border; }
+ bool IsRectangle() const { return GetClassID() == XFA_ELEMENT_Rectangle; }
+ int32_t GetHand() const;
+ int32_t GetPresence() const;
+ int32_t CountEdges() const;
+ CXFA_Edge GetEdge(int32_t nIndex = 0) const;
+ void GetStrokes(CXFA_StrokeArray& strokes) const;
+ FX_BOOL IsCircular() const;
+ FX_BOOL GetStartAngle(FX_FLOAT& fStartAngle) const;
+ FX_FLOAT GetStartAngle() const {
+ FX_FLOAT fStartAngle;
+ GetStartAngle(fStartAngle);
+ return fStartAngle;
+ }
+
+ FX_BOOL GetSweepAngle(FX_FLOAT& fSweepAngle) const;
+ FX_FLOAT GetSweepAngle() const {
+ FX_FLOAT fSweepAngle;
+ GetSweepAngle(fSweepAngle);
+ return fSweepAngle;
+ }
+
+ CXFA_Fill GetFill(FX_BOOL bModified = FALSE) const;
+ CXFA_Margin GetMargin() const;
+ int32_t Get3DStyle(FX_BOOL& bVisible, FX_FLOAT& fThickness) const;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_BOX_H_
diff --git a/xfa/fxfa/parser/cxfa_calculate.cpp b/xfa/fxfa/parser/cxfa_calculate.cpp
new file mode 100644
index 0000000000..8984c5e817
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_calculate.cpp
@@ -0,0 +1,32 @@
+// Copyright 2016 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_calculate.h"
+
+#include "xfa/fxfa/parser/cxfa_text.h"
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_Calculate::CXFA_Calculate(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+int32_t CXFA_Calculate::GetOverride() {
+ XFA_ATTRIBUTEENUM eAtt = XFA_ATTRIBUTEENUM_Error;
+ m_pNode->TryEnum(XFA_ATTRIBUTE_Override, eAtt, FALSE);
+ return eAtt;
+}
+
+CXFA_Script CXFA_Calculate::GetScript() {
+ return CXFA_Script(m_pNode->GetChild(0, XFA_ELEMENT_Script));
+}
+
+void CXFA_Calculate::GetMessageText(CFX_WideString& wsMessage) {
+ CXFA_Node* pNode = m_pNode->GetChild(0, XFA_ELEMENT_Message);
+ if (!pNode)
+ return;
+
+ CXFA_Text text(pNode->GetChild(0, XFA_ELEMENT_Text));
+ if (text)
+ text.GetContent(wsMessage);
+}
diff --git a/xfa/fxfa/parser/cxfa_calculate.h b/xfa/fxfa/parser/cxfa_calculate.h
new file mode 100644
index 0000000000..c90656a314
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_calculate.h
@@ -0,0 +1,25 @@
+// Copyright 2016 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_CALCULATE_H_
+#define XFA_FXFA_PARSER_CXFA_CALCULATE_H_
+
+#include "core/fxcrt/include/fx_string.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+#include "xfa/fxfa/parser/cxfa_script.h"
+
+class CXFA_Node;
+
+class CXFA_Calculate : public CXFA_Data {
+ public:
+ explicit CXFA_Calculate(CXFA_Node* pNode);
+
+ int32_t GetOverride();
+ CXFA_Script GetScript();
+ void GetMessageText(CFX_WideString& wsMessage);
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_CALCULATE_H_
diff --git a/xfa/fxfa/parser/cxfa_caption.cpp b/xfa/fxfa/parser/cxfa_caption.cpp
new file mode 100644
index 0000000000..1d343e7e43
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_caption.cpp
@@ -0,0 +1,41 @@
+// Copyright 2016 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_caption.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_Caption::CXFA_Caption(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+int32_t CXFA_Caption::GetPresence() {
+ XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Visible;
+ m_pNode->TryEnum(XFA_ATTRIBUTE_Presence, eAttr);
+ return eAttr;
+}
+
+int32_t CXFA_Caption::GetPlacementType() {
+ XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Left;
+ m_pNode->TryEnum(XFA_ATTRIBUTE_Placement, eAttr);
+ return eAttr;
+}
+
+FX_FLOAT CXFA_Caption::GetReserve() {
+ CXFA_Measurement ms;
+ m_pNode->TryMeasure(XFA_ATTRIBUTE_Reserve, ms);
+ return ms.ToUnit(XFA_UNIT_Pt);
+}
+
+CXFA_Margin CXFA_Caption::GetMargin() {
+ return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_ELEMENT_Margin) : NULL);
+}
+
+CXFA_Font CXFA_Caption::GetFont() {
+ return CXFA_Font(m_pNode ? m_pNode->GetChild(0, XFA_ELEMENT_Font) : NULL);
+}
+
+CXFA_Value CXFA_Caption::GetValue() {
+ return CXFA_Value(m_pNode ? m_pNode->GetChild(0, XFA_ELEMENT_Value) : NULL);
+}
diff --git a/xfa/fxfa/parser/cxfa_caption.h b/xfa/fxfa/parser/cxfa_caption.h
new file mode 100644
index 0000000000..70dd435653
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_caption.h
@@ -0,0 +1,29 @@
+// Copyright 2016 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_CAPTION_H_
+#define XFA_FXFA_PARSER_CXFA_CAPTION_H_
+
+#include "xfa/fxfa/parser/cxfa_data.h"
+#include "xfa/fxfa/parser/cxfa_font.h"
+#include "xfa/fxfa/parser/cxfa_margin.h"
+#include "xfa/fxfa/parser/cxfa_value.h"
+
+class CXFA_Node;
+
+class CXFA_Caption : public CXFA_Data {
+ public:
+ explicit CXFA_Caption(CXFA_Node* pNode);
+
+ int32_t GetPresence();
+ int32_t GetPlacementType();
+ FX_FLOAT GetReserve();
+ CXFA_Margin GetMargin();
+ CXFA_Font GetFont();
+ CXFA_Value GetValue();
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_CAPTION_H_
diff --git a/xfa/fxfa/parser/cxfa_corner.h b/xfa/fxfa/parser/cxfa_corner.h
new file mode 100644
index 0000000000..7665c53812
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_corner.h
@@ -0,0 +1,19 @@
+// Copyright 2016 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_CORNER_H_
+#define XFA_FXFA_PARSER_CXFA_CORNER_H_
+
+#include "xfa/fxfa/parser/cxfa_stroke.h"
+
+class CXFA_Node;
+
+class CXFA_Corner : public CXFA_Stroke {
+ public:
+ explicit CXFA_Corner(CXFA_Node* pNode) : CXFA_Stroke(pNode) {}
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_CORNER_H_
diff --git a/xfa/fxfa/parser/cxfa_data.cpp b/xfa/fxfa/parser/cxfa_data.cpp
new file mode 100644
index 0000000000..cbcb079cad
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_data.cpp
@@ -0,0 +1,80 @@
+// Copyright 2016 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_data.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+// Static.
+FX_ARGB CXFA_Data::ToColor(const CFX_WideStringC& wsValue) {
+ uint8_t r = 0, g = 0, b = 0;
+ if (wsValue.GetLength() == 0)
+ return 0xff000000;
+
+ int cc = 0;
+ const FX_WCHAR* str = wsValue.c_str();
+ int len = wsValue.GetLength();
+ while (XFA_IsSpace(str[cc]) && cc < len)
+ cc++;
+
+ if (cc >= len)
+ return 0xff000000;
+
+ while (cc < len) {
+ if (str[cc] == ',' || !XFA_IsDigit(str[cc]))
+ break;
+
+ r = r * 10 + str[cc] - '0';
+ cc++;
+ }
+ if (cc < len && str[cc] == ',') {
+ cc++;
+ while (XFA_IsSpace(str[cc]) && cc < len)
+ cc++;
+
+ while (cc < len) {
+ if (str[cc] == ',' || !XFA_IsDigit(str[cc]))
+ break;
+
+ g = g * 10 + str[cc] - '0';
+ cc++;
+ }
+ if (cc < len && str[cc] == ',') {
+ cc++;
+ while (XFA_IsSpace(str[cc]) && cc < len)
+ cc++;
+
+ while (cc < len) {
+ if (str[cc] == ',' || !XFA_IsDigit(str[cc]))
+ break;
+
+ b = b * 10 + str[cc] - '0';
+ cc++;
+ }
+ }
+ }
+ return (0xff << 24) | (r << 16) | (g << 8) | b;
+}
+
+XFA_ELEMENT CXFA_Data::GetClassID() const {
+ return m_pNode ? m_pNode->GetClassID() : XFA_ELEMENT_UNKNOWN;
+}
+
+FX_BOOL CXFA_Data::TryMeasure(XFA_ATTRIBUTE eAttr,
+ FX_FLOAT& fValue,
+ FX_BOOL bUseDefault) const {
+ CXFA_Measurement ms;
+ if (m_pNode->TryMeasure(eAttr, ms, bUseDefault)) {
+ fValue = ms.ToUnit(XFA_UNIT_Pt);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+FX_BOOL CXFA_Data::SetMeasure(XFA_ATTRIBUTE eAttr, FX_FLOAT fValue) {
+ CXFA_Measurement ms(fValue, XFA_UNIT_Pt);
+ return m_pNode->SetMeasure(eAttr, ms);
+}
diff --git a/xfa/fxfa/parser/cxfa_data.h b/xfa/fxfa/parser/cxfa_data.h
new file mode 100644
index 0000000000..e6750d5ff7
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_data.h
@@ -0,0 +1,35 @@
+// Copyright 2016 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_DATA_H_
+#define XFA_FXFA_PARSER_CXFA_DATA_H_
+
+#include "core/fxcrt/include/fx_system.h"
+#include "core/fxge/include/fx_dib.h"
+#include "xfa/include/fxfa/fxfa_basic.h"
+
+class CXFA_Node;
+
+class CXFA_Data {
+ public:
+ static FX_ARGB ToColor(const CFX_WideStringC& wsValue);
+
+ explicit CXFA_Data(CXFA_Node* pNode) : m_pNode(pNode) {}
+
+ operator bool() const { return !!m_pNode; }
+ CXFA_Node* GetNode() const { return m_pNode; }
+ XFA_ELEMENT GetClassID() const;
+
+ protected:
+ FX_BOOL TryMeasure(XFA_ATTRIBUTE eAttr,
+ FX_FLOAT& fValue,
+ FX_BOOL bUseDefault = FALSE) const;
+ FX_BOOL SetMeasure(XFA_ATTRIBUTE eAttr, FX_FLOAT fValue);
+
+ CXFA_Node* m_pNode;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_DATA_H_
diff --git a/xfa/fxfa/parser/cxfa_edge.h b/xfa/fxfa/parser/cxfa_edge.h
new file mode 100644
index 0000000000..96e725f4c6
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_edge.h
@@ -0,0 +1,19 @@
+// Copyright 2016 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_EDGE_H_
+#define XFA_FXFA_PARSER_CXFA_EDGE_H_
+
+#include "xfa/fxfa/parser/cxfa_stroke.h"
+
+class CXFA_Node;
+
+class CXFA_Edge : public CXFA_Stroke {
+ public:
+ explicit CXFA_Edge(CXFA_Node* pNode) : CXFA_Stroke(pNode) {}
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_EDGE_H_
diff --git a/xfa/fxfa/parser/cxfa_event.cpp b/xfa/fxfa/parser/cxfa_event.cpp
new file mode 100644
index 0000000000..efff3e5161
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_event.cpp
@@ -0,0 +1,49 @@
+// Copyright 2016 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_event.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_Event::CXFA_Event(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+int32_t CXFA_Event::GetActivity() {
+ return m_pNode->GetEnum(XFA_ATTRIBUTE_Activity);
+}
+
+int32_t CXFA_Event::GetEventType() {
+ CXFA_Node* pChild = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ while (pChild) {
+ int32_t eType = pChild->GetClassID();
+ if (eType != XFA_ELEMENT_Extras)
+ return eType;
+
+ pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
+ }
+ return XFA_ELEMENT_UNKNOWN;
+}
+
+void CXFA_Event::GetRef(CFX_WideStringC& wsRef) {
+ m_pNode->TryCData(XFA_ATTRIBUTE_Ref, wsRef);
+}
+
+CXFA_Script CXFA_Event::GetScript() {
+ return CXFA_Script(m_pNode->GetChild(0, XFA_ELEMENT_Script));
+}
+
+CXFA_Submit CXFA_Event::GetSubmit() {
+ return CXFA_Submit(m_pNode->GetChild(0, XFA_ELEMENT_Submit));
+}
+
+void CXFA_Event::GetSignDataTarget(CFX_WideString& wsTarget) {
+ CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_SignData);
+ if (!pNode)
+ return;
+
+ CFX_WideStringC wsCData;
+ pNode->TryCData(XFA_ATTRIBUTE_Target, wsCData);
+ wsTarget = wsCData;
+}
diff --git a/xfa/fxfa/parser/cxfa_event.h b/xfa/fxfa/parser/cxfa_event.h
new file mode 100644
index 0000000000..91d0812f95
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_event.h
@@ -0,0 +1,33 @@
+// Copyright 2016 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_EVENT_H_
+#define XFA_FXFA_PARSER_CXFA_EVENT_H_
+
+#include <stdint.h>
+
+#include "core/fxcrt/include/fx_string.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+#include "xfa/fxfa/parser/cxfa_script.h"
+#include "xfa/fxfa/parser/cxfa_submit.h"
+
+class CXFA_Node;
+
+class CXFA_Event : public CXFA_Data {
+ public:
+ explicit CXFA_Event(CXFA_Node* pNode);
+
+ int32_t GetActivity();
+ int32_t GetEventType();
+ void GetRef(CFX_WideStringC& wsRef);
+
+ CXFA_Script GetScript();
+ CXFA_Submit GetSubmit();
+
+ void GetSignDataTarget(CFX_WideString& wsTarget);
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_EVENT_H_
diff --git a/xfa/fxfa/parser/cxfa_exdata.cpp b/xfa/fxfa/parser/cxfa_exdata.cpp
new file mode 100644
index 0000000000..358cc3d611
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_exdata.cpp
@@ -0,0 +1,15 @@
+// Copyright 2016 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_exdata.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_ExData::CXFA_ExData(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+FX_BOOL CXFA_ExData::SetContentType(const CFX_WideString& wsContentType) {
+ return m_pNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
+}
diff --git a/xfa/fxfa/parser/cxfa_exdata.h b/xfa/fxfa/parser/cxfa_exdata.h
new file mode 100644
index 0000000000..eb04398379
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_exdata.h
@@ -0,0 +1,22 @@
+// Copyright 2016 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_EXDATA_H_
+#define XFA_FXFA_PARSER_CXFA_EXDATA_H_
+
+#include "core/fxcrt/include/fx_string.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+
+class CXFA_Node;
+
+class CXFA_ExData : public CXFA_Data {
+ public:
+ explicit CXFA_ExData(CXFA_Node* pNode);
+
+ FX_BOOL SetContentType(const CFX_WideString& wsContentType);
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_EXDATA_H_
diff --git a/xfa/fxfa/parser/cxfa_fill.cpp b/xfa/fxfa/parser/cxfa_fill.cpp
new file mode 100644
index 0000000000..c67e303eb2
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_fill.cpp
@@ -0,0 +1,103 @@
+// Copyright 2016 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_fill.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_Fill::CXFA_Fill(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+CXFA_Fill::~CXFA_Fill() {}
+
+int32_t CXFA_Fill::GetPresence() {
+ return m_pNode->GetEnum(XFA_ATTRIBUTE_Presence);
+}
+
+void CXFA_Fill::SetColor(FX_ARGB color) {
+ CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Color);
+ CFX_WideString wsColor;
+ int a, r, g, b;
+ ArgbDecode(color, a, r, g, b);
+ wsColor.Format(L"%d,%d,%d", r, g, b);
+ pNode->SetCData(XFA_ATTRIBUTE_Value, wsColor);
+}
+
+FX_ARGB CXFA_Fill::GetColor(FX_BOOL bText) {
+ if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_ELEMENT_Color)) {
+ CFX_WideStringC wsColor;
+ if (pNode->TryCData(XFA_ATTRIBUTE_Value, wsColor, FALSE))
+ return CXFA_Data::ToColor(wsColor);
+ }
+ if (bText)
+ return 0xFF000000;
+ return 0xFFFFFFFF;
+}
+
+int32_t CXFA_Fill::GetFillType() {
+ CXFA_Node* pChild = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ while (pChild) {
+ int32_t eType = pChild->GetClassID();
+ if (eType != XFA_ELEMENT_Color && eType != XFA_ELEMENT_Extras)
+ return eType;
+
+ pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
+ }
+ return XFA_ELEMENT_Solid;
+}
+
+int32_t CXFA_Fill::GetPattern(FX_ARGB& foreColor) {
+ CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Pattern);
+ if (CXFA_Node* pColor = pNode->GetChild(0, XFA_ELEMENT_Color)) {
+ CFX_WideStringC wsColor;
+ pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, FALSE);
+ foreColor = CXFA_Data::ToColor(wsColor);
+ } else {
+ foreColor = 0xFF000000;
+ }
+ return pNode->GetEnum(XFA_ATTRIBUTE_Type);
+}
+
+int32_t CXFA_Fill::GetStipple(FX_ARGB& stippleColor) {
+ CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Stipple);
+ int32_t eAttr = 50;
+ pNode->TryInteger(XFA_ATTRIBUTE_Rate, eAttr);
+ if (CXFA_Node* pColor = pNode->GetChild(0, XFA_ELEMENT_Color)) {
+ CFX_WideStringC wsColor;
+ pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, FALSE);
+ stippleColor = CXFA_Data::ToColor(wsColor);
+ } else {
+ stippleColor = 0xFF000000;
+ }
+ return eAttr;
+}
+
+int32_t CXFA_Fill::GetLinear(FX_ARGB& endColor) {
+ CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Linear);
+ XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToRight;
+ pNode->TryEnum(XFA_ATTRIBUTE_Type, eAttr);
+ if (CXFA_Node* pColor = pNode->GetChild(0, XFA_ELEMENT_Color)) {
+ CFX_WideStringC wsColor;
+ pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, FALSE);
+ endColor = CXFA_Data::ToColor(wsColor);
+ } else {
+ endColor = 0xFF000000;
+ }
+ return eAttr;
+}
+
+int32_t CXFA_Fill::GetRadial(FX_ARGB& endColor) {
+ CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Radial);
+ XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToEdge;
+ pNode->TryEnum(XFA_ATTRIBUTE_Type, eAttr);
+ if (CXFA_Node* pColor = pNode->GetChild(0, XFA_ELEMENT_Color)) {
+ CFX_WideStringC wsColor;
+ pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, FALSE);
+ endColor = CXFA_Data::ToColor(wsColor);
+ } else {
+ endColor = 0xFF000000;
+ }
+ return eAttr;
+}
diff --git a/xfa/fxfa/parser/cxfa_fill.h b/xfa/fxfa/parser/cxfa_fill.h
new file mode 100644
index 0000000000..57f0410741
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_fill.h
@@ -0,0 +1,31 @@
+// Copyright 2016 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_FILL_H_
+#define XFA_FXFA_PARSER_CXFA_FILL_H_
+
+#include "core/fxcrt/include/fx_system.h"
+#include "core/fxge/include/fx_dib.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+
+class CXFA_Node;
+
+class CXFA_Fill : public CXFA_Data {
+ public:
+ explicit CXFA_Fill(CXFA_Node* pNode);
+ ~CXFA_Fill();
+
+ int32_t GetPresence();
+ FX_ARGB GetColor(FX_BOOL bText = FALSE);
+ int32_t GetFillType();
+ int32_t GetPattern(FX_ARGB& foreColor);
+ int32_t GetStipple(FX_ARGB& stippleColor);
+ int32_t GetLinear(FX_ARGB& endColor);
+ int32_t GetRadial(FX_ARGB& endColor);
+ void SetColor(FX_ARGB color);
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_FILL_H_
diff --git a/xfa/fxfa/parser/cxfa_font.cpp b/xfa/fxfa/parser/cxfa_font.cpp
new file mode 100644
index 0000000000..8579fcba80
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_font.cpp
@@ -0,0 +1,92 @@
+// Copyright 2016 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_font.h"
+
+#include "core/fxge/include/fx_dib.h"
+#include "xfa/fxfa/parser/cxfa_fill.h"
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_Font::CXFA_Font(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+FX_FLOAT CXFA_Font::GetBaselineShift() {
+ return m_pNode->GetMeasure(XFA_ATTRIBUTE_BaselineShift).ToUnit(XFA_UNIT_Pt);
+}
+
+FX_FLOAT CXFA_Font::GetHorizontalScale() {
+ CFX_WideString wsValue;
+ m_pNode->TryCData(XFA_ATTRIBUTE_FontHorizontalScale, wsValue);
+ int32_t iScale = FXSYS_wtoi((const FX_WCHAR*)wsValue);
+ return iScale > 0 ? (FX_FLOAT)iScale : 100.0f;
+}
+
+FX_FLOAT CXFA_Font::GetVerticalScale() {
+ CFX_WideString wsValue;
+ m_pNode->TryCData(XFA_ATTRIBUTE_FontVerticalScale, wsValue);
+ int32_t iScale = FXSYS_wtoi((const FX_WCHAR*)wsValue);
+ return iScale > 0 ? (FX_FLOAT)iScale : 100.0f;
+}
+
+FX_FLOAT CXFA_Font::GetLetterSpacing() {
+ CFX_WideStringC wsValue;
+ if (!m_pNode->TryCData(XFA_ATTRIBUTE_LetterSpacing, wsValue))
+ return 0;
+
+ CXFA_Measurement ms(wsValue);
+ if (ms.GetUnit() == XFA_UNIT_Em)
+ return ms.GetValue() * GetFontSize();
+ return ms.ToUnit(XFA_UNIT_Pt);
+}
+
+int32_t CXFA_Font::GetLineThrough() {
+ int32_t iValue = 0;
+ m_pNode->TryInteger(XFA_ATTRIBUTE_LineThrough, iValue);
+ return iValue;
+}
+
+int32_t CXFA_Font::GetUnderline() {
+ int32_t iValue = 0;
+ m_pNode->TryInteger(XFA_ATTRIBUTE_Underline, iValue);
+ return iValue;
+}
+
+int32_t CXFA_Font::GetUnderlinePeriod() {
+ XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_All;
+ m_pNode->TryEnum(XFA_ATTRIBUTE_UnderlinePeriod, eAttr);
+ return eAttr;
+}
+
+FX_FLOAT CXFA_Font::GetFontSize() {
+ CXFA_Measurement ms;
+ m_pNode->TryMeasure(XFA_ATTRIBUTE_Size, ms);
+ return ms.ToUnit(XFA_UNIT_Pt);
+}
+
+void CXFA_Font::GetTypeface(CFX_WideStringC& wsTypeFace) {
+ m_pNode->TryCData(XFA_ATTRIBUTE_Typeface, wsTypeFace);
+}
+
+FX_BOOL CXFA_Font::IsBold() {
+ XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Normal;
+ m_pNode->TryEnum(XFA_ATTRIBUTE_Weight, eAttr);
+ return eAttr == XFA_ATTRIBUTEENUM_Bold;
+}
+
+FX_BOOL CXFA_Font::IsItalic() {
+ XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Normal;
+ m_pNode->TryEnum(XFA_ATTRIBUTE_Posture, eAttr);
+ return eAttr == XFA_ATTRIBUTEENUM_Italic;
+}
+
+void CXFA_Font::SetColor(FX_ARGB color) {
+ CXFA_Fill fill(m_pNode->GetProperty(0, XFA_ELEMENT_Fill));
+ fill.SetColor(color);
+}
+
+FX_ARGB CXFA_Font::GetColor() {
+ CXFA_Fill fill(m_pNode->GetChild(0, XFA_ELEMENT_Fill));
+ return fill ? fill.GetColor(TRUE) : 0xFF000000;
+}
diff --git a/xfa/fxfa/parser/cxfa_font.h b/xfa/fxfa/parser/cxfa_font.h
new file mode 100644
index 0000000000..e2e1809aa3
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_font.h
@@ -0,0 +1,36 @@
+// Copyright 2016 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_FONT_H_
+#define XFA_FXFA_PARSER_CXFA_FONT_H_
+
+#include "core/fxge/include/fx_dib.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+
+class CXFA_Node;
+
+class CXFA_Font : public CXFA_Data {
+ public:
+ explicit CXFA_Font(CXFA_Node* pNode);
+
+ FX_FLOAT GetBaselineShift();
+ FX_FLOAT GetHorizontalScale();
+ FX_FLOAT GetVerticalScale();
+ FX_FLOAT GetLetterSpacing();
+ int32_t GetLineThrough();
+ int32_t GetUnderline();
+ int32_t GetUnderlinePeriod();
+ FX_FLOAT GetFontSize();
+ void GetTypeface(CFX_WideStringC& wsTypeFace);
+
+ FX_BOOL IsBold();
+ FX_BOOL IsItalic();
+
+ FX_ARGB GetColor();
+ void SetColor(FX_ARGB color);
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_FONT_H_
diff --git a/xfa/fxfa/parser/cxfa_image.cpp b/xfa/fxfa/parser/cxfa_image.cpp
new file mode 100644
index 0000000000..c54a580b80
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_image.cpp
@@ -0,0 +1,54 @@
+// Copyright 2016 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_image.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_Image::CXFA_Image(CXFA_Node* pNode, FX_BOOL bDefValue)
+ : CXFA_Data(pNode), m_bDefValue(bDefValue) {}
+
+int32_t CXFA_Image::GetAspect() {
+ return m_pNode->GetEnum(XFA_ATTRIBUTE_Aspect);
+}
+
+FX_BOOL CXFA_Image::GetContentType(CFX_WideString& wsContentType) {
+ return m_pNode->TryCData(XFA_ATTRIBUTE_ContentType, wsContentType);
+}
+
+FX_BOOL CXFA_Image::GetHref(CFX_WideString& wsHref) {
+ if (m_bDefValue)
+ return m_pNode->TryCData(XFA_ATTRIBUTE_Href, wsHref);
+ return m_pNode->GetAttribute(FX_WSTRC(L"href"), wsHref);
+}
+
+int32_t CXFA_Image::GetTransferEncoding() {
+ if (m_bDefValue)
+ return m_pNode->GetEnum(XFA_ATTRIBUTE_TransferEncoding);
+ return XFA_ATTRIBUTEENUM_Base64;
+}
+
+FX_BOOL CXFA_Image::GetContent(CFX_WideString& wsText) {
+ return m_pNode->TryContent(wsText);
+}
+
+FX_BOOL CXFA_Image::SetContentType(const CFX_WideString& wsContentType) {
+ return m_pNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
+}
+
+FX_BOOL CXFA_Image::SetHref(const CFX_WideString& wsHref) {
+ if (m_bDefValue)
+ return m_pNode->SetCData(XFA_ATTRIBUTE_Href, wsHref);
+ return m_pNode->SetAttribute(XFA_ATTRIBUTE_Href, wsHref.AsWideStringC());
+}
+
+FX_BOOL CXFA_Image::SetTransferEncoding(int32_t iTransferEncoding) {
+ if (m_bDefValue) {
+ return m_pNode->SetEnum(XFA_ATTRIBUTE_TransferEncoding,
+ (XFA_ATTRIBUTEENUM)iTransferEncoding);
+ }
+ return TRUE;
+}
diff --git a/xfa/fxfa/parser/cxfa_image.h b/xfa/fxfa/parser/cxfa_image.h
new file mode 100644
index 0000000000..9f8b3bb228
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_image.h
@@ -0,0 +1,33 @@
+// Copyright 2016 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_IMAGE_H_
+#define XFA_FXFA_PARSER_CXFA_IMAGE_H_
+
+#include "core/fxcrt/include/fx_string.h"
+#include "core/fxcrt/include/fx_system.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+
+class CXFA_Node;
+
+class CXFA_Image : public CXFA_Data {
+ public:
+ CXFA_Image(CXFA_Node* pNode, FX_BOOL bDefValue);
+
+ int32_t GetAspect();
+ FX_BOOL GetContentType(CFX_WideString& wsContentType);
+ FX_BOOL GetHref(CFX_WideString& wsHref);
+ int32_t GetTransferEncoding();
+ FX_BOOL GetContent(CFX_WideString& wsText);
+ FX_BOOL SetContentType(const CFX_WideString& wsContentType);
+ FX_BOOL SetHref(const CFX_WideString& wsHref);
+ FX_BOOL SetTransferEncoding(int32_t iTransferEncoding);
+
+ protected:
+ FX_BOOL m_bDefValue;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_IMAGE_H_
diff --git a/xfa/fxfa/parser/cxfa_line.cpp b/xfa/fxfa/parser/cxfa_line.cpp
new file mode 100644
index 0000000000..07ca6d7a69
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_line.cpp
@@ -0,0 +1,22 @@
+// Copyright 2016 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_line.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+int32_t CXFA_Line::GetHand() {
+ return m_pNode->GetEnum(XFA_ATTRIBUTE_Hand);
+}
+
+FX_BOOL CXFA_Line::GetSlop() {
+ XFA_ATTRIBUTEENUM eSlop = m_pNode->GetEnum(XFA_ATTRIBUTE_Slope);
+ return eSlop == XFA_ATTRIBUTEENUM_Slash;
+}
+
+CXFA_Edge CXFA_Line::GetEdge() {
+ return CXFA_Edge(m_pNode->GetChild(0, XFA_ELEMENT_Edge));
+}
diff --git a/xfa/fxfa/parser/cxfa_line.h b/xfa/fxfa/parser/cxfa_line.h
new file mode 100644
index 0000000000..3807604853
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_line.h
@@ -0,0 +1,25 @@
+// Copyright 2016 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_LINE_H_
+#define XFA_FXFA_PARSER_CXFA_LINE_H_
+
+#include "core/fxcrt/include/fx_system.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+#include "xfa/fxfa/parser/cxfa_edge.h"
+
+class CXFA_Node;
+
+class CXFA_Line : public CXFA_Data {
+ public:
+ explicit CXFA_Line(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+ int32_t GetHand();
+ FX_BOOL GetSlop();
+ CXFA_Edge GetEdge();
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_LINE_H_
diff --git a/xfa/fxfa/parser/cxfa_margin.cpp b/xfa/fxfa/parser/cxfa_margin.cpp
new file mode 100644
index 0000000000..c3ced3df93
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_margin.cpp
@@ -0,0 +1,32 @@
+// Copyright 2016 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_margin.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_Margin::CXFA_Margin(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+FX_BOOL CXFA_Margin::GetLeftInset(FX_FLOAT& fInset, FX_FLOAT fDefInset) const {
+ fInset = fDefInset;
+ return TryMeasure(XFA_ATTRIBUTE_LeftInset, fInset);
+}
+
+FX_BOOL CXFA_Margin::GetTopInset(FX_FLOAT& fInset, FX_FLOAT fDefInset) const {
+ fInset = fDefInset;
+ return TryMeasure(XFA_ATTRIBUTE_TopInset, fInset);
+}
+
+FX_BOOL CXFA_Margin::GetRightInset(FX_FLOAT& fInset, FX_FLOAT fDefInset) const {
+ fInset = fDefInset;
+ return TryMeasure(XFA_ATTRIBUTE_RightInset, fInset);
+}
+
+FX_BOOL CXFA_Margin::GetBottomInset(FX_FLOAT& fInset,
+ FX_FLOAT fDefInset) const {
+ fInset = fDefInset;
+ return TryMeasure(XFA_ATTRIBUTE_BottomInset, fInset);
+}
diff --git a/xfa/fxfa/parser/cxfa_margin.h b/xfa/fxfa/parser/cxfa_margin.h
new file mode 100644
index 0000000000..ecfc628b89
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_margin.h
@@ -0,0 +1,25 @@
+// Copyright 2016 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_MARGIN_H_
+#define XFA_FXFA_PARSER_CXFA_MARGIN_H_
+
+#include "core/fxcrt/include/fx_system.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+
+class CXFA_Node;
+
+class CXFA_Margin : public CXFA_Data {
+ public:
+ explicit CXFA_Margin(CXFA_Node* pNode);
+
+ FX_BOOL GetLeftInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const;
+ FX_BOOL GetTopInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const;
+ FX_BOOL GetRightInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const;
+ FX_BOOL GetBottomInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_MARGIN_H_
diff --git a/xfa/fxfa/parser/cxfa_occur.cpp b/xfa/fxfa/parser/cxfa_occur.cpp
new file mode 100644
index 0000000000..6d105abec6
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_occur.cpp
@@ -0,0 +1,67 @@
+// Copyright 2016 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_occur.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_Occur::CXFA_Occur(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+int32_t CXFA_Occur::GetMax() {
+ int32_t iMax = 1;
+ if (m_pNode) {
+ if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, TRUE))
+ iMax = GetMin();
+ }
+ return iMax;
+}
+
+int32_t CXFA_Occur::GetMin() {
+ int32_t iMin = 1;
+ if (m_pNode) {
+ if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, TRUE) || iMin < 0)
+ iMin = 1;
+ }
+ return iMin;
+}
+
+FX_BOOL CXFA_Occur::GetOccurInfo(int32_t& iMin, int32_t& iMax, int32_t& iInit) {
+ if (!m_pNode)
+ return FALSE;
+ if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, FALSE) || iMin < 0)
+ iMin = 1;
+ if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, FALSE)) {
+ if (iMin == 0)
+ iMax = 1;
+ else
+ iMax = iMin;
+ }
+ if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Initial, iInit, FALSE) ||
+ iInit < iMin) {
+ iInit = iMin;
+ }
+ return TRUE;
+}
+
+void CXFA_Occur::SetMax(int32_t iMax) {
+ iMax = (iMax != -1 && iMax < 1) ? 1 : iMax;
+ m_pNode->SetInteger(XFA_ATTRIBUTE_Max, iMax, FALSE);
+ int32_t iMin = GetMin();
+ if (iMax != -1 && iMax < iMin) {
+ iMin = iMax;
+ m_pNode->SetInteger(XFA_ATTRIBUTE_Min, iMin, FALSE);
+ }
+}
+
+void CXFA_Occur::SetMin(int32_t iMin) {
+ iMin = (iMin < 0) ? 1 : iMin;
+ m_pNode->SetInteger(XFA_ATTRIBUTE_Min, iMin, FALSE);
+ int32_t iMax = GetMax();
+ if (iMax > 0 && iMax < iMin) {
+ iMax = iMin;
+ m_pNode->SetInteger(XFA_ATTRIBUTE_Max, iMax, FALSE);
+ }
+}
diff --git a/xfa/fxfa/parser/cxfa_occur.h b/xfa/fxfa/parser/cxfa_occur.h
new file mode 100644
index 0000000000..0f10540b92
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_occur.h
@@ -0,0 +1,26 @@
+// Copyright 2016 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_OCCUR_H_
+#define XFA_FXFA_PARSER_CXFA_OCCUR_H_
+
+#include "core/fxcrt/include/fx_system.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+
+class CXFA_Node;
+
+class CXFA_Occur : public CXFA_Data {
+ public:
+ explicit CXFA_Occur(CXFA_Node* pNode);
+
+ int32_t GetMax();
+ int32_t GetMin();
+ FX_BOOL GetOccurInfo(int32_t& iMin, int32_t& iMax, int32_t& iInit);
+ void SetMax(int32_t iMax);
+ void SetMin(int32_t iMin);
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_OCCUR_H_
diff --git a/xfa/fxfa/parser/cxfa_para.cpp b/xfa/fxfa/parser/cxfa_para.cpp
new file mode 100644
index 0000000000..4f4a169666
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_para.cpp
@@ -0,0 +1,59 @@
+// Copyright 2016 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_para.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_Para::CXFA_Para(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+int32_t CXFA_Para::GetHorizontalAlign() {
+ XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Left;
+ m_pNode->TryEnum(XFA_ATTRIBUTE_HAlign, eAttr);
+ return eAttr;
+}
+
+int32_t CXFA_Para::GetVerticalAlign() {
+ XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Top;
+ m_pNode->TryEnum(XFA_ATTRIBUTE_VAlign, eAttr);
+ return eAttr;
+}
+
+FX_FLOAT CXFA_Para::GetLineHeight() {
+ CXFA_Measurement ms;
+ m_pNode->TryMeasure(XFA_ATTRIBUTE_LineHeight, ms);
+ return ms.ToUnit(XFA_UNIT_Pt);
+}
+
+FX_FLOAT CXFA_Para::GetMarginLeft() {
+ CXFA_Measurement ms;
+ m_pNode->TryMeasure(XFA_ATTRIBUTE_MarginLeft, ms);
+ return ms.ToUnit(XFA_UNIT_Pt);
+}
+
+FX_FLOAT CXFA_Para::GetMarginRight() {
+ CXFA_Measurement ms;
+ m_pNode->TryMeasure(XFA_ATTRIBUTE_MarginRight, ms);
+ return ms.ToUnit(XFA_UNIT_Pt);
+}
+
+FX_FLOAT CXFA_Para::GetSpaceAbove() {
+ CXFA_Measurement ms;
+ m_pNode->TryMeasure(XFA_ATTRIBUTE_SpaceAbove, ms);
+ return ms.ToUnit(XFA_UNIT_Pt);
+}
+
+FX_FLOAT CXFA_Para::GetSpaceBelow() {
+ CXFA_Measurement ms;
+ m_pNode->TryMeasure(XFA_ATTRIBUTE_SpaceBelow, ms);
+ return ms.ToUnit(XFA_UNIT_Pt);
+}
+
+FX_FLOAT CXFA_Para::GetTextIndent() {
+ CXFA_Measurement ms;
+ m_pNode->TryMeasure(XFA_ATTRIBUTE_TextIndent, ms);
+ return ms.ToUnit(XFA_UNIT_Pt);
+}
diff --git a/xfa/fxfa/parser/cxfa_para.h b/xfa/fxfa/parser/cxfa_para.h
new file mode 100644
index 0000000000..109d05d2f0
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_para.h
@@ -0,0 +1,29 @@
+// Copyright 2016 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_PARA_H_
+#define XFA_FXFA_PARSER_CXFA_PARA_H_
+
+#include "core/fxcrt/include/fx_system.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+
+class CXFA_Node;
+
+class CXFA_Para : public CXFA_Data {
+ public:
+ explicit CXFA_Para(CXFA_Node* pNode);
+
+ int32_t GetHorizontalAlign();
+ int32_t GetVerticalAlign();
+ FX_FLOAT GetLineHeight();
+ FX_FLOAT GetMarginLeft();
+ FX_FLOAT GetMarginRight();
+ FX_FLOAT GetSpaceAbove();
+ FX_FLOAT GetSpaceBelow();
+ FX_FLOAT GetTextIndent();
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_PARA_H_
diff --git a/xfa/fxfa/parser/cxfa_rectangle.h b/xfa/fxfa/parser/cxfa_rectangle.h
new file mode 100644
index 0000000000..8d18ace0de
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_rectangle.h
@@ -0,0 +1,19 @@
+// Copyright 2016 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_RECTANGLE_H_
+#define XFA_FXFA_PARSER_CXFA_RECTANGLE_H_
+
+#include "xfa/fxfa/parser/cxfa_box.h"
+
+class CXFA_Node;
+
+class CXFA_Rectangle : public CXFA_Box {
+ public:
+ explicit CXFA_Rectangle(CXFA_Node* pNode) : CXFA_Box(pNode) {}
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_RECTANGLE_H_
diff --git a/xfa/fxfa/parser/cxfa_script.cpp b/xfa/fxfa/parser/cxfa_script.cpp
new file mode 100644
index 0000000000..b99d8a3945
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_script.cpp
@@ -0,0 +1,31 @@
+// Copyright 2016 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_script.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_Script::CXFA_Script(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+XFA_SCRIPTTYPE CXFA_Script::GetContentType() {
+ CFX_WideStringC cData;
+ if (m_pNode->TryCData(XFA_ATTRIBUTE_ContentType, cData, FALSE)) {
+ if (cData == FX_WSTRC(L"application/x-javascript"))
+ return XFA_SCRIPTTYPE_Javascript;
+ if (cData == FX_WSTRC(L"application/x-formcalc"))
+ return XFA_SCRIPTTYPE_Formcalc;
+ return XFA_SCRIPTTYPE_Unkown;
+ }
+ return XFA_SCRIPTTYPE_Formcalc;
+}
+
+int32_t CXFA_Script::GetRunAt() {
+ return m_pNode->GetEnum(XFA_ATTRIBUTE_RunAt);
+}
+
+void CXFA_Script::GetExpression(CFX_WideString& wsExpression) {
+ m_pNode->TryContent(wsExpression);
+}
diff --git a/xfa/fxfa/parser/cxfa_script.h b/xfa/fxfa/parser/cxfa_script.h
new file mode 100644
index 0000000000..f265961b07
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_script.h
@@ -0,0 +1,32 @@
+// Copyright 2016 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_SCRIPT_H_
+#define XFA_FXFA_PARSER_CXFA_SCRIPT_H_
+
+#include <stdint.h>
+
+#include "core/fxcrt/include/fx_string.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+
+enum XFA_SCRIPTTYPE {
+ XFA_SCRIPTTYPE_Formcalc = 0,
+ XFA_SCRIPTTYPE_Javascript,
+ XFA_SCRIPTTYPE_Unkown,
+};
+
+class CXFA_Node;
+
+class CXFA_Script : public CXFA_Data {
+ public:
+ explicit CXFA_Script(CXFA_Node* pNode);
+
+ XFA_SCRIPTTYPE GetContentType();
+ int32_t GetRunAt();
+ void GetExpression(CFX_WideString& wsExpression);
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_SCRIPT_H_
diff --git a/xfa/fxfa/parser/cxfa_stroke.cpp b/xfa/fxfa/parser/cxfa_stroke.cpp
new file mode 100644
index 0000000000..ac175bed58
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_stroke.cpp
@@ -0,0 +1,105 @@
+// Copyright 2016 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_stroke.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+int32_t CXFA_Stroke::GetPresence() const {
+ return m_pNode ? m_pNode->GetEnum(XFA_ATTRIBUTE_Presence)
+ : XFA_ATTRIBUTEENUM_Invisible;
+}
+
+int32_t CXFA_Stroke::GetCapType() const {
+ if (!m_pNode)
+ return XFA_ATTRIBUTEENUM_Square;
+ return m_pNode->GetEnum(XFA_ATTRIBUTE_Cap);
+}
+
+int32_t CXFA_Stroke::GetStrokeType() const {
+ return m_pNode ? m_pNode->GetEnum(XFA_ATTRIBUTE_Stroke)
+ : XFA_ATTRIBUTEENUM_Solid;
+}
+
+FX_FLOAT CXFA_Stroke::GetThickness() const {
+ return GetMSThickness().ToUnit(XFA_UNIT_Pt);
+}
+
+CXFA_Measurement CXFA_Stroke::GetMSThickness() const {
+ return m_pNode ? m_pNode->GetMeasure(XFA_ATTRIBUTE_Thickness)
+ : XFA_GetAttributeDefaultValue_Measure(XFA_ELEMENT_Edge,
+ XFA_ATTRIBUTE_Thickness,
+ XFA_XDPPACKET_Form);
+}
+
+void CXFA_Stroke::SetMSThickness(CXFA_Measurement msThinkness) {
+ if (!m_pNode)
+ return;
+
+ m_pNode->SetMeasure(XFA_ATTRIBUTE_Thickness, msThinkness);
+}
+
+FX_ARGB CXFA_Stroke::GetColor() const {
+ if (!m_pNode)
+ return 0xFF000000;
+
+ CXFA_Node* pNode = m_pNode->GetChild(0, XFA_ELEMENT_Color);
+ if (!pNode)
+ return 0xFF000000;
+
+ CFX_WideStringC wsColor;
+ pNode->TryCData(XFA_ATTRIBUTE_Value, wsColor);
+ return CXFA_Data::ToColor(wsColor);
+}
+
+void CXFA_Stroke::SetColor(FX_ARGB argb) {
+ if (!m_pNode)
+ return;
+
+ CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Color);
+ CFX_WideString wsColor;
+ int a;
+ int r;
+ int g;
+ int b;
+ ArgbDecode(argb, a, r, g, b);
+ wsColor.Format(L"%d,%d,%d", r, g, b);
+ pNode->SetCData(XFA_ATTRIBUTE_Value, wsColor);
+}
+
+int32_t CXFA_Stroke::GetJoinType() const {
+ return m_pNode ? m_pNode->GetEnum(XFA_ATTRIBUTE_Join)
+ : XFA_ATTRIBUTEENUM_Square;
+}
+
+FX_BOOL CXFA_Stroke::IsInverted() const {
+ return m_pNode ? m_pNode->GetBoolean(XFA_ATTRIBUTE_Inverted) : FALSE;
+}
+
+FX_FLOAT CXFA_Stroke::GetRadius() const {
+ return m_pNode ? m_pNode->GetMeasure(XFA_ATTRIBUTE_Radius).ToUnit(XFA_UNIT_Pt)
+ : 0;
+}
+
+FX_BOOL CXFA_Stroke::SameStyles(CXFA_Stroke stroke, uint32_t dwFlags) const {
+ if (m_pNode == stroke.GetNode())
+ return TRUE;
+ if (FXSYS_fabs(GetThickness() - stroke.GetThickness()) >= 0.01f)
+ return FALSE;
+ if ((dwFlags & XFA_STROKE_SAMESTYLE_NoPresence) == 0 &&
+ IsVisible() != stroke.IsVisible()) {
+ return FALSE;
+ }
+ if (GetStrokeType() != stroke.GetStrokeType())
+ return FALSE;
+ if (GetColor() != stroke.GetColor())
+ return FALSE;
+ if ((dwFlags & XFA_STROKE_SAMESTYLE_Corner) != 0 &&
+ FXSYS_fabs(GetRadius() - stroke.GetRadius()) >= 0.01f) {
+ return FALSE;
+ }
+ return TRUE;
+}
diff --git a/xfa/fxfa/parser/cxfa_stroke.h b/xfa/fxfa/parser/cxfa_stroke.h
new file mode 100644
index 0000000000..34ec8dd42a
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_stroke.h
@@ -0,0 +1,45 @@
+// Copyright 2016 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_STROKE_H_
+#define XFA_FXFA_PARSER_CXFA_STROKE_H_
+
+#include "core/fxcrt/include/fx_system.h"
+#include "core/fxge/include/fx_dib.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+#include "xfa/include/fxfa/fxfa_basic.h"
+
+enum StrokeSameStyle {
+ XFA_STROKE_SAMESTYLE_NoPresence = 1,
+ XFA_STROKE_SAMESTYLE_Corner = 2
+};
+
+class CXFA_Node;
+
+class CXFA_Stroke : public CXFA_Data {
+ public:
+ explicit CXFA_Stroke(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+ bool IsCorner() const { return GetClassID() == XFA_ELEMENT_Corner; }
+ bool IsEdge() const { return GetClassID() == XFA_ELEMENT_Edge; }
+ bool IsVisible() const { return GetPresence() == XFA_ATTRIBUTEENUM_Visible; }
+ int32_t GetPresence() const;
+ int32_t GetCapType() const;
+ int32_t GetStrokeType() const;
+ FX_FLOAT GetThickness() const;
+ CXFA_Measurement GetMSThickness() const;
+ void SetMSThickness(CXFA_Measurement msThinkness);
+ FX_ARGB GetColor() const;
+ void SetColor(FX_ARGB argb);
+ int32_t GetJoinType() const;
+ FX_BOOL IsInverted() const;
+ FX_FLOAT GetRadius() const;
+ FX_BOOL SameStyles(CXFA_Stroke stroke, uint32_t dwFlags = 0) const;
+};
+
+typedef CFX_ArrayTemplate<CXFA_Stroke> CXFA_StrokeArray;
+
+#endif // XFA_FXFA_PARSER_CXFA_STROKE_H_
diff --git a/xfa/fxfa/parser/cxfa_submit.cpp b/xfa/fxfa/parser/cxfa_submit.cpp
new file mode 100644
index 0000000000..2aa011b0e3
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_submit.cpp
@@ -0,0 +1,27 @@
+// Copyright 2016 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_submit.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_Submit::CXFA_Submit(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+FX_BOOL CXFA_Submit::IsSubmitEmbedPDF() {
+ return m_pNode->GetBoolean(XFA_ATTRIBUTE_EmbedPDF);
+}
+
+int32_t CXFA_Submit::GetSubmitFormat() {
+ return m_pNode->GetEnum(XFA_ATTRIBUTE_Format);
+}
+
+void CXFA_Submit::GetSubmitTarget(CFX_WideStringC& wsTarget) {
+ m_pNode->TryCData(XFA_ATTRIBUTE_Target, wsTarget);
+}
+
+void CXFA_Submit::GetSubmitXDPContent(CFX_WideStringC& wsContent) {
+ m_pNode->TryCData(XFA_ATTRIBUTE_XdpContent, wsContent);
+}
diff --git a/xfa/fxfa/parser/cxfa_submit.h b/xfa/fxfa/parser/cxfa_submit.h
new file mode 100644
index 0000000000..598431102d
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_submit.h
@@ -0,0 +1,26 @@
+// Copyright 2016 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_SUBMIT_H_
+#define XFA_FXFA_PARSER_CXFA_SUBMIT_H_
+
+#include "core/fxcrt/include/fx_string.h"
+#include "core/fxcrt/include/fx_system.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+
+class CXFA_Node;
+
+class CXFA_Submit : public CXFA_Data {
+ public:
+ explicit CXFA_Submit(CXFA_Node* pNode);
+
+ FX_BOOL IsSubmitEmbedPDF();
+ int32_t GetSubmitFormat();
+ void GetSubmitTarget(CFX_WideStringC& wsTarget);
+ void GetSubmitXDPContent(CFX_WideStringC& wsContent);
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_SUBMIT_H_
diff --git a/xfa/fxfa/parser/cxfa_text.cpp b/xfa/fxfa/parser/cxfa_text.cpp
new file mode 100644
index 0000000000..fc7d7aa280
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_text.cpp
@@ -0,0 +1,15 @@
+// Copyright 2016 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_text.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_Text::CXFA_Text(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+void CXFA_Text::GetContent(CFX_WideString& wsText) {
+ m_pNode->TryContent(wsText);
+}
diff --git a/xfa/fxfa/parser/cxfa_text.h b/xfa/fxfa/parser/cxfa_text.h
new file mode 100644
index 0000000000..7467647791
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_text.h
@@ -0,0 +1,22 @@
+// Copyright 2016 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_TEXT_H_
+#define XFA_FXFA_PARSER_CXFA_TEXT_H_
+
+#include "core/fxcrt/include/fx_string.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+
+class CXFA_Node;
+
+class CXFA_Text : public CXFA_Data {
+ public:
+ explicit CXFA_Text(CXFA_Node* pNode);
+
+ void GetContent(CFX_WideString& wsText);
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_TEXT_H_
diff --git a/xfa/fxfa/parser/cxfa_tooltip.cpp b/xfa/fxfa/parser/cxfa_tooltip.cpp
new file mode 100644
index 0000000000..079b365e46
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_tooltip.cpp
@@ -0,0 +1,15 @@
+// Copyright 2016 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_tooltip.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_ToolTip::CXFA_ToolTip(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+FX_BOOL CXFA_ToolTip::GetTip(CFX_WideString& wsTip) {
+ return m_pNode->TryContent(wsTip);
+}
diff --git a/xfa/fxfa/parser/cxfa_tooltip.h b/xfa/fxfa/parser/cxfa_tooltip.h
new file mode 100644
index 0000000000..af1791e2ec
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_tooltip.h
@@ -0,0 +1,22 @@
+// Copyright 2016 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_TOOLTIP_H_
+#define XFA_FXFA_PARSER_CXFA_TOOLTIP_H_
+
+#include "core/fxcrt/include/fx_string.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+
+class CXFA_Node;
+
+class CXFA_ToolTip : public CXFA_Data {
+ public:
+ explicit CXFA_ToolTip(CXFA_Node* pNode);
+
+ FX_BOOL GetTip(CFX_WideString& wsTip);
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_TOOLTIP_H_
diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp
new file mode 100644
index 0000000000..d226cbf52a
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_validate.cpp
@@ -0,0 +1,119 @@
+// Copyright 2016 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_validate.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+CXFA_Validate::CXFA_Validate(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+int32_t CXFA_Validate::GetFormatTest() {
+ return m_pNode->GetEnum(XFA_ATTRIBUTE_FormatTest);
+}
+
+FX_BOOL CXFA_Validate::SetTestValue(int32_t iType,
+ CFX_WideString& wsValue,
+ XFA_ATTRIBUTEENUM eName) {
+ const XFA_ATTRIBUTEENUMINFO* pInfo =
+ XFA_GetAttributeEnumByName(wsValue.AsWideStringC());
+ if (pInfo)
+ eName = pInfo->eName;
+
+ m_pNode->SetEnum((XFA_ATTRIBUTE)iType, eName, FALSE);
+ return TRUE;
+}
+
+FX_BOOL CXFA_Validate::SetNullTest(CFX_WideString wsValue) {
+ return SetTestValue(XFA_ATTRIBUTE_NullTest, wsValue,
+ XFA_ATTRIBUTEENUM_Disabled);
+}
+
+int32_t CXFA_Validate::GetNullTest() {
+ return m_pNode->GetEnum(XFA_ATTRIBUTE_NullTest);
+}
+
+int32_t CXFA_Validate::GetScriptTest() {
+ return m_pNode->GetEnum(XFA_ATTRIBUTE_ScriptTest);
+}
+
+void CXFA_Validate::GetMessageText(CFX_WideString& wsMessage,
+ const CFX_WideStringC& wsMessageType) {
+ CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Message, FALSE);
+ if (!pNode)
+ return;
+
+ CXFA_Node* pItemNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ for (; pItemNode;
+ pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ if (pItemNode->GetClassID() != XFA_ELEMENT_Text)
+ continue;
+
+ CFX_WideStringC wsName;
+ pItemNode->TryCData(XFA_ATTRIBUTE_Name, wsName);
+ if (wsName.IsEmpty() || wsName == wsMessageType) {
+ pItemNode->TryContent(wsMessage);
+ return;
+ }
+ }
+}
+
+void CXFA_Validate::SetFormatMessageText(CFX_WideString wsMessage) {
+ SetMessageText(wsMessage, FX_WSTRC(L"formatTest"));
+}
+
+void CXFA_Validate::GetFormatMessageText(CFX_WideString& wsMessage) {
+ GetMessageText(wsMessage, FX_WSTRC(L"formatTest"));
+}
+
+void CXFA_Validate::SetNullMessageText(CFX_WideString wsMessage) {
+ SetMessageText(wsMessage, FX_WSTRC(L"nullTest"));
+}
+
+void CXFA_Validate::GetNullMessageText(CFX_WideString& wsMessage) {
+ GetMessageText(wsMessage, FX_WSTRC(L"nullTest"));
+}
+
+void CXFA_Validate::SetMessageText(CFX_WideString& wsMessage,
+ const CFX_WideStringC& wsMessageType) {
+ CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Message, TRUE);
+ if (!pNode)
+ return;
+
+ CXFA_Node* pItemNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ for (; pItemNode;
+ pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ if (pItemNode->GetClassID() != XFA_ELEMENT_Text)
+ continue;
+
+ CFX_WideStringC wsName;
+ pItemNode->TryCData(XFA_ATTRIBUTE_Name, wsName);
+ if (wsName.IsEmpty() || wsName == wsMessageType) {
+ pItemNode->SetContent(wsMessage, wsMessage, FALSE);
+ return;
+ }
+ }
+ CXFA_Node* pTextNode = pNode->CreateSamePacketNode(XFA_ELEMENT_Text);
+ pNode->InsertChild(pTextNode);
+ pTextNode->SetCData(XFA_ATTRIBUTE_Name, wsMessageType, FALSE);
+ pTextNode->SetContent(wsMessage, wsMessage, FALSE);
+}
+
+void CXFA_Validate::GetScriptMessageText(CFX_WideString& wsMessage) {
+ GetMessageText(wsMessage, FX_WSTRC(L"scriptTest"));
+}
+
+void CXFA_Validate::SetScriptMessageText(CFX_WideString wsMessage) {
+ SetMessageText(wsMessage, FX_WSTRC(L"scriptTest"));
+}
+
+void CXFA_Validate::GetPicture(CFX_WideString& wsPicture) {
+ if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_ELEMENT_Picture))
+ pNode->TryContent(wsPicture);
+}
+
+CXFA_Script CXFA_Validate::GetScript() {
+ return CXFA_Script(m_pNode->GetChild(0, XFA_ELEMENT_Script));
+}
diff --git a/xfa/fxfa/parser/cxfa_validate.h b/xfa/fxfa/parser/cxfa_validate.h
new file mode 100644
index 0000000000..aab5de3466
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_validate.h
@@ -0,0 +1,44 @@
+// Copyright 2016 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_VALIDATE_H_
+#define XFA_FXFA_PARSER_CXFA_VALIDATE_H_
+
+#include "core/fxcrt/include/fx_string.h"
+#include "core/fxcrt/include/fx_system.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+#include "xfa/fxfa/parser/cxfa_script.h"
+
+class CXFA_Node;
+
+class CXFA_Validate : public CXFA_Data {
+ public:
+ explicit CXFA_Validate(CXFA_Node* pNode);
+
+ int32_t GetFormatTest();
+ int32_t GetNullTest();
+ FX_BOOL SetNullTest(CFX_WideString wsValue);
+ int32_t GetScriptTest();
+ void GetFormatMessageText(CFX_WideString& wsMessage);
+ void SetFormatMessageText(CFX_WideString wsMessage);
+ void GetNullMessageText(CFX_WideString& wsMessage);
+ void SetNullMessageText(CFX_WideString wsMessage);
+ void GetScriptMessageText(CFX_WideString& wsMessage);
+ void SetScriptMessageText(CFX_WideString wsMessage);
+ void GetPicture(CFX_WideString& wsPicture);
+ CXFA_Script GetScript();
+
+ protected:
+ void GetMessageText(CFX_WideString& wsMessage,
+ const CFX_WideStringC& wsMessageType);
+ void SetMessageText(CFX_WideString& wsMessage,
+ const CFX_WideStringC& wsMessageType);
+ FX_BOOL SetTestValue(int32_t iType,
+ CFX_WideString& wsValue,
+ XFA_ATTRIBUTEENUM eName);
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_VALIDATE_H_
diff --git a/xfa/fxfa/parser/cxfa_value.cpp b/xfa/fxfa/parser/cxfa_value.cpp
new file mode 100644
index 0000000000..1e41ab27d3
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_value.cpp
@@ -0,0 +1,56 @@
+// Copyright 2016 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_value.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+XFA_ELEMENT CXFA_Value::GetChildValueClassID() {
+ if (!m_pNode)
+ return XFA_ELEMENT_UNKNOWN;
+ if (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild))
+ return pNode->GetClassID();
+ return XFA_ELEMENT_UNKNOWN;
+}
+
+FX_BOOL CXFA_Value::GetChildValueContent(CFX_WideString& wsContent) {
+ if (!m_pNode)
+ return FALSE;
+ if (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild))
+ return pNode->TryContent(wsContent);
+ return FALSE;
+}
+
+CXFA_Arc CXFA_Value::GetArc() {
+ return CXFA_Arc(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)
+ : nullptr);
+}
+
+CXFA_Line CXFA_Value::GetLine() {
+ return CXFA_Line(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)
+ : nullptr);
+}
+
+CXFA_Rectangle CXFA_Value::GetRectangle() {
+ return CXFA_Rectangle(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)
+ : nullptr);
+}
+
+CXFA_Text CXFA_Value::GetText() {
+ return CXFA_Text(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)
+ : nullptr);
+}
+
+CXFA_ExData CXFA_Value::GetExData() {
+ return CXFA_ExData(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)
+ : nullptr);
+}
+
+CXFA_Image CXFA_Value::GetImage() {
+ return CXFA_Image(
+ m_pNode ? (m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) : nullptr,
+ TRUE);
+}
diff --git a/xfa/fxfa/parser/cxfa_value.h b/xfa/fxfa/parser/cxfa_value.h
new file mode 100644
index 0000000000..5c9a684828
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_value.h
@@ -0,0 +1,35 @@
+// Copyright 2016 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_VALUE_H_
+#define XFA_FXFA_PARSER_CXFA_VALUE_H_
+
+#include "core/fxcrt/include/fx_string.h"
+#include "xfa/fxfa/parser/cxfa_arc.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+#include "xfa/fxfa/parser/cxfa_exdata.h"
+#include "xfa/fxfa/parser/cxfa_image.h"
+#include "xfa/fxfa/parser/cxfa_line.h"
+#include "xfa/fxfa/parser/cxfa_rectangle.h"
+#include "xfa/fxfa/parser/cxfa_text.h"
+
+class CXFA_Node;
+
+class CXFA_Value : public CXFA_Data {
+ public:
+ explicit CXFA_Value(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+
+ XFA_ELEMENT GetChildValueClassID();
+ FX_BOOL GetChildValueContent(CFX_WideString& wsContent);
+ CXFA_Arc GetArc();
+ CXFA_Line GetLine();
+ CXFA_Rectangle GetRectangle();
+ CXFA_Text GetText();
+ CXFA_ExData GetExData();
+ CXFA_Image GetImage();
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_VALUE_H_
diff --git a/xfa/fxfa/parser/xfa_objectacc_imp.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index c0f281dc24..af714fdd7a 100644
--- a/xfa/fxfa/parser/xfa_objectacc_imp.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -1,938 +1,153 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2016 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_widgetdata.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_event.h"
+#include "xfa/fxfa/parser/xfa_document.h"
#include "core/fxcrt/include/fx_ext.h"
-#include "xfa/fxbarcode/include/BC_Library.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
-#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
-#include "xfa/fxfa/parser/xfa_docdata.h"
-#include "xfa/fxfa/parser/xfa_doclayout.h"
-#include "xfa/fxfa/parser/xfa_document.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
+#include "xfa/fxbarcode/include/BC_Library.h"
#include "xfa/fxfa/parser/xfa_localevalue.h"
-#include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
-#include "xfa/fxfa/parser/xfa_script.h"
-#include "xfa/fxfa/parser/xfa_utils.h"
-
-static FX_ARGB XFA_WStringToColor(const CFX_WideStringC& wsValue) {
- uint8_t r = 0, g = 0, b = 0;
- if (wsValue.GetLength() == 0) {
- return 0xff000000;
- }
- int cc = 0;
- const FX_WCHAR* str = wsValue.c_str();
- int len = wsValue.GetLength();
- while (XFA_IsSpace(str[cc]) && cc < len) {
- cc++;
- }
- if (cc >= len) {
- return 0xff000000;
- }
- while (cc < len) {
- if (str[cc] == ',' || !XFA_IsDigit(str[cc])) {
- break;
- }
- r = r * 10 + str[cc] - '0';
- cc++;
- }
- if (cc < len && str[cc] == ',') {
- cc++;
- while (XFA_IsSpace(str[cc]) && cc < len) {
- cc++;
- }
- while (cc < len) {
- if (str[cc] == ',' || !XFA_IsDigit(str[cc])) {
- break;
- }
- g = g * 10 + str[cc] - '0';
- cc++;
- }
- if (cc < len && str[cc] == ',') {
- cc++;
- while (XFA_IsSpace(str[cc]) && cc < len) {
- cc++;
- }
- while (cc < len) {
- if (str[cc] == ',' || !XFA_IsDigit(str[cc])) {
- break;
- }
- b = b * 10 + str[cc] - '0';
- cc++;
- }
- }
- }
- return (0xff << 24) | (r << 16) | (g << 8) | b;
-}
-XFA_ELEMENT CXFA_Data::GetClassID() const {
- return m_pNode ? m_pNode->GetClassID() : XFA_ELEMENT_UNKNOWN;
-}
-FX_BOOL CXFA_Data::TryMeasure(XFA_ATTRIBUTE eAttr,
- FX_FLOAT& fValue,
- FX_BOOL bUseDefault) const {
- CXFA_Measurement ms;
- if (m_pNode->TryMeasure(eAttr, ms, bUseDefault)) {
- fValue = ms.ToUnit(XFA_UNIT_Pt);
- return TRUE;
- }
- return FALSE;
-}
-FX_BOOL CXFA_Data::SetMeasure(XFA_ATTRIBUTE eAttr, FX_FLOAT fValue) {
- CXFA_Measurement ms(fValue, XFA_UNIT_Pt);
- return m_pNode->SetMeasure(eAttr, ms);
-}
-CXFA_Fill::CXFA_Fill(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-CXFA_Fill::~CXFA_Fill() {}
-int32_t CXFA_Fill::GetPresence() {
- return m_pNode->GetEnum(XFA_ATTRIBUTE_Presence);
-}
-void CXFA_Fill::SetColor(FX_ARGB color) {
- CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Color);
- CFX_WideString wsColor;
- int a, r, g, b;
- ArgbDecode(color, a, r, g, b);
- wsColor.Format(L"%d,%d,%d", r, g, b);
- pNode->SetCData(XFA_ATTRIBUTE_Value, wsColor);
-}
-FX_ARGB CXFA_Fill::GetColor(FX_BOOL bText) {
- if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_ELEMENT_Color)) {
- CFX_WideStringC wsColor;
- if (pNode->TryCData(XFA_ATTRIBUTE_Value, wsColor, FALSE)) {
- return XFA_WStringToColor(wsColor);
- }
- }
- if (bText) {
- return 0xFF000000;
- }
- return 0xFFFFFFFF;
-}
-int32_t CXFA_Fill::GetFillType() {
- CXFA_Node* pChild = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- while (pChild) {
- int32_t eType = pChild->GetClassID();
- if (eType != XFA_ELEMENT_Color && eType != XFA_ELEMENT_Extras) {
- return eType;
- }
- pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
- }
- return XFA_ELEMENT_Solid;
-}
-int32_t CXFA_Fill::GetPattern(FX_ARGB& foreColor) {
- CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Pattern);
- if (CXFA_Node* pColor = pNode->GetChild(0, XFA_ELEMENT_Color)) {
- CFX_WideStringC wsColor;
- pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, FALSE);
- foreColor = XFA_WStringToColor(wsColor);
- } else {
- foreColor = 0xFF000000;
- }
- return pNode->GetEnum(XFA_ATTRIBUTE_Type);
-}
-int32_t CXFA_Fill::GetStipple(FX_ARGB& stippleColor) {
- CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Stipple);
- int32_t eAttr = 50;
- pNode->TryInteger(XFA_ATTRIBUTE_Rate, eAttr);
- if (CXFA_Node* pColor = pNode->GetChild(0, XFA_ELEMENT_Color)) {
- CFX_WideStringC wsColor;
- pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, FALSE);
- stippleColor = XFA_WStringToColor(wsColor);
- } else {
- stippleColor = 0xFF000000;
- }
- return eAttr;
-}
-int32_t CXFA_Fill::GetLinear(FX_ARGB& endColor) {
- CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Linear);
- XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToRight;
- pNode->TryEnum(XFA_ATTRIBUTE_Type, eAttr);
- if (CXFA_Node* pColor = pNode->GetChild(0, XFA_ELEMENT_Color)) {
- CFX_WideStringC wsColor;
- pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, FALSE);
- endColor = XFA_WStringToColor(wsColor);
- } else {
- endColor = 0xFF000000;
- }
- return eAttr;
-}
-int32_t CXFA_Fill::GetRadial(FX_ARGB& endColor) {
- CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Radial);
- XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToEdge;
- pNode->TryEnum(XFA_ATTRIBUTE_Type, eAttr);
- if (CXFA_Node* pColor = pNode->GetChild(0, XFA_ELEMENT_Color)) {
- CFX_WideStringC wsColor;
- pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, FALSE);
- endColor = XFA_WStringToColor(wsColor);
- } else {
- endColor = 0xFF000000;
- }
- return eAttr;
-}
-CXFA_Margin::CXFA_Margin(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-FX_BOOL CXFA_Margin::GetLeftInset(FX_FLOAT& fInset, FX_FLOAT fDefInset) const {
- fInset = fDefInset;
- return TryMeasure(XFA_ATTRIBUTE_LeftInset, fInset);
-}
-FX_BOOL CXFA_Margin::GetTopInset(FX_FLOAT& fInset, FX_FLOAT fDefInset) const {
- fInset = fDefInset;
- return TryMeasure(XFA_ATTRIBUTE_TopInset, fInset);
-}
-FX_BOOL CXFA_Margin::GetRightInset(FX_FLOAT& fInset, FX_FLOAT fDefInset) const {
- fInset = fDefInset;
- return TryMeasure(XFA_ATTRIBUTE_RightInset, fInset);
-}
-FX_BOOL CXFA_Margin::GetBottomInset(FX_FLOAT& fInset,
- FX_FLOAT fDefInset) const {
- fInset = fDefInset;
- return TryMeasure(XFA_ATTRIBUTE_BottomInset, fInset);
-}
-CXFA_Font::CXFA_Font(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-FX_FLOAT CXFA_Font::GetBaselineShift() {
- return m_pNode->GetMeasure(XFA_ATTRIBUTE_BaselineShift).ToUnit(XFA_UNIT_Pt);
-}
-FX_FLOAT CXFA_Font::GetHorizontalScale() {
- CFX_WideString wsValue;
- m_pNode->TryCData(XFA_ATTRIBUTE_FontHorizontalScale, wsValue);
- int32_t iScale = FXSYS_wtoi((const FX_WCHAR*)wsValue);
- return iScale > 0 ? (FX_FLOAT)iScale : 100.0f;
-}
-FX_FLOAT CXFA_Font::GetVerticalScale() {
- CFX_WideString wsValue;
- m_pNode->TryCData(XFA_ATTRIBUTE_FontVerticalScale, wsValue);
- int32_t iScale = FXSYS_wtoi((const FX_WCHAR*)wsValue);
- return iScale > 0 ? (FX_FLOAT)iScale : 100.0f;
-}
-FX_FLOAT CXFA_Font::GetLetterSpacing() {
- CFX_WideStringC wsValue;
- if (!m_pNode->TryCData(XFA_ATTRIBUTE_LetterSpacing, wsValue)) {
- return 0;
- }
- CXFA_Measurement ms(wsValue);
- if (ms.GetUnit() == XFA_UNIT_Em) {
- return ms.GetValue() * GetFontSize();
- }
- return ms.ToUnit(XFA_UNIT_Pt);
-}
-int32_t CXFA_Font::GetLineThrough() {
- int32_t iValue = 0;
- m_pNode->TryInteger(XFA_ATTRIBUTE_LineThrough, iValue);
- return iValue;
-}
-int32_t CXFA_Font::GetUnderline() {
- int32_t iValue = 0;
- m_pNode->TryInteger(XFA_ATTRIBUTE_Underline, iValue);
- return iValue;
-}
-int32_t CXFA_Font::GetUnderlinePeriod() {
- XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_All;
- m_pNode->TryEnum(XFA_ATTRIBUTE_UnderlinePeriod, eAttr);
- return eAttr;
-}
-FX_FLOAT CXFA_Font::GetFontSize() {
- CXFA_Measurement ms;
- m_pNode->TryMeasure(XFA_ATTRIBUTE_Size, ms);
- return ms.ToUnit(XFA_UNIT_Pt);
-}
-void CXFA_Font::GetTypeface(CFX_WideStringC& wsTypeFace) {
- m_pNode->TryCData(XFA_ATTRIBUTE_Typeface, wsTypeFace);
-}
-FX_BOOL CXFA_Font::IsBold() {
- XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Normal;
- m_pNode->TryEnum(XFA_ATTRIBUTE_Weight, eAttr);
- return eAttr == XFA_ATTRIBUTEENUM_Bold;
-}
-FX_BOOL CXFA_Font::IsItalic() {
- XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Normal;
- m_pNode->TryEnum(XFA_ATTRIBUTE_Posture, eAttr);
- return eAttr == XFA_ATTRIBUTEENUM_Italic;
-}
-void CXFA_Font::SetColor(FX_ARGB color) {
- CXFA_Fill fill(m_pNode->GetProperty(0, XFA_ELEMENT_Fill));
- fill.SetColor(color);
-}
-FX_ARGB CXFA_Font::GetColor() {
- CXFA_Fill fill(m_pNode->GetChild(0, XFA_ELEMENT_Fill));
- return fill ? fill.GetColor(TRUE) : 0xFF000000;
-}
-CXFA_Caption::CXFA_Caption(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-int32_t CXFA_Caption::GetPresence() {
- XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Visible;
- m_pNode->TryEnum(XFA_ATTRIBUTE_Presence, eAttr);
- return eAttr;
-}
-int32_t CXFA_Caption::GetPlacementType() {
- XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Left;
- m_pNode->TryEnum(XFA_ATTRIBUTE_Placement, eAttr);
- return eAttr;
-}
-FX_FLOAT CXFA_Caption::GetReserve() {
- CXFA_Measurement ms;
- m_pNode->TryMeasure(XFA_ATTRIBUTE_Reserve, ms);
- return ms.ToUnit(XFA_UNIT_Pt);
-}
-CXFA_Margin CXFA_Caption::GetMargin() {
- return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_ELEMENT_Margin) : NULL);
-}
-CXFA_Font CXFA_Caption::GetFont() {
- return CXFA_Font(m_pNode ? m_pNode->GetChild(0, XFA_ELEMENT_Font) : NULL);
-}
-CXFA_Value CXFA_Caption::GetValue() {
- return CXFA_Value(m_pNode ? m_pNode->GetChild(0, XFA_ELEMENT_Value) : NULL);
-}
-CXFA_Para::CXFA_Para(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-int32_t CXFA_Para::GetHorizontalAlign() {
- XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Left;
- m_pNode->TryEnum(XFA_ATTRIBUTE_HAlign, eAttr);
- return eAttr;
-}
-int32_t CXFA_Para::GetVerticalAlign() {
- XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Top;
- m_pNode->TryEnum(XFA_ATTRIBUTE_VAlign, eAttr);
- return eAttr;
-}
-FX_FLOAT CXFA_Para::GetLineHeight() {
- CXFA_Measurement ms;
- m_pNode->TryMeasure(XFA_ATTRIBUTE_LineHeight, ms);
- return ms.ToUnit(XFA_UNIT_Pt);
-}
-FX_FLOAT CXFA_Para::GetMarginLeft() {
- CXFA_Measurement ms;
- m_pNode->TryMeasure(XFA_ATTRIBUTE_MarginLeft, ms);
- return ms.ToUnit(XFA_UNIT_Pt);
-}
-FX_FLOAT CXFA_Para::GetMarginRight() {
- CXFA_Measurement ms;
- m_pNode->TryMeasure(XFA_ATTRIBUTE_MarginRight, ms);
- return ms.ToUnit(XFA_UNIT_Pt);
-}
-FX_FLOAT CXFA_Para::GetSpaceAbove() {
- CXFA_Measurement ms;
- m_pNode->TryMeasure(XFA_ATTRIBUTE_SpaceAbove, ms);
- return ms.ToUnit(XFA_UNIT_Pt);
-}
-FX_FLOAT CXFA_Para::GetSpaceBelow() {
- CXFA_Measurement ms;
- m_pNode->TryMeasure(XFA_ATTRIBUTE_SpaceBelow, ms);
- return ms.ToUnit(XFA_UNIT_Pt);
-}
-FX_FLOAT CXFA_Para::GetTextIndent() {
- CXFA_Measurement ms;
- m_pNode->TryMeasure(XFA_ATTRIBUTE_TextIndent, ms);
- return ms.ToUnit(XFA_UNIT_Pt);
-}
-CXFA_Event::CXFA_Event(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-int32_t CXFA_Event::GetActivity() {
- return m_pNode->GetEnum(XFA_ATTRIBUTE_Activity);
-}
-int32_t CXFA_Event::GetEventType() {
- CXFA_Node* pChild = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- while (pChild) {
- int32_t eType = pChild->GetClassID();
- if (eType != XFA_ELEMENT_Extras) {
- return eType;
- }
- pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
- }
- return XFA_ELEMENT_UNKNOWN;
-}
-void CXFA_Event::GetRef(CFX_WideStringC& wsRef) {
- m_pNode->TryCData(XFA_ATTRIBUTE_Ref, wsRef);
-}
-CXFA_Script CXFA_Event::GetScript() {
- return CXFA_Script(m_pNode->GetChild(0, XFA_ELEMENT_Script));
-}
-CXFA_Submit CXFA_Event::GetSubmit() {
- return CXFA_Submit(m_pNode->GetChild(0, XFA_ELEMENT_Submit));
-}
-void CXFA_Event::GetSignDataTarget(CFX_WideString& wsTarget) {
- if (CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_SignData)) {
- CFX_WideStringC wsCData;
- pNode->TryCData(XFA_ATTRIBUTE_Target, wsCData);
- wsTarget = wsCData;
- }
-}
-CXFA_Script::CXFA_Script(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-XFA_SCRIPTTYPE CXFA_Script::GetContentType() {
- CFX_WideStringC cData;
- if (m_pNode->TryCData(XFA_ATTRIBUTE_ContentType, cData, FALSE)) {
- if (cData == FX_WSTRC(L"application/x-javascript")) {
- return XFA_SCRIPTTYPE_Javascript;
- } else if (cData == FX_WSTRC(L"application/x-formcalc")) {
- return XFA_SCRIPTTYPE_Formcalc;
- } else {
- return XFA_SCRIPTTYPE_Unkown;
- }
- }
- return XFA_SCRIPTTYPE_Formcalc;
-}
-int32_t CXFA_Script::GetRunAt() {
- return m_pNode->GetEnum(XFA_ATTRIBUTE_RunAt);
-}
-void CXFA_Script::GetExpression(CFX_WideString& wsExpression) {
- m_pNode->TryContent(wsExpression);
-}
-CXFA_Submit::CXFA_Submit(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-FX_BOOL CXFA_Submit::IsSubmitEmbedPDF() {
- return m_pNode->GetBoolean(XFA_ATTRIBUTE_EmbedPDF);
-}
-int32_t CXFA_Submit::GetSubmitFormat() {
- return m_pNode->GetEnum(XFA_ATTRIBUTE_Format);
-}
-void CXFA_Submit::GetSubmitTarget(CFX_WideStringC& wsTarget) {
- m_pNode->TryCData(XFA_ATTRIBUTE_Target, wsTarget);
-}
-void CXFA_Submit::GetSubmitXDPContent(CFX_WideStringC& wsContent) {
- m_pNode->TryCData(XFA_ATTRIBUTE_XdpContent, wsContent);
-}
-XFA_ELEMENT CXFA_Value::GetChildValueClassID() {
- if (!m_pNode) {
- return XFA_ELEMENT_UNKNOWN;
- }
- if (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) {
- return pNode->GetClassID();
- }
- return XFA_ELEMENT_UNKNOWN;
-}
-FX_BOOL CXFA_Value::GetChildValueContent(CFX_WideString& wsContent) {
- if (!m_pNode) {
- return FALSE;
- }
- if (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) {
- return pNode->TryContent(wsContent);
- }
- return FALSE;
-}
-CXFA_Arc CXFA_Value::GetArc() {
- return CXFA_Arc(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)
- : nullptr);
-}
-CXFA_Line CXFA_Value::GetLine() {
- return CXFA_Line(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)
- : nullptr);
-}
-CXFA_Rectangle CXFA_Value::GetRectangle() {
- return CXFA_Rectangle(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)
- : nullptr);
-}
-CXFA_Text CXFA_Value::GetText() {
- return CXFA_Text(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)
- : nullptr);
-}
-CXFA_ExData CXFA_Value::GetExData() {
- return CXFA_ExData(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)
- : nullptr);
-}
-CXFA_Image CXFA_Value::GetImage() {
- return CXFA_Image(
- m_pNode ? (m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) : nullptr,
- TRUE);
-}
-int32_t CXFA_Line::GetHand() {
- return m_pNode->GetEnum(XFA_ATTRIBUTE_Hand);
-}
-FX_BOOL CXFA_Line::GetSlop() {
- XFA_ATTRIBUTEENUM eSlop = m_pNode->GetEnum(XFA_ATTRIBUTE_Slope);
- return eSlop == XFA_ATTRIBUTEENUM_Slash;
-}
-CXFA_Edge CXFA_Line::GetEdge() {
- return CXFA_Edge(m_pNode->GetChild(0, XFA_ELEMENT_Edge));
-}
-CXFA_Text::CXFA_Text(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-void CXFA_Text::GetContent(CFX_WideString& wsText) {
- m_pNode->TryContent(wsText);
-}
-CXFA_ExData::CXFA_ExData(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-FX_BOOL CXFA_ExData::SetContentType(const CFX_WideString& wsContentType) {
- return m_pNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
-}
-CXFA_Image::CXFA_Image(CXFA_Node* pNode, FX_BOOL bDefValue)
- : CXFA_Data(pNode), m_bDefValue(bDefValue) {}
-int32_t CXFA_Image::GetAspect() {
- return m_pNode->GetEnum(XFA_ATTRIBUTE_Aspect);
-}
-FX_BOOL CXFA_Image::GetContentType(CFX_WideString& wsContentType) {
- return m_pNode->TryCData(XFA_ATTRIBUTE_ContentType, wsContentType);
-}
-FX_BOOL CXFA_Image::GetHref(CFX_WideString& wsHref) {
- if (m_bDefValue) {
- return m_pNode->TryCData(XFA_ATTRIBUTE_Href, wsHref);
- }
- return m_pNode->GetAttribute(FX_WSTRC(L"href"), wsHref);
-}
-int32_t CXFA_Image::GetTransferEncoding() {
- if (m_bDefValue) {
- return m_pNode->GetEnum(XFA_ATTRIBUTE_TransferEncoding);
- }
- return XFA_ATTRIBUTEENUM_Base64;
-}
-FX_BOOL CXFA_Image::GetContent(CFX_WideString& wsText) {
- return m_pNode->TryContent(wsText);
-}
-FX_BOOL CXFA_Image::SetContentType(const CFX_WideString& wsContentType) {
- return m_pNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
-}
-FX_BOOL CXFA_Image::SetHref(const CFX_WideString& wsHref) {
- if (m_bDefValue) {
- return m_pNode->SetCData(XFA_ATTRIBUTE_Href, wsHref);
- }
- return m_pNode->SetAttribute(XFA_ATTRIBUTE_Href, wsHref.AsWideStringC());
-}
-FX_BOOL CXFA_Image::SetTransferEncoding(int32_t iTransferEncoding) {
- if (m_bDefValue) {
- return m_pNode->SetEnum(XFA_ATTRIBUTE_TransferEncoding,
- (XFA_ATTRIBUTEENUM)iTransferEncoding);
- }
- return TRUE;
-}
-CXFA_Calculate::CXFA_Calculate(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-int32_t CXFA_Calculate::GetOverride() {
- XFA_ATTRIBUTEENUM eAtt = XFA_ATTRIBUTEENUM_Error;
- m_pNode->TryEnum(XFA_ATTRIBUTE_Override, eAtt, FALSE);
- return eAtt;
-}
-CXFA_Script CXFA_Calculate::GetScript() {
- return CXFA_Script(m_pNode->GetChild(0, XFA_ELEMENT_Script));
-}
-void CXFA_Calculate::GetMessageText(CFX_WideString& wsMessage) {
- if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_ELEMENT_Message)) {
- CXFA_Text text(pNode->GetChild(0, XFA_ELEMENT_Text));
- if (text) {
- text.GetContent(wsMessage);
- }
- }
-}
-CXFA_Validate::CXFA_Validate(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-int32_t CXFA_Validate::GetFormatTest() {
- return m_pNode->GetEnum(XFA_ATTRIBUTE_FormatTest);
-}
-FX_BOOL CXFA_Validate::SetTestValue(int32_t iType,
- CFX_WideString& wsValue,
- XFA_ATTRIBUTEENUM eName) {
- const XFA_ATTRIBUTEENUMINFO* pInfo =
- XFA_GetAttributeEnumByName(wsValue.AsWideStringC());
- if (pInfo) {
- eName = pInfo->eName;
- }
- m_pNode->SetEnum((XFA_ATTRIBUTE)iType, eName, FALSE);
- return TRUE;
-}
-FX_BOOL CXFA_Validate::SetNullTest(CFX_WideString wsValue) {
- return SetTestValue(XFA_ATTRIBUTE_NullTest, wsValue,
- XFA_ATTRIBUTEENUM_Disabled);
-}
-int32_t CXFA_Validate::GetNullTest() {
- return m_pNode->GetEnum(XFA_ATTRIBUTE_NullTest);
-}
-int32_t CXFA_Validate::GetScriptTest() {
- return m_pNode->GetEnum(XFA_ATTRIBUTE_ScriptTest);
-}
-void CXFA_Validate::GetMessageText(CFX_WideString& wsMessage,
- const CFX_WideStringC& wsMessageType) {
- if (CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Message, FALSE)) {
- CXFA_Node* pItemNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- for (; pItemNode;
- pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
- if (pItemNode->GetClassID() != XFA_ELEMENT_Text) {
- continue;
- }
- CFX_WideStringC wsName;
- pItemNode->TryCData(XFA_ATTRIBUTE_Name, wsName);
- if (wsName.IsEmpty() || wsName == wsMessageType) {
- pItemNode->TryContent(wsMessage);
- return;
- }
- }
- }
-}
-void CXFA_Validate::SetFormatMessageText(CFX_WideString wsMessage) {
- SetMessageText(wsMessage, FX_WSTRC(L"formatTest"));
-}
-void CXFA_Validate::GetFormatMessageText(CFX_WideString& wsMessage) {
- GetMessageText(wsMessage, FX_WSTRC(L"formatTest"));
-}
-void CXFA_Validate::SetNullMessageText(CFX_WideString wsMessage) {
- SetMessageText(wsMessage, FX_WSTRC(L"nullTest"));
-}
-void CXFA_Validate::GetNullMessageText(CFX_WideString& wsMessage) {
- GetMessageText(wsMessage, FX_WSTRC(L"nullTest"));
-}
-void CXFA_Validate::SetMessageText(CFX_WideString& wsMessage,
- const CFX_WideStringC& wsMessageType) {
- if (CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Message, TRUE)) {
- CXFA_Node* pItemNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- for (; pItemNode;
- pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
- if (pItemNode->GetClassID() != XFA_ELEMENT_Text) {
- continue;
- }
- CFX_WideStringC wsName;
- pItemNode->TryCData(XFA_ATTRIBUTE_Name, wsName);
- if (wsName.IsEmpty() || wsName == wsMessageType) {
- pItemNode->SetContent(wsMessage, wsMessage, FALSE);
- return;
- }
- }
- CXFA_Node* pTextNode = pNode->CreateSamePacketNode(XFA_ELEMENT_Text);
- pNode->InsertChild(pTextNode);
- pTextNode->SetCData(XFA_ATTRIBUTE_Name, wsMessageType, FALSE);
- pTextNode->SetContent(wsMessage, wsMessage, FALSE);
- }
-}
-void CXFA_Validate::GetScriptMessageText(CFX_WideString& wsMessage) {
- GetMessageText(wsMessage, FX_WSTRC(L"scriptTest"));
-}
-void CXFA_Validate::SetScriptMessageText(CFX_WideString wsMessage) {
- SetMessageText(wsMessage, FX_WSTRC(L"scriptTest"));
-}
-void CXFA_Validate::GetPicture(CFX_WideString& wsPicture) {
- if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_ELEMENT_Picture)) {
- pNode->TryContent(wsPicture);
- }
-}
-CXFA_Script CXFA_Validate::GetScript() {
- return CXFA_Script(m_pNode->GetChild(0, XFA_ELEMENT_Script));
-}
-CXFA_Bind::CXFA_Bind(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-void CXFA_Bind::GetPicture(CFX_WideString& wsPicture) {
- if (CXFA_Node* pPicture = m_pNode->GetChild(0, XFA_ELEMENT_Picture)) {
- pPicture->TryContent(wsPicture);
- }
-}
-CXFA_Assist::CXFA_Assist(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-CXFA_ToolTip CXFA_Assist::GetToolTip() {
- return CXFA_ToolTip(m_pNode->GetChild(0, XFA_ELEMENT_ToolTip));
-}
-CXFA_ToolTip::CXFA_ToolTip(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-FX_BOOL CXFA_ToolTip::GetTip(CFX_WideString& wsTip) {
- return m_pNode->TryContent(wsTip);
-}
-CXFA_BindItems::CXFA_BindItems(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-void CXFA_BindItems::GetLabelRef(CFX_WideStringC& wsLabelRef) {
- m_pNode->TryCData(XFA_ATTRIBUTE_LabelRef, wsLabelRef);
-}
-void CXFA_BindItems::GetValueRef(CFX_WideStringC& wsValueRef) {
- m_pNode->TryCData(XFA_ATTRIBUTE_ValueRef, wsValueRef);
-}
-void CXFA_BindItems::GetRef(CFX_WideStringC& wsRef) {
- m_pNode->TryCData(XFA_ATTRIBUTE_Ref, wsRef);
-}
-FX_BOOL CXFA_BindItems::SetConnection(const CFX_WideString& wsConnection) {
- return m_pNode->SetCData(XFA_ATTRIBUTE_Connection, wsConnection);
-}
-int32_t CXFA_Box::GetHand() const {
- if (!m_pNode) {
- return XFA_ATTRIBUTEENUM_Even;
- }
- return m_pNode->GetEnum(XFA_ATTRIBUTE_Hand);
-}
-int32_t CXFA_Box::GetPresence() const {
- if (!m_pNode) {
- return XFA_ATTRIBUTEENUM_Hidden;
- }
- return m_pNode->GetEnum(XFA_ATTRIBUTE_Presence);
-}
-int32_t CXFA_Box::CountEdges() const {
- if (!m_pNode) {
- return 0;
- }
- return m_pNode->CountChildren(XFA_ELEMENT_Edge);
-}
-CXFA_Edge CXFA_Box::GetEdge(int32_t nIndex) const {
- return CXFA_Edge(
- m_pNode ? m_pNode->GetProperty(nIndex, XFA_ELEMENT_Edge, nIndex == 0)
- : nullptr);
-}
-static void XFA_BOX_GetStrokes(CXFA_Node* pNode,
- CXFA_StrokeArray& strokes,
- FX_BOOL bNULL) {
- strokes.RemoveAll();
- if (!pNode) {
- return;
- }
- strokes.SetSize(8);
- int32_t i, j;
- for (i = 0, j = 0; i < 4; i++) {
- CXFA_Corner corner =
- CXFA_Corner(pNode->GetProperty(i, XFA_ELEMENT_Corner, i == 0));
- if (corner || i == 0) {
- strokes.SetAt(j, corner);
- } else if (bNULL) {
- strokes.SetAt(j, CXFA_Stroke(nullptr));
- } else if (i == 1) {
- strokes.SetAt(j, strokes[0]);
- } else if (i == 2) {
- strokes.SetAt(j, strokes[0]);
- } else {
- strokes.SetAt(j, strokes[2]);
- }
- j++;
- CXFA_Edge edge = CXFA_Edge(pNode->GetProperty(i, XFA_ELEMENT_Edge, i == 0));
- if (edge || i == 0) {
- strokes.SetAt(j, edge);
- } else if (bNULL) {
- strokes.SetAt(j, CXFA_Stroke(nullptr));
- } else if (i == 1) {
- strokes.SetAt(j, strokes[1]);
- } else if (i == 2) {
- strokes.SetAt(j, strokes[1]);
- } else {
- strokes.SetAt(j, strokes[3]);
- }
- j++;
- }
-}
-void CXFA_Box::GetStrokes(CXFA_StrokeArray& strokes) const {
- XFA_BOX_GetStrokes(m_pNode, strokes, FALSE);
-}
-FX_BOOL CXFA_Box::IsCircular() const {
- if (!m_pNode) {
- return FALSE;
+
+namespace {
+
+FX_FLOAT GetEdgeThickness(const CXFA_StrokeArray& strokes,
+ FX_BOOL b3DStyle,
+ int32_t nIndex) {
+ FX_FLOAT fThickness = 0;
+
+ if (strokes[nIndex * 2 + 1].GetPresence() == XFA_ATTRIBUTEENUM_Visible) {
+ if (nIndex == 0)
+ fThickness += 2.5f;
+
+ fThickness += strokes[nIndex * 2 + 1].GetThickness() * (b3DStyle ? 4 : 2);
}
- return m_pNode->GetBoolean(XFA_ATTRIBUTE_Circular);
+ return fThickness;
}
-FX_BOOL CXFA_Box::GetStartAngle(FX_FLOAT& fStartAngle) const {
- fStartAngle = 0;
- if (!m_pNode) {
+
+FX_BOOL SplitDateTime(const CFX_WideString& wsDateTime,
+ CFX_WideString& wsDate,
+ CFX_WideString& wsTime) {
+ wsDate = L"";
+ wsTime = L"";
+ if (wsDateTime.IsEmpty())
return FALSE;
- }
- CXFA_Measurement ms;
- FX_BOOL bRet = m_pNode->TryMeasure(XFA_ATTRIBUTE_StartAngle, ms, FALSE);
- if (bRet) {
- fStartAngle = ms.GetValue();
- }
- return bRet;
-}
-FX_BOOL CXFA_Box::GetSweepAngle(FX_FLOAT& fSweepAngle) const {
- fSweepAngle = 360;
- if (!m_pNode) {
+
+ int nSplitIndex = -1;
+ nSplitIndex = wsDateTime.Find('T');
+ if (nSplitIndex < 0)
+ nSplitIndex = wsDateTime.Find(' ');
+ if (nSplitIndex < 0)
return FALSE;
- }
- CXFA_Measurement ms;
- FX_BOOL bRet = m_pNode->TryMeasure(XFA_ATTRIBUTE_SweepAngle, ms, FALSE);
- if (bRet) {
- fSweepAngle = ms.GetValue();
- }
- return bRet;
-}
-CXFA_Fill CXFA_Box::GetFill(FX_BOOL bModified) const {
- if (!m_pNode) {
- return CXFA_Fill(nullptr);
- }
- CXFA_Node* pFillNode = m_pNode->GetProperty(0, XFA_ELEMENT_Fill, bModified);
- return CXFA_Fill(pFillNode);
-}
-CXFA_Margin CXFA_Box::GetMargin() const {
- return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_ELEMENT_Margin)
- : nullptr);
-}
-static int32_t XFA_BOX_3DStyle(const CXFA_StrokeArray& strokes,
- CXFA_Stroke& stroke) {
- int32_t iCount = strokes.GetSize();
- if (iCount < 1) {
- return 0;
- }
- stroke = strokes[0];
- for (int32_t i = 1; i < iCount; i++) {
- CXFA_Stroke find = strokes[i];
- if (!find) {
- continue;
- }
- if (!stroke) {
- stroke = find;
- } else if (stroke.GetStrokeType() != find.GetStrokeType()) {
- stroke = find;
- break;
+
+ wsDate = wsDateTime.Left(nSplitIndex);
+ if (!wsDate.IsEmpty()) {
+ int32_t iCount = wsDate.GetLength();
+ int32_t i = 0;
+ for (i = 0; i < iCount; i++) {
+ if (wsDate[i] >= '0' && wsDate[i] <= '9')
+ break;
}
+ if (i == iCount)
+ return FALSE;
}
- int32_t iType = stroke.GetStrokeType();
- if (iType == XFA_ATTRIBUTEENUM_Lowered || iType == XFA_ATTRIBUTEENUM_Raised ||
- iType == XFA_ATTRIBUTEENUM_Etched ||
- iType == XFA_ATTRIBUTEENUM_Embossed) {
- return iType;
- }
- return 0;
-}
-int32_t CXFA_Box::Get3DStyle(FX_BOOL& bVisible, FX_FLOAT& fThickness) const {
- if (IsArc()) {
- return 0;
- }
- CXFA_StrokeArray strokes;
- XFA_BOX_GetStrokes(m_pNode, strokes, TRUE);
- CXFA_Stroke stroke(NULL);
- int32_t iType = XFA_BOX_3DStyle(strokes, stroke);
- if (iType) {
- bVisible = stroke.IsVisible();
- fThickness = stroke.GetThickness();
- }
- return iType;
-}
-int32_t CXFA_Stroke::GetPresence() const {
- return m_pNode ? m_pNode->GetEnum(XFA_ATTRIBUTE_Presence)
- : XFA_ATTRIBUTEENUM_Invisible;
-}
-int32_t CXFA_Stroke::GetCapType() const {
- if (!m_pNode) {
- return XFA_ATTRIBUTEENUM_Square;
- }
- return m_pNode->GetEnum(XFA_ATTRIBUTE_Cap);
-}
-int32_t CXFA_Stroke::GetStrokeType() const {
- return m_pNode ? m_pNode->GetEnum(XFA_ATTRIBUTE_Stroke)
- : XFA_ATTRIBUTEENUM_Solid;
-}
-FX_FLOAT CXFA_Stroke::GetThickness() const {
- return GetMSThickness().ToUnit(XFA_UNIT_Pt);
-}
-CXFA_Measurement CXFA_Stroke::GetMSThickness() const {
- return m_pNode ? m_pNode->GetMeasure(XFA_ATTRIBUTE_Thickness)
- : XFA_GetAttributeDefaultValue_Measure(XFA_ELEMENT_Edge,
- XFA_ATTRIBUTE_Thickness,
- XFA_XDPPACKET_Form);
-}
-void CXFA_Stroke::SetMSThickness(CXFA_Measurement msThinkness) {
- if (!m_pNode) {
- return;
- }
- m_pNode->SetMeasure(XFA_ATTRIBUTE_Thickness, msThinkness);
-}
-FX_ARGB CXFA_Stroke::GetColor() const {
- if (!m_pNode) {
- return 0xFF000000;
- }
- CXFA_Node* pNode = m_pNode->GetChild(0, XFA_ELEMENT_Color);
- if (!pNode) {
- return 0xFF000000;
- }
- CFX_WideStringC wsColor;
- pNode->TryCData(XFA_ATTRIBUTE_Value, wsColor);
- return XFA_WStringToColor(wsColor);
-}
-void CXFA_Stroke::SetColor(FX_ARGB argb) {
- if (!m_pNode) {
- return;
- }
- CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Color);
- CFX_WideString wsColor;
- int a, r, g, b;
- ArgbDecode(argb, a, r, g, b);
- wsColor.Format(L"%d,%d,%d", r, g, b);
- pNode->SetCData(XFA_ATTRIBUTE_Value, wsColor);
-}
-int32_t CXFA_Stroke::GetJoinType() const {
- return m_pNode ? m_pNode->GetEnum(XFA_ATTRIBUTE_Join)
- : XFA_ATTRIBUTEENUM_Square;
-}
-FX_BOOL CXFA_Stroke::IsInverted() const {
- return m_pNode ? m_pNode->GetBoolean(XFA_ATTRIBUTE_Inverted) : FALSE;
-}
-FX_FLOAT CXFA_Stroke::GetRadius() const {
- return m_pNode ? m_pNode->GetMeasure(XFA_ATTRIBUTE_Radius).ToUnit(XFA_UNIT_Pt)
- : 0;
-}
-FX_BOOL CXFA_Stroke::SameStyles(CXFA_Stroke stroke, uint32_t dwFlags) const {
- if (m_pNode == stroke.GetNode()) {
- return TRUE;
- }
- if (FXSYS_fabs(GetThickness() - stroke.GetThickness()) >= 0.01f) {
- return FALSE;
- }
- if ((dwFlags & XFA_STROKE_SAMESTYLE_NoPresence) == 0 &&
- IsVisible() != stroke.IsVisible()) {
- return FALSE;
- }
- if (GetStrokeType() != stroke.GetStrokeType()) {
- return FALSE;
- }
- if (GetColor() != stroke.GetColor()) {
- return FALSE;
- }
- if ((dwFlags & XFA_STROKE_SAMESTYLE_Corner) != 0 &&
- FXSYS_fabs(GetRadius() - stroke.GetRadius()) >= 0.01f) {
- return FALSE;
- }
- return TRUE;
-}
-FX_FLOAT XFA_GetEdgeThickness(const CXFA_StrokeArray& strokes,
- FX_BOOL b3DStyle,
- int32_t nIndex) {
- FX_FLOAT fThickness = 0;
- {
- if (strokes[nIndex * 2 + 1].GetPresence() == XFA_ATTRIBUTEENUM_Visible) {
- if (nIndex == 0) {
- fThickness += 2.5f;
- }
- fThickness += strokes[nIndex * 2 + 1].GetThickness() * (b3DStyle ? 4 : 2);
+ wsTime = wsDateTime.Right(wsDateTime.GetLength() - nSplitIndex - 1);
+ if (!wsTime.IsEmpty()) {
+ int32_t iCount = wsTime.GetLength();
+ int32_t i = 0;
+ for (i = 0; i < iCount; i++) {
+ if (wsTime[i] >= '0' && wsTime[i] <= '9')
+ break;
}
+ if (i == iCount)
+ return FALSE;
}
- return fThickness;
+ return TRUE;
}
+
+} // namespace
+
CXFA_WidgetData::CXFA_WidgetData(CXFA_Node* pNode)
: CXFA_Data(pNode),
m_bIsNull(TRUE),
m_bPreNull(TRUE),
m_pUiChildNode(NULL),
m_eUIType(XFA_ELEMENT_UNKNOWN) {}
+
CXFA_Node* CXFA_WidgetData::GetUIChild() {
- if (m_eUIType == XFA_ELEMENT_UNKNOWN) {
+ if (m_eUIType == XFA_ELEMENT_UNKNOWN)
m_pUiChildNode = XFA_CreateUIChild(m_pNode, m_eUIType);
- }
+
return m_pUiChildNode;
}
+
XFA_ELEMENT CXFA_WidgetData::GetUIType() {
GetUIChild();
return m_eUIType;
}
+
CFX_WideString CXFA_WidgetData::GetRawValue() {
return m_pNode->GetContent();
}
+
int32_t CXFA_WidgetData::GetAccess(FX_BOOL bTemplate) {
if (bTemplate) {
CXFA_Node* pNode = m_pNode->GetTemplateNode();
- if (pNode) {
+ if (pNode)
return pNode->GetEnum(XFA_ATTRIBUTE_Access);
- }
return XFA_ATTRIBUTEENUM_Open;
}
CXFA_Node* pNode = m_pNode;
while (pNode) {
int32_t iAcc = pNode->GetEnum(XFA_ATTRIBUTE_Access);
- if (iAcc != XFA_ATTRIBUTEENUM_Open) {
+ if (iAcc != XFA_ATTRIBUTEENUM_Open)
return iAcc;
- }
+
pNode =
pNode->GetNodeItem(XFA_NODEITEM_Parent, XFA_OBJECTTYPE_ContainerNode);
}
return XFA_ATTRIBUTEENUM_Open;
}
+
int32_t CXFA_WidgetData::GetRotate() {
CXFA_Measurement ms;
- if (!m_pNode->TryMeasure(XFA_ATTRIBUTE_Rotate, ms, FALSE)) {
+ if (!m_pNode->TryMeasure(XFA_ATTRIBUTE_Rotate, ms, FALSE))
return 0;
- }
+
int32_t iRotate = FXSYS_round(ms.GetValue());
iRotate = XFA_MapRotation(iRotate);
return iRotate / 90 * 90;
}
+
CXFA_Border CXFA_WidgetData::GetBorder(FX_BOOL bModified) {
return CXFA_Border(m_pNode->GetProperty(0, XFA_ELEMENT_Border, bModified));
}
+
CXFA_Caption CXFA_WidgetData::GetCaption(FX_BOOL bModified) {
return CXFA_Caption(m_pNode->GetProperty(0, XFA_ELEMENT_Caption, bModified));
}
+
CXFA_Font CXFA_WidgetData::GetFont(FX_BOOL bModified) {
return CXFA_Font(m_pNode->GetProperty(0, XFA_ELEMENT_Font, bModified));
}
+
CXFA_Margin CXFA_WidgetData::GetMargin(FX_BOOL bModified) {
return CXFA_Margin(m_pNode->GetProperty(0, XFA_ELEMENT_Margin, bModified));
}
+
CXFA_Para CXFA_WidgetData::GetPara(FX_BOOL bModified) {
return CXFA_Para(m_pNode->GetProperty(0, XFA_ELEMENT_Para, bModified));
}
+
void CXFA_WidgetData::GetEventList(CXFA_NodeArray& events) {
m_pNode->GetNodeList(events, 0, XFA_ELEMENT_Event);
}
+
int32_t CXFA_WidgetData::GetEventByActivity(int32_t iActivity,
CXFA_NodeArray& events,
FX_BOOL bIsFormReady) {
@@ -946,13 +161,11 @@ int32_t CXFA_WidgetData::GetEventByActivity(int32_t iActivity,
CFX_WideStringC wsRef;
event.GetRef(wsRef);
if (bIsFormReady) {
- if (wsRef == CFX_WideStringC(L"$form")) {
+ if (wsRef == CFX_WideStringC(L"$form"))
events.Add(allEvents[i]);
- }
} else {
- if (wsRef == CFX_WideStringC(L"$layout")) {
+ if (wsRef == CFX_WideStringC(L"$layout"))
events.Add(allEvents[i]);
- }
}
} else {
events.Add(allEvents[i]);
@@ -961,69 +174,84 @@ int32_t CXFA_WidgetData::GetEventByActivity(int32_t iActivity,
}
return events.GetSize();
}
+
CXFA_Value CXFA_WidgetData::GetDefaultValue(FX_BOOL bModified) {
CXFA_Node* pTemNode = m_pNode->GetTemplateNode();
return CXFA_Value(pTemNode
? pTemNode->GetProperty(0, XFA_ELEMENT_Value, bModified)
: nullptr);
}
+
CXFA_Value CXFA_WidgetData::GetFormValue(FX_BOOL bModified) {
return CXFA_Value(m_pNode->GetProperty(0, XFA_ELEMENT_Value, bModified));
}
+
CXFA_Calculate CXFA_WidgetData::GetCalculate(FX_BOOL bModified) {
return CXFA_Calculate(
m_pNode->GetProperty(0, XFA_ELEMENT_Calculate, bModified));
}
+
CXFA_Validate CXFA_WidgetData::GetValidate(FX_BOOL bModified) {
return CXFA_Validate(
m_pNode->GetProperty(0, XFA_ELEMENT_Validate, bModified));
}
+
CXFA_Bind CXFA_WidgetData::GetBind(FX_BOOL bModified) {
return CXFA_Bind(m_pNode->GetProperty(0, XFA_ELEMENT_Bind, bModified));
}
+
CXFA_Assist CXFA_WidgetData::GetAssist(FX_BOOL bModified) {
return CXFA_Assist(m_pNode->GetProperty(0, XFA_ELEMENT_Assist, bModified));
}
+
FX_BOOL CXFA_WidgetData::GetWidth(FX_FLOAT& fWidth) {
return TryMeasure(XFA_ATTRIBUTE_W, fWidth);
}
+
FX_BOOL CXFA_WidgetData::GetHeight(FX_FLOAT& fHeight) {
return TryMeasure(XFA_ATTRIBUTE_H, fHeight);
}
+
FX_BOOL CXFA_WidgetData::GetMinWidth(FX_FLOAT& fMinWidth) {
return TryMeasure(XFA_ATTRIBUTE_MinW, fMinWidth);
}
+
FX_BOOL CXFA_WidgetData::GetMinHeight(FX_FLOAT& fMinHeight) {
return TryMeasure(XFA_ATTRIBUTE_MinH, fMinHeight);
}
+
FX_BOOL CXFA_WidgetData::GetMaxWidth(FX_FLOAT& fMaxWidth) {
return TryMeasure(XFA_ATTRIBUTE_MaxW, fMaxWidth);
}
+
FX_BOOL CXFA_WidgetData::GetMaxHeight(FX_FLOAT& fMaxHeight) {
return TryMeasure(XFA_ATTRIBUTE_MaxH, fMaxHeight);
}
+
CXFA_Border CXFA_WidgetData::GetUIBorder(FX_BOOL bModified) {
CXFA_Node* pUIChild = GetUIChild();
return CXFA_Border(
pUIChild ? pUIChild->GetProperty(0, XFA_ELEMENT_Border, bModified)
: nullptr);
}
+
CXFA_Margin CXFA_WidgetData::GetUIMargin(FX_BOOL bModified) {
CXFA_Node* pUIChild = GetUIChild();
return CXFA_Margin(
pUIChild ? pUIChild->GetProperty(0, XFA_ELEMENT_Margin, bModified)
: nullptr);
}
+
void CXFA_WidgetData::GetUIMargin(CFX_RectF& rtUIMargin) {
rtUIMargin.Reset();
CXFA_Margin mgUI = GetUIMargin();
- if (!mgUI) {
+ if (!mgUI)
return;
- }
+
CXFA_Border border = GetUIBorder();
- if (border && border.GetPresence() != XFA_ATTRIBUTEENUM_Visible) {
+ if (border && border.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
return;
- }
+
FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset;
FX_BOOL bLeft = mgUI.GetLeftInset(fLeftInset);
FX_BOOL bTop = mgUI.GetTopInset(fTopInset);
@@ -1036,30 +264,27 @@ void CXFA_WidgetData::GetUIMargin(CFX_RectF& rtUIMargin) {
if (!bLeft || !bTop || !bRight || !bBottom) {
CXFA_StrokeArray strokes;
border.GetStrokes(strokes);
- if (!bTop) {
- fTopInset = XFA_GetEdgeThickness(strokes, bVisible, 0);
- }
- if (!bRight) {
- fRightInset = XFA_GetEdgeThickness(strokes, bVisible, 1);
- }
- if (!bBottom) {
- fBottomInset = XFA_GetEdgeThickness(strokes, bVisible, 2);
- }
- if (!bLeft) {
- fLeftInset = XFA_GetEdgeThickness(strokes, bVisible, 3);
- }
+ if (!bTop)
+ fTopInset = GetEdgeThickness(strokes, bVisible, 0);
+ if (!bRight)
+ fRightInset = GetEdgeThickness(strokes, bVisible, 1);
+ if (!bBottom)
+ fBottomInset = GetEdgeThickness(strokes, bVisible, 2);
+ if (!bLeft)
+ fLeftInset = GetEdgeThickness(strokes, bVisible, 3);
}
}
rtUIMargin.Set(fLeftInset, fTopInset, fRightInset, fBottomInset);
}
+
int32_t CXFA_WidgetData::GetButtonHighlight() {
CXFA_Node* pUIChild = GetUIChild();
- if (pUIChild) {
+ if (pUIChild)
return pUIChild->GetEnum(XFA_ATTRIBUTE_Highlight);
- }
return XFA_GetAttributeDefaultValue_Enum(
XFA_ELEMENT_Button, XFA_ATTRIBUTE_Highlight, XFA_XDPPACKET_Form);
}
+
FX_BOOL CXFA_WidgetData::GetButtonRollover(CFX_WideString& wsRollover,
FX_BOOL& bRichText) {
if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_ELEMENT_Items)) {
@@ -1077,6 +302,7 @@ FX_BOOL CXFA_WidgetData::GetButtonRollover(CFX_WideString& wsRollover,
}
return FALSE;
}
+
FX_BOOL CXFA_WidgetData::GetButtonDown(CFX_WideString& wsDown,
FX_BOOL& bRichText) {
if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_ELEMENT_Items)) {
@@ -1094,64 +320,66 @@ FX_BOOL CXFA_WidgetData::GetButtonDown(CFX_WideString& wsDown,
}
return FALSE;
}
+
int32_t CXFA_WidgetData::GetCheckButtonShape() {
CXFA_Node* pUIChild = GetUIChild();
- if (pUIChild) {
+ if (pUIChild)
return pUIChild->GetEnum(XFA_ATTRIBUTE_Shape);
- }
return XFA_GetAttributeDefaultValue_Enum(
XFA_ELEMENT_CheckButton, XFA_ATTRIBUTE_Shape, XFA_XDPPACKET_Form);
}
+
int32_t CXFA_WidgetData::GetCheckButtonMark() {
CXFA_Node* pUIChild = GetUIChild();
- if (pUIChild) {
+ if (pUIChild)
return pUIChild->GetEnum(XFA_ATTRIBUTE_Mark);
- }
return XFA_GetAttributeDefaultValue_Enum(
XFA_ELEMENT_CheckButton, XFA_ATTRIBUTE_Mark, XFA_XDPPACKET_Form);
}
+
FX_BOOL CXFA_WidgetData::IsRadioButton() {
- if (CXFA_Node* pParent = m_pNode->GetNodeItem(XFA_NODEITEM_Parent)) {
+ if (CXFA_Node* pParent = m_pNode->GetNodeItem(XFA_NODEITEM_Parent))
return pParent->GetClassID() == XFA_ELEMENT_ExclGroup;
- }
return FALSE;
}
+
FX_FLOAT CXFA_WidgetData::GetCheckButtonSize() {
CXFA_Node* pUIChild = GetUIChild();
- if (pUIChild) {
+ if (pUIChild)
return pUIChild->GetMeasure(XFA_ATTRIBUTE_Size).ToUnit(XFA_UNIT_Pt);
- }
return XFA_GetAttributeDefaultValue_Measure(
XFA_ELEMENT_CheckButton, XFA_ATTRIBUTE_Size, XFA_XDPPACKET_Form)
.ToUnit(XFA_UNIT_Pt);
}
+
FX_BOOL CXFA_WidgetData::IsAllowNeutral() {
CXFA_Node* pUIChild = GetUIChild();
- if (pUIChild) {
+ if (pUIChild)
return pUIChild->GetBoolean(XFA_ATTRIBUTE_AllowNeutral);
- }
return XFA_GetAttributeDefaultValue_Boolean(
XFA_ELEMENT_CheckButton, XFA_ATTRIBUTE_AllowNeutral, XFA_XDPPACKET_Form);
}
+
XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() {
CFX_WideString wsValue = GetRawValue();
- if (wsValue.IsEmpty()) {
+ if (wsValue.IsEmpty())
return XFA_CHECKSTATE_Off;
- }
+
if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_ELEMENT_Items)) {
CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild);
int32_t i = 0;
while (pText) {
CFX_WideString wsContent;
- if (pText->TryContent(wsContent) && (wsContent == wsValue)) {
+ if (pText->TryContent(wsContent) && (wsContent == wsValue))
return (XFA_CHECKSTATE)i;
- }
+
i++;
pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling);
}
}
return XFA_CHECKSTATE_Off;
}
+
void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState,
FX_BOOL bNotify) {
CXFA_WidgetData exclGroup(GetExclGroupNode());
@@ -1160,34 +388,32 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState,
if (eCheckState != XFA_CHECKSTATE_Off) {
if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_ELEMENT_Items)) {
CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild);
- if (pText) {
+ if (pText)
pText->TryContent(wsValue);
- }
}
}
CXFA_Node* pChild =
exclGroup.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild);
for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
- if (pChild->GetClassID() != XFA_ELEMENT_Field) {
+ if (pChild->GetClassID() != XFA_ELEMENT_Field)
continue;
- }
+
CXFA_Node* pItem = pChild->GetChild(0, XFA_ELEMENT_Items);
- if (!pItem) {
+ if (!pItem)
continue;
- }
+
CXFA_Node* pItemchild = pItem->GetNodeItem(XFA_NODEITEM_FirstChild);
- if (!pItemchild) {
+ if (!pItemchild)
continue;
- }
+
CFX_WideString text = pItemchild->GetContent();
CFX_WideString wsChildValue = text;
if (wsValue != text) {
pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling);
- if (pItemchild) {
+ if (pItemchild)
wsChildValue = pItemchild->GetContent();
- } else {
+ else
wsChildValue.Empty();
- }
}
CXFA_WidgetData ch(pChild);
ch.SyncValue(wsChildValue, bNotify);
@@ -1195,9 +421,9 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState,
exclGroup.SyncValue(wsValue, bNotify);
} else {
CXFA_Node* pItems = m_pNode->GetChild(0, XFA_ELEMENT_Items);
- if (!pItems) {
+ if (!pItems)
return;
- }
+
int32_t i = -1;
CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild);
CFX_WideString wsContent;
@@ -1212,19 +438,20 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState,
SyncValue(wsContent, bNotify);
}
}
+
CXFA_Node* CXFA_WidgetData::GetExclGroupNode() {
CXFA_Node* pExcl = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_Parent));
- if (!pExcl || pExcl->GetClassID() != XFA_ELEMENT_ExclGroup) {
+ if (!pExcl || pExcl->GetClassID() != XFA_ELEMENT_ExclGroup)
return NULL;
- }
return pExcl;
}
+
CXFA_Node* CXFA_WidgetData::GetSelectedMember() {
CXFA_Node* pSelectedMember = NULL;
CFX_WideString wsState = GetRawValue();
- if (wsState.IsEmpty()) {
+ if (wsState.IsEmpty())
return pSelectedMember;
- }
+
for (CXFA_Node* pNode = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild));
pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
CXFA_WidgetData widgetData(pNode);
@@ -1235,6 +462,7 @@ CXFA_Node* CXFA_WidgetData::GetSelectedMember() {
}
return pSelectedMember;
}
+
CXFA_Node* CXFA_WidgetData::SetSelectedMember(const CFX_WideStringC& wsName,
FX_BOOL bNotify) {
CXFA_Node* pSelectedMember = NULL;
@@ -1251,6 +479,7 @@ CXFA_Node* CXFA_WidgetData::SetSelectedMember(const CFX_WideStringC& wsName,
}
return pSelectedMember;
}
+
void CXFA_WidgetData::SetSelectedMemberByValue(const CFX_WideStringC& wsValue,
FX_BOOL bNotify,
FX_BOOL bScriptModify,
@@ -1258,25 +487,24 @@ void CXFA_WidgetData::SetSelectedMemberByValue(const CFX_WideStringC& wsValue,
CFX_WideString wsExclGroup;
for (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); pNode;
pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
- if (pNode->GetClassID() != XFA_ELEMENT_Field) {
+ if (pNode->GetClassID() != XFA_ELEMENT_Field)
continue;
- }
+
CXFA_Node* pItem = pNode->GetChild(0, XFA_ELEMENT_Items);
- if (!pItem) {
+ if (!pItem)
continue;
- }
+
CXFA_Node* pItemchild = pItem->GetNodeItem(XFA_NODEITEM_FirstChild);
- if (!pItemchild) {
+ if (!pItemchild)
continue;
- }
+
CFX_WideString wsChildValue = pItemchild->GetContent();
if (wsValue != wsChildValue) {
pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling);
- if (pItemchild) {
+ if (pItemchild)
wsChildValue = pItemchild->GetContent();
- } else {
+ else
wsChildValue.Empty();
- }
} else {
wsExclGroup = wsValue;
}
@@ -1288,91 +516,93 @@ void CXFA_WidgetData::SetSelectedMemberByValue(const CFX_WideStringC& wsValue,
bSyncData);
}
}
+
CXFA_Node* CXFA_WidgetData::GetExclGroupFirstMember() {
CXFA_Node* pExcl = GetNode();
- if (!pExcl) {
+ if (!pExcl)
return NULL;
- }
+
CXFA_Node* pNode = pExcl->GetNodeItem(XFA_NODEITEM_FirstChild);
while (pNode) {
- if (pNode->GetClassID() == XFA_ELEMENT_Field) {
+ if (pNode->GetClassID() == XFA_ELEMENT_Field)
return pNode;
- }
+
pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling);
}
return NULL;
}
CXFA_Node* CXFA_WidgetData::GetExclGroupNextMember(CXFA_Node* pNode) {
- if (!pNode) {
+ if (!pNode)
return NULL;
- }
+
CXFA_Node* pNodeField = pNode->GetNodeItem(XFA_NODEITEM_NextSibling);
while (pNodeField) {
- if (pNodeField->GetClassID() == XFA_ELEMENT_Field) {
+ if (pNodeField->GetClassID() == XFA_ELEMENT_Field)
return pNodeField;
- }
+
pNodeField = pNodeField->GetNodeItem(XFA_NODEITEM_NextSibling);
}
return NULL;
}
+
int32_t CXFA_WidgetData::GetChoiceListCommitOn() {
CXFA_Node* pUIChild = GetUIChild();
- if (pUIChild) {
+ if (pUIChild)
return pUIChild->GetEnum(XFA_ATTRIBUTE_CommitOn);
- }
return XFA_GetAttributeDefaultValue_Enum(
XFA_ELEMENT_ChoiceList, XFA_ATTRIBUTE_CommitOn, XFA_XDPPACKET_Form);
}
+
FX_BOOL CXFA_WidgetData::IsChoiceListAllowTextEntry() {
CXFA_Node* pUIChild = GetUIChild();
- if (pUIChild) {
+ if (pUIChild)
return pUIChild->GetBoolean(XFA_ATTRIBUTE_TextEntry);
- }
return XFA_GetAttributeDefaultValue_Boolean(
XFA_ELEMENT_ChoiceList, XFA_ATTRIBUTE_TextEntry, XFA_XDPPACKET_Form);
}
+
int32_t CXFA_WidgetData::GetChoiceListOpen() {
CXFA_Node* pUIChild = GetUIChild();
- if (pUIChild) {
+ if (pUIChild)
return pUIChild->GetEnum(XFA_ATTRIBUTE_Open);
- }
return XFA_GetAttributeDefaultValue_Enum(
XFA_ELEMENT_ChoiceList, XFA_ATTRIBUTE_Open, XFA_XDPPACKET_Form);
}
+
FX_BOOL CXFA_WidgetData::IsListBox() {
int32_t iOpenMode = GetChoiceListOpen();
return (iOpenMode == XFA_ATTRIBUTEENUM_Always ||
iOpenMode == XFA_ATTRIBUTEENUM_MultiSelect);
}
+
int32_t CXFA_WidgetData::CountChoiceListItems(FX_BOOL bSaveValue) {
CXFA_NodeArray pItems;
CXFA_Node* pItem = NULL;
int32_t iCount = 0;
CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
- if (pNode->GetClassID() != XFA_ELEMENT_Items) {
+ if (pNode->GetClassID() != XFA_ELEMENT_Items)
continue;
- }
+
iCount++;
pItems.Add(pNode);
- if (iCount == 2) {
+ if (iCount == 2)
break;
- }
}
- if (iCount == 0) {
+ if (iCount == 0)
return 0;
- }
+
pItem = pItems[0];
if (iCount > 1) {
FX_BOOL bItemOneHasSave = pItems[0]->GetBoolean(XFA_ATTRIBUTE_Save);
FX_BOOL bItemTwoHasSave = pItems[1]->GetBoolean(XFA_ATTRIBUTE_Save);
- if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave) {
+ if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave)
pItem = pItems[1];
- }
}
pItems.RemoveAll();
return pItem->CountChildren(XFA_ELEMENT_UNKNOWN);
}
+
FX_BOOL CXFA_WidgetData::GetChoiceListItem(CFX_WideString& wsText,
int32_t nIndex,
FX_BOOL bSaveValue) {
@@ -1382,25 +612,23 @@ FX_BOOL CXFA_WidgetData::GetChoiceListItem(CFX_WideString& wsText,
int32_t iCount = 0;
CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
- if (pNode->GetClassID() != XFA_ELEMENT_Items) {
+ if (pNode->GetClassID() != XFA_ELEMENT_Items)
continue;
- }
+
iCount++;
pItemsArray.Add(pNode);
- if (iCount == 2) {
+ if (iCount == 2)
break;
- }
}
- if (iCount == 0) {
+ if (iCount == 0)
return FALSE;
- }
+
pItems = pItemsArray[0];
if (iCount > 1) {
FX_BOOL bItemOneHasSave = pItemsArray[0]->GetBoolean(XFA_ATTRIBUTE_Save);
FX_BOOL bItemTwoHasSave = pItemsArray[1]->GetBoolean(XFA_ATTRIBUTE_Save);
- if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave) {
+ if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave)
pItems = pItemsArray[1];
- }
}
if (pItems) {
CXFA_Node* pItem = pItems->GetChild(nIndex, XFA_ELEMENT_UNKNOWN);
@@ -1411,6 +639,7 @@ FX_BOOL CXFA_WidgetData::GetChoiceListItem(CFX_WideString& wsText,
}
return FALSE;
}
+
void CXFA_WidgetData::GetChoiceListItems(CFX_WideStringArray& wsTextArray,
FX_BOOL bSaveValue) {
CXFA_NodeArray pItems;
@@ -1418,38 +647,36 @@ void CXFA_WidgetData::GetChoiceListItems(CFX_WideStringArray& wsTextArray,
int32_t iCount = 0;
CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
- if (pNode->GetClassID() != XFA_ELEMENT_Items) {
+ if (pNode->GetClassID() != XFA_ELEMENT_Items)
continue;
- }
+
iCount++;
pItems.Add(pNode);
- if (iCount == 2) {
+ if (iCount == 2)
break;
- }
}
- if (iCount == 0) {
+ if (iCount == 0)
return;
- }
+
pItem = pItems[0];
if (iCount > 1) {
FX_BOOL bItemOneHasSave = pItems[0]->GetBoolean(XFA_ATTRIBUTE_Save);
FX_BOOL bItemTwoHasSave = pItems[1]->GetBoolean(XFA_ATTRIBUTE_Save);
- if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave) {
+ if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave)
pItem = pItems[1];
- }
}
pItems.RemoveAll();
pNode = pItem->GetNodeItem(XFA_NODEITEM_FirstChild);
- for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling))
pNode->TryContent(wsTextArray.Add());
- }
}
+
int32_t CXFA_WidgetData::CountSelectedItems() {
CFX_WideStringArray wsValueArray;
GetSelectedItemsValue(wsValueArray);
- if (IsListBox() || !IsChoiceListAllowTextEntry()) {
+ if (IsListBox() || !IsChoiceListAllowTextEntry())
return wsValueArray.GetSize();
- }
+
int32_t iSelected = 0;
CFX_WideStringArray wsSaveTextArray;
GetChoiceListItems(wsSaveTextArray, TRUE);
@@ -1465,6 +692,7 @@ int32_t CXFA_WidgetData::CountSelectedItems() {
}
return iSelected;
}
+
int32_t CXFA_WidgetData::GetSelectedItem(int32_t nIndex) {
CFX_WideStringArray wsValueArray;
GetSelectedItemsValue(wsValueArray);
@@ -1472,19 +700,19 @@ int32_t CXFA_WidgetData::GetSelectedItem(int32_t nIndex) {
GetChoiceListItems(wsSaveTextArray, TRUE);
int32_t iSaves = wsSaveTextArray.GetSize();
for (int32_t j = 0; j < iSaves; j++) {
- if (wsValueArray[nIndex] == wsSaveTextArray[j]) {
+ if (wsValueArray[nIndex] == wsSaveTextArray[j])
return j;
- }
}
return -1;
}
+
void CXFA_WidgetData::GetSelectedItems(CFX_Int32Array& iSelArray) {
CFX_WideStringArray wsValueArray;
GetSelectedItemsValue(wsValueArray);
int32_t iValues = wsValueArray.GetSize();
- if (iValues < 1) {
+ if (iValues < 1)
return;
- }
+
CFX_WideStringArray wsSaveTextArray;
GetChoiceListItems(wsSaveTextArray, TRUE);
int32_t iSaves = wsSaveTextArray.GetSize();
@@ -1497,6 +725,7 @@ void CXFA_WidgetData::GetSelectedItems(CFX_Int32Array& iSelArray) {
}
}
}
+
void CXFA_WidgetData::GetSelectedItemsValue(
CFX_WideStringArray& wsSelTextArray) {
CFX_WideString wsValue = GetRawValue();
@@ -1509,51 +738,51 @@ void CXFA_WidgetData::GetSelectedItemsValue(
while (iEnd >= iStart) {
wsSelTextArray.Add(wsValue.Mid(iStart, iEnd - iStart));
iStart = iEnd + 1;
- if (iStart >= iLength) {
+ if (iStart >= iLength)
break;
- }
+
iEnd = wsValue.Find(L'\n', iStart);
- if (iEnd < 0) {
+ if (iEnd < 0)
wsSelTextArray.Add(wsValue.Mid(iStart, iLength - iStart));
- }
}
}
} else {
wsSelTextArray.Add(wsValue);
}
}
+
FX_BOOL CXFA_WidgetData::GetItemState(int32_t nIndex) {
- if (nIndex < 0) {
+ if (nIndex < 0)
return FALSE;
- }
+
CFX_WideStringArray wsSaveTextArray;
GetChoiceListItems(wsSaveTextArray, TRUE);
- if (wsSaveTextArray.GetSize() <= nIndex) {
+ if (wsSaveTextArray.GetSize() <= nIndex)
return FALSE;
- }
+
CFX_WideStringArray wsValueArray;
GetSelectedItemsValue(wsValueArray);
int32_t iValues = wsValueArray.GetSize();
for (int32_t j = 0; j < iValues; j++) {
- if (wsValueArray[j] == wsSaveTextArray[nIndex]) {
+ if (wsValueArray[j] == wsSaveTextArray[nIndex])
return TRUE;
- }
}
return FALSE;
}
+
void CXFA_WidgetData::SetItemState(int32_t nIndex,
FX_BOOL bSelected,
FX_BOOL bNotify,
FX_BOOL bScriptModify,
FX_BOOL bSyncData) {
- if (nIndex < 0) {
+ if (nIndex < 0)
return;
- }
+
CFX_WideStringArray wsSaveTextArray;
GetChoiceListItems(wsSaveTextArray, TRUE);
- if (wsSaveTextArray.GetSize() <= nIndex) {
+ if (wsSaveTextArray.GetSize() <= nIndex)
return;
- }
+
int32_t iSel = -1;
CFX_WideStringArray wsValueArray;
GetSelectedItemsValue(wsValueArray);
@@ -1601,6 +830,7 @@ void CXFA_WidgetData::SetItemState(int32_t nIndex,
}
}
}
+
void CXFA_WidgetData::SetSelectdItems(CFX_Int32Array& iSelArray,
FX_BOOL bNotify,
FX_BOOL bScriptModify,
@@ -1619,11 +849,12 @@ void CXFA_WidgetData::SetSelectdItems(CFX_Int32Array& iSelArray,
}
}
CFX_WideString wsFormat(wsValue);
- if (GetChoiceListOpen() != XFA_ATTRIBUTEENUM_MultiSelect) {
+ if (GetChoiceListOpen() != XFA_ATTRIBUTEENUM_MultiSelect)
GetFormatDataValue(wsValue.AsWideStringC(), wsFormat);
- }
+
m_pNode->SetContent(wsValue, wsFormat, bNotify, bScriptModify, bSyncData);
}
+
void CXFA_WidgetData::ClearAllSelections() {
CXFA_Node* pBind = m_pNode->GetBindData();
if (pBind && GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
@@ -1635,22 +866,23 @@ void CXFA_WidgetData::ClearAllSelections() {
SyncValue(CFX_WideString(), FALSE);
}
}
+
void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel,
const CFX_WideString& wsValue,
int32_t nIndex,
FX_BOOL bNotify) {
CFX_WideString wsNewValue(wsValue);
- if (wsNewValue.IsEmpty()) {
+ if (wsNewValue.IsEmpty())
wsNewValue = wsLabel;
- }
+
CXFA_NodeArray listitems;
int32_t iCount = 0;
CXFA_Node* pItemNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
for (; pItemNode;
pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
- if (pItemNode->GetClassID() != XFA_ELEMENT_Items) {
+ if (pItemNode->GetClassID() != XFA_ELEMENT_Items)
continue;
- }
+
listitems.Add(pItemNode);
iCount++;
}
@@ -1666,11 +898,10 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel,
for (int32_t i = 0; i < 2; i++) {
CXFA_Node* pNode = listitems[i];
FX_BOOL bHasSave = pNode->GetBoolean(XFA_ATTRIBUTE_Save);
- if (bHasSave) {
+ if (bHasSave)
InsertListTextItem(pNode, wsNewValue.AsWideStringC(), nIndex);
- } else {
+ else
InsertListTextItem(pNode, wsLabel.AsWideStringC(), nIndex);
- }
}
} else {
CXFA_Node* pNode = listitems[0];
@@ -1693,22 +924,23 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel,
InsertListTextItem(pNode, wsLabel.AsWideStringC(), nIndex);
InsertListTextItem(pSaveItems, wsNewValue.AsWideStringC(), nIndex);
}
- if (!bNotify) {
+ if (!bNotify)
return;
- }
+
m_pNode->GetDocument()->GetNotify()->OnWidgetDataEvent(
this, XFA_WIDGETEVENT_ListItemAdded, (void*)(const FX_WCHAR*)wsLabel,
(void*)(const FX_WCHAR*)wsValue, (void*)(uintptr_t)nIndex);
}
+
void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue,
CFX_WideString& wsLabel) {
int32_t iCount = 0;
CXFA_NodeArray listitems;
CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) {
- if (pItems->GetClassID() != XFA_ELEMENT_Items) {
+ if (pItems->GetClassID() != XFA_ELEMENT_Items)
continue;
- }
+
iCount++;
listitems.Add(pItems);
}
@@ -1737,24 +969,24 @@ void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue,
}
iCount++;
}
- if (iSearch < 0) {
+ if (iSearch < 0)
return;
- }
if (CXFA_Node* pText =
pLabelItems->GetChild(iSearch, XFA_ELEMENT_UNKNOWN)) {
pText->TryContent(wsLabel);
}
}
}
+
void CXFA_WidgetData::GetItemValue(const CFX_WideStringC& wsLabel,
CFX_WideString& wsValue) {
int32_t iCount = 0;
CXFA_NodeArray listitems;
CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) {
- if (pItems->GetClassID() != XFA_ELEMENT_Items) {
+ if (pItems->GetClassID() != XFA_ELEMENT_Items)
continue;
- }
+
iCount++;
listitems.Add(pItems);
}
@@ -1783,14 +1015,13 @@ void CXFA_WidgetData::GetItemValue(const CFX_WideStringC& wsLabel,
}
iCount++;
}
- if (iSearch < 0) {
+ if (iSearch < 0)
return;
- }
- if (CXFA_Node* pText = pSaveItems->GetChild(iSearch, XFA_ELEMENT_UNKNOWN)) {
+ if (CXFA_Node* pText = pSaveItems->GetChild(iSearch, XFA_ELEMENT_UNKNOWN))
pText->TryContent(wsValue);
- }
}
}
+
FX_BOOL CXFA_WidgetData::DeleteItem(int32_t nIndex,
FX_BOOL bNotify,
FX_BOOL bScriptModify,
@@ -1798,9 +1029,9 @@ FX_BOOL CXFA_WidgetData::DeleteItem(int32_t nIndex,
FX_BOOL bSetValue = FALSE;
CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) {
- if (pItems->GetClassID() != XFA_ELEMENT_Items) {
+ if (pItems->GetClassID() != XFA_ELEMENT_Items)
continue;
- }
+
if (nIndex < 0) {
while (CXFA_Node* pNode = pItems->GetNodeItem(XFA_NODEITEM_FirstChild)) {
pItems->RemoveChild(pNode);
@@ -1822,34 +1053,35 @@ FX_BOOL CXFA_WidgetData::DeleteItem(int32_t nIndex,
}
}
}
- if (!bNotify) {
+ if (!bNotify)
return TRUE;
- }
+
m_pNode->GetDocument()->GetNotify()->OnWidgetDataEvent(
this, XFA_WIDGETEVENT_ListItemRemoved, (void*)(uintptr_t)nIndex);
return TRUE;
}
+
int32_t CXFA_WidgetData::GetHorizontalScrollPolicy() {
CXFA_Node* pUIChild = GetUIChild();
- if (pUIChild) {
+ if (pUIChild)
return pUIChild->GetEnum(XFA_ATTRIBUTE_HScrollPolicy);
- }
return XFA_ATTRIBUTEENUM_Auto;
}
+
int32_t CXFA_WidgetData::GetNumberOfCells() {
CXFA_Node* pUIChild = GetUIChild();
- if (!pUIChild) {
+ if (!pUIChild)
return -1;
- }
- if (CXFA_Node* pNode = pUIChild->GetChild(0, XFA_ELEMENT_Comb)) {
+ if (CXFA_Node* pNode = pUIChild->GetChild(0, XFA_ELEMENT_Comb))
return pNode->GetInteger(XFA_ATTRIBUTE_NumberOfCells);
- }
return -1;
}
+
CFX_WideString CXFA_WidgetData::GetBarcodeType() {
CXFA_Node* pUIChild = GetUIChild();
return pUIChild ? pUIChild->GetCData(XFA_ATTRIBUTE_Type) : NULL;
}
+
FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_CharEncoding(int32_t& val) {
CXFA_Node* pUIChild = GetUIChild();
CFX_WideString wsCharEncoding;
@@ -1864,6 +1096,7 @@ FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_CharEncoding(int32_t& val) {
}
return FALSE;
}
+
FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_Checksum(int32_t& val) {
CXFA_Node* pUIChild = GetUIChild();
XFA_ATTRIBUTEENUM eChecksum;
@@ -1887,6 +1120,7 @@ FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_Checksum(int32_t& val) {
}
return FALSE;
}
+
FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_DataLength(int32_t& val) {
CXFA_Node* pUIChild = GetUIChild();
CFX_WideString wsDataLength;
@@ -1896,6 +1130,7 @@ FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_DataLength(int32_t& val) {
}
return FALSE;
}
+
FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_StartChar(FX_CHAR& val) {
CXFA_Node* pUIChild = GetUIChild();
CFX_WideStringC wsStartEndChar;
@@ -1907,6 +1142,7 @@ FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_StartChar(FX_CHAR& val) {
}
return FALSE;
}
+
FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_EndChar(FX_CHAR& val) {
CXFA_Node* pUIChild = GetUIChild();
CFX_WideStringC wsStartEndChar;
@@ -1918,6 +1154,7 @@ FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_EndChar(FX_CHAR& val) {
}
return FALSE;
}
+
FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_ECLevel(int32_t& val) {
CXFA_Node* pUIChild = GetUIChild();
CFX_WideString wsECLevel;
@@ -1927,6 +1164,7 @@ FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_ECLevel(int32_t& val) {
}
return FALSE;
}
+
FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_ModuleWidth(int32_t& val) {
CXFA_Node* pUIChild = GetUIChild();
CXFA_Measurement mModuleWidthHeight;
@@ -1936,6 +1174,7 @@ FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_ModuleWidth(int32_t& val) {
}
return FALSE;
}
+
FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_ModuleHeight(int32_t& val) {
CXFA_Node* pUIChild = GetUIChild();
CXFA_Measurement mModuleWidthHeight;
@@ -1945,6 +1184,7 @@ FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_ModuleHeight(int32_t& val) {
}
return FALSE;
}
+
FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_PrintChecksum(FX_BOOL& val) {
CXFA_Node* pUIChild = GetUIChild();
FX_BOOL bPrintCheckDigit;
@@ -1954,6 +1194,7 @@ FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_PrintChecksum(FX_BOOL& val) {
}
return FALSE;
}
+
FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_TextLocation(int32_t& val) {
CXFA_Node* pUIChild = GetUIChild();
XFA_ATTRIBUTEENUM eTextLocation;
@@ -1980,6 +1221,7 @@ FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_TextLocation(int32_t& val) {
}
return FALSE;
}
+
FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_Truncate(FX_BOOL& val) {
CXFA_Node* pUIChild = GetUIChild();
FX_BOOL bTruncate;
@@ -1989,6 +1231,7 @@ FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_Truncate(FX_BOOL& val) {
}
return FALSE;
}
+
FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(FX_FLOAT& val) {
CXFA_Node* pUIChild = GetUIChild();
CFX_WideString wsWideNarrowRatio;
@@ -2001,15 +1244,15 @@ FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(FX_FLOAT& val) {
int32_t fA, fB;
fA = FXSYS_wtoi(wsWideNarrowRatio.Left(ptPos));
fB = FXSYS_wtoi(wsWideNarrowRatio.Mid(ptPos + 1));
- if (fB) {
+ if (fB)
fRatio = (FX_FLOAT)fA / fB;
- }
}
val = fRatio;
return TRUE;
}
return FALSE;
}
+
void CXFA_WidgetData::GetPasswordChar(CFX_WideString& wsPassWord) {
CXFA_Node* pUIChild = GetUIChild();
if (pUIChild) {
@@ -2020,22 +1263,23 @@ void CXFA_WidgetData::GetPasswordChar(CFX_WideString& wsPassWord) {
XFA_XDPPACKET_Form);
}
}
+
FX_BOOL CXFA_WidgetData::IsMultiLine() {
CXFA_Node* pUIChild = GetUIChild();
- if (pUIChild) {
+ if (pUIChild)
return pUIChild->GetBoolean(XFA_ATTRIBUTE_MultiLine);
- }
return XFA_GetAttributeDefaultValue_Boolean(
XFA_ELEMENT_TextEdit, XFA_ATTRIBUTE_MultiLine, XFA_XDPPACKET_Form);
}
+
int32_t CXFA_WidgetData::GetVerticalScrollPolicy() {
CXFA_Node* pUIChild = GetUIChild();
- if (pUIChild) {
+ if (pUIChild)
return pUIChild->GetEnum(XFA_ATTRIBUTE_VScrollPolicy);
- }
return XFA_GetAttributeDefaultValue_Enum(
XFA_ELEMENT_TextEdit, XFA_ATTRIBUTE_VScrollPolicy, XFA_XDPPACKET_Form);
}
+
int32_t CXFA_WidgetData::GetMaxChars(XFA_ELEMENT& eType) {
if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_ELEMENT_Value)) {
if (CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) {
@@ -2055,68 +1299,25 @@ int32_t CXFA_WidgetData::GetMaxChars(XFA_ELEMENT& eType) {
}
return 0;
}
+
FX_BOOL CXFA_WidgetData::GetFracDigits(int32_t& iFracDigits) {
if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_ELEMENT_Value)) {
- if (CXFA_Node* pChild = pNode->GetChild(0, XFA_ELEMENT_Decimal)) {
+ if (CXFA_Node* pChild = pNode->GetChild(0, XFA_ELEMENT_Decimal))
return pChild->TryInteger(XFA_ATTRIBUTE_FracDigits, iFracDigits);
- }
}
iFracDigits = -1;
return FALSE;
}
+
FX_BOOL CXFA_WidgetData::GetLeadDigits(int32_t& iLeadDigits) {
if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_ELEMENT_Value)) {
- if (CXFA_Node* pChild = pNode->GetChild(0, XFA_ELEMENT_Decimal)) {
+ if (CXFA_Node* pChild = pNode->GetChild(0, XFA_ELEMENT_Decimal))
return pChild->TryInteger(XFA_ATTRIBUTE_LeadDigits, iLeadDigits);
- }
}
iLeadDigits = -1;
return FALSE;
}
-CFX_WideString XFA_NumericLimit(const CFX_WideString& wsValue,
- int32_t iLead,
- int32_t iTread) {
- if ((iLead == -1) && (iTread == -1)) {
- return wsValue;
- }
- CFX_WideString wsRet;
- int32_t iLead_ = 0, iTread_ = -1;
- int32_t iCount = wsValue.GetLength();
- if (iCount == 0) {
- return wsValue;
- }
- int32_t i = 0;
- if (wsValue[i] == L'-') {
- wsRet += L'-';
- i++;
- }
- for (; i < iCount; i++) {
- FX_WCHAR wc = wsValue[i];
- if (XFA_IsDigit(wc)) {
- if (iLead >= 0) {
- iLead_++;
- if (iLead_ > iLead) {
- return L"0";
- }
- } else if (iTread_ >= 0) {
- iTread_++;
- if (iTread_ > iTread) {
- if (iTread != -1) {
- CFX_Decimal wsDeci = CFX_Decimal(wsValue.AsWideStringC());
- wsDeci.SetScale(iTread);
- wsRet = wsDeci;
- }
- return wsRet;
- }
- }
- } else if (wc == L'.') {
- iTread_ = 0;
- iLead = -1;
- }
- wsRet += wc;
- }
- return wsRet;
-}
+
FX_BOOL CXFA_WidgetData::SetValue(const CFX_WideString& wsValue,
XFA_VALUEPICTURE eValueType) {
if (wsValue.IsEmpty()) {
@@ -2131,9 +1332,9 @@ FX_BOOL CXFA_WidgetData::SetValue(const CFX_WideString& wsValue,
FX_BOOL bValidate = TRUE;
FX_BOOL bSyncData = FALSE;
CXFA_Node* pNode = GetUIChild();
- if (!pNode) {
+ if (!pNode)
return TRUE;
- }
+
XFA_ELEMENT uiType = pNode->GetClassID();
if (!wsPicture.IsEmpty()) {
CXFA_LocaleMgr* pLocalMgr = m_pNode->GetDocument()->GetLocalMgr();
@@ -2150,7 +1351,7 @@ FX_BOOL CXFA_WidgetData::SetValue(const CFX_WideString& wsValue,
int32_t iFracDigits = 0;
GetLeadDigits(iLeadDigits);
GetFracDigits(iFracDigits);
- wsNewText = XFA_NumericLimit(wsNewText, iLeadDigits, iFracDigits);
+ wsNewText = NumericLimit(wsNewText, iLeadDigits, iFracDigits);
}
bSyncData = TRUE;
}
@@ -2161,36 +1362,36 @@ FX_BOOL CXFA_WidgetData::SetValue(const CFX_WideString& wsValue,
int32_t iFracDigits = 0;
GetLeadDigits(iLeadDigits);
GetFracDigits(iFracDigits);
- wsNewText = XFA_NumericLimit(wsNewText, iLeadDigits, iFracDigits);
+ wsNewText = NumericLimit(wsNewText, iLeadDigits, iFracDigits);
}
bSyncData = TRUE;
}
}
- if (uiType != XFA_ELEMENT_NumericEdit || bSyncData) {
+ if (uiType != XFA_ELEMENT_NumericEdit || bSyncData)
SyncValue(wsNewText, TRUE);
- }
+
return bValidate;
}
+
FX_BOOL CXFA_WidgetData::GetPictureContent(CFX_WideString& wsPicture,
XFA_VALUEPICTURE ePicture) {
- if (ePicture == XFA_VALUEPICTURE_Raw) {
+ if (ePicture == XFA_VALUEPICTURE_Raw)
return FALSE;
- }
+
CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(this);
switch (ePicture) {
case XFA_VALUEPICTURE_Display: {
if (CXFA_Node* pFormat = m_pNode->GetChild(0, XFA_ELEMENT_Format)) {
if (CXFA_Node* pPicture = pFormat->GetChild(0, XFA_ELEMENT_Picture)) {
- if (pPicture->TryContent(wsPicture)) {
+ if (pPicture->TryContent(wsPicture))
return TRUE;
- }
}
}
CFX_WideString wsDataPicture, wsTimePicture;
IFX_Locale* pLocale = GetLocal();
- if (!pLocale) {
+ if (!pLocale)
return FALSE;
- }
+
uint32_t dwType = widgetValue.GetType();
switch (dwType) {
case XFA_VT_DATE:
@@ -2214,15 +1415,15 @@ FX_BOOL CXFA_WidgetData::GetPictureContent(CFX_WideString& wsPicture,
default:
break;
}
- }
return TRUE;
+ }
+
case XFA_VALUEPICTURE_Edit: {
CXFA_Node* pUI = m_pNode->GetChild(0, XFA_ELEMENT_Ui);
if (pUI) {
if (CXFA_Node* pPicture = pUI->GetChild(0, XFA_ELEMENT_Picture)) {
- if (pPicture->TryContent(wsPicture)) {
+ if (pPicture->TryContent(wsPicture))
return TRUE;
- }
}
}
{
@@ -2252,24 +1453,26 @@ FX_BOOL CXFA_WidgetData::GetPictureContent(CFX_WideString& wsPicture,
break;
}
}
- }
return TRUE;
+ }
case XFA_VALUEPICTURE_DataBind: {
if (CXFA_Bind bind = GetBind()) {
bind.GetPicture(wsPicture);
return TRUE;
}
- } break;
+ break;
+ }
default:
break;
}
return FALSE;
}
+
IFX_Locale* CXFA_WidgetData::GetLocal() {
IFX_Locale* pLocale = NULL;
- if (!m_pNode) {
+ if (!m_pNode)
return pLocale;
- }
+
FX_BOOL bLocale = FALSE;
CFX_WideString wsLocaleName;
bLocale = m_pNode->GetLocaleName(wsLocaleName);
@@ -2283,50 +1486,6 @@ IFX_Locale* CXFA_WidgetData::GetLocal() {
}
return pLocale;
}
-static FX_BOOL XFA_SplitDateTime(const CFX_WideString& wsDateTime,
- CFX_WideString& wsDate,
- CFX_WideString& wsTime) {
- wsDate = L"";
- wsTime = L"";
- if (wsDateTime.IsEmpty()) {
- return FALSE;
- }
- int nSplitIndex = -1;
- nSplitIndex = wsDateTime.Find('T');
- if (nSplitIndex < 0) {
- nSplitIndex = wsDateTime.Find(' ');
- }
- if (nSplitIndex < 0) {
- return FALSE;
- }
- wsDate = wsDateTime.Left(nSplitIndex);
- if (!wsDate.IsEmpty()) {
- int32_t iCount = wsDate.GetLength();
- int32_t i = 0;
- for (i = 0; i < iCount; i++) {
- if (wsDate[i] >= '0' && wsDate[i] <= '9') {
- break;
- }
- }
- if (i == iCount) {
- return FALSE;
- }
- }
- wsTime = wsDateTime.Right(wsDateTime.GetLength() - nSplitIndex - 1);
- if (!wsTime.IsEmpty()) {
- int32_t iCount = wsTime.GetLength();
- int32_t i = 0;
- for (i = 0; i < iCount; i++) {
- if (wsTime[i] >= '0' && wsTime[i] <= '9') {
- break;
- }
- }
- if (i == iCount) {
- return FALSE;
- }
- }
- return TRUE;
-}
FX_BOOL CXFA_WidgetData::GetValue(CFX_WideString& wsValue,
XFA_VALUEPICTURE eValueType) {
@@ -2375,7 +1534,7 @@ FX_BOOL CXFA_WidgetData::GetValue(CFX_WideString& wsValue,
switch (widgetValue.GetType()) {
case XFA_VT_DATE: {
CFX_WideString wsDate, wsTime;
- if (XFA_SplitDateTime(wsValue, wsDate, wsTime)) {
+ if (SplitDateTime(wsValue, wsDate, wsTime)) {
CXFA_LocaleValue date(XFA_VT_DATE, wsDate, pLocalMgr);
if (date.FormatPatterns(wsValue, wsPicture, pLocale, eValueType))
return TRUE;
@@ -2384,7 +1543,7 @@ FX_BOOL CXFA_WidgetData::GetValue(CFX_WideString& wsValue,
}
case XFA_VT_TIME: {
CFX_WideString wsDate, wsTime;
- if (XFA_SplitDateTime(wsValue, wsDate, wsTime)) {
+ if (SplitDateTime(wsValue, wsDate, wsTime)) {
CXFA_LocaleValue time(XFA_VT_TIME, wsTime, pLocalMgr);
if (time.FormatPatterns(wsValue, wsPicture, pLocale, eValueType))
return TRUE;
@@ -2403,14 +1562,14 @@ FX_BOOL CXFA_WidgetData::GetNormalizeDataValue(
const CFX_WideStringC& wsValue,
CFX_WideString& wsNormalizeValue) {
wsNormalizeValue = wsValue;
- if (wsValue.IsEmpty()) {
+ if (wsValue.IsEmpty())
return TRUE;
- }
+
CFX_WideString wsPicture;
GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind);
- if (wsPicture.IsEmpty()) {
+ if (wsPicture.IsEmpty())
return TRUE;
- }
+
FXSYS_assert(GetNode());
CXFA_LocaleMgr* pLocalMgr = GetNode()->GetDocument()->GetLocalMgr();
IFX_Locale* pLocale = GetLocal();
@@ -2423,27 +1582,28 @@ FX_BOOL CXFA_WidgetData::GetNormalizeDataValue(
}
return FALSE;
}
+
FX_BOOL CXFA_WidgetData::GetFormatDataValue(const CFX_WideStringC& wsValue,
CFX_WideString& wsFormatedValue) {
wsFormatedValue = wsValue;
- if (wsValue.IsEmpty()) {
+ if (wsValue.IsEmpty())
return TRUE;
- }
+
CFX_WideString wsPicture;
GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind);
- if (wsPicture.IsEmpty()) {
+ if (wsPicture.IsEmpty())
return TRUE;
- }
+
if (IFX_Locale* pLocale = GetLocal()) {
FXSYS_assert(GetNode());
CXFA_Node* pNodeValue = GetNode()->GetChild(0, XFA_ELEMENT_Value);
- if (!pNodeValue) {
+ if (!pNodeValue)
return FALSE;
- }
+
CXFA_Node* pValueChild = pNodeValue->GetNodeItem(XFA_NODEITEM_FirstChild);
- if (!pValueChild) {
+ if (!pValueChild)
return FALSE;
- }
+
int32_t iVTType = XFA_VT_NULL;
XFA_ELEMENT eType = pValueChild->GetClassID();
switch (eType) {
@@ -2480,7 +1640,7 @@ FX_BOOL CXFA_WidgetData::GetFormatDataValue(const CFX_WideStringC& wsValue,
switch (widgetValue.GetType()) {
case XFA_VT_DATE: {
CFX_WideString wsDate, wsTime;
- if (XFA_SplitDateTime(wsValue, wsDate, wsTime)) {
+ if (SplitDateTime(wsValue, wsDate, wsTime)) {
CXFA_LocaleValue date(XFA_VT_DATE, wsDate, pLocalMgr);
if (date.FormatPatterns(wsFormatedValue, wsPicture, pLocale,
XFA_VALUEPICTURE_DataBind)) {
@@ -2491,7 +1651,7 @@ FX_BOOL CXFA_WidgetData::GetFormatDataValue(const CFX_WideStringC& wsValue,
}
case XFA_VT_TIME: {
CFX_WideString wsDate, wsTime;
- if (XFA_SplitDateTime(wsValue, wsDate, wsTime)) {
+ if (SplitDateTime(wsValue, wsDate, wsTime)) {
CXFA_LocaleValue time(XFA_VT_TIME, wsTime, pLocalMgr);
if (time.FormatPatterns(wsFormatedValue, wsPicture, pLocale,
XFA_VALUEPICTURE_DataBind)) {
@@ -2508,11 +1668,12 @@ FX_BOOL CXFA_WidgetData::GetFormatDataValue(const CFX_WideStringC& wsValue,
}
return FALSE;
}
+
void CXFA_WidgetData::NormalizeNumStr(const CFX_WideString& wsValue,
CFX_WideString& wsOutput) {
- if (wsValue.IsEmpty()) {
+ if (wsValue.IsEmpty())
return;
- }
+
wsOutput = wsValue;
wsOutput.TrimLeft('0');
int32_t dot_index = wsOutput.Find('.');
@@ -2522,16 +1683,16 @@ void CXFA_WidgetData::NormalizeNumStr(const CFX_WideString& wsValue,
wsOutput.TrimRight(L"0");
wsOutput.TrimRight(L".");
}
- if (wsOutput.IsEmpty() || wsOutput[0] == '.') {
+ if (wsOutput.IsEmpty() || wsOutput[0] == '.')
wsOutput.Insert(0, '0');
- }
}
+
void CXFA_WidgetData::FormatNumStr(const CFX_WideString& wsValue,
IFX_Locale* pLocale,
CFX_WideString& wsOutput) {
- if (wsValue.IsEmpty()) {
+ if (wsValue.IsEmpty())
return;
- }
+
CFX_WideString wsSrcNum = wsValue;
CFX_WideString wsGroupSymbol;
pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping, wsGroupSymbol);
@@ -2542,17 +1703,17 @@ void CXFA_WidgetData::FormatNumStr(const CFX_WideString& wsValue,
}
int32_t len = wsSrcNum.GetLength();
int32_t dot_index = wsSrcNum.Find('.');
- if (dot_index == -1) {
+ if (dot_index == -1)
dot_index = len;
- }
+
int32_t cc = dot_index - 1;
if (cc >= 0) {
int nPos = dot_index % 3;
wsOutput.Empty();
for (int32_t i = 0; i < dot_index; i++) {
- if (i % 3 == nPos && i != 0) {
+ if (i % 3 == nPos && i != 0)
wsOutput += wsGroupSymbol;
- }
+
wsOutput += wsSrcNum[i];
}
if (dot_index < len) {
@@ -2568,19 +1729,21 @@ void CXFA_WidgetData::FormatNumStr(const CFX_WideString& wsValue,
}
}
}
+
void CXFA_WidgetData::SyncValue(const CFX_WideString& wsValue,
FX_BOOL bNotify) {
- if (!m_pNode) {
+ if (!m_pNode)
return;
- }
+
CFX_WideString wsFormatValue(wsValue);
CXFA_WidgetData* pContainerWidgetData = m_pNode->GetContainerWidgetData();
- if (pContainerWidgetData) {
+ if (pContainerWidgetData)
pContainerWidgetData->GetFormatDataValue(wsValue.AsWideStringC(),
wsFormatValue);
- }
+
m_pNode->SetContent(wsValue, wsFormatValue, bNotify);
}
+
void CXFA_WidgetData::InsertListTextItem(CXFA_Node* pItems,
const CFX_WideStringC& wsText,
int32_t nIndex) {
@@ -2588,72 +1751,47 @@ void CXFA_WidgetData::InsertListTextItem(CXFA_Node* pItems,
pItems->InsertChild(nIndex, pText);
pText->SetContent(wsText, wsText, FALSE, FALSE, FALSE);
}
-CXFA_Occur::CXFA_Occur(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-int32_t CXFA_Occur::GetMax() {
- int32_t iMax = 1;
- if (m_pNode) {
- if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, TRUE)) {
- iMax = GetMin();
- }
- }
- return iMax;
-}
-int32_t CXFA_Occur::GetMin() {
- int32_t iMin = 1;
- if (m_pNode) {
- if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, TRUE) || iMin < 0) {
- iMin = 1;
- }
- }
- return iMin;
-}
-FX_BOOL CXFA_Occur::GetOccurInfo(int32_t& iMin, int32_t& iMax, int32_t& iInit) {
- if (!m_pNode) {
- return FALSE;
- }
- if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, FALSE) || iMin < 0) {
- iMin = 1;
- }
- if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, FALSE)) {
- if (iMin == 0) {
- iMax = 1;
- } else {
- iMax = iMin;
- }
- }
- if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Initial, iInit, FALSE) ||
- iInit < iMin) {
- iInit = iMin;
+
+CFX_WideString CXFA_WidgetData::NumericLimit(const CFX_WideString& wsValue,
+ int32_t iLead,
+ int32_t iTread) const {
+ if ((iLead == -1) && (iTread == -1))
+ return wsValue;
+
+ CFX_WideString wsRet;
+ int32_t iLead_ = 0, iTread_ = -1;
+ int32_t iCount = wsValue.GetLength();
+ if (iCount == 0)
+ return wsValue;
+
+ int32_t i = 0;
+ if (wsValue[i] == L'-') {
+ wsRet += L'-';
+ i++;
}
- return TRUE;
-}
-void CXFA_Occur::SetMax(int32_t iMax) {
- iMax = (iMax != -1 && iMax < 1) ? 1 : iMax;
- m_pNode->SetInteger(XFA_ATTRIBUTE_Max, iMax, FALSE);
- int32_t iMin = GetMin();
- if (iMax != -1 && iMax < iMin) {
- iMin = iMax;
- m_pNode->SetInteger(XFA_ATTRIBUTE_Min, iMin, FALSE);
- }
-}
-void CXFA_Occur::SetMin(int32_t iMin) {
- iMin = (iMin < 0) ? 1 : iMin;
- m_pNode->SetInteger(XFA_ATTRIBUTE_Min, iMin, FALSE);
- int32_t iMax = GetMax();
- if (iMax > 0 && iMax < iMin) {
- iMax = iMin;
- m_pNode->SetInteger(XFA_ATTRIBUTE_Max, iMax, FALSE);
- }
-}
-XFA_ATTRIBUTEENUM XFA_GetEnumTypeAttribute(
- CXFA_Node* pNode,
- XFA_ATTRIBUTE attributeValue = XFA_ATTRIBUTE_Type,
- XFA_ATTRIBUTEENUM eDefaultValue = XFA_ATTRIBUTEENUM_Optional) {
- XFA_ATTRIBUTEENUM eType = eDefaultValue;
- if (pNode) {
- if (!pNode->TryEnum(attributeValue, eType, TRUE)) {
- eType = eDefaultValue;
+ for (; i < iCount; i++) {
+ FX_WCHAR wc = wsValue[i];
+ if (XFA_IsDigit(wc)) {
+ if (iLead >= 0) {
+ iLead_++;
+ if (iLead_ > iLead)
+ return L"0";
+ } else if (iTread_ >= 0) {
+ iTread_++;
+ if (iTread_ > iTread) {
+ if (iTread != -1) {
+ CFX_Decimal wsDeci = CFX_Decimal(wsValue.AsWideStringC());
+ wsDeci.SetScale(iTread);
+ wsRet = wsDeci;
+ }
+ return wsRet;
+ }
+ }
+ } else if (wc == L'.') {
+ iTread_ = 0;
+ iLead = -1;
}
+ wsRet += wc;
}
- return eType;
+ return wsRet;
}
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h
new file mode 100644
index 0000000000..7b7afd14ce
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_widgetdata.h
@@ -0,0 +1,181 @@
+// Copyright 2016 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_WIDGETDATA_H_
+#define XFA_FXFA_PARSER_CXFA_WIDGETDATA_H_
+
+#include "core/fxcrt/include/fx_string.h"
+#include "core/fxcrt/include/fx_system.h"
+#include "xfa/fxfa/parser/cxfa_assist.h"
+#include "xfa/fxfa/parser/cxfa_bind.h"
+#include "xfa/fxfa/parser/cxfa_border.h"
+#include "xfa/fxfa/parser/cxfa_calculate.h"
+#include "xfa/fxfa/parser/cxfa_caption.h"
+#include "xfa/fxfa/parser/cxfa_data.h"
+#include "xfa/fxfa/parser/cxfa_font.h"
+#include "xfa/fxfa/parser/cxfa_margin.h"
+#include "xfa/fxfa/parser/cxfa_para.h"
+#include "xfa/fxfa/parser/cxfa_validate.h"
+#include "xfa/fxfa/parser/xfa_object.h"
+
+enum XFA_CHECKSTATE {
+ XFA_CHECKSTATE_On = 0,
+ XFA_CHECKSTATE_Off = 1,
+ XFA_CHECKSTATE_Neutral = 2,
+};
+
+enum XFA_VALUEPICTURE {
+ XFA_VALUEPICTURE_Raw = 0,
+ XFA_VALUEPICTURE_Display,
+ XFA_VALUEPICTURE_Edit,
+ XFA_VALUEPICTURE_DataBind,
+};
+
+class CXFA_Node;
+class IFX_Locale;
+
+class CXFA_WidgetData : public CXFA_Data {
+ public:
+ explicit CXFA_WidgetData(CXFA_Node* pNode);
+
+ CXFA_Node* GetUIChild();
+ XFA_ELEMENT GetUIType();
+ CFX_WideString GetRawValue();
+ int32_t GetAccess(FX_BOOL bTemplate = FALSE);
+ int32_t GetRotate();
+ CXFA_Border GetBorder(FX_BOOL bModified = FALSE);
+ CXFA_Caption GetCaption(FX_BOOL bModified = FALSE);
+ CXFA_Font GetFont(FX_BOOL bModified = FALSE);
+ CXFA_Margin GetMargin(FX_BOOL bModified = FALSE);
+ CXFA_Para GetPara(FX_BOOL bModified = FALSE);
+ void GetEventList(CXFA_NodeArray& events);
+ int32_t GetEventByActivity(int32_t iActivity,
+ CXFA_NodeArray& events,
+ FX_BOOL bIsFormReady = FALSE);
+ CXFA_Value GetDefaultValue(FX_BOOL bModified = FALSE);
+ CXFA_Value GetFormValue(FX_BOOL bModified = FALSE);
+ CXFA_Calculate GetCalculate(FX_BOOL bModified = FALSE);
+ CXFA_Validate GetValidate(FX_BOOL bModified = FALSE);
+ CXFA_Bind GetBind(FX_BOOL bModified = FALSE);
+ CXFA_Assist GetAssist(FX_BOOL bModified = FALSE);
+ uint32_t GetRelevantStatus();
+ FX_BOOL GetWidth(FX_FLOAT& fWidth);
+ FX_BOOL GetHeight(FX_FLOAT& fHeight);
+ FX_BOOL GetMinWidth(FX_FLOAT& fMinWidth);
+ FX_BOOL GetMinHeight(FX_FLOAT& fMinHeight);
+ FX_BOOL GetMaxWidth(FX_FLOAT& fMaxWidth);
+ FX_BOOL GetMaxHeight(FX_FLOAT& fMaxHeight);
+ CXFA_Border GetUIBorder(FX_BOOL bModified = FALSE);
+ CXFA_Margin GetUIMargin(FX_BOOL bModified = FALSE);
+ void GetUIMargin(CFX_RectF& rtUIMargin);
+ int32_t GetButtonHighlight();
+ FX_BOOL GetButtonRollover(CFX_WideString& wsRollover, FX_BOOL& bRichText);
+ FX_BOOL GetButtonDown(CFX_WideString& wsDown, FX_BOOL& bRichText);
+ int32_t GetCheckButtonShape();
+ int32_t GetCheckButtonMark();
+ FX_FLOAT GetCheckButtonSize();
+ FX_BOOL IsAllowNeutral();
+ FX_BOOL IsRadioButton();
+ XFA_CHECKSTATE GetCheckState();
+ void SetCheckState(XFA_CHECKSTATE eCheckState, FX_BOOL bNotify = TRUE);
+ CXFA_Node* GetExclGroupNode();
+ CXFA_Node* GetSelectedMember();
+ CXFA_Node* SetSelectedMember(const CFX_WideStringC& wsName,
+ FX_BOOL bNotify = TRUE);
+ void SetSelectedMemberByValue(const CFX_WideStringC& wsValue,
+ FX_BOOL bNotify = TRUE,
+ FX_BOOL bScriptModify = FALSE,
+ FX_BOOL bSyncData = TRUE);
+ CXFA_Node* GetExclGroupFirstMember();
+ CXFA_Node* GetExclGroupNextMember(CXFA_Node* pNode);
+ int32_t GetChoiceListCommitOn();
+ FX_BOOL IsChoiceListAllowTextEntry();
+ int32_t GetChoiceListOpen();
+ FX_BOOL IsListBox();
+ int32_t CountChoiceListItems(FX_BOOL bSaveValue = FALSE);
+ FX_BOOL GetChoiceListItem(CFX_WideString& wsText,
+ int32_t nIndex,
+ FX_BOOL bSaveValue = FALSE);
+ void GetChoiceListItems(CFX_WideStringArray& wsTextArray,
+ FX_BOOL bSaveValue = FALSE);
+ int32_t CountSelectedItems();
+ int32_t GetSelectedItem(int32_t nIndex = 0);
+ void GetSelectedItems(CFX_Int32Array& iSelArray);
+ void GetSelectedItemsValue(CFX_WideStringArray& wsSelTextArray);
+ FX_BOOL GetItemState(int32_t nIndex);
+ void SetItemState(int32_t nIndex,
+ FX_BOOL bSelected,
+ FX_BOOL bNotify = FALSE,
+ FX_BOOL bScriptModify = FALSE,
+ FX_BOOL bSyncData = TRUE);
+ void SetSelectdItems(CFX_Int32Array& iSelArray,
+ FX_BOOL bNotify = FALSE,
+ FX_BOOL bScriptModify = FALSE,
+ FX_BOOL bSyncData = TRUE);
+ void ClearAllSelections();
+ void InsertItem(const CFX_WideString& wsLabel,
+ const CFX_WideString& wsValue,
+ int32_t nIndex = -1,
+ FX_BOOL bNotify = FALSE);
+ void GetItemLabel(const CFX_WideStringC& wsValue, CFX_WideString& wsLabel);
+ void GetItemValue(const CFX_WideStringC& wsLabel, CFX_WideString& wsValue);
+ FX_BOOL DeleteItem(int32_t nIndex,
+ FX_BOOL bNotify = FALSE,
+ FX_BOOL bScriptModify = FALSE,
+ FX_BOOL bSyncData = TRUE);
+ int32_t GetHorizontalScrollPolicy();
+ int32_t GetNumberOfCells();
+ FX_BOOL SetValue(const CFX_WideString& wsValue, XFA_VALUEPICTURE eValueType);
+ FX_BOOL GetPictureContent(CFX_WideString& wsPicture,
+ XFA_VALUEPICTURE ePicture);
+ IFX_Locale* GetLocal();
+ FX_BOOL GetValue(CFX_WideString& wsValue, XFA_VALUEPICTURE eValueType);
+ FX_BOOL GetNormalizeDataValue(const CFX_WideStringC& wsValue,
+ CFX_WideString& wsNormalizeValue);
+ FX_BOOL GetFormatDataValue(const CFX_WideStringC& wsValue,
+ CFX_WideString& wsFormatedValue);
+ void NormalizeNumStr(const CFX_WideString& wsValue, CFX_WideString& wsOutput);
+ CFX_WideString GetBarcodeType();
+ FX_BOOL GetBarcodeAttribute_CharEncoding(int32_t& val);
+ FX_BOOL GetBarcodeAttribute_Checksum(int32_t& val);
+ FX_BOOL GetBarcodeAttribute_DataLength(int32_t& val);
+ FX_BOOL GetBarcodeAttribute_StartChar(FX_CHAR& val);
+ FX_BOOL GetBarcodeAttribute_EndChar(FX_CHAR& val);
+ FX_BOOL GetBarcodeAttribute_ECLevel(int32_t& val);
+ FX_BOOL GetBarcodeAttribute_ModuleWidth(int32_t& val);
+ FX_BOOL GetBarcodeAttribute_ModuleHeight(int32_t& val);
+ FX_BOOL GetBarcodeAttribute_PrintChecksum(FX_BOOL& val);
+ FX_BOOL GetBarcodeAttribute_TextLocation(int32_t& val);
+ FX_BOOL GetBarcodeAttribute_Truncate(FX_BOOL& val);
+ FX_BOOL GetBarcodeAttribute_WideNarrowRatio(FX_FLOAT& val);
+ void GetPasswordChar(CFX_WideString& wsPassWord);
+ FX_BOOL IsMultiLine();
+ int32_t GetVerticalScrollPolicy();
+ int32_t GetMaxChars(XFA_ELEMENT& eType);
+ FX_BOOL GetFracDigits(int32_t& iFracDigits);
+ FX_BOOL GetLeadDigits(int32_t& iLeadDigits);
+
+ CFX_WideString NumericLimit(const CFX_WideString& wsValue,
+ int32_t iLead,
+ int32_t iTread) const;
+
+ FX_BOOL m_bIsNull;
+ FX_BOOL m_bPreNull;
+
+ protected:
+ void SyncValue(const CFX_WideString& wsValue, FX_BOOL bNotify);
+ void InsertListTextItem(CXFA_Node* pItems,
+ const CFX_WideStringC& wsText,
+ int32_t nIndex = -1);
+ void FormatNumStr(const CFX_WideString& wsValue,
+ IFX_Locale* pLocale,
+ CFX_WideString& wsOutput);
+
+ CXFA_Node* m_pUiChildNode;
+ XFA_ELEMENT m_eUIType;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_WIDGETDATA_H_
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 2217b94a3b..f812d03032 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -9,6 +9,7 @@
#include "core/fxcrt/include/fx_ext.h"
#include "xfa/fde/xml/fde_xml_imp.h"
#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
+#include "xfa/fxfa/parser/cxfa_occur.h"
#include "xfa/fxfa/parser/xfa_basic_imp.h"
#include "xfa/fxfa/parser/xfa_docdata.h"
#include "xfa/fxfa/parser/xfa_doclayout.h"
diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
index 8278ce990d..d680128dde 100644
--- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
+++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
@@ -12,6 +12,7 @@
#include "xfa/fgas/crt/fgas_algorithm.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
+#include "xfa/fxfa/parser/cxfa_occur.h"
#include "xfa/fxfa/parser/xfa_docdata.h"
#include "xfa/fxfa/parser/xfa_doclayout.h"
#include "xfa/fxfa/parser/xfa_document.h"
diff --git a/xfa/fxfa/parser/xfa_localemgr.h b/xfa/fxfa/parser/xfa_localemgr.h
index 62b8c67924..2bdd1dd504 100644
--- a/xfa/fxfa/parser/xfa_localemgr.h
+++ b/xfa/fxfa/parser/xfa_localemgr.h
@@ -10,7 +10,6 @@
#include "xfa/fgas/localization/fgas_datetime.h"
#include "xfa/fgas/localization/fgas_locale.h"
#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/include/fxfa/fxfa_objectacc.h"
class CXFA_Node;
class IFX_Locale;
diff --git a/xfa/fxfa/parser/xfa_localevalue.h b/xfa/fxfa/parser/xfa_localevalue.h
index bd88b0c325..912af93eeb 100644
--- a/xfa/fxfa/parser/xfa_localevalue.h
+++ b/xfa/fxfa/parser/xfa_localevalue.h
@@ -7,7 +7,9 @@
#ifndef XFA_FXFA_PARSER_XFA_LOCALEVALUE_H_
#define XFA_FXFA_PARSER_XFA_LOCALEVALUE_H_
-#include "xfa/include/fxfa/fxfa_objectacc.h"
+#include "core/fxcrt/include/fx_string.h"
+#include "core/fxcrt/include/fx_system.h"
+#include "xfa/fxfa/parser/cxfa_widgetdata.h"
class IFX_Locale;
class CFX_Unitime;
diff --git a/xfa/fxfa/parser/xfa_object.h b/xfa/fxfa/parser/xfa_object.h
index 3279941a4a..4361eb7f4a 100644
--- a/xfa/fxfa/parser/xfa_object.h
+++ b/xfa/fxfa/parser/xfa_object.h
@@ -87,6 +87,7 @@ class CXFA_Object {
CXFA_Document* const m_pDocument;
uint32_t m_uFlags;
};
+using CXFA_ObjArray = CFX_ArrayTemplate<CXFA_Object*>;
#define XFA_NODEFILTER_Children 0x01
#define XFA_NODEFILTER_Properties 0x02
diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp
index 8be5746960..d078423e36 100644
--- a/xfa/fxfa/parser/xfa_object_imp.cpp
+++ b/xfa/fxfa/parser/xfa_object_imp.cpp
@@ -12,6 +12,7 @@
#include "xfa/fgas/crt/fgas_system.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
+#include "xfa/fxfa/parser/cxfa_occur.h"
#include "xfa/fxfa/parser/xfa_basic_imp.h"
#include "xfa/fxfa/parser/xfa_docdata.h"
#include "xfa/fxfa/parser/xfa_doclayout.h"
@@ -2009,7 +2010,8 @@ void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue,
int32_t iFracDigits = 0;
pWidgetData->GetLeadDigits(iLeadDigits);
pWidgetData->GetFracDigits(iFracDigits);
- wsNewText = XFA_NumericLimit(wsNewText, iLeadDigits, iFracDigits);
+ wsNewText =
+ pWidgetData->NumericLimit(wsNewText, iLeadDigits, iFracDigits);
}
CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData();
CFX_WideString wsFormatText(wsNewText);
diff --git a/xfa/fxfa/parser/xfa_script.h b/xfa/fxfa/parser/xfa_script.h
index 80601c5b97..d92ede37c5 100644
--- a/xfa/fxfa/parser/xfa_script.h
+++ b/xfa/fxfa/parser/xfa_script.h
@@ -8,7 +8,6 @@
#define XFA_FXFA_PARSER_XFA_SCRIPT_H_
#include "xfa/include/fxfa/fxfa.h"
-#include "xfa/include/fxfa/fxfa_objectacc.h"
#define XFA_RESOLVENODE_Children 0x0001
#define XFA_RESOLVENODE_Attributes 0x0004
diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.h b/xfa/fxfa/parser/xfa_script_resolveprocessor.h
index ee0cd82b7c..b63cced721 100644
--- a/xfa/fxfa/parser/xfa_script_resolveprocessor.h
+++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.h
@@ -9,7 +9,6 @@
#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_script.h"
-#include "xfa/include/fxfa/fxfa_objectacc.h"
class CXFA_NodeHelper;
class CXFA_ScriptContext;
diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h
index 9070b97e0e..83d0e23e21 100644
--- a/xfa/fxfa/parser/xfa_utils.h
+++ b/xfa/fxfa/parser/xfa_utils.h
@@ -14,6 +14,13 @@ class CFDE_XMLElement;
class CFDE_XMLNode;
class CXFA_LocaleValue;
+inline FX_BOOL XFA_IsSpace(FX_WCHAR c) {
+ return (c == 0x20) || (c == 0x0d) || (c == 0x0a) || (c == 0x09);
+}
+inline FX_BOOL XFA_IsDigit(FX_WCHAR c) {
+ return c >= '0' && c <= '9';
+}
+
FX_BOOL XFA_FDEExtension_ResolveNamespaceQualifier(
CFDE_XMLElement* pNode,
const CFX_WideStringC& wsQualifier,
@@ -195,9 +202,6 @@ class CXFA_WidgetData;
CXFA_Node* XFA_CreateUIChild(CXFA_Node* pNode, XFA_ELEMENT& eWidgetType);
CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData);
-CFX_WideString XFA_NumericLimit(const CFX_WideString& wsValue,
- int32_t iLead,
- int32_t iTread);
FX_DOUBLE XFA_WideStringToDouble(const CFX_WideString& wsStringVal);
FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal);
int32_t XFA_MapRotation(int32_t nRotation);
diff --git a/xfa/include/fxfa/fxfa_objectacc.h b/xfa/include/fxfa/fxfa_objectacc.h
deleted file mode 100644
index f6f48e96d4..0000000000
--- a/xfa/include/fxfa/fxfa_objectacc.h
+++ /dev/null
@@ -1,561 +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
-
-#ifndef XFA_INCLUDE_FXFA_FXFA_OBJECTACC_H_
-#define XFA_INCLUDE_FXFA_FXFA_OBJECTACC_H_
-
-#include "core/fxge/include/fx_dib.h"
-#include "xfa/fxfa/parser/xfa_object.h"
-
-class CXFA_Node;
-class IFX_Locale;
-class CXFA_Margin;
-class CXFA_Caption;
-class CXFA_Para;
-class CXFA_Event;
-class CXFA_Script;
-class CXFA_Value;
-class CXFA_Calculate;
-class CXFA_Line;
-class CXFA_Text;
-class CXFA_ExData;
-class CXFA_Image;
-class CXFA_Validate;
-class CXFA_Bind;
-class CXFA_Assist;
-class CXFA_ToolTip;
-class CXFA_Submit;
-class CXFA_BindItems;
-class CXFA_Stroke;
-class CXFA_Corner;
-class CXFA_Edge;
-class CXFA_Box;
-class CXFA_Arc;
-class CXFA_Border;
-class CXFA_Rectangle;
-class CXFA_WidgetData;
-class CXFA_Occur;
-
-inline FX_BOOL XFA_IsSpace(FX_WCHAR c) {
- return (c == 0x20) || (c == 0x0d) || (c == 0x0a) || (c == 0x09);
-}
-inline FX_BOOL XFA_IsDigit(FX_WCHAR c) {
- return c >= '0' && c <= '9';
-}
-typedef CFX_ArrayTemplate<CXFA_Object*> CXFA_ObjArray;
-
-class CXFA_Data {
- public:
- explicit CXFA_Data(CXFA_Node* pNode) : m_pNode(pNode) {}
-
- operator bool() const { return !!m_pNode; }
- CXFA_Node* GetNode() const { return m_pNode; }
- XFA_ELEMENT GetClassID() const;
-
- protected:
- FX_BOOL TryMeasure(XFA_ATTRIBUTE eAttr,
- FX_FLOAT& fValue,
- FX_BOOL bUseDefault = FALSE) const;
- FX_BOOL SetMeasure(XFA_ATTRIBUTE eAttr, FX_FLOAT fValue);
-
- CXFA_Node* m_pNode;
-};
-
-class CXFA_Fill : public CXFA_Data {
- public:
- explicit CXFA_Fill(CXFA_Node* pNode);
- ~CXFA_Fill();
-
- int32_t GetPresence();
- FX_ARGB GetColor(FX_BOOL bText = FALSE);
- int32_t GetFillType();
- int32_t GetPattern(FX_ARGB& foreColor);
- int32_t GetStipple(FX_ARGB& stippleColor);
- int32_t GetLinear(FX_ARGB& endColor);
- int32_t GetRadial(FX_ARGB& endColor);
- void SetColor(FX_ARGB color);
-};
-
-class CXFA_Margin : public CXFA_Data {
- public:
- explicit CXFA_Margin(CXFA_Node* pNode);
- FX_BOOL GetLeftInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const;
- FX_BOOL GetTopInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const;
- FX_BOOL GetRightInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const;
- FX_BOOL GetBottomInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const;
-};
-
-class CXFA_Font : public CXFA_Data {
- public:
- explicit CXFA_Font(CXFA_Node* pNode);
-
- FX_FLOAT GetBaselineShift();
- FX_FLOAT GetHorizontalScale();
- FX_FLOAT GetVerticalScale();
- FX_FLOAT GetLetterSpacing();
- int32_t GetLineThrough();
- int32_t GetUnderline();
- int32_t GetUnderlinePeriod();
- FX_FLOAT GetFontSize();
- void GetTypeface(CFX_WideStringC& wsTypeFace);
-
- FX_BOOL IsBold();
- FX_BOOL IsItalic();
-
- FX_ARGB GetColor();
- void SetColor(FX_ARGB color);
-
-};
-
-class CXFA_Caption : public CXFA_Data {
- public:
- explicit CXFA_Caption(CXFA_Node* pNode);
-
- int32_t GetPresence();
- int32_t GetPlacementType();
- FX_FLOAT GetReserve();
- CXFA_Margin GetMargin();
- CXFA_Font GetFont();
- CXFA_Value GetValue();
-};
-
-class CXFA_Para : public CXFA_Data {
- public:
- explicit CXFA_Para(CXFA_Node* pNode);
-
- int32_t GetHorizontalAlign();
- int32_t GetVerticalAlign();
- FX_FLOAT GetLineHeight();
- FX_FLOAT GetMarginLeft();
- FX_FLOAT GetMarginRight();
- FX_FLOAT GetSpaceAbove();
- FX_FLOAT GetSpaceBelow();
- FX_FLOAT GetTextIndent();
-};
-
-enum XFA_TEXTENCODING {
- XFA_TEXTENCODING_None,
- XFA_TEXTENCODING_Big5,
- XFA_TEXTENCODING_FontSpecific,
- XFA_TEXTENCODING_GBK,
- XFA_TEXTENCODING_GB18030,
- XFA_TEXTENCODING_GB2312,
- XFA_TEXTENCODING_ISO8859NN,
- XFA_TEXTENCODING_KSC5601,
- XFA_TEXTENCODING_ShiftJIS,
- XFA_TEXTENCODING_UCS2,
- XFA_TEXTENCODING_UTF16,
- XFA_TEXTENCODING_UTF8
-};
-
-class CXFA_Event : public CXFA_Data {
- public:
- explicit CXFA_Event(CXFA_Node* pNode);
-
- int32_t GetActivity();
- int32_t GetEventType();
- void GetRef(CFX_WideStringC& wsRef);
-
-
- CXFA_Script GetScript();
- CXFA_Submit GetSubmit();
-
- void GetSignDataTarget(CFX_WideString& wsTarget);
-};
-
-enum XFA_SCRIPTTYPE {
- XFA_SCRIPTTYPE_Formcalc = 0,
- XFA_SCRIPTTYPE_Javascript,
- XFA_SCRIPTTYPE_Unkown,
-};
-
-class CXFA_Script : public CXFA_Data {
- public:
- explicit CXFA_Script(CXFA_Node* pNode);
-
- XFA_SCRIPTTYPE GetContentType();
- int32_t GetRunAt();
- void GetExpression(CFX_WideString& wsExpression);
-};
-
-class CXFA_Submit : public CXFA_Data {
- public:
- explicit CXFA_Submit(CXFA_Node* pNode);
-
- FX_BOOL IsSubmitEmbedPDF();
- int32_t GetSubmitFormat();
- void GetSubmitTarget(CFX_WideStringC& wsTarget);
- void GetSubmitXDPContent(CFX_WideStringC& wsContent);
-};
-
-class CXFA_Value : public CXFA_Data {
- public:
- explicit CXFA_Value(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-
- XFA_ELEMENT GetChildValueClassID();
- FX_BOOL GetChildValueContent(CFX_WideString& wsContent);
- CXFA_Arc GetArc();
- CXFA_Line GetLine();
- CXFA_Rectangle GetRectangle();
- CXFA_Text GetText();
- CXFA_ExData GetExData();
- CXFA_Image GetImage();
-};
-
-class CXFA_Line : public CXFA_Data {
- public:
- explicit CXFA_Line(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-
- int32_t GetHand();
- FX_BOOL GetSlop();
- CXFA_Edge GetEdge();
-};
-
-class CXFA_Text : public CXFA_Data {
- public:
- explicit CXFA_Text(CXFA_Node* pNode);
-
- void GetContent(CFX_WideString& wsText);
-};
-
-class CXFA_ExData : public CXFA_Data {
- public:
- explicit CXFA_ExData(CXFA_Node* pNode);
-
- FX_BOOL SetContentType(const CFX_WideString& wsContentType);
-};
-
-class CXFA_Image : public CXFA_Data {
- public:
- CXFA_Image(CXFA_Node* pNode, FX_BOOL bDefValue);
-
- int32_t GetAspect();
- FX_BOOL GetContentType(CFX_WideString& wsContentType);
- FX_BOOL GetHref(CFX_WideString& wsHref);
- int32_t GetTransferEncoding();
- FX_BOOL GetContent(CFX_WideString& wsText);
- FX_BOOL SetContentType(const CFX_WideString& wsContentType);
- FX_BOOL SetHref(const CFX_WideString& wsHref);
- FX_BOOL SetTransferEncoding(int32_t iTransferEncoding);
-
- protected:
- FX_BOOL m_bDefValue;
-};
-
-class CXFA_Calculate : public CXFA_Data {
- public:
- explicit CXFA_Calculate(CXFA_Node* pNode);
-
- int32_t GetOverride();
- CXFA_Script GetScript();
- void GetMessageText(CFX_WideString& wsMessage);
-};
-
-class CXFA_Validate : public CXFA_Data {
- public:
- explicit CXFA_Validate(CXFA_Node* pNode);
-
- int32_t GetFormatTest();
- int32_t GetNullTest();
- FX_BOOL SetNullTest(CFX_WideString wsValue);
- int32_t GetScriptTest();
- void GetFormatMessageText(CFX_WideString& wsMessage);
- void SetFormatMessageText(CFX_WideString wsMessage);
- void GetNullMessageText(CFX_WideString& wsMessage);
- void SetNullMessageText(CFX_WideString wsMessage);
- void GetScriptMessageText(CFX_WideString& wsMessage);
- void SetScriptMessageText(CFX_WideString wsMessage);
- void GetPicture(CFX_WideString& wsPicture);
- CXFA_Script GetScript();
-
- protected:
- void GetMessageText(CFX_WideString& wsMessage,
- const CFX_WideStringC& wsMessageType);
- void SetMessageText(CFX_WideString& wsMessage,
- const CFX_WideStringC& wsMessageType);
- FX_BOOL SetTestValue(int32_t iType,
- CFX_WideString& wsValue,
- XFA_ATTRIBUTEENUM eName);
-};
-
-class CXFA_Bind : public CXFA_Data {
- public:
- explicit CXFA_Bind(CXFA_Node* pNode);
-
- void GetPicture(CFX_WideString& wsPicture);
-};
-
-class CXFA_Assist : public CXFA_Data {
- public:
- explicit CXFA_Assist(CXFA_Node* pNode);
-
- CXFA_ToolTip GetToolTip();
-};
-
-class CXFA_ToolTip : public CXFA_Data {
- public:
- explicit CXFA_ToolTip(CXFA_Node* pNode);
-
- FX_BOOL GetTip(CFX_WideString& wsTip);
-};
-
-class CXFA_BindItems : public CXFA_Data {
- public:
- explicit CXFA_BindItems(CXFA_Node* pNode);
-
- void GetLabelRef(CFX_WideStringC& wsLabelRef);
- void GetValueRef(CFX_WideStringC& wsValueRef);
- void GetRef(CFX_WideStringC& wsRef);
- FX_BOOL SetConnection(const CFX_WideString& wsConnection);
-};
-
-#define XFA_STROKE_SAMESTYLE_NoPresence 1
-#define XFA_STROKE_SAMESTYLE_Corner 2
-
-class CXFA_Stroke : public CXFA_Data {
- public:
- explicit CXFA_Stroke(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-
- bool IsCorner() const { return GetClassID() == XFA_ELEMENT_Corner; }
- bool IsEdge() const { return GetClassID() == XFA_ELEMENT_Edge; }
- bool IsVisible() const { return GetPresence() == XFA_ATTRIBUTEENUM_Visible; }
- int32_t GetPresence() const;
- int32_t GetCapType() const;
- int32_t GetStrokeType() const;
- FX_FLOAT GetThickness() const;
- CXFA_Measurement GetMSThickness() const;
- void SetMSThickness(CXFA_Measurement msThinkness);
- FX_ARGB GetColor() const;
- void SetColor(FX_ARGB argb);
- int32_t GetJoinType() const;
- FX_BOOL IsInverted() const;
- FX_FLOAT GetRadius() const;
- FX_BOOL SameStyles(CXFA_Stroke stroke, uint32_t dwFlags = 0) const;
-};
-
-class CXFA_Corner : public CXFA_Stroke {
- public:
- explicit CXFA_Corner(CXFA_Node* pNode) : CXFA_Stroke(pNode) {}
-};
-
-class CXFA_Edge : public CXFA_Stroke {
- public:
- explicit CXFA_Edge(CXFA_Node* pNode) : CXFA_Stroke(pNode) {}
-};
-
-typedef CFX_ArrayTemplate<CXFA_Stroke> CXFA_StrokeArray;
-typedef CFX_ArrayTemplate<CXFA_Edge> CXFA_EdgeArray;
-typedef CFX_ArrayTemplate<CXFA_Corner> CXFA_CornerArray;
-
-class CXFA_Box : public CXFA_Data {
- public:
- explicit CXFA_Box(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-
- bool IsArc() const { return GetClassID() == XFA_ELEMENT_Arc; }
- bool IsBorder() const { return GetClassID() == XFA_ELEMENT_Border; }
- bool IsRectangle() const { return GetClassID() == XFA_ELEMENT_Rectangle; }
- int32_t GetHand() const;
- int32_t GetPresence() const;
- int32_t CountEdges() const;
- CXFA_Edge GetEdge(int32_t nIndex = 0) const;
- void GetStrokes(CXFA_StrokeArray& strokes) const;
- FX_BOOL IsCircular() const;
- FX_BOOL GetStartAngle(FX_FLOAT& fStartAngle) const;
- FX_FLOAT GetStartAngle() const {
- FX_FLOAT fStartAngle;
- GetStartAngle(fStartAngle);
- return fStartAngle;
- }
-
- FX_BOOL GetSweepAngle(FX_FLOAT& fSweepAngle) const;
- FX_FLOAT GetSweepAngle() const {
- FX_FLOAT fSweepAngle;
- GetSweepAngle(fSweepAngle);
- return fSweepAngle;
- }
-
- CXFA_Fill GetFill(FX_BOOL bModified = FALSE) const;
- CXFA_Margin GetMargin() const;
- int32_t Get3DStyle(FX_BOOL& bVisible, FX_FLOAT& fThickness) const;
-};
-
-class CXFA_Arc : public CXFA_Box {
- public:
- explicit CXFA_Arc(CXFA_Node* pNode) : CXFA_Box(pNode) {}
-};
-
-class CXFA_Border : public CXFA_Box {
- public:
- explicit CXFA_Border(CXFA_Node* pNode) : CXFA_Box(pNode) {}
-};
-
-class CXFA_Rectangle : public CXFA_Box {
- public:
- explicit CXFA_Rectangle(CXFA_Node* pNode) : CXFA_Box(pNode) {}
-};
-
-enum XFA_CHECKSTATE {
- XFA_CHECKSTATE_On = 0,
- XFA_CHECKSTATE_Off = 1,
- XFA_CHECKSTATE_Neutral = 2,
-};
-
-enum XFA_VALUEPICTURE {
- XFA_VALUEPICTURE_Raw = 0,
- XFA_VALUEPICTURE_Display,
- XFA_VALUEPICTURE_Edit,
- XFA_VALUEPICTURE_DataBind,
-};
-
-class CXFA_WidgetData : public CXFA_Data {
- public:
- explicit CXFA_WidgetData(CXFA_Node* pNode);
-
- CXFA_Node* GetUIChild();
- XFA_ELEMENT GetUIType();
- CFX_WideString GetRawValue();
- int32_t GetAccess(FX_BOOL bTemplate = FALSE);
- int32_t GetRotate();
- CXFA_Border GetBorder(FX_BOOL bModified = FALSE);
- CXFA_Caption GetCaption(FX_BOOL bModified = FALSE);
- CXFA_Font GetFont(FX_BOOL bModified = FALSE);
- CXFA_Margin GetMargin(FX_BOOL bModified = FALSE);
- CXFA_Para GetPara(FX_BOOL bModified = FALSE);
- void GetEventList(CXFA_NodeArray& events);
- int32_t GetEventByActivity(int32_t iActivity,
- CXFA_NodeArray& events,
- FX_BOOL bIsFormReady = FALSE);
- CXFA_Value GetDefaultValue(FX_BOOL bModified = FALSE);
- CXFA_Value GetFormValue(FX_BOOL bModified = FALSE);
- CXFA_Calculate GetCalculate(FX_BOOL bModified = FALSE);
- CXFA_Validate GetValidate(FX_BOOL bModified = FALSE);
- CXFA_Bind GetBind(FX_BOOL bModified = FALSE);
- CXFA_Assist GetAssist(FX_BOOL bModified = FALSE);
- uint32_t GetRelevantStatus();
- FX_BOOL GetWidth(FX_FLOAT& fWidth);
- FX_BOOL GetHeight(FX_FLOAT& fHeight);
- FX_BOOL GetMinWidth(FX_FLOAT& fMinWidth);
- FX_BOOL GetMinHeight(FX_FLOAT& fMinHeight);
- FX_BOOL GetMaxWidth(FX_FLOAT& fMaxWidth);
- FX_BOOL GetMaxHeight(FX_FLOAT& fMaxHeight);
- CXFA_Border GetUIBorder(FX_BOOL bModified = FALSE);
- CXFA_Margin GetUIMargin(FX_BOOL bModified = FALSE);
- void GetUIMargin(CFX_RectF& rtUIMargin);
- int32_t GetButtonHighlight();
- FX_BOOL GetButtonRollover(CFX_WideString& wsRollover, FX_BOOL& bRichText);
- FX_BOOL GetButtonDown(CFX_WideString& wsDown, FX_BOOL& bRichText);
- int32_t GetCheckButtonShape();
- int32_t GetCheckButtonMark();
- FX_FLOAT GetCheckButtonSize();
- FX_BOOL IsAllowNeutral();
- FX_BOOL IsRadioButton();
- XFA_CHECKSTATE GetCheckState();
- void SetCheckState(XFA_CHECKSTATE eCheckState, FX_BOOL bNotify = TRUE);
- CXFA_Node* GetExclGroupNode();
- CXFA_Node* GetSelectedMember();
- CXFA_Node* SetSelectedMember(const CFX_WideStringC& wsName,
- FX_BOOL bNotify = TRUE);
- void SetSelectedMemberByValue(const CFX_WideStringC& wsValue,
- FX_BOOL bNotify = TRUE,
- FX_BOOL bScriptModify = FALSE,
- FX_BOOL bSyncData = TRUE);
- CXFA_Node* GetExclGroupFirstMember();
- CXFA_Node* GetExclGroupNextMember(CXFA_Node* pNode);
- int32_t GetChoiceListCommitOn();
- FX_BOOL IsChoiceListAllowTextEntry();
- int32_t GetChoiceListOpen();
- FX_BOOL IsListBox();
- int32_t CountChoiceListItems(FX_BOOL bSaveValue = FALSE);
- FX_BOOL GetChoiceListItem(CFX_WideString& wsText,
- int32_t nIndex,
- FX_BOOL bSaveValue = FALSE);
- void GetChoiceListItems(CFX_WideStringArray& wsTextArray,
- FX_BOOL bSaveValue = FALSE);
- int32_t CountSelectedItems();
- int32_t GetSelectedItem(int32_t nIndex = 0);
- void GetSelectedItems(CFX_Int32Array& iSelArray);
- void GetSelectedItemsValue(CFX_WideStringArray& wsSelTextArray);
- FX_BOOL GetItemState(int32_t nIndex);
- void SetItemState(int32_t nIndex,
- FX_BOOL bSelected,
- FX_BOOL bNotify = FALSE,
- FX_BOOL bScriptModify = FALSE,
- FX_BOOL bSyncData = TRUE);
- void SetSelectdItems(CFX_Int32Array& iSelArray,
- FX_BOOL bNotify = FALSE,
- FX_BOOL bScriptModify = FALSE,
- FX_BOOL bSyncData = TRUE);
- void ClearAllSelections();
- void InsertItem(const CFX_WideString& wsLabel,
- const CFX_WideString& wsValue,
- int32_t nIndex = -1,
- FX_BOOL bNotify = FALSE);
- void GetItemLabel(const CFX_WideStringC& wsValue, CFX_WideString& wsLabel);
- void GetItemValue(const CFX_WideStringC& wsLabel, CFX_WideString& wsValue);
- FX_BOOL DeleteItem(int32_t nIndex,
- FX_BOOL bNotify = FALSE,
- FX_BOOL bScriptModify = FALSE,
- FX_BOOL bSyncData = TRUE);
- int32_t GetHorizontalScrollPolicy();
- int32_t GetNumberOfCells();
- FX_BOOL SetValue(const CFX_WideString& wsValue, XFA_VALUEPICTURE eValueType);
- FX_BOOL GetPictureContent(CFX_WideString& wsPicture,
- XFA_VALUEPICTURE ePicture);
- IFX_Locale* GetLocal();
- FX_BOOL GetValue(CFX_WideString& wsValue, XFA_VALUEPICTURE eValueType);
- FX_BOOL GetNormalizeDataValue(const CFX_WideStringC& wsValue,
- CFX_WideString& wsNormalizeValue);
- FX_BOOL GetFormatDataValue(const CFX_WideStringC& wsValue,
- CFX_WideString& wsFormatedValue);
- void NormalizeNumStr(const CFX_WideString& wsValue, CFX_WideString& wsOutput);
- CFX_WideString GetBarcodeType();
- FX_BOOL GetBarcodeAttribute_CharEncoding(int32_t& val);
- FX_BOOL GetBarcodeAttribute_Checksum(int32_t& val);
- FX_BOOL GetBarcodeAttribute_DataLength(int32_t& val);
- FX_BOOL GetBarcodeAttribute_StartChar(FX_CHAR& val);
- FX_BOOL GetBarcodeAttribute_EndChar(FX_CHAR& val);
- FX_BOOL GetBarcodeAttribute_ECLevel(int32_t& val);
- FX_BOOL GetBarcodeAttribute_ModuleWidth(int32_t& val);
- FX_BOOL GetBarcodeAttribute_ModuleHeight(int32_t& val);
- FX_BOOL GetBarcodeAttribute_PrintChecksum(FX_BOOL& val);
- FX_BOOL GetBarcodeAttribute_TextLocation(int32_t& val);
- FX_BOOL GetBarcodeAttribute_Truncate(FX_BOOL& val);
- FX_BOOL GetBarcodeAttribute_WideNarrowRatio(FX_FLOAT& val);
- void GetPasswordChar(CFX_WideString& wsPassWord);
- FX_BOOL IsMultiLine();
- int32_t GetVerticalScrollPolicy();
- int32_t GetMaxChars(XFA_ELEMENT& eType);
- FX_BOOL GetFracDigits(int32_t& iFracDigits);
- FX_BOOL GetLeadDigits(int32_t& iLeadDigits);
-
- FX_BOOL m_bIsNull;
- FX_BOOL m_bPreNull;
-
- protected:
- void SyncValue(const CFX_WideString& wsValue, FX_BOOL bNotify);
- void InsertListTextItem(CXFA_Node* pItems,
- const CFX_WideStringC& wsText,
- int32_t nIndex = -1);
- void FormatNumStr(const CFX_WideString& wsValue,
- IFX_Locale* pLocale,
- CFX_WideString& wsOutput);
-
- CXFA_Node* m_pUiChildNode;
- XFA_ELEMENT m_eUIType;
-};
-
-class CXFA_Occur : public CXFA_Data {
- public:
- explicit CXFA_Occur(CXFA_Node* pNode);
-
- int32_t GetMax();
- int32_t GetMin();
- FX_BOOL GetOccurInfo(int32_t& iMin, int32_t& iMax, int32_t& iInit);
- void SetMax(int32_t iMax);
- void SetMin(int32_t iMin);
-};
-
-#endif // XFA_INCLUDE_FXFA_FXFA_OBJECTACC_H_
diff --git a/xfa/include/fxfa/fxfa_widget.h b/xfa/include/fxfa/fxfa_widget.h
index f1fcffefc4..6ab7a6f0da 100644
--- a/xfa/include/fxfa/fxfa_widget.h
+++ b/xfa/include/fxfa/fxfa_widget.h
@@ -7,7 +7,15 @@
#ifndef XFA_INCLUDE_FXFA_FXFA_WIDGET_H_
#define XFA_INCLUDE_FXFA_FXFA_WIDGET_H_
-#include "xfa/include/fxfa/fxfa_objectacc.h"
+#include "core/fxcrt/include/fx_coordinates.h"
+#include "core/fxge/include/fx_dib.h"
+#include "xfa/fxfa/parser/cxfa_box.h"
+#include "xfa/fxfa/parser/cxfa_event.h"
+#include "xfa/fxfa/parser/cxfa_image.h"
+#include "xfa/fxfa/parser/cxfa_margin.h"
+#include "xfa/fxfa/parser/cxfa_script.h"
+#include "xfa/fxfa/parser/cxfa_value.h"
+#include "xfa/fxfa/parser/cxfa_widgetdata.h"
class CXFA_Node;
class CXFA_FFDocView;
diff --git a/xfa/include/fxfa/xfa_ffwidget.h b/xfa/include/fxfa/xfa_ffwidget.h
index 0690b7f3a1..30ad6d250a 100644
--- a/xfa/include/fxfa/xfa_ffwidget.h
+++ b/xfa/include/fxfa/xfa_ffwidget.h
@@ -169,9 +169,6 @@ FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len);
void XFA_RectWidthoutMargin(CFX_RectF& rt,
const CXFA_Margin& mg,
FX_BOOL bUI = FALSE);
-FX_FLOAT XFA_GetEdgeThickness(const CXFA_StrokeArray& strokes,
- FX_BOOL b3DStyle,
- int32_t nIndex);
CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem);
FX_BOOL XFA_IsCreateWidget(XFA_ELEMENT iType);
#define XFA_DRAWBOX_ForceRound 1