Split apart remaining xfa/fxfa/app files
This CL splits the remaining files in xfa/fxfa/app into individual files
named after the classes.
Change-Id: I84bd8938937641bb6897614ed15558a2682f456c
Reviewed-on: https://pdfium-review.googlesource.com/6010
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 5802752..4c36297 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1593,6 +1593,52 @@
"xfa/fwl/theme/cfwl_widgettp.h",
"xfa/fxfa/app/cxfa_csstagprovider.cpp",
"xfa/fxfa/app/cxfa_csstagprovider.h",
+ "xfa/fxfa/app/cxfa_ffarc.cpp",
+ "xfa/fxfa/app/cxfa_ffarc.h",
+ "xfa/fxfa/app/cxfa_ffbarcode.cpp",
+ "xfa/fxfa/app/cxfa_ffbarcode.h",
+ "xfa/fxfa/app/cxfa_ffcheckbutton.cpp",
+ "xfa/fxfa/app/cxfa_ffcheckbutton.h",
+ "xfa/fxfa/app/cxfa_ffcombobox.cpp",
+ "xfa/fxfa/app/cxfa_ffcombobox.h",
+ "xfa/fxfa/app/cxfa_ffdatetimeedit.cpp",
+ "xfa/fxfa/app/cxfa_ffdatetimeedit.h",
+ "xfa/fxfa/app/cxfa_ffdraw.cpp",
+ "xfa/fxfa/app/cxfa_ffdraw.h",
+ "xfa/fxfa/app/cxfa_ffexclgroup.cpp",
+ "xfa/fxfa/app/cxfa_ffexclgroup.h",
+ "xfa/fxfa/app/cxfa_fffield.cpp",
+ "xfa/fxfa/app/cxfa_fffield.h",
+ "xfa/fxfa/app/cxfa_ffimage.cpp",
+ "xfa/fxfa/app/cxfa_ffimage.h",
+ "xfa/fxfa/app/cxfa_ffimageedit.cpp",
+ "xfa/fxfa/app/cxfa_ffimageedit.h",
+ "xfa/fxfa/app/cxfa_ffline.cpp",
+ "xfa/fxfa/app/cxfa_ffline.h",
+ "xfa/fxfa/app/cxfa_fflistbox.cpp",
+ "xfa/fxfa/app/cxfa_fflistbox.h",
+ "xfa/fxfa/app/cxfa_ffnotify.cpp",
+ "xfa/fxfa/app/cxfa_ffnotify.h",
+ "xfa/fxfa/app/cxfa_ffnumericedit.cpp",
+ "xfa/fxfa/app/cxfa_ffnumericedit.h",
+ "xfa/fxfa/app/cxfa_ffpasswordedit.cpp",
+ "xfa/fxfa/app/cxfa_ffpasswordedit.h",
+ "xfa/fxfa/app/cxfa_ffpushbutton.cpp",
+ "xfa/fxfa/app/cxfa_ffpushbutton.h",
+ "xfa/fxfa/app/cxfa_ffrectangle.cpp",
+ "xfa/fxfa/app/cxfa_ffrectangle.h",
+ "xfa/fxfa/app/cxfa_ffsignature.cpp",
+ "xfa/fxfa/app/cxfa_ffsignature.h",
+ "xfa/fxfa/app/cxfa_ffsubform.cpp",
+ "xfa/fxfa/app/cxfa_ffsubform.h",
+ "xfa/fxfa/app/cxfa_fftext.cpp",
+ "xfa/fxfa/app/cxfa_fftext.h",
+ "xfa/fxfa/app/cxfa_fftextedit.cpp",
+ "xfa/fxfa/app/cxfa_fftextedit.h",
+ "xfa/fxfa/app/cxfa_fwladapterwidgetmgr.cpp",
+ "xfa/fxfa/app/cxfa_fwladapterwidgetmgr.h",
+ "xfa/fxfa/app/cxfa_fwltheme.cpp",
+ "xfa/fxfa/app/cxfa_fwltheme.h",
"xfa/fxfa/app/cxfa_linkuserdata.cpp",
"xfa/fxfa/app/cxfa_linkuserdata.h",
"xfa/fxfa/app/cxfa_loadercontext.cpp",
@@ -1605,48 +1651,14 @@
"xfa/fxfa/app/cxfa_textparsecontext.h",
"xfa/fxfa/app/cxfa_textparser.cpp",
"xfa/fxfa/app/cxfa_textparser.h",
+ "xfa/fxfa/app/cxfa_textpiece.cpp",
+ "xfa/fxfa/app/cxfa_textpiece.h",
+ "xfa/fxfa/app/cxfa_textprovider.cpp",
+ "xfa/fxfa/app/cxfa_textprovider.h",
"xfa/fxfa/app/cxfa_texttabstopscontext.cpp",
"xfa/fxfa/app/cxfa_texttabstopscontext.h",
"xfa/fxfa/app/cxfa_textuserdata.cpp",
"xfa/fxfa/app/cxfa_textuserdata.h",
- "xfa/fxfa/app/xfa_ffbarcode.cpp",
- "xfa/fxfa/app/xfa_ffbarcode.h",
- "xfa/fxfa/app/xfa_ffcheckbutton.cpp",
- "xfa/fxfa/app/xfa_ffcheckbutton.h",
- "xfa/fxfa/app/xfa_ffchoicelist.cpp",
- "xfa/fxfa/app/xfa_ffchoicelist.h",
- "xfa/fxfa/app/xfa_ffdraw.cpp",
- "xfa/fxfa/app/xfa_ffdraw.h",
- "xfa/fxfa/app/xfa_ffexclgroup.cpp",
- "xfa/fxfa/app/xfa_ffexclgroup.h",
- "xfa/fxfa/app/xfa_fffield.cpp",
- "xfa/fxfa/app/xfa_fffield.h",
- "xfa/fxfa/app/xfa_ffimage.cpp",
- "xfa/fxfa/app/xfa_ffimage.h",
- "xfa/fxfa/app/xfa_ffimageedit.cpp",
- "xfa/fxfa/app/xfa_ffimageedit.h",
- "xfa/fxfa/app/xfa_ffnotify.cpp",
- "xfa/fxfa/app/xfa_ffnotify.h",
- "xfa/fxfa/app/xfa_ffpath.cpp",
- "xfa/fxfa/app/xfa_ffpath.h",
- "xfa/fxfa/app/xfa_ffpushbutton.cpp",
- "xfa/fxfa/app/xfa_ffpushbutton.h",
- "xfa/fxfa/app/xfa_ffsignature.cpp",
- "xfa/fxfa/app/xfa_ffsignature.h",
- "xfa/fxfa/app/xfa_ffsubform.cpp",
- "xfa/fxfa/app/xfa_ffsubform.h",
- "xfa/fxfa/app/xfa_fftext.cpp",
- "xfa/fxfa/app/xfa_fftext.h",
- "xfa/fxfa/app/xfa_fftextedit.cpp",
- "xfa/fxfa/app/xfa_fftextedit.h",
- "xfa/fxfa/app/xfa_ffwidgetacc.cpp",
- "xfa/fxfa/app/xfa_ffwidgetacc.h",
- "xfa/fxfa/app/xfa_fwladapter.cpp",
- "xfa/fxfa/app/xfa_fwladapter.h",
- "xfa/fxfa/app/xfa_fwltheme.cpp",
- "xfa/fxfa/app/xfa_fwltheme.h",
- "xfa/fxfa/app/xfa_textpiece.cpp",
- "xfa/fxfa/app/xfa_textpiece.h",
"xfa/fxfa/cxfa_deffontmgr.cpp",
"xfa/fxfa/cxfa_deffontmgr.h",
"xfa/fxfa/cxfa_eventparam.cpp",
@@ -1917,8 +1929,8 @@
"xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp",
"xfa/fgas/layout/cfx_rtfbreak_unittest.cpp",
"xfa/fwl/cfx_barcode_unittest.cpp",
+ "xfa/fxfa/app/cxfa_ffbarcode_unittest.cpp",
"xfa/fxfa/app/cxfa_textparser_unittest.cpp",
- "xfa/fxfa/app/xfa_ffbarcode_unittest.cpp",
"xfa/fxfa/cxfa_ffapp_unittest.cpp",
"xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp",
"xfa/fxfa/fm2js/cxfa_fmparse_unittest.cpp",
diff --git a/xfa/fwl/cfwl_app.cpp b/xfa/fwl/cfwl_app.cpp
index febc8a0..e762125 100644
--- a/xfa/fwl/cfwl_app.cpp
+++ b/xfa/fwl/cfwl_app.cpp
@@ -10,7 +10,7 @@
#include "xfa/fwl/cfwl_notedriver.h"
#include "xfa/fwl/cfwl_widget.h"
#include "xfa/fwl/cfwl_widgetmgr.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
+#include "xfa/fxfa/app/cxfa_fwladapterwidgetmgr.h"
CFWL_App::CFWL_App(CXFA_FFApp* pAdapter)
: m_pAdapterNative(pAdapter),
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp
index d0dbf1f..67a63ba 100644
--- a/xfa/fwl/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -12,7 +12,7 @@
#include "xfa/fwl/cfwl_app.h"
#include "xfa/fwl/cfwl_form.h"
#include "xfa/fwl/cfwl_notedriver.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
+#include "xfa/fxfa/app/cxfa_fwladapterwidgetmgr.h"
#include "xfa/fxfa/cxfa_ffapp.h"
namespace {
diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp
index 138a99e..06cdceb 100644
--- a/xfa/fwl/theme/cfwl_edittp.cpp
+++ b/xfa/fwl/theme/cfwl_edittp.cpp
@@ -9,7 +9,7 @@
#include "xfa/fwl/cfwl_edit.h"
#include "xfa/fwl/cfwl_themebackground.h"
#include "xfa/fwl/cfwl_widget.h"
-#include "xfa/fxfa/app/xfa_fwltheme.h"
+#include "xfa/fxfa/app/cxfa_fwltheme.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"
diff --git a/xfa/fxfa/app/cxfa_ffarc.cpp b/xfa/fxfa/app/cxfa_ffarc.cpp
new file mode 100644
index 0000000..e208548
--- /dev/null
+++ b/xfa/fxfa/app/cxfa_ffarc.cpp
@@ -0,0 +1,33 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fxfa/app/cxfa_ffarc.h"
+
+CXFA_FFArc::CXFA_FFArc(CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pDataAcc) {}
+
+CXFA_FFArc::~CXFA_FFArc() {}
+
+void CXFA_FFArc::RenderWidget(CFX_Graphics* pGS,
+ CFX_Matrix* pMatrix,
+ uint32_t dwStatus) {
+ if (!IsMatchVisibleStatus(dwStatus))
+ return;
+
+ CXFA_Value value = m_pDataAcc->GetFormValue();
+ if (!value)
+ return;
+
+ CXFA_Arc arcObj = value.GetArc();
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
+ mtRotate.Concat(*pMatrix);
+
+ CFX_RectF rtArc = GetRectWithoutRotate();
+ if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
+ XFA_RectWidthoutMargin(rtArc, mgWidget);
+
+ DrawBorder(pGS, arcObj, rtArc, &mtRotate);
+}
diff --git a/xfa/fxfa/app/cxfa_ffarc.h b/xfa/fxfa/app/cxfa_ffarc.h
new file mode 100644
index 0000000..777ed6f
--- /dev/null
+++ b/xfa/fxfa/app/cxfa_ffarc.h
@@ -0,0 +1,23 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_APP_CXFA_FFARC_H_
+#define XFA_FXFA_APP_CXFA_FFARC_H_
+
+#include "xfa/fxfa/app/cxfa_ffdraw.h"
+
+class CXFA_FFArc : public CXFA_FFDraw {
+ public:
+ explicit CXFA_FFArc(CXFA_WidgetAcc* pDataAcc);
+ ~CXFA_FFArc() override;
+
+ // CXFA_FFWidget
+ void RenderWidget(CFX_Graphics* pGS,
+ CFX_Matrix* pMatrix,
+ uint32_t dwStatus) override;
+};
+
+#endif // XFA_FXFA_APP_CXFA_FFARC_H_
diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/cxfa_ffbarcode.cpp
similarity index 98%
rename from xfa/fxfa/app/xfa_ffbarcode.cpp
rename to xfa/fxfa/app/cxfa_ffbarcode.cpp
index 4dcffa5..bd529d3 100644
--- a/xfa/fxfa/app/xfa_ffbarcode.cpp
+++ b/xfa/fxfa/app/cxfa_ffbarcode.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_ffbarcode.h"
+#include "xfa/fxfa/app/cxfa_ffbarcode.h"
#include <utility>
@@ -13,9 +13,8 @@
#include "xfa/fwl/cfwl_app.h"
#include "xfa/fwl/cfwl_barcode.h"
#include "xfa/fwl/cfwl_notedriver.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/app/xfa_fftextedit.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
+#include "xfa/fxfa/app/cxfa_fffield.h"
+#include "xfa/fxfa/app/cxfa_fwladapterwidgetmgr.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
diff --git a/xfa/fxfa/app/xfa_ffbarcode.h b/xfa/fxfa/app/cxfa_ffbarcode.h
similarity index 92%
rename from xfa/fxfa/app/xfa_ffbarcode.h
rename to xfa/fxfa/app/cxfa_ffbarcode.h
index 5164623..11b678d 100644
--- a/xfa/fxfa/app/xfa_ffbarcode.h
+++ b/xfa/fxfa/app/cxfa_ffbarcode.h
@@ -4,11 +4,11 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_APP_XFA_FFBARCODE_H_
-#define XFA_FXFA_APP_XFA_FFBARCODE_H_
+#ifndef XFA_FXFA_APP_CXFA_FFBARCODE_H_
+#define XFA_FXFA_APP_CXFA_FFBARCODE_H_
#include "fxbarcode/BC_Library.h"
-#include "xfa/fxfa/app/xfa_fftextedit.h"
+#include "xfa/fxfa/app/cxfa_fftextedit.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
enum class BarcodeType {
@@ -100,4 +100,4 @@
bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
};
-#endif // XFA_FXFA_APP_XFA_FFBARCODE_H_
+#endif // XFA_FXFA_APP_CXFA_FFBARCODE_H_
diff --git a/xfa/fxfa/app/xfa_ffbarcode_unittest.cpp b/xfa/fxfa/app/cxfa_ffbarcode_unittest.cpp
similarity index 95%
rename from xfa/fxfa/app/xfa_ffbarcode_unittest.cpp
rename to xfa/fxfa/app/cxfa_ffbarcode_unittest.cpp
index 95e2377..65e44ad 100644
--- a/xfa/fxfa/app/xfa_ffbarcode_unittest.cpp
+++ b/xfa/fxfa/app/cxfa_ffbarcode_unittest.cpp
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "xfa/fxfa/app/xfa_ffbarcode.h"
+#include "xfa/fxfa/app/cxfa_ffbarcode.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/base/ptr_util.h"
diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/cxfa_ffcheckbutton.cpp
similarity index 98%
rename from xfa/fxfa/app/xfa_ffcheckbutton.cpp
rename to xfa/fxfa/app/cxfa_ffcheckbutton.cpp
index 76531ce..b55daae 100644
--- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/app/cxfa_ffcheckbutton.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_ffcheckbutton.h"
+#include "xfa/fxfa/app/cxfa_ffcheckbutton.h"
#include <utility>
#include "third_party/base/ptr_util.h"
@@ -12,8 +12,8 @@
#include "xfa/fwl/cfwl_messagemouse.h"
#include "xfa/fwl/cfwl_notedriver.h"
#include "xfa/fwl/cfwl_widgetmgr.h"
-#include "xfa/fxfa/app/xfa_ffexclgroup.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
+#include "xfa/fxfa/app/cxfa_ffexclgroup.h"
+#include "xfa/fxfa/app/cxfa_fffield.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.h b/xfa/fxfa/app/cxfa_ffcheckbutton.h
similarity index 88%
rename from xfa/fxfa/app/xfa_ffcheckbutton.h
rename to xfa/fxfa/app/cxfa_ffcheckbutton.h
index d4de7e8..f92b50a 100644
--- a/xfa/fxfa/app/xfa_ffcheckbutton.h
+++ b/xfa/fxfa/app/cxfa_ffcheckbutton.h
@@ -4,10 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_APP_XFA_FFCHECKBUTTON_H_
-#define XFA_FXFA_APP_XFA_FFCHECKBUTTON_H_
+#ifndef XFA_FXFA_APP_CXFA_FFCHECKBUTTON_H_
+#define XFA_FXFA_APP_CXFA_FFCHECKBUTTON_H_
-#include "xfa/fxfa/app/xfa_fffield.h"
+#include "xfa/fxfa/app/cxfa_fffield.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
class CXFA_FFCheckButton : public CXFA_FFField {
@@ -43,4 +43,4 @@
CFX_RectF m_rtCheckBox;
};
-#endif // XFA_FXFA_APP_XFA_FFCHECKBUTTON_H_
+#endif // XFA_FXFA_APP_CXFA_FFCHECKBUTTON_H_
diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/cxfa_ffcombobox.cpp
similarity index 62%
rename from xfa/fxfa/app/xfa_ffchoicelist.cpp
rename to xfa/fxfa/app/cxfa_ffcombobox.cpp
index e24e7f7..91de16e 100644
--- a/xfa/fxfa/app/xfa_ffchoicelist.cpp
+++ b/xfa/fxfa/app/cxfa_ffcombobox.cpp
@@ -4,227 +4,25 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_ffchoicelist.h"
+#include "xfa/fxfa/app/cxfa_ffcombobox.h"
-#include <algorithm>
#include <utility>
#include <vector>
-#include "third_party/base/ptr_util.h"
-#include "third_party/base/stl_util.h"
-#include "xfa/fwl/cfwl_app.h"
#include "xfa/fwl/cfwl_combobox.h"
-#include "xfa/fwl/cfwl_edit.h"
#include "xfa/fwl/cfwl_eventselectchanged.h"
-#include "xfa/fwl/cfwl_listbox.h"
#include "xfa/fwl/cfwl_notedriver.h"
-#include "xfa/fwl/cfwl_widgetproperties.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
#include "xfa/fxfa/cxfa_eventparam.h"
-#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
-#include "xfa/fxfa/cxfa_ffpageview.h"
-#include "xfa/fxfa/cxfa_ffwidget.h"
namespace {
-CFWL_ListBox* ToListBox(CFWL_Widget* widget) {
- return static_cast<CFWL_ListBox*>(widget);
-}
-
CFWL_ComboBox* ToComboBox(CFWL_Widget* widget) {
return static_cast<CFWL_ComboBox*>(widget);
}
} // namespace
-CXFA_FFListBox::CXFA_FFListBox(CXFA_WidgetAcc* pDataAcc)
- : CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
-
-CXFA_FFListBox::~CXFA_FFListBox() {
- if (!m_pNormalWidget)
- return;
-
- CFWL_NoteDriver* pNoteDriver =
- m_pNormalWidget->GetOwnerApp()->GetNoteDriver();
- pNoteDriver->UnregisterEventTarget(m_pNormalWidget.get());
-}
-
-bool CXFA_FFListBox::LoadWidget() {
- auto pNew = pdfium::MakeUnique<CFWL_ListBox>(
- GetFWLApp(), pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr);
- CFWL_ListBox* pListBox = pNew.get();
- pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll | FWL_WGTSTYLE_NoBackground,
- 0xFFFFFFFF);
- m_pNormalWidget = std::move(pNew);
- m_pNormalWidget->SetLayoutItem(this);
-
- CFWL_NoteDriver* pNoteDriver =
- m_pNormalWidget->GetOwnerApp()->GetNoteDriver();
- pNoteDriver->RegisterEventTarget(m_pNormalWidget.get(),
- m_pNormalWidget.get());
- m_pOldDelegate = m_pNormalWidget->GetDelegate();
- m_pNormalWidget->SetDelegate(this);
- m_pNormalWidget->LockUpdate();
-
- for (const auto& label : m_pDataAcc->GetChoiceListItems(false))
- pListBox->AddString(label.AsStringC());
-
- uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus;
- if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect)
- dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection;
-
- dwExtendedStyle |= GetAlignment();
- m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
- for (int32_t selected : m_pDataAcc->GetSelectedItems())
- pListBox->SetSelItem(pListBox->GetItem(nullptr, selected), true);
-
- m_pNormalWidget->UnlockUpdate();
- return CXFA_FFField::LoadWidget();
-}
-
-bool CXFA_FFListBox::OnKillFocus(CXFA_FFWidget* pNewFocus) {
- if (!ProcessCommittedData())
- UpdateFWLData();
-
- CXFA_FFField::OnKillFocus(pNewFocus);
- return true;
-}
-
-bool CXFA_FFListBox::CommitData() {
- auto* pListBox = ToListBox(m_pNormalWidget.get());
- std::vector<int32_t> iSelArray;
- int32_t iSels = pListBox->CountSelItems();
- for (int32_t i = 0; i < iSels; ++i)
- iSelArray.push_back(pListBox->GetSelIndex(i));
-
- m_pDataAcc->SetSelectedItems(iSelArray, true, false, true);
- return true;
-}
-
-bool CXFA_FFListBox::IsDataChanged() {
- std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems();
- int32_t iOldSels = pdfium::CollectionSize<int32_t>(iSelArray);
- auto* pListBox = ToListBox(m_pNormalWidget.get());
- int32_t iSels = pListBox->CountSelItems();
- if (iOldSels != iSels)
- return true;
-
- for (int32_t i = 0; i < iSels; ++i) {
- CFWL_ListItem* hlistItem = pListBox->GetItem(nullptr, iSelArray[i]);
- if (!(hlistItem->GetStates() & FWL_ITEMSTATE_LTB_Selected))
- return true;
- }
- return false;
-}
-
-uint32_t CXFA_FFListBox::GetAlignment() {
- CXFA_Para para = m_pDataAcc->GetPara();
- if (!para)
- return 0;
-
- uint32_t dwExtendedStyle = 0;
- switch (para.GetHorizontalAlign()) {
- case XFA_ATTRIBUTEENUM_Center:
- dwExtendedStyle |= FWL_STYLEEXT_LTB_CenterAlign;
- break;
- case XFA_ATTRIBUTEENUM_Justify:
- break;
- case XFA_ATTRIBUTEENUM_JustifyAll:
- break;
- case XFA_ATTRIBUTEENUM_Radix:
- break;
- case XFA_ATTRIBUTEENUM_Right:
- dwExtendedStyle |= FWL_STYLEEXT_LTB_RightAlign;
- break;
- default:
- dwExtendedStyle |= FWL_STYLEEXT_LTB_LeftAlign;
- break;
- }
- return dwExtendedStyle;
-}
-
-bool CXFA_FFListBox::UpdateFWLData() {
- if (!m_pNormalWidget)
- return false;
-
- auto* pListBox = ToListBox(m_pNormalWidget.get());
- std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems();
- std::vector<CFWL_ListItem*> selItemArray(iSelArray.size());
- std::transform(iSelArray.begin(), iSelArray.end(), selItemArray.begin(),
- [pListBox](int32_t val) { return pListBox->GetSelItem(val); });
-
- pListBox->SetSelItem(pListBox->GetSelItem(-1), false);
- for (CFWL_ListItem* pItem : selItemArray)
- pListBox->SetSelItem(pItem, true);
-
- m_pNormalWidget->Update();
- return true;
-}
-
-void CXFA_FFListBox::OnSelectChanged(CFWL_Widget* pWidget) {
- CXFA_EventParam eParam;
- eParam.m_eType = XFA_EVENT_Change;
- eParam.m_pTarget = m_pDataAcc.Get();
- m_pDataAcc->GetValue(eParam.m_wsPrevText, XFA_VALUEPICTURE_Raw);
-
- auto* pListBox = ToListBox(m_pNormalWidget.get());
- int32_t iSels = pListBox->CountSelItems();
- if (iSels > 0) {
- CFWL_ListItem* item = pListBox->GetSelItem(0);
- eParam.m_wsNewText = item ? item->GetText() : L"";
- }
- m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
-}
-
-void CXFA_FFListBox::SetItemState(int32_t nIndex, bool bSelected) {
- auto* pListBox = ToListBox(m_pNormalWidget.get());
- pListBox->SetSelItem(pListBox->GetSelItem(nIndex), bSelected);
- m_pNormalWidget->Update();
- AddInvalidateRect();
-}
-
-void CXFA_FFListBox::InsertItem(const CFX_WideStringC& wsLabel,
- int32_t nIndex) {
- CFX_WideString wsTemp(wsLabel);
- ToListBox(m_pNormalWidget.get())->AddString(wsTemp.AsStringC());
- m_pNormalWidget->Update();
- AddInvalidateRect();
-}
-
-void CXFA_FFListBox::DeleteItem(int32_t nIndex) {
- auto* pListBox = ToListBox(m_pNormalWidget.get());
- if (nIndex < 0)
- pListBox->DeleteAll();
- else
- pListBox->DeleteString(pListBox->GetItem(nullptr, nIndex));
-
- pListBox->Update();
- AddInvalidateRect();
-}
-
-void CXFA_FFListBox::OnProcessMessage(CFWL_Message* pMessage) {
- m_pOldDelegate->OnProcessMessage(pMessage);
-}
-
-void CXFA_FFListBox::OnProcessEvent(CFWL_Event* pEvent) {
- CXFA_FFField::OnProcessEvent(pEvent);
- switch (pEvent->GetType()) {
- case CFWL_Event::Type::SelectChanged:
- OnSelectChanged(m_pNormalWidget.get());
- break;
- default:
- break;
- }
- m_pOldDelegate->OnProcessEvent(pEvent);
-}
-
-void CXFA_FFListBox::OnDrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
- m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix);
-}
-
CXFA_FFComboBox::CXFA_FFComboBox(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
diff --git a/xfa/fxfa/app/xfa_ffchoicelist.h b/xfa/fxfa/app/cxfa_ffcombobox.h
similarity index 64%
rename from xfa/fxfa/app/xfa_ffchoicelist.h
rename to xfa/fxfa/app/cxfa_ffcombobox.h
index 20f053c..048521f 100644
--- a/xfa/fxfa/app/xfa_ffchoicelist.h
+++ b/xfa/fxfa/app/cxfa_ffcombobox.h
@@ -1,44 +1,13 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2017 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_APP_XFA_FFCHOICELIST_H_
-#define XFA_FXFA_APP_XFA_FFCHOICELIST_H_
+#ifndef XFA_FXFA_APP_CXFA_FFCOMBOBOX_H_
+#define XFA_FXFA_APP_CXFA_FFCOMBOBOX_H_
-#include <vector>
-
-#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/cxfa_ffpageview.h"
-
-class CXFA_FFListBox : public CXFA_FFField {
- public:
- explicit CXFA_FFListBox(CXFA_WidgetAcc* pDataAcc);
- ~CXFA_FFListBox() override;
-
- // CXFA_FFField
- bool LoadWidget() override;
- bool OnKillFocus(CXFA_FFWidget* pNewWidget) override;
- void OnProcessMessage(CFWL_Message* pMessage) override;
- void OnProcessEvent(CFWL_Event* pEvent) override;
- void OnDrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = nullptr) override;
-
- void OnSelectChanged(CFWL_Widget* pWidget);
- void SetItemState(int32_t nIndex, bool bSelected);
- void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex);
- void DeleteItem(int32_t nIndex);
-
- private:
- bool CommitData() override;
- bool UpdateFWLData() override;
- bool IsDataChanged() override;
-
- uint32_t GetAlignment();
-
- IFWL_WidgetDelegate* m_pOldDelegate;
-};
+#include "xfa/fxfa/app/cxfa_fffield.h"
class CXFA_FFComboBox : public CXFA_FFField {
public:
@@ -97,4 +66,4 @@
IFWL_WidgetDelegate* m_pOldDelegate;
};
-#endif // XFA_FXFA_APP_XFA_FFCHOICELIST_H_
+#endif // XFA_FXFA_APP_CXFA_FFCOMBOBOX_H_
diff --git a/xfa/fxfa/app/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/app/cxfa_ffdatetimeedit.cpp
new file mode 100644
index 0000000..10a7b18
--- /dev/null
+++ b/xfa/fxfa/app/cxfa_ffdatetimeedit.cpp
@@ -0,0 +1,213 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fxfa/app/cxfa_ffdatetimeedit.h"
+
+#include <utility>
+
+#include "xfa/fwl/cfwl_datetimepicker.h"
+#include "xfa/fwl/cfwl_eventselectchanged.h"
+#include "xfa/fwl/cfwl_notedriver.h"
+#include "xfa/fwl/cfwl_widget.h"
+#include "xfa/fxfa/cxfa_eventparam.h"
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
+
+CXFA_FFDateTimeEdit::CXFA_FFDateTimeEdit(CXFA_WidgetAcc* pDataAcc)
+ : CXFA_FFTextEdit(pDataAcc) {}
+
+CXFA_FFDateTimeEdit::~CXFA_FFDateTimeEdit() {}
+
+CFX_RectF CXFA_FFDateTimeEdit::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
+ if (bDrawFocus)
+ return CFX_RectF();
+ return CXFA_FFWidget::GetBBox(dwStatus);
+}
+
+bool CXFA_FFDateTimeEdit::PtInActiveRect(const CFX_PointF& point) {
+ auto* pPicker = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get());
+ return pPicker && pPicker->GetBBox().Contains(point);
+}
+
+bool CXFA_FFDateTimeEdit::LoadWidget() {
+ auto pNewPicker = pdfium::MakeUnique<CFWL_DateTimePicker>(GetFWLApp());
+ CFWL_DateTimePicker* pWidget = pNewPicker.get();
+ m_pNormalWidget = std::move(pNewPicker);
+ m_pNormalWidget->SetLayoutItem(this);
+
+ CFWL_NoteDriver* pNoteDriver =
+ m_pNormalWidget->GetOwnerApp()->GetNoteDriver();
+ pNoteDriver->RegisterEventTarget(m_pNormalWidget.get(),
+ m_pNormalWidget.get());
+ m_pOldDelegate = m_pNormalWidget->GetDelegate();
+ m_pNormalWidget->SetDelegate(this);
+ m_pNormalWidget->LockUpdate();
+
+ CFX_WideString wsText;
+ m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
+ pWidget->SetEditText(wsText);
+ if (CXFA_Value value = m_pDataAcc->GetFormValue()) {
+ switch (value.GetChildValueClassID()) {
+ case XFA_Element::Date: {
+ if (!wsText.IsEmpty()) {
+ CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc.Get());
+ CFX_DateTime date = lcValue.GetDate();
+ if (date.IsSet())
+ pWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay());
+ }
+ } break;
+ default:
+ break;
+ }
+ }
+ UpdateWidgetProperty();
+ m_pNormalWidget->UnlockUpdate();
+ return CXFA_FFField::LoadWidget();
+}
+
+void CXFA_FFDateTimeEdit::UpdateWidgetProperty() {
+ CFWL_DateTimePicker* pWidget =
+ static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get());
+ if (!pWidget)
+ return;
+
+ uint32_t dwExtendedStyle = FWL_STYLEEXT_DTP_ShortDateFormat;
+ dwExtendedStyle |= UpdateUIProperty();
+ dwExtendedStyle |= GetAlignment();
+ m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
+ uint32_t dwEditStyles = FWL_STYLEEXT_EDT_LastLineHeight;
+ int32_t iNumCells = m_pDataAcc->GetNumberOfCells();
+ if (iNumCells > 0) {
+ dwEditStyles |= FWL_STYLEEXT_EDT_CombText;
+ pWidget->SetEditLimit(iNumCells);
+ }
+ if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
+ !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
+ dwEditStyles |= FWL_STYLEEXT_EDT_ReadOnly;
+ }
+ if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off)
+ dwEditStyles |= FWL_STYLEEXT_EDT_AutoHScroll;
+
+ pWidget->ModifyEditStylesEx(dwEditStyles, 0xFFFFFFFF);
+}
+
+uint32_t CXFA_FFDateTimeEdit::GetAlignment() {
+ CXFA_Para para = m_pDataAcc->GetPara();
+ if (!para)
+ return 0;
+
+ uint32_t dwExtendedStyle = 0;
+ switch (para.GetHorizontalAlign()) {
+ case XFA_ATTRIBUTEENUM_Center:
+ dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHCenter;
+ break;
+ case XFA_ATTRIBUTEENUM_Justify:
+ dwExtendedStyle |= FWL_STYLEEXT_DTP_EditJustified;
+ break;
+ case XFA_ATTRIBUTEENUM_JustifyAll:
+ case XFA_ATTRIBUTEENUM_Radix:
+ break;
+ case XFA_ATTRIBUTEENUM_Right:
+ dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHFar;
+ break;
+ default:
+ dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHNear;
+ break;
+ }
+
+ switch (para.GetVerticalAlign()) {
+ case XFA_ATTRIBUTEENUM_Middle:
+ dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVCenter;
+ break;
+ case XFA_ATTRIBUTEENUM_Bottom:
+ dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVFar;
+ break;
+ default:
+ dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVNear;
+ break;
+ }
+ return dwExtendedStyle;
+}
+
+bool CXFA_FFDateTimeEdit::CommitData() {
+ auto* pPicker = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get());
+ if (!m_pDataAcc->SetValue(pPicker->GetEditText(), XFA_VALUEPICTURE_Edit))
+ return false;
+
+ m_pDataAcc->UpdateUIDisplay(this);
+ return true;
+}
+
+bool CXFA_FFDateTimeEdit::UpdateFWLData() {
+ if (!m_pNormalWidget)
+ return false;
+
+ XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display;
+ if (IsFocused())
+ eType = XFA_VALUEPICTURE_Edit;
+
+ CFX_WideString wsText;
+ m_pDataAcc->GetValue(wsText, eType);
+
+ auto* normalWidget = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get());
+ normalWidget->SetEditText(wsText);
+ if (IsFocused() && !wsText.IsEmpty()) {
+ CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc.Get());
+ CFX_DateTime date = lcValue.GetDate();
+ if (lcValue.IsValid()) {
+ if (date.IsSet())
+ normalWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay());
+ }
+ }
+ m_pNormalWidget->Update();
+ return true;
+}
+
+bool CXFA_FFDateTimeEdit::IsDataChanged() {
+ if (m_dwStatus & XFA_WidgetStatus_TextEditValueChanged)
+ return true;
+
+ CFX_WideString wsText =
+ static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get())->GetEditText();
+ CFX_WideString wsOldValue;
+ m_pDataAcc->GetValue(wsOldValue, XFA_VALUEPICTURE_Edit);
+ return wsOldValue != wsText;
+}
+
+void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget,
+ int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay) {
+ CFX_WideString wsPicture;
+ m_pDataAcc->GetPictureContent(wsPicture, XFA_VALUEPICTURE_Edit);
+
+ CXFA_LocaleValue date(XFA_VT_DATE, GetDoc()->GetXFADoc()->GetLocalMgr());
+ date.SetDate(CFX_DateTime(iYear, iMonth, iDay, 0, 0, 0, 0));
+
+ CFX_WideString wsDate;
+ date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(),
+ XFA_VALUEPICTURE_Edit);
+
+ auto* pDateTime = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get());
+ pDateTime->SetEditText(wsDate);
+ pDateTime->Update();
+ GetDoc()->GetDocEnvironment()->SetFocusWidget(GetDoc(), nullptr);
+
+ CXFA_EventParam eParam;
+ eParam.m_eType = XFA_EVENT_Change;
+ eParam.m_pTarget = m_pDataAcc.Get();
+ m_pDataAcc->GetValue(eParam.m_wsNewText, XFA_VALUEPICTURE_Raw);
+ m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
+}
+
+void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) {
+ if (pEvent->GetType() == CFWL_Event::Type::SelectChanged) {
+ auto* event = static_cast<CFWL_EventSelectChanged*>(pEvent);
+ OnSelectChanged(m_pNormalWidget.get(), event->iYear, event->iMonth,
+ event->iDay);
+ return;
+ }
+ CXFA_FFTextEdit::OnProcessEvent(pEvent);
+}
diff --git a/xfa/fxfa/app/cxfa_ffdatetimeedit.h b/xfa/fxfa/app/cxfa_ffdatetimeedit.h
new file mode 100644
index 0000000..c62f657
--- /dev/null
+++ b/xfa/fxfa/app/cxfa_ffdatetimeedit.h
@@ -0,0 +1,47 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_APP_CXFA_FFDATETIMEEDIT_H_
+#define XFA_FXFA_APP_CXFA_FFDATETIMEEDIT_H_
+
+#include "core/fxcrt/fx_coordinates.h"
+#include "xfa/fxfa/app/cxfa_fftextedit.h"
+
+enum XFA_DATETIMETYPE {
+ XFA_DATETIMETYPE_Date = 0,
+ XFA_DATETIMETYPE_Time,
+ XFA_DATETIMETYPE_DateAndTime
+};
+
+class CFWL_Event;
+class CFWL_Widget;
+
+class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit {
+ public:
+ explicit CXFA_FFDateTimeEdit(CXFA_WidgetAcc* pDataAcc);
+ ~CXFA_FFDateTimeEdit() override;
+
+ // CXFA_FFTextEdit
+ CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false) override;
+ bool LoadWidget() override;
+ void UpdateWidgetProperty() override;
+ void OnProcessEvent(CFWL_Event* pEvent) override;
+
+ void OnSelectChanged(CFWL_Widget* pWidget,
+ int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay);
+
+ private:
+ bool PtInActiveRect(const CFX_PointF& point) override;
+ bool CommitData() override;
+ bool UpdateFWLData() override;
+ bool IsDataChanged() override;
+
+ uint32_t GetAlignment();
+};
+
+#endif // XFA_FXFA_APP_CXFA_FFDATETIMEEDIT_H_
diff --git a/xfa/fxfa/app/xfa_ffdraw.cpp b/xfa/fxfa/app/cxfa_ffdraw.cpp
similarity index 92%
rename from xfa/fxfa/app/xfa_ffdraw.cpp
rename to xfa/fxfa/app/cxfa_ffdraw.cpp
index 8742b83..5736e77 100644
--- a/xfa/fxfa/app/xfa_ffdraw.cpp
+++ b/xfa/fxfa/app/cxfa_ffdraw.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_ffdraw.h"
+#include "xfa/fxfa/app/cxfa_ffdraw.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
diff --git a/xfa/fxfa/app/xfa_ffdraw.h b/xfa/fxfa/app/cxfa_ffdraw.h
similarity index 80%
rename from xfa/fxfa/app/xfa_ffdraw.h
rename to xfa/fxfa/app/cxfa_ffdraw.h
index bcd74f2..2a65ad0 100644
--- a/xfa/fxfa/app/xfa_ffdraw.h
+++ b/xfa/fxfa/app/cxfa_ffdraw.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_APP_XFA_FFDRAW_H_
-#define XFA_FXFA_APP_XFA_FFDRAW_H_
+#ifndef XFA_FXFA_APP_CXFA_FFDRAW_H_
+#define XFA_FXFA_APP_CXFA_FFDRAW_H_
#include "xfa/fxfa/cxfa_ffpageview.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
@@ -16,4 +16,4 @@
~CXFA_FFDraw() override;
};
-#endif // XFA_FXFA_APP_XFA_FFDRAW_H_
+#endif // XFA_FXFA_APP_CXFA_FFDRAW_H_
diff --git a/xfa/fxfa/app/xfa_ffexclgroup.cpp b/xfa/fxfa/app/cxfa_ffexclgroup.cpp
similarity index 95%
rename from xfa/fxfa/app/xfa_ffexclgroup.cpp
rename to xfa/fxfa/app/cxfa_ffexclgroup.cpp
index 9f2560f..60f0202 100644
--- a/xfa/fxfa/app/xfa_ffexclgroup.cpp
+++ b/xfa/fxfa/app/cxfa_ffexclgroup.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_ffexclgroup.h"
+#include "xfa/fxfa/app/cxfa_ffexclgroup.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
diff --git a/xfa/fxfa/app/xfa_ffexclgroup.h b/xfa/fxfa/app/cxfa_ffexclgroup.h
similarity index 83%
rename from xfa/fxfa/app/xfa_ffexclgroup.h
rename to xfa/fxfa/app/cxfa_ffexclgroup.h
index a148945..4b66b94 100644
--- a/xfa/fxfa/app/xfa_ffexclgroup.h
+++ b/xfa/fxfa/app/cxfa_ffexclgroup.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_APP_XFA_FFEXCLGROUP_H_
-#define XFA_FXFA_APP_XFA_FFEXCLGROUP_H_
+#ifndef XFA_FXFA_APP_CXFA_FFEXCLGROUP_H_
+#define XFA_FXFA_APP_CXFA_FFEXCLGROUP_H_
#include "xfa/fxfa/cxfa_ffpageview.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
@@ -21,4 +21,4 @@
uint32_t dwStatus) override;
};
-#endif // XFA_FXFA_APP_XFA_FFEXCLGROUP_H_
+#endif // XFA_FXFA_APP_CXFA_FFEXCLGROUP_H_
diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/cxfa_fffield.cpp
similarity index 99%
rename from xfa/fxfa/app/xfa_fffield.cpp
rename to xfa/fxfa/app/cxfa_fffield.cpp
index 425ba30..fe56917 100644
--- a/xfa/fxfa/app/xfa_fffield.cpp
+++ b/xfa/fxfa/app/cxfa_fffield.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_fffield.h"
+#include "xfa/fxfa/app/cxfa_fffield.h"
#include "xfa/fwl/cfwl_edit.h"
#include "xfa/fwl/cfwl_eventmouse.h"
@@ -15,8 +15,8 @@
#include "xfa/fwl/cfwl_messagesetfocus.h"
#include "xfa/fwl/cfwl_picturebox.h"
#include "xfa/fwl/cfwl_widgetmgr.h"
+#include "xfa/fxfa/app/cxfa_fwltheme.h"
#include "xfa/fxfa/app/cxfa_textlayout.h"
-#include "xfa/fxfa/app/xfa_fwltheme.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
diff --git a/xfa/fxfa/app/xfa_fffield.h b/xfa/fxfa/app/cxfa_fffield.h
similarity index 96%
rename from xfa/fxfa/app/xfa_fffield.h
rename to xfa/fxfa/app/cxfa_fffield.h
index eb06caf..3799eb3 100644
--- a/xfa/fxfa/app/xfa_fffield.h
+++ b/xfa/fxfa/app/cxfa_fffield.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_APP_XFA_FFFIELD_H_
-#define XFA_FXFA_APP_XFA_FFFIELD_H_
+#ifndef XFA_FXFA_APP_CXFA_FFFIELD_H_
+#define XFA_FXFA_APP_CXFA_FFFIELD_H_
#include <memory>
@@ -96,4 +96,4 @@
CFX_RectF m_rtCaption;
};
-#endif // XFA_FXFA_APP_XFA_FFFIELD_H_
+#endif // XFA_FXFA_APP_CXFA_FFFIELD_H_
diff --git a/xfa/fxfa/app/xfa_ffimage.cpp b/xfa/fxfa/app/cxfa_ffimage.cpp
similarity index 96%
rename from xfa/fxfa/app/xfa_ffimage.cpp
rename to xfa/fxfa/app/cxfa_ffimage.cpp
index db9b4de..f8a6668 100644
--- a/xfa/fxfa/app/xfa_ffimage.cpp
+++ b/xfa/fxfa/app/cxfa_ffimage.cpp
@@ -4,9 +4,9 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_ffimage.h"
+#include "xfa/fxfa/app/cxfa_ffimage.h"
-#include "xfa/fxfa/app/xfa_ffdraw.h"
+#include "xfa/fxfa/app/cxfa_ffdraw.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
diff --git a/xfa/fxfa/app/xfa_ffimage.h b/xfa/fxfa/app/cxfa_ffimage.h
similarity index 80%
rename from xfa/fxfa/app/xfa_ffimage.h
rename to xfa/fxfa/app/cxfa_ffimage.h
index 2c42791..1b22fce 100644
--- a/xfa/fxfa/app/xfa_ffimage.h
+++ b/xfa/fxfa/app/cxfa_ffimage.h
@@ -4,10 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_APP_XFA_FFIMAGE_H_
-#define XFA_FXFA_APP_XFA_FFIMAGE_H_
+#ifndef XFA_FXFA_APP_CXFA_FFIMAGE_H_
+#define XFA_FXFA_APP_CXFA_FFIMAGE_H_
-#include "xfa/fxfa/app/xfa_ffdraw.h"
+#include "xfa/fxfa/app/cxfa_ffdraw.h"
class CXFA_FFImage : public CXFA_FFDraw {
public:
@@ -23,4 +23,4 @@
void UnloadWidget() override;
};
-#endif // XFA_FXFA_APP_XFA_FFIMAGE_H_
+#endif // XFA_FXFA_APP_CXFA_FFIMAGE_H_
diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/cxfa_ffimageedit.cpp
similarity index 98%
rename from xfa/fxfa/app/xfa_ffimageedit.cpp
rename to xfa/fxfa/app/cxfa_ffimageedit.cpp
index c8d9509..0b0b6ec 100644
--- a/xfa/fxfa/app/xfa_ffimageedit.cpp
+++ b/xfa/fxfa/app/cxfa_ffimageedit.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_ffimageedit.h"
+#include "xfa/fxfa/app/cxfa_ffimageedit.h"
#include <utility>
@@ -13,7 +13,7 @@
#include "xfa/fwl/cfwl_messagemouse.h"
#include "xfa/fwl/cfwl_notedriver.h"
#include "xfa/fwl/cfwl_picturebox.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
+#include "xfa/fxfa/app/cxfa_fffield.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
diff --git a/xfa/fxfa/app/xfa_ffimageedit.h b/xfa/fxfa/app/cxfa_ffimageedit.h
similarity index 86%
rename from xfa/fxfa/app/xfa_ffimageedit.h
rename to xfa/fxfa/app/cxfa_ffimageedit.h
index ee91a77..81b45e8 100644
--- a/xfa/fxfa/app/xfa_ffimageedit.h
+++ b/xfa/fxfa/app/cxfa_ffimageedit.h
@@ -4,10 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_APP_XFA_FFIMAGEEDIT_H_
-#define XFA_FXFA_APP_XFA_FFIMAGEEDIT_H_
+#ifndef XFA_FXFA_APP_CXFA_FFIMAGEEDIT_H_
+#define XFA_FXFA_APP_CXFA_FFIMAGEEDIT_H_
-#include "xfa/fxfa/app/xfa_fffield.h"
+#include "xfa/fxfa/app/cxfa_fffield.h"
class CXFA_FFImageEdit : public CXFA_FFField {
public:
@@ -34,4 +34,4 @@
IFWL_WidgetDelegate* m_pOldDelegate;
};
-#endif // XFA_FXFA_APP_XFA_FFIMAGEEDIT_H_
+#endif // XFA_FXFA_APP_CXFA_FFIMAGEEDIT_H_
diff --git a/xfa/fxfa/app/xfa_ffpath.cpp b/xfa/fxfa/app/cxfa_ffline.cpp
similarity index 61%
rename from xfa/fxfa/app/xfa_ffpath.cpp
rename to xfa/fxfa/app/cxfa_ffline.cpp
index 854a028..67ed7eb 100644
--- a/xfa/fxfa/app/xfa_ffpath.cpp
+++ b/xfa/fxfa/app/cxfa_ffline.cpp
@@ -1,17 +1,13 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2017 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_ffpath.h"
+#include "xfa/fxfa/app/cxfa_ffline.h"
-#include "xfa/fxfa/app/xfa_ffdraw.h"
-#include "xfa/fxfa/cxfa_ffapp.h"
-#include "xfa/fxfa/cxfa_ffdoc.h"
-#include "xfa/fxfa/cxfa_ffpageview.h"
-#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxgraphics/cfx_color.h"
+#include "xfa/fxgraphics/cfx_graphics.h"
#include "xfa/fxgraphics/cfx_path.h"
CXFA_FFLine::CXFA_FFLine(CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pDataAcc) {}
@@ -101,56 +97,3 @@
pGS->StrokePath(&linePath, &mtRotate);
pGS->RestoreGraphState();
}
-
-CXFA_FFArc::CXFA_FFArc(CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pDataAcc) {}
-
-CXFA_FFArc::~CXFA_FFArc() {}
-
-void CXFA_FFArc::RenderWidget(CFX_Graphics* pGS,
- CFX_Matrix* pMatrix,
- uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus))
- return;
-
- CXFA_Value value = m_pDataAcc->GetFormValue();
- if (!value)
- return;
-
- CXFA_Arc arcObj = value.GetArc();
- CFX_Matrix mtRotate = GetRotateMatrix();
- if (pMatrix)
- mtRotate.Concat(*pMatrix);
-
- CFX_RectF rtArc = GetRectWithoutRotate();
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
- XFA_RectWidthoutMargin(rtArc, mgWidget);
-
- DrawBorder(pGS, arcObj, rtArc, &mtRotate);
-}
-
-CXFA_FFRectangle::CXFA_FFRectangle(CXFA_WidgetAcc* pDataAcc)
- : CXFA_FFDraw(pDataAcc) {}
-
-CXFA_FFRectangle::~CXFA_FFRectangle() {}
-
-void CXFA_FFRectangle::RenderWidget(CFX_Graphics* pGS,
- CFX_Matrix* pMatrix,
- uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus))
- return;
-
- CXFA_Value value = m_pDataAcc->GetFormValue();
- if (!value)
- return;
-
- CXFA_Rectangle rtObj = value.GetRectangle();
- CFX_RectF rect = GetRectWithoutRotate();
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
- XFA_RectWidthoutMargin(rect, mgWidget);
-
- CFX_Matrix mtRotate = GetRotateMatrix();
- if (pMatrix)
- mtRotate.Concat(*pMatrix);
-
- DrawBorder(pGS, rtObj, rect, &mtRotate);
-}
diff --git a/xfa/fxfa/app/cxfa_ffline.h b/xfa/fxfa/app/cxfa_ffline.h
new file mode 100644
index 0000000..6803e38
--- /dev/null
+++ b/xfa/fxfa/app/cxfa_ffline.h
@@ -0,0 +1,26 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_APP_CXFA_FFLINE_H_
+#define XFA_FXFA_APP_CXFA_FFLINE_H_
+
+#include "xfa/fxfa/app/cxfa_ffdraw.h"
+
+class CXFA_FFLine : public CXFA_FFDraw {
+ public:
+ explicit CXFA_FFLine(CXFA_WidgetAcc* pDataAcc);
+ ~CXFA_FFLine() override;
+
+ // CXFA_FFWidget
+ void RenderWidget(CFX_Graphics* pGS,
+ CFX_Matrix* pMatrix,
+ uint32_t dwStatus) override;
+
+ private:
+ void GetRectFromHand(CFX_RectF& rect, int32_t iHand, float fLineWidth);
+};
+
+#endif // XFA_FXFA_APP_CXFA_FFLINE_H_
diff --git a/xfa/fxfa/app/cxfa_fflistbox.cpp b/xfa/fxfa/app/cxfa_fflistbox.cpp
new file mode 100644
index 0000000..dd80325
--- /dev/null
+++ b/xfa/fxfa/app/cxfa_fflistbox.cpp
@@ -0,0 +1,210 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fxfa/app/cxfa_fflistbox.h"
+
+#include <algorithm>
+#include <utility>
+#include <vector>
+
+#include "xfa/fwl/cfwl_listbox.h"
+#include "xfa/fwl/cfwl_notedriver.h"
+#include "xfa/fwl/cfwl_widget.h"
+#include "xfa/fxfa/cxfa_eventparam.h"
+
+namespace {
+
+CFWL_ListBox* ToListBox(CFWL_Widget* widget) {
+ return static_cast<CFWL_ListBox*>(widget);
+}
+
+} // namespace
+
+CXFA_FFListBox::CXFA_FFListBox(CXFA_WidgetAcc* pDataAcc)
+ : CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
+
+CXFA_FFListBox::~CXFA_FFListBox() {
+ if (!m_pNormalWidget)
+ return;
+
+ CFWL_NoteDriver* pNoteDriver =
+ m_pNormalWidget->GetOwnerApp()->GetNoteDriver();
+ pNoteDriver->UnregisterEventTarget(m_pNormalWidget.get());
+}
+
+bool CXFA_FFListBox::LoadWidget() {
+ auto pNew = pdfium::MakeUnique<CFWL_ListBox>(
+ GetFWLApp(), pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr);
+ CFWL_ListBox* pListBox = pNew.get();
+ pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll | FWL_WGTSTYLE_NoBackground,
+ 0xFFFFFFFF);
+ m_pNormalWidget = std::move(pNew);
+ m_pNormalWidget->SetLayoutItem(this);
+
+ CFWL_NoteDriver* pNoteDriver =
+ m_pNormalWidget->GetOwnerApp()->GetNoteDriver();
+ pNoteDriver->RegisterEventTarget(m_pNormalWidget.get(),
+ m_pNormalWidget.get());
+ m_pOldDelegate = m_pNormalWidget->GetDelegate();
+ m_pNormalWidget->SetDelegate(this);
+ m_pNormalWidget->LockUpdate();
+
+ for (const auto& label : m_pDataAcc->GetChoiceListItems(false))
+ pListBox->AddString(label.AsStringC());
+
+ uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus;
+ if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect)
+ dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection;
+
+ dwExtendedStyle |= GetAlignment();
+ m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
+ for (int32_t selected : m_pDataAcc->GetSelectedItems())
+ pListBox->SetSelItem(pListBox->GetItem(nullptr, selected), true);
+
+ m_pNormalWidget->UnlockUpdate();
+ return CXFA_FFField::LoadWidget();
+}
+
+bool CXFA_FFListBox::OnKillFocus(CXFA_FFWidget* pNewFocus) {
+ if (!ProcessCommittedData())
+ UpdateFWLData();
+
+ CXFA_FFField::OnKillFocus(pNewFocus);
+ return true;
+}
+
+bool CXFA_FFListBox::CommitData() {
+ auto* pListBox = ToListBox(m_pNormalWidget.get());
+ std::vector<int32_t> iSelArray;
+ int32_t iSels = pListBox->CountSelItems();
+ for (int32_t i = 0; i < iSels; ++i)
+ iSelArray.push_back(pListBox->GetSelIndex(i));
+
+ m_pDataAcc->SetSelectedItems(iSelArray, true, false, true);
+ return true;
+}
+
+bool CXFA_FFListBox::IsDataChanged() {
+ std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems();
+ int32_t iOldSels = pdfium::CollectionSize<int32_t>(iSelArray);
+ auto* pListBox = ToListBox(m_pNormalWidget.get());
+ int32_t iSels = pListBox->CountSelItems();
+ if (iOldSels != iSels)
+ return true;
+
+ for (int32_t i = 0; i < iSels; ++i) {
+ CFWL_ListItem* hlistItem = pListBox->GetItem(nullptr, iSelArray[i]);
+ if (!(hlistItem->GetStates() & FWL_ITEMSTATE_LTB_Selected))
+ return true;
+ }
+ return false;
+}
+
+uint32_t CXFA_FFListBox::GetAlignment() {
+ CXFA_Para para = m_pDataAcc->GetPara();
+ if (!para)
+ return 0;
+
+ uint32_t dwExtendedStyle = 0;
+ switch (para.GetHorizontalAlign()) {
+ case XFA_ATTRIBUTEENUM_Center:
+ dwExtendedStyle |= FWL_STYLEEXT_LTB_CenterAlign;
+ break;
+ case XFA_ATTRIBUTEENUM_Justify:
+ break;
+ case XFA_ATTRIBUTEENUM_JustifyAll:
+ break;
+ case XFA_ATTRIBUTEENUM_Radix:
+ break;
+ case XFA_ATTRIBUTEENUM_Right:
+ dwExtendedStyle |= FWL_STYLEEXT_LTB_RightAlign;
+ break;
+ default:
+ dwExtendedStyle |= FWL_STYLEEXT_LTB_LeftAlign;
+ break;
+ }
+ return dwExtendedStyle;
+}
+
+bool CXFA_FFListBox::UpdateFWLData() {
+ if (!m_pNormalWidget)
+ return false;
+
+ auto* pListBox = ToListBox(m_pNormalWidget.get());
+ std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems();
+ std::vector<CFWL_ListItem*> selItemArray(iSelArray.size());
+ std::transform(iSelArray.begin(), iSelArray.end(), selItemArray.begin(),
+ [pListBox](int32_t val) { return pListBox->GetSelItem(val); });
+
+ pListBox->SetSelItem(pListBox->GetSelItem(-1), false);
+ for (CFWL_ListItem* pItem : selItemArray)
+ pListBox->SetSelItem(pItem, true);
+
+ m_pNormalWidget->Update();
+ return true;
+}
+
+void CXFA_FFListBox::OnSelectChanged(CFWL_Widget* pWidget) {
+ CXFA_EventParam eParam;
+ eParam.m_eType = XFA_EVENT_Change;
+ eParam.m_pTarget = m_pDataAcc.Get();
+ m_pDataAcc->GetValue(eParam.m_wsPrevText, XFA_VALUEPICTURE_Raw);
+
+ auto* pListBox = ToListBox(m_pNormalWidget.get());
+ int32_t iSels = pListBox->CountSelItems();
+ if (iSels > 0) {
+ CFWL_ListItem* item = pListBox->GetSelItem(0);
+ eParam.m_wsNewText = item ? item->GetText() : L"";
+ }
+ m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
+}
+
+void CXFA_FFListBox::SetItemState(int32_t nIndex, bool bSelected) {
+ auto* pListBox = ToListBox(m_pNormalWidget.get());
+ pListBox->SetSelItem(pListBox->GetSelItem(nIndex), bSelected);
+ m_pNormalWidget->Update();
+ AddInvalidateRect();
+}
+
+void CXFA_FFListBox::InsertItem(const CFX_WideStringC& wsLabel,
+ int32_t nIndex) {
+ CFX_WideString wsTemp(wsLabel);
+ ToListBox(m_pNormalWidget.get())->AddString(wsTemp.AsStringC());
+ m_pNormalWidget->Update();
+ AddInvalidateRect();
+}
+
+void CXFA_FFListBox::DeleteItem(int32_t nIndex) {
+ auto* pListBox = ToListBox(m_pNormalWidget.get());
+ if (nIndex < 0)
+ pListBox->DeleteAll();
+ else
+ pListBox->DeleteString(pListBox->GetItem(nullptr, nIndex));
+
+ pListBox->Update();
+ AddInvalidateRect();
+}
+
+void CXFA_FFListBox::OnProcessMessage(CFWL_Message* pMessage) {
+ m_pOldDelegate->OnProcessMessage(pMessage);
+}
+
+void CXFA_FFListBox::OnProcessEvent(CFWL_Event* pEvent) {
+ CXFA_FFField::OnProcessEvent(pEvent);
+ switch (pEvent->GetType()) {
+ case CFWL_Event::Type::SelectChanged:
+ OnSelectChanged(m_pNormalWidget.get());
+ break;
+ default:
+ break;
+ }
+ m_pOldDelegate->OnProcessEvent(pEvent);
+}
+
+void CXFA_FFListBox::OnDrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
+ m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix);
+}
diff --git a/xfa/fxfa/app/cxfa_fflistbox.h b/xfa/fxfa/app/cxfa_fflistbox.h
new file mode 100644
index 0000000..6f090af
--- /dev/null
+++ b/xfa/fxfa/app/cxfa_fflistbox.h
@@ -0,0 +1,40 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_APP_CXFA_FFLISTBOX_H_
+#define XFA_FXFA_APP_CXFA_FFLISTBOX_H_
+
+#include "xfa/fxfa/app/cxfa_fffield.h"
+
+class CXFA_FFListBox : public CXFA_FFField {
+ public:
+ explicit CXFA_FFListBox(CXFA_WidgetAcc* pDataAcc);
+ ~CXFA_FFListBox() override;
+
+ // CXFA_FFField
+ bool LoadWidget() override;
+ bool OnKillFocus(CXFA_FFWidget* pNewWidget) override;
+ void OnProcessMessage(CFWL_Message* pMessage) override;
+ void OnProcessEvent(CFWL_Event* pEvent) override;
+ void OnDrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix = nullptr) override;
+
+ void OnSelectChanged(CFWL_Widget* pWidget);
+ void SetItemState(int32_t nIndex, bool bSelected);
+ void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex);
+ void DeleteItem(int32_t nIndex);
+
+ private:
+ bool CommitData() override;
+ bool UpdateFWLData() override;
+ bool IsDataChanged() override;
+
+ uint32_t GetAlignment();
+
+ IFWL_WidgetDelegate* m_pOldDelegate;
+};
+
+#endif // XFA_FXFA_APP_CXFA_FFLISTBOX_H_
diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/cxfa_ffnotify.cpp
similarity index 94%
rename from xfa/fxfa/app/xfa_ffnotify.cpp
rename to xfa/fxfa/app/cxfa_ffnotify.cpp
index b07b625..a660fff 100644
--- a/xfa/fxfa/app/xfa_ffnotify.cpp
+++ b/xfa/fxfa/app/cxfa_ffnotify.cpp
@@ -4,26 +4,31 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/app/cxfa_ffnotify.h"
#include "fxjs/cfxjse_value.h"
+#include "xfa/fxfa/app/cxfa_ffarc.h"
+#include "xfa/fxfa/app/cxfa_ffbarcode.h"
+#include "xfa/fxfa/app/cxfa_ffcheckbutton.h"
+#include "xfa/fxfa/app/cxfa_ffcombobox.h"
+#include "xfa/fxfa/app/cxfa_ffdatetimeedit.h"
+#include "xfa/fxfa/app/cxfa_ffdraw.h"
+#include "xfa/fxfa/app/cxfa_ffexclgroup.h"
+#include "xfa/fxfa/app/cxfa_fffield.h"
+#include "xfa/fxfa/app/cxfa_ffimage.h"
+#include "xfa/fxfa/app/cxfa_ffimageedit.h"
+#include "xfa/fxfa/app/cxfa_ffline.h"
+#include "xfa/fxfa/app/cxfa_fflistbox.h"
+#include "xfa/fxfa/app/cxfa_ffnumericedit.h"
+#include "xfa/fxfa/app/cxfa_ffpasswordedit.h"
+#include "xfa/fxfa/app/cxfa_ffpushbutton.h"
+#include "xfa/fxfa/app/cxfa_ffrectangle.h"
+#include "xfa/fxfa/app/cxfa_ffsignature.h"
+#include "xfa/fxfa/app/cxfa_ffsubform.h"
+#include "xfa/fxfa/app/cxfa_fftext.h"
+#include "xfa/fxfa/app/cxfa_fwladapterwidgetmgr.h"
#include "xfa/fxfa/app/cxfa_textlayout.h"
-#include "xfa/fxfa/app/xfa_ffbarcode.h"
-#include "xfa/fxfa/app/xfa_ffcheckbutton.h"
-#include "xfa/fxfa/app/xfa_ffchoicelist.h"
-#include "xfa/fxfa/app/xfa_ffdraw.h"
-#include "xfa/fxfa/app/xfa_ffexclgroup.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/app/xfa_ffimage.h"
-#include "xfa/fxfa/app/xfa_ffimageedit.h"
-#include "xfa/fxfa/app/xfa_ffpath.h"
-#include "xfa/fxfa/app/xfa_ffpushbutton.h"
-#include "xfa/fxfa/app/xfa_ffsignature.h"
-#include "xfa/fxfa/app/xfa_ffsubform.h"
-#include "xfa/fxfa/app/xfa_fftext.h"
-#include "xfa/fxfa/app/xfa_fftextedit.h"
-#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
+#include "xfa/fxfa/app/cxfa_textprovider.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
diff --git a/xfa/fxfa/app/xfa_ffnotify.h b/xfa/fxfa/app/cxfa_ffnotify.h
similarity index 96%
rename from xfa/fxfa/app/xfa_ffnotify.h
rename to xfa/fxfa/app/cxfa_ffnotify.h
index 930d3b6..935a0c3 100644
--- a/xfa/fxfa/app/xfa_ffnotify.h
+++ b/xfa/fxfa/app/cxfa_ffnotify.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_APP_XFA_FFNOTIFY_H_
-#define XFA_FXFA_APP_XFA_FFNOTIFY_H_
+#ifndef XFA_FXFA_APP_CXFA_FFNOTIFY_H_
+#define XFA_FXFA_APP_CXFA_FFNOTIFY_H_
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/parser/cxfa_document.h"
@@ -74,4 +74,4 @@
CFX_UnownedPtr<CXFA_FFDoc> const m_pDoc;
};
-#endif // XFA_FXFA_APP_XFA_FFNOTIFY_H_
+#endif // XFA_FXFA_APP_CXFA_FFNOTIFY_H_
diff --git a/xfa/fxfa/app/cxfa_ffnumericedit.cpp b/xfa/fxfa/app/cxfa_ffnumericedit.cpp
new file mode 100644
index 0000000..a2aad63
--- /dev/null
+++ b/xfa/fxfa/app/cxfa_ffnumericedit.cpp
@@ -0,0 +1,97 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fxfa/app/cxfa_ffnumericedit.h"
+
+#include <utility>
+
+#include "xfa/fwl/cfwl_edit.h"
+#include "xfa/fwl/cfwl_eventvalidate.h"
+#include "xfa/fwl/cfwl_notedriver.h"
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
+
+CXFA_FFNumericEdit::CXFA_FFNumericEdit(CXFA_WidgetAcc* pDataAcc)
+ : CXFA_FFTextEdit(pDataAcc) {}
+
+CXFA_FFNumericEdit::~CXFA_FFNumericEdit() {}
+
+bool CXFA_FFNumericEdit::LoadWidget() {
+ auto pNewEdit = pdfium::MakeUnique<CFWL_Edit>(
+ GetFWLApp(), pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr);
+ CFWL_Edit* pWidget = pNewEdit.get();
+ m_pNormalWidget = std::move(pNewEdit);
+ m_pNormalWidget->SetLayoutItem(this);
+
+ CFWL_NoteDriver* pNoteDriver =
+ m_pNormalWidget->GetOwnerApp()->GetNoteDriver();
+ pNoteDriver->RegisterEventTarget(m_pNormalWidget.get(),
+ m_pNormalWidget.get());
+ m_pOldDelegate = m_pNormalWidget->GetDelegate();
+ m_pNormalWidget->SetDelegate(this);
+ m_pNormalWidget->LockUpdate();
+
+ CFX_WideString wsText;
+ m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
+ pWidget->SetText(wsText);
+ UpdateWidgetProperty();
+ m_pNormalWidget->UnlockUpdate();
+ return CXFA_FFField::LoadWidget();
+}
+
+void CXFA_FFNumericEdit::UpdateWidgetProperty() {
+ CFWL_Edit* pWidget = static_cast<CFWL_Edit*>(m_pNormalWidget.get());
+ if (!pWidget)
+ return;
+
+ uint32_t dwExtendedStyle =
+ FWL_STYLEEXT_EDT_ShowScrollbarFocus | FWL_STYLEEXT_EDT_OuterScrollbar |
+ FWL_STYLEEXT_EDT_Validate | FWL_STYLEEXT_EDT_Number |
+ FWL_STYLEEXT_EDT_LastLineHeight;
+ dwExtendedStyle |= UpdateUIProperty();
+ if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off)
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
+
+ int32_t iNumCells = m_pDataAcc->GetNumberOfCells();
+ if (iNumCells > 0) {
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText;
+ pWidget->SetLimit(iNumCells);
+ }
+ dwExtendedStyle |= GetAlignment();
+ if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
+ !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
+ }
+ m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
+}
+
+void CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) {
+ if (pEvent->GetType() == CFWL_Event::Type::Validate) {
+ CFWL_EventValidate* event = static_cast<CFWL_EventValidate*>(pEvent);
+ event->bValidate = OnValidate(m_pNormalWidget.get(), event->wsInsert);
+ return;
+ }
+ CXFA_FFTextEdit::OnProcessEvent(pEvent);
+}
+
+bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget,
+ CFX_WideString& wsText) {
+ CFX_WideString wsPattern;
+ m_pDataAcc->GetPictureContent(wsPattern, XFA_VALUEPICTURE_Edit);
+ if (!wsPattern.IsEmpty())
+ return true;
+
+ int32_t iLeads = 0;
+ m_pDataAcc->GetLeadDigits(iLeads);
+
+ int32_t iFracs = 0;
+ m_pDataAcc->GetFracDigits(iFracs);
+
+ CFX_WideString wsFormat;
+ CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(m_pDataAcc.Get());
+ widgetValue.GetNumbericFormat(wsFormat, iLeads, iFracs);
+ return widgetValue.ValidateNumericTemp(wsText, wsFormat,
+ m_pDataAcc->GetLocal());
+}
diff --git a/xfa/fxfa/app/cxfa_ffnumericedit.h b/xfa/fxfa/app/cxfa_ffnumericedit.h
new file mode 100644
index 0000000..25e2304
--- /dev/null
+++ b/xfa/fxfa/app/cxfa_ffnumericedit.h
@@ -0,0 +1,31 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_APP_CXFA_FFNUMERICEDIT_H_
+#define XFA_FXFA_APP_CXFA_FFNUMERICEDIT_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "xfa/fxfa/app/cxfa_fftextedit.h"
+
+class CFWL_Event;
+class CFWL_Widget;
+class CXFA_WidgetAcc;
+
+class CXFA_FFNumericEdit : public CXFA_FFTextEdit {
+ public:
+ explicit CXFA_FFNumericEdit(CXFA_WidgetAcc* pDataAcc);
+ ~CXFA_FFNumericEdit() override;
+
+ // CXFA_FFTextEdit
+ bool LoadWidget() override;
+ void UpdateWidgetProperty() override;
+ void OnProcessEvent(CFWL_Event* pEvent) override;
+
+ private:
+ bool OnValidate(CFWL_Widget* pWidget, CFX_WideString& wsText);
+};
+
+#endif // XFA_FXFA_APP_CXFA_FFNUMERICEDIT_H_
diff --git a/xfa/fxfa/app/cxfa_ffpasswordedit.cpp b/xfa/fxfa/app/cxfa_ffpasswordedit.cpp
new file mode 100644
index 0000000..1b404fa
--- /dev/null
+++ b/xfa/fxfa/app/cxfa_ffpasswordedit.cpp
@@ -0,0 +1,64 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fxfa/app/cxfa_ffpasswordedit.h"
+
+#include <utility>
+
+#include "xfa/fwl/cfwl_edit.h"
+#include "xfa/fwl/cfwl_notedriver.h"
+
+CXFA_FFPasswordEdit::CXFA_FFPasswordEdit(CXFA_WidgetAcc* pDataAcc)
+ : CXFA_FFTextEdit(pDataAcc) {}
+
+CXFA_FFPasswordEdit::~CXFA_FFPasswordEdit() {}
+
+bool CXFA_FFPasswordEdit::LoadWidget() {
+ auto pNewEdit = pdfium::MakeUnique<CFWL_Edit>(
+ GetFWLApp(), pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr);
+ CFWL_Edit* pWidget = pNewEdit.get();
+ m_pNormalWidget = std::move(pNewEdit);
+ m_pNormalWidget->SetLayoutItem(this);
+
+ CFWL_NoteDriver* pNoteDriver =
+ m_pNormalWidget->GetOwnerApp()->GetNoteDriver();
+ pNoteDriver->RegisterEventTarget(m_pNormalWidget.get(),
+ m_pNormalWidget.get());
+ m_pOldDelegate = m_pNormalWidget->GetDelegate();
+ m_pNormalWidget->SetDelegate(this);
+ m_pNormalWidget->LockUpdate();
+
+ CFX_WideString wsText;
+ m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
+ pWidget->SetText(wsText);
+ UpdateWidgetProperty();
+ m_pNormalWidget->UnlockUpdate();
+ return CXFA_FFField::LoadWidget();
+}
+
+void CXFA_FFPasswordEdit::UpdateWidgetProperty() {
+ CFWL_Edit* pWidget = static_cast<CFWL_Edit*>(m_pNormalWidget.get());
+ if (!pWidget)
+ return;
+
+ uint32_t dwExtendedStyle =
+ FWL_STYLEEXT_EDT_ShowScrollbarFocus | FWL_STYLEEXT_EDT_OuterScrollbar |
+ FWL_STYLEEXT_EDT_Password | FWL_STYLEEXT_EDT_LastLineHeight;
+ dwExtendedStyle |= UpdateUIProperty();
+
+ CFX_WideString wsPassWord;
+ m_pDataAcc->GetPasswordChar(wsPassWord);
+ if (!wsPassWord.IsEmpty())
+ pWidget->SetAliasChar(wsPassWord.GetAt(0));
+ if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off)
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
+ if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
+ !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
+ }
+ dwExtendedStyle |= GetAlignment();
+ m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
+}
diff --git a/xfa/fxfa/app/cxfa_ffpasswordedit.h b/xfa/fxfa/app/cxfa_ffpasswordedit.h
new file mode 100644
index 0000000..5d292d4
--- /dev/null
+++ b/xfa/fxfa/app/cxfa_ffpasswordedit.h
@@ -0,0 +1,24 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_APP_CXFA_FFPASSWORDEDIT_H_
+#define XFA_FXFA_APP_CXFA_FFPASSWORDEDIT_H_
+
+#include "xfa/fxfa/app/cxfa_fftextedit.h"
+
+class CXFA_WidgetAcc;
+
+class CXFA_FFPasswordEdit : public CXFA_FFTextEdit {
+ public:
+ explicit CXFA_FFPasswordEdit(CXFA_WidgetAcc* pDataAcc);
+ ~CXFA_FFPasswordEdit() override;
+
+ // CXFA_FFTextEdit
+ bool LoadWidget() override;
+ void UpdateWidgetProperty() override;
+};
+
+#endif // XFA_FXFA_APP_CXFA_FFPASSWORDEDIT_H_
diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/cxfa_ffpushbutton.cpp
similarity index 98%
rename from xfa/fxfa/app/xfa_ffpushbutton.cpp
rename to xfa/fxfa/app/cxfa_ffpushbutton.cpp
index b596996..1e784a4 100644
--- a/xfa/fxfa/app/xfa_ffpushbutton.cpp
+++ b/xfa/fxfa/app/cxfa_ffpushbutton.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_ffpushbutton.h"
+#include "xfa/fxfa/app/cxfa_ffpushbutton.h"
#include <utility>
@@ -12,9 +12,9 @@
#include "xfa/fwl/cfwl_notedriver.h"
#include "xfa/fwl/cfwl_pushbutton.h"
#include "xfa/fwl/cfwl_widgetmgr.h"
+#include "xfa/fxfa/app/cxfa_fffield.h"
#include "xfa/fxfa/app/cxfa_textlayout.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
+#include "xfa/fxfa/app/cxfa_textprovider.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
diff --git a/xfa/fxfa/app/xfa_ffpushbutton.h b/xfa/fxfa/app/cxfa_ffpushbutton.h
similarity index 90%
rename from xfa/fxfa/app/xfa_ffpushbutton.h
rename to xfa/fxfa/app/cxfa_ffpushbutton.h
index 3695fc4..797d92d 100644
--- a/xfa/fxfa/app/xfa_ffpushbutton.h
+++ b/xfa/fxfa/app/cxfa_ffpushbutton.h
@@ -4,12 +4,12 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_APP_XFA_FFPUSHBUTTON_H_
-#define XFA_FXFA_APP_XFA_FFPUSHBUTTON_H_
+#ifndef XFA_FXFA_APP_CXFA_FFPUSHBUTTON_H_
+#define XFA_FXFA_APP_CXFA_FFPUSHBUTTON_H_
#include <memory>
-#include "xfa/fxfa/app/xfa_fffield.h"
+#include "xfa/fxfa/app/cxfa_fffield.h"
#define XFA_FWL_PSBSTYLEEXT_HiliteNone (0L << 0)
#define XFA_FWL_PSBSTYLEEXT_HiliteInverted (1L << 0)
@@ -51,4 +51,4 @@
IFWL_WidgetDelegate* m_pOldDelegate;
};
-#endif // XFA_FXFA_APP_XFA_FFPUSHBUTTON_H_
+#endif // XFA_FXFA_APP_CXFA_FFPUSHBUTTON_H_
diff --git a/xfa/fxfa/app/cxfa_ffrectangle.cpp b/xfa/fxfa/app/cxfa_ffrectangle.cpp
new file mode 100644
index 0000000..bccf740
--- /dev/null
+++ b/xfa/fxfa/app/cxfa_ffrectangle.cpp
@@ -0,0 +1,34 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fxfa/app/cxfa_ffrectangle.h"
+
+CXFA_FFRectangle::CXFA_FFRectangle(CXFA_WidgetAcc* pDataAcc)
+ : CXFA_FFDraw(pDataAcc) {}
+
+CXFA_FFRectangle::~CXFA_FFRectangle() {}
+
+void CXFA_FFRectangle::RenderWidget(CFX_Graphics* pGS,
+ CFX_Matrix* pMatrix,
+ uint32_t dwStatus) {
+ if (!IsMatchVisibleStatus(dwStatus))
+ return;
+
+ CXFA_Value value = m_pDataAcc->GetFormValue();
+ if (!value)
+ return;
+
+ CXFA_Rectangle rtObj = value.GetRectangle();
+ CFX_RectF rect = GetRectWithoutRotate();
+ if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
+ XFA_RectWidthoutMargin(rect, mgWidget);
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
+ mtRotate.Concat(*pMatrix);
+
+ DrawBorder(pGS, rtObj, rect, &mtRotate);
+}
diff --git a/xfa/fxfa/app/cxfa_ffrectangle.h b/xfa/fxfa/app/cxfa_ffrectangle.h
new file mode 100644
index 0000000..499f600
--- /dev/null
+++ b/xfa/fxfa/app/cxfa_ffrectangle.h
@@ -0,0 +1,23 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_APP_CXFA_FFRECTANGLE_H_
+#define XFA_FXFA_APP_CXFA_FFRECTANGLE_H_
+
+#include "xfa/fxfa/app/cxfa_ffdraw.h"
+
+class CXFA_FFRectangle : public CXFA_FFDraw {
+ public:
+ explicit CXFA_FFRectangle(CXFA_WidgetAcc* pDataAcc);
+ ~CXFA_FFRectangle() override;
+
+ // CXFA_FFWidget
+ void RenderWidget(CFX_Graphics* pGS,
+ CFX_Matrix* pMatrix,
+ uint32_t dwStatus) override;
+};
+
+#endif // XFA_FXFA_APP_CXFA_FFRECTANGLE_H_
diff --git a/xfa/fxfa/app/xfa_ffsignature.cpp b/xfa/fxfa/app/cxfa_ffsignature.cpp
similarity index 97%
rename from xfa/fxfa/app/xfa_ffsignature.cpp
rename to xfa/fxfa/app/cxfa_ffsignature.cpp
index edc3433..a5d33ad 100644
--- a/xfa/fxfa/app/xfa_ffsignature.cpp
+++ b/xfa/fxfa/app/cxfa_ffsignature.cpp
@@ -4,9 +4,9 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_ffsignature.h"
+#include "xfa/fxfa/app/cxfa_ffsignature.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
+#include "xfa/fxfa/app/cxfa_fffield.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
diff --git a/xfa/fxfa/app/xfa_ffsignature.h b/xfa/fxfa/app/cxfa_ffsignature.h
similarity index 90%
rename from xfa/fxfa/app/xfa_ffsignature.h
rename to xfa/fxfa/app/cxfa_ffsignature.h
index 934323f..839cfaf 100644
--- a/xfa/fxfa/app/xfa_ffsignature.h
+++ b/xfa/fxfa/app/cxfa_ffsignature.h
@@ -4,10 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_APP_XFA_FFSIGNATURE_H_
-#define XFA_FXFA_APP_XFA_FFSIGNATURE_H_
+#ifndef XFA_FXFA_APP_CXFA_FFSIGNATURE_H_
+#define XFA_FXFA_APP_CXFA_FFSIGNATURE_H_
-#include "xfa/fxfa/app/xfa_fffield.h"
+#include "xfa/fxfa/app/cxfa_fffield.h"
class CXFA_FFSignature final : public CXFA_FFField {
public:
@@ -39,4 +39,4 @@
bool OnSetCursor(const CFX_PointF& point) override;
};
-#endif // XFA_FXFA_APP_XFA_FFSIGNATURE_H_
+#endif // XFA_FXFA_APP_CXFA_FFSIGNATURE_H_
diff --git a/xfa/fxfa/app/xfa_ffsubform.cpp b/xfa/fxfa/app/cxfa_ffsubform.cpp
similarity index 92%
rename from xfa/fxfa/app/xfa_ffsubform.cpp
rename to xfa/fxfa/app/cxfa_ffsubform.cpp
index d008c5b..80a7782 100644
--- a/xfa/fxfa/app/xfa_ffsubform.cpp
+++ b/xfa/fxfa/app/cxfa_ffsubform.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_ffsubform.h"
+#include "xfa/fxfa/app/cxfa_ffsubform.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
diff --git a/xfa/fxfa/app/xfa_ffsubform.h b/xfa/fxfa/app/cxfa_ffsubform.h
similarity index 79%
rename from xfa/fxfa/app/xfa_ffsubform.h
rename to xfa/fxfa/app/cxfa_ffsubform.h
index c87688f..d73e53d 100644
--- a/xfa/fxfa/app/xfa_ffsubform.h
+++ b/xfa/fxfa/app/cxfa_ffsubform.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_APP_XFA_FFSUBFORM_H_
-#define XFA_FXFA_APP_XFA_FFSUBFORM_H_
+#ifndef XFA_FXFA_APP_CXFA_FFSUBFORM_H_
+#define XFA_FXFA_APP_CXFA_FFSUBFORM_H_
#include "xfa/fxfa/cxfa_ffpageview.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
@@ -16,4 +16,4 @@
~CXFA_FFSubForm() override;
};
-#endif // XFA_FXFA_APP_XFA_FFSUBFORM_H_
+#endif // XFA_FXFA_APP_CXFA_FFSUBFORM_H_
diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/cxfa_fftext.cpp
similarity index 97%
rename from xfa/fxfa/app/xfa_fftext.cpp
rename to xfa/fxfa/app/cxfa_fftext.cpp
index 89d77c3..b5224ea 100644
--- a/xfa/fxfa/app/xfa_fftext.cpp
+++ b/xfa/fxfa/app/cxfa_fftext.cpp
@@ -4,15 +4,15 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_fftext.h"
+#include "xfa/fxfa/app/cxfa_fftext.h"
#include "xfa/fwl/fwl_widgetdef.h"
#include "xfa/fwl/fwl_widgethit.h"
+#include "xfa/fxfa/app/cxfa_ffdraw.h"
#include "xfa/fxfa/app/cxfa_linkuserdata.h"
#include "xfa/fxfa/app/cxfa_pieceline.h"
#include "xfa/fxfa/app/cxfa_textlayout.h"
-#include "xfa/fxfa/app/xfa_ffdraw.h"
-#include "xfa/fxfa/app/xfa_textpiece.h"
+#include "xfa/fxfa/app/cxfa_textpiece.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
diff --git a/xfa/fxfa/app/xfa_fftext.h b/xfa/fxfa/app/cxfa_fftext.h
similarity index 86%
rename from xfa/fxfa/app/xfa_fftext.h
rename to xfa/fxfa/app/cxfa_fftext.h
index eddc122..3fd48da 100644
--- a/xfa/fxfa/app/xfa_fftext.h
+++ b/xfa/fxfa/app/cxfa_fftext.h
@@ -4,10 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_APP_XFA_FFTEXT_H_
-#define XFA_FXFA_APP_XFA_FFTEXT_H_
+#ifndef XFA_FXFA_APP_CXFA_FFTEXT_H_
+#define XFA_FXFA_APP_CXFA_FFTEXT_H_
-#include "xfa/fxfa/app/xfa_ffdraw.h"
+#include "xfa/fxfa/app/cxfa_ffdraw.h"
class CXFA_FFText : public CXFA_FFDraw {
public:
@@ -29,4 +29,4 @@
const wchar_t* GetLinkURLAtPoint(const CFX_PointF& point);
};
-#endif // XFA_FXFA_APP_XFA_FFTEXT_H_
+#endif // XFA_FXFA_APP_CXFA_FFTEXT_H_
diff --git a/xfa/fxfa/app/cxfa_fftextedit.cpp b/xfa/fxfa/app/cxfa_fftextedit.cpp
new file mode 100644
index 0000000..b61d4ab
--- /dev/null
+++ b/xfa/fxfa/app/cxfa_fftextedit.cpp
@@ -0,0 +1,364 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fxfa/app/cxfa_fftextedit.h"
+
+#include <utility>
+
+#include "xfa/fwl/cfwl_datetimepicker.h"
+#include "xfa/fwl/cfwl_edit.h"
+#include "xfa/fwl/cfwl_eventcheckword.h"
+#include "xfa/fwl/cfwl_eventtarget.h"
+#include "xfa/fwl/cfwl_eventtextchanged.h"
+#include "xfa/fwl/cfwl_messagekillfocus.h"
+#include "xfa/fwl/cfwl_messagesetfocus.h"
+#include "xfa/fwl/cfwl_notedriver.h"
+#include "xfa/fxfa/cxfa_eventparam.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
+
+CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_WidgetAcc* pDataAcc)
+ : CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
+
+CXFA_FFTextEdit::~CXFA_FFTextEdit() {
+ if (m_pNormalWidget) {
+ CFWL_NoteDriver* pNoteDriver =
+ m_pNormalWidget->GetOwnerApp()->GetNoteDriver();
+ pNoteDriver->UnregisterEventTarget(m_pNormalWidget.get());
+ }
+}
+
+bool CXFA_FFTextEdit::LoadWidget() {
+ auto pNewWidget = pdfium::MakeUnique<CFWL_Edit>(
+ GetFWLApp(), pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr);
+ CFWL_Edit* pFWLEdit = pNewWidget.get();
+ m_pNormalWidget = std::move(pNewWidget);
+ m_pNormalWidget->SetLayoutItem(this);
+
+ CFWL_NoteDriver* pNoteDriver =
+ m_pNormalWidget->GetOwnerApp()->GetNoteDriver();
+ pNoteDriver->RegisterEventTarget(m_pNormalWidget.get(),
+ m_pNormalWidget.get());
+ m_pOldDelegate = m_pNormalWidget->GetDelegate();
+ m_pNormalWidget->SetDelegate(this);
+ m_pNormalWidget->LockUpdate();
+ UpdateWidgetProperty();
+
+ CFX_WideString wsText;
+ m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
+ pFWLEdit->SetText(wsText);
+ m_pNormalWidget->UnlockUpdate();
+ return CXFA_FFField::LoadWidget();
+}
+
+void CXFA_FFTextEdit::UpdateWidgetProperty() {
+ CFWL_Edit* pWidget = static_cast<CFWL_Edit*>(m_pNormalWidget.get());
+ if (!pWidget)
+ return;
+
+ uint32_t dwStyle = 0;
+ uint32_t dwExtendedStyle = FWL_STYLEEXT_EDT_ShowScrollbarFocus |
+ FWL_STYLEEXT_EDT_OuterScrollbar |
+ FWL_STYLEEXT_EDT_LastLineHeight;
+ dwExtendedStyle |= UpdateUIProperty();
+ if (m_pDataAcc->IsMultiLine()) {
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine | FWL_STYLEEXT_EDT_WantReturn;
+ if (m_pDataAcc->GetVerticalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) {
+ dwStyle |= FWL_WGTSTYLE_VScroll;
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoVScroll;
+ }
+ } else if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) {
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
+ }
+ if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
+ !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine;
+ }
+
+ XFA_Element eType = XFA_Element::Unknown;
+ int32_t iMaxChars = m_pDataAcc->GetMaxChars(eType);
+ if (eType == XFA_Element::ExData)
+ iMaxChars = 0;
+
+ int32_t iNumCells = m_pDataAcc->GetNumberOfCells();
+ if (iNumCells == 0) {
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText;
+ pWidget->SetLimit(iMaxChars > 0 ? iMaxChars : 1);
+ } else if (iNumCells > 0) {
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText;
+ pWidget->SetLimit(iNumCells);
+ } else {
+ pWidget->SetLimit(iMaxChars);
+ }
+ dwExtendedStyle |= GetAlignment();
+ m_pNormalWidget->ModifyStyles(dwStyle, 0xFFFFFFFF);
+ m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
+}
+
+bool CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
+ if (!PtInActiveRect(point))
+ return false;
+ if (!IsFocused()) {
+ m_dwStatus |= XFA_WidgetStatus_Focused;
+ UpdateFWLData();
+ AddInvalidateRect();
+ }
+
+ SetButtonDown(true);
+ CFWL_MessageMouse ms(nullptr, m_pNormalWidget.get());
+ ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown;
+ ms.m_dwFlags = dwFlags;
+ ms.m_pos = FWLToClient(point);
+ TranslateFWLMessage(&ms);
+ return true;
+}
+
+bool CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
+ if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open)
+ return false;
+ if (!PtInActiveRect(point))
+ return false;
+ if (!IsFocused()) {
+ m_dwStatus |= XFA_WidgetStatus_Focused;
+ UpdateFWLData();
+ AddInvalidateRect();
+ }
+
+ SetButtonDown(true);
+ CFWL_MessageMouse ms(nullptr, nullptr);
+ ms.m_dwCmd = FWL_MouseCommand::RightButtonDown;
+ ms.m_dwFlags = dwFlags;
+ ms.m_pos = FWLToClient(point);
+ TranslateFWLMessage(&ms);
+ return true;
+}
+
+bool CXFA_FFTextEdit::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
+ if (!CXFA_FFField::OnRButtonUp(dwFlags, point))
+ return false;
+
+ GetDoc()->GetDocEnvironment()->PopupMenu(this, point);
+ return true;
+}
+
+bool CXFA_FFTextEdit::OnSetFocus(CXFA_FFWidget* pOldWidget) {
+ m_dwStatus &= ~XFA_WidgetStatus_TextEditValueChanged;
+ if (!IsFocused()) {
+ m_dwStatus |= XFA_WidgetStatus_Focused;
+ UpdateFWLData();
+ AddInvalidateRect();
+ }
+ CXFA_FFWidget::OnSetFocus(pOldWidget);
+ CFWL_MessageSetFocus ms(nullptr, m_pNormalWidget.get());
+ TranslateFWLMessage(&ms);
+ return true;
+}
+
+bool CXFA_FFTextEdit::OnKillFocus(CXFA_FFWidget* pNewWidget) {
+ CFWL_MessageKillFocus ms(nullptr, m_pNormalWidget.get());
+ TranslateFWLMessage(&ms);
+ m_dwStatus &= ~XFA_WidgetStatus_Focused;
+
+ SetEditScrollOffset();
+ ProcessCommittedData();
+ UpdateFWLData();
+ AddInvalidateRect();
+ CXFA_FFWidget::OnKillFocus(pNewWidget);
+
+ m_dwStatus &= ~XFA_WidgetStatus_TextEditValueChanged;
+ return true;
+}
+
+bool CXFA_FFTextEdit::CommitData() {
+ CFX_WideString wsText =
+ static_cast<CFWL_Edit*>(m_pNormalWidget.get())->GetText();
+ if (m_pDataAcc->SetValue(wsText, XFA_VALUEPICTURE_Edit)) {
+ m_pDataAcc->UpdateUIDisplay(this);
+ return true;
+ }
+ ValidateNumberField(wsText);
+ return false;
+}
+
+void CXFA_FFTextEdit::ValidateNumberField(const CFX_WideString& wsText) {
+ CXFA_WidgetAcc* pAcc = GetDataAcc();
+ if (!pAcc || pAcc->GetUIType() != XFA_Element::NumericEdit)
+ return;
+
+ IXFA_AppProvider* pAppProvider = GetApp()->GetAppProvider();
+ if (!pAppProvider)
+ return;
+
+ CFX_WideString wsSomField;
+ pAcc->GetNode()->GetSOMExpression(wsSomField);
+
+ CFX_WideString wsMessage;
+ wsMessage.Format(L"%s can not contain %s", wsText.c_str(),
+ wsSomField.c_str());
+ pAppProvider->MsgBox(wsMessage, pAppProvider->GetAppTitle(), XFA_MBICON_Error,
+ XFA_MB_OK);
+}
+
+bool CXFA_FFTextEdit::IsDataChanged() {
+ return (m_dwStatus & XFA_WidgetStatus_TextEditValueChanged) != 0;
+}
+
+uint32_t CXFA_FFTextEdit::GetAlignment() {
+ CXFA_Para para = m_pDataAcc->GetPara();
+ if (!para)
+ return 0;
+
+ uint32_t dwExtendedStyle = 0;
+ switch (para.GetHorizontalAlign()) {
+ case XFA_ATTRIBUTEENUM_Center:
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_HCenter;
+ break;
+ case XFA_ATTRIBUTEENUM_Justify:
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_Justified;
+ break;
+ case XFA_ATTRIBUTEENUM_JustifyAll:
+ case XFA_ATTRIBUTEENUM_Radix:
+ break;
+ case XFA_ATTRIBUTEENUM_Right:
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_HFar;
+ break;
+ default:
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_HNear;
+ break;
+ }
+
+ switch (para.GetVerticalAlign()) {
+ case XFA_ATTRIBUTEENUM_Middle:
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_VCenter;
+ break;
+ case XFA_ATTRIBUTEENUM_Bottom:
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_VFar;
+ break;
+ default:
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_VNear;
+ break;
+ }
+ return dwExtendedStyle;
+}
+
+bool CXFA_FFTextEdit::UpdateFWLData() {
+ if (!m_pNormalWidget)
+ return false;
+
+ XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display;
+ if (IsFocused())
+ eType = XFA_VALUEPICTURE_Edit;
+
+ bool bUpdate = false;
+ if (m_pDataAcc->GetUIType() == XFA_Element::TextEdit &&
+ m_pDataAcc->GetNumberOfCells() < 0) {
+ XFA_Element elementType = XFA_Element::Unknown;
+ int32_t iMaxChars = m_pDataAcc->GetMaxChars(elementType);
+ if (elementType == XFA_Element::ExData)
+ iMaxChars = eType == XFA_VALUEPICTURE_Edit ? iMaxChars : 0;
+ if (static_cast<CFWL_Edit*>(m_pNormalWidget.get())->GetLimit() !=
+ iMaxChars) {
+ static_cast<CFWL_Edit*>(m_pNormalWidget.get())->SetLimit(iMaxChars);
+ bUpdate = true;
+ }
+ }
+
+ if (m_pDataAcc->GetUIType() == XFA_Element::Barcode) {
+ int32_t nDataLen = 0;
+ if (eType == XFA_VALUEPICTURE_Edit)
+ m_pDataAcc->GetBarcodeAttribute_DataLength(&nDataLen);
+ static_cast<CFWL_Edit*>(m_pNormalWidget.get())->SetLimit(nDataLen);
+ bUpdate = true;
+ }
+
+ CFX_WideString wsText;
+ m_pDataAcc->GetValue(wsText, eType);
+
+ CFX_WideString wsOldText =
+ static_cast<CFWL_Edit*>(m_pNormalWidget.get())->GetText();
+ if (wsText != wsOldText || (eType == XFA_VALUEPICTURE_Edit && bUpdate)) {
+ static_cast<CFWL_Edit*>(m_pNormalWidget.get())->SetText(wsText);
+ bUpdate = true;
+ }
+ if (bUpdate)
+ m_pNormalWidget->Update();
+
+ return true;
+}
+
+void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget,
+ const CFX_WideString& wsChanged,
+ const CFX_WideString& wsPrevText) {
+ m_dwStatus |= XFA_WidgetStatus_TextEditValueChanged;
+ CXFA_EventParam eParam;
+ eParam.m_eType = XFA_EVENT_Change;
+ eParam.m_wsChange = wsChanged;
+ eParam.m_pTarget = m_pDataAcc.Get();
+ eParam.m_wsPrevText = wsPrevText;
+ CFWL_Edit* pEdit = static_cast<CFWL_Edit*>(m_pNormalWidget.get());
+ if (m_pDataAcc->GetUIType() == XFA_Element::DateTimeEdit) {
+ CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)pEdit;
+ eParam.m_wsNewText = pDateTime->GetEditText();
+ int32_t iSels = pDateTime->CountSelRanges();
+ if (iSels)
+ eParam.m_iSelEnd = pDateTime->GetSelRange(0, &eParam.m_iSelStart);
+ } else {
+ eParam.m_wsNewText = pEdit->GetText();
+ int32_t iSels = pEdit->CountSelRanges();
+ if (iSels)
+ eParam.m_iSelEnd = pEdit->GetSelRange(0, &eParam.m_iSelStart);
+ }
+ m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
+}
+
+void CXFA_FFTextEdit::OnTextFull(CFWL_Widget* pWidget) {
+ CXFA_EventParam eParam;
+ eParam.m_eType = XFA_EVENT_Full;
+ eParam.m_pTarget = m_pDataAcc.Get();
+ m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Full, &eParam);
+}
+
+bool CXFA_FFTextEdit::CheckWord(const CFX_ByteStringC& sWord) {
+ if (sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_Element::TextEdit)
+ return true;
+ return false;
+}
+
+void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) {
+ m_pOldDelegate->OnProcessMessage(pMessage);
+}
+
+void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) {
+ CXFA_FFField::OnProcessEvent(pEvent);
+ switch (pEvent->GetType()) {
+ case CFWL_Event::Type::TextChanged: {
+ CFWL_EventTextChanged* event =
+ static_cast<CFWL_EventTextChanged*>(pEvent);
+ CFX_WideString wsChange;
+ OnTextChanged(m_pNormalWidget.get(), wsChange, event->wsPrevText);
+ break;
+ }
+ case CFWL_Event::Type::TextFull: {
+ OnTextFull(m_pNormalWidget.get());
+ break;
+ }
+ case CFWL_Event::Type::CheckWord: {
+ CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged");
+ CFWL_EventCheckWord* event = static_cast<CFWL_EventCheckWord*>(pEvent);
+ event->bCheckWord = CheckWord(event->bsWord.AsStringC());
+ break;
+ }
+ default:
+ break;
+ }
+ m_pOldDelegate->OnProcessEvent(pEvent);
+}
+
+void CXFA_FFTextEdit::OnDrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
+ m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix);
+}
diff --git a/xfa/fxfa/app/cxfa_fftextedit.h b/xfa/fxfa/app/cxfa_fftextedit.h
new file mode 100644
index 0000000..fa0779e
--- /dev/null
+++ b/xfa/fxfa/app/cxfa_fftextedit.h
@@ -0,0 +1,57 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_APP_CXFA_FFTEXTEDIT_H_
+#define XFA_FXFA_APP_CXFA_FFTEXTEDIT_H_
+
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxcrt/fx_string.h"
+#include "xfa/fxfa/app/cxfa_fffield.h"
+
+class CFWL_Event;
+class CFWL_Widget;
+class CFX_Matrix;
+class CXFA_FFWidget;
+class CXFA_WidgetAcc;
+class IFWL_WidgetDelegate;
+
+class CXFA_FFTextEdit : public CXFA_FFField {
+ public:
+ explicit CXFA_FFTextEdit(CXFA_WidgetAcc* pDataAcc);
+ ~CXFA_FFTextEdit() override;
+
+ // CXFA_FFField
+ bool LoadWidget() override;
+ void UpdateWidgetProperty() override;
+ bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnSetFocus(CXFA_FFWidget* pOldWidget) override;
+ bool OnKillFocus(CXFA_FFWidget* pNewWidget) override;
+ void OnProcessMessage(CFWL_Message* pMessage) override;
+ void OnProcessEvent(CFWL_Event* pEvent) override;
+ void OnDrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix = nullptr) override;
+
+ void OnTextChanged(CFWL_Widget* pWidget,
+ const CFX_WideString& wsChanged,
+ const CFX_WideString& wsPrevText);
+ void OnTextFull(CFWL_Widget* pWidget);
+ bool CheckWord(const CFX_ByteStringC& sWord);
+
+ protected:
+ uint32_t GetAlignment();
+
+ IFWL_WidgetDelegate* m_pOldDelegate;
+
+ private:
+ bool CommitData() override;
+ bool UpdateFWLData() override;
+ bool IsDataChanged() override;
+ void ValidateNumberField(const CFX_WideString& wsText);
+};
+
+#endif // XFA_FXFA_APP_CXFA_FFTEXTEDIT_H_
diff --git a/xfa/fxfa/app/xfa_fwladapter.cpp b/xfa/fxfa/app/cxfa_fwladapterwidgetmgr.cpp
similarity index 92%
rename from xfa/fxfa/app/xfa_fwladapter.cpp
rename to xfa/fxfa/app/cxfa_fwladapterwidgetmgr.cpp
index 3cf6e5e..42362d8 100644
--- a/xfa/fxfa/app/xfa_fwladapter.cpp
+++ b/xfa/fxfa/app/cxfa_fwladapterwidgetmgr.cpp
@@ -4,9 +4,9 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_fwladapter.h"
+#include "xfa/fxfa/app/cxfa_fwladapterwidgetmgr.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
+#include "xfa/fxfa/app/cxfa_fffield.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
CXFA_FWLAdapterWidgetMgr::CXFA_FWLAdapterWidgetMgr() {}
diff --git a/xfa/fxfa/app/xfa_fwladapter.h b/xfa/fxfa/app/cxfa_fwladapterwidgetmgr.h
similarity index 81%
rename from xfa/fxfa/app/xfa_fwladapter.h
rename to xfa/fxfa/app/cxfa_fwladapterwidgetmgr.h
index b4a3481..f9126ea 100644
--- a/xfa/fxfa/app/xfa_fwladapter.h
+++ b/xfa/fxfa/app/cxfa_fwladapterwidgetmgr.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_APP_XFA_FWLADAPTER_H_
-#define XFA_FXFA_APP_XFA_FWLADAPTER_H_
+#ifndef XFA_FXFA_APP_CXFA_FWLADAPTERWIDGETMGR_H_
+#define XFA_FXFA_APP_CXFA_FWLADAPTERWIDGETMGR_H_
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_system.h"
@@ -25,4 +25,4 @@
CFX_RectF& rtPopup);
};
-#endif // XFA_FXFA_APP_XFA_FWLADAPTER_H_
+#endif // XFA_FXFA_APP_CXFA_FWLADAPTERWIDGETMGR_H_
diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/cxfa_fwltheme.cpp
similarity index 99%
rename from xfa/fxfa/app/xfa_fwltheme.cpp
rename to xfa/fxfa/app/cxfa_fwltheme.cpp
index 9af45e6..5f8e1dc 100644
--- a/xfa/fxfa/app/xfa_fwltheme.cpp
+++ b/xfa/fxfa/app/cxfa_fwltheme.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_fwltheme.h"
+#include "xfa/fxfa/app/cxfa_fwltheme.h"
#include "core/fxcrt/fx_codepage.h"
#include "xfa/fde/cfde_textout.h"
diff --git a/xfa/fxfa/app/xfa_fwltheme.h b/xfa/fxfa/app/cxfa_fwltheme.h
similarity index 95%
rename from xfa/fxfa/app/xfa_fwltheme.h
rename to xfa/fxfa/app/cxfa_fwltheme.h
index 7563c69..eaca990 100644
--- a/xfa/fxfa/app/xfa_fwltheme.h
+++ b/xfa/fxfa/app/cxfa_fwltheme.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_APP_XFA_FWLTHEME_H_
-#define XFA_FXFA_APP_XFA_FWLTHEME_H_
+#ifndef XFA_FXFA_APP_CXFA_FWLTHEME_H_
+#define XFA_FXFA_APP_CXFA_FWLTHEME_H_
#include <memory>
@@ -67,4 +67,4 @@
CXFA_FFWidget* XFA_ThemeGetOuterWidget(CFWL_Widget* pWidget);
-#endif // XFA_FXFA_APP_XFA_FWLTHEME_H_
+#endif // XFA_FXFA_APP_CXFA_FWLTHEME_H_
diff --git a/xfa/fxfa/app/cxfa_pieceline.cpp b/xfa/fxfa/app/cxfa_pieceline.cpp
index b906cf2..2e1ea55 100644
--- a/xfa/fxfa/app/cxfa_pieceline.cpp
+++ b/xfa/fxfa/app/cxfa_pieceline.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/app/cxfa_pieceline.h"
-#include "xfa/fxfa/app/xfa_textpiece.h"
+#include "xfa/fxfa/app/cxfa_textpiece.h"
CXFA_PieceLine::CXFA_PieceLine() {}
diff --git a/xfa/fxfa/app/cxfa_pieceline.h b/xfa/fxfa/app/cxfa_pieceline.h
index 87f71fc..6b17ebf 100644
--- a/xfa/fxfa/app/cxfa_pieceline.h
+++ b/xfa/fxfa/app/cxfa_pieceline.h
@@ -12,14 +12,14 @@
#include "core/fxcrt/fx_basic.h"
-class XFA_TextPiece;
+class CXFA_TextPiece;
class CXFA_PieceLine {
public:
CXFA_PieceLine();
~CXFA_PieceLine();
- std::vector<std::unique_ptr<XFA_TextPiece>> m_textPieces;
+ std::vector<std::unique_ptr<CXFA_TextPiece>> m_textPieces;
std::vector<int32_t> m_charCounts;
};
diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp
index c43f7e3..489df9a 100644
--- a/xfa/fxfa/app/cxfa_textlayout.cpp
+++ b/xfa/fxfa/app/cxfa_textlayout.cpp
@@ -24,10 +24,10 @@
#include "xfa/fxfa/app/cxfa_loadercontext.h"
#include "xfa/fxfa/app/cxfa_pieceline.h"
#include "xfa/fxfa/app/cxfa_textparsecontext.h"
+#include "xfa/fxfa/app/cxfa_textpiece.h"
+#include "xfa/fxfa/app/cxfa_textprovider.h"
#include "xfa/fxfa/app/cxfa_texttabstopscontext.h"
#include "xfa/fxfa/app/cxfa_textuserdata.h"
-#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
-#include "xfa/fxfa/app/xfa_textpiece.h"
#include "xfa/fxfa/parser/cxfa_font.h"
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_para.h"
@@ -594,7 +594,7 @@
int32_t iPieces = pdfium::CollectionSize<int32_t>(pPieceLine->m_textPieces);
int32_t j = 0;
for (j = 0; j < iPieces; j++) {
- const XFA_TextPiece* pPiece = pPieceLine->m_textPieces[j].get();
+ const CXFA_TextPiece* pPiece = pPieceLine->m_textPieces[j].get();
int32_t iChars = pPiece->iChars;
if (iCharCount < iChars) {
FX_Free(pCharPos);
@@ -964,7 +964,7 @@
if (iPieces == 0)
return;
- XFA_TextPiece* pPiece = pPieceLine->m_textPieces[iPieces - 1].get();
+ CXFA_TextPiece* pPiece = pPieceLine->m_textPieces[iPieces - 1].get();
int32_t& iTabstopsIndex = m_pTabstopContext->m_iTabIndex;
int32_t iCount = m_textParser.CountTabs(pStyle);
if (!pdfium::IndexInBounds(m_pTabstopContext->m_tabstops, iTabstopsIndex))
@@ -975,7 +975,7 @@
m_pTabstopContext->m_bTabstops = true;
float fRight = 0;
if (iPieces > 1) {
- XFA_TextPiece* p = pPieceLine->m_textPieces[iPieces - 2].get();
+ CXFA_TextPiece* p = pPieceLine->m_textPieces[iPieces - 2].get();
fRight = p->rtPiece.right();
}
m_pTabstopContext->m_fTabWidth =
@@ -1032,7 +1032,7 @@
pStyle = pUserData->m_pStyle;
float fVerScale = pPiece->m_iVerticalScale / 100.0f;
- auto pTP = pdfium::MakeUnique<XFA_TextPiece>();
+ auto pTP = pdfium::MakeUnique<CXFA_TextPiece>();
pTP->iChars = pPiece->m_iChars;
pTP->szText = pPiece->GetString();
pTP->Widths = pPiece->GetWidths();
@@ -1149,7 +1149,7 @@
int32_t iPiece,
FXTEXT_CHARPOS* pCharPos,
const CFX_Matrix& tmDoc2Device) {
- const XFA_TextPiece* pPiece = pPieceLine->m_textPieces[iPiece].get();
+ const CXFA_TextPiece* pPiece = pPieceLine->m_textPieces[iPiece].get();
int32_t iCount = GetDisplayPos(pPiece, pCharPos);
if (iCount > 0) {
pBrush->SetColor(pPiece->dwColor);
@@ -1165,7 +1165,7 @@
int32_t iPiece,
FXTEXT_CHARPOS* pCharPos,
const CFX_Matrix& tmDoc2Device) {
- XFA_TextPiece* pPiece = pPieceLine->m_textPieces[iPiece].get();
+ CXFA_TextPiece* pPiece = pPieceLine->m_textPieces[iPiece].get();
bool bNoUnderline = pPiece->iUnderline < 1 || pPiece->iUnderline > 2;
bool bNoLineThrough = pPiece->iLineThrough < 1 || pPiece->iLineThrough > 2;
if (bNoUnderline && bNoLineThrough)
@@ -1273,7 +1273,7 @@
pDevice->DrawPath(pPen, 1, pPath.get(), &tmDoc2Device);
}
-int32_t CXFA_TextLayout::GetDisplayPos(const XFA_TextPiece* pPiece,
+int32_t CXFA_TextLayout::GetDisplayPos(const CXFA_TextPiece* pPiece,
FXTEXT_CHARPOS* pCharPos,
bool bCharCode) {
if (!pPiece)
@@ -1285,7 +1285,7 @@
return m_pBreak->GetDisplayPos(&tr, pCharPos, bCharCode);
}
-bool CXFA_TextLayout::ToRun(const XFA_TextPiece* pPiece, FX_RTFTEXTOBJ* tr) {
+bool CXFA_TextLayout::ToRun(const CXFA_TextPiece* pPiece, FX_RTFTEXTOBJ* tr) {
int32_t iLength = pPiece->iChars;
if (iLength < 1)
return false;
diff --git a/xfa/fxfa/app/cxfa_textlayout.h b/xfa/fxfa/app/cxfa_textlayout.h
index 75c2d56..e8c203f 100644
--- a/xfa/fxfa/app/cxfa_textlayout.h
+++ b/xfa/fxfa/app/cxfa_textlayout.h
@@ -29,7 +29,7 @@
class CXFA_PieceLine;
class CXFA_TextProvider;
class CXFA_TextTabstopsContext;
-class XFA_TextPiece;
+class CXFA_TextPiece;
class CXFA_TextLayout {
public:
@@ -112,10 +112,10 @@
int32_t iPiece,
FXTEXT_CHARPOS* pCharPos,
const CFX_Matrix& tmDoc2Device);
- int32_t GetDisplayPos(const XFA_TextPiece* pPiece,
+ int32_t GetDisplayPos(const CXFA_TextPiece* pPiece,
FXTEXT_CHARPOS* pCharPos,
bool bCharCode = false);
- bool ToRun(const XFA_TextPiece* pPiece, FX_RTFTEXTOBJ* tr);
+ bool ToRun(const CXFA_TextPiece* pPiece, FX_RTFTEXTOBJ* tr);
void DoTabstops(CFDE_CSSComputedStyle* pStyle, CXFA_PieceLine* pPieceLine);
bool Layout(int32_t iBlock);
int32_t CountBlocks() const;
diff --git a/xfa/fxfa/app/cxfa_textparser.cpp b/xfa/fxfa/app/cxfa_textparser.cpp
index 33bd2b9..8bdb0a8 100644
--- a/xfa/fxfa/app/cxfa_textparser.cpp
+++ b/xfa/fxfa/app/cxfa_textparser.cpp
@@ -21,8 +21,8 @@
#include "xfa/fgas/font/cfgas_fontmgr.h"
#include "xfa/fxfa/app/cxfa_csstagprovider.h"
#include "xfa/fxfa/app/cxfa_textparsecontext.h"
+#include "xfa/fxfa/app/cxfa_textprovider.h"
#include "xfa/fxfa/app/cxfa_texttabstopscontext.h"
-#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_fontmgr.h"
diff --git a/xfa/fxfa/app/xfa_textpiece.cpp b/xfa/fxfa/app/cxfa_textpiece.cpp
similarity index 71%
rename from xfa/fxfa/app/xfa_textpiece.cpp
rename to xfa/fxfa/app/cxfa_textpiece.cpp
index c53e45f..4cbad0a 100644
--- a/xfa/fxfa/app/xfa_textpiece.cpp
+++ b/xfa/fxfa/app/cxfa_textpiece.cpp
@@ -4,10 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_textpiece.h"
+#include "xfa/fxfa/app/cxfa_textpiece.h"
#include "xfa/fxfa/app/cxfa_linkuserdata.h"
-XFA_TextPiece::XFA_TextPiece() {}
+CXFA_TextPiece::CXFA_TextPiece() {}
-XFA_TextPiece::~XFA_TextPiece() {}
+CXFA_TextPiece::~CXFA_TextPiece() {}
diff --git a/xfa/fxfa/app/xfa_textpiece.h b/xfa/fxfa/app/cxfa_textpiece.h
similarity index 81%
rename from xfa/fxfa/app/xfa_textpiece.h
rename to xfa/fxfa/app/cxfa_textpiece.h
index fd1f3bd..0fba66e 100644
--- a/xfa/fxfa/app/xfa_textpiece.h
+++ b/xfa/fxfa/app/cxfa_textpiece.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_APP_XFA_TEXTPIECE_H_
-#define XFA_FXFA_APP_XFA_TEXTPIECE_H_
+#ifndef XFA_FXFA_APP_CXFA_TEXTPIECE_H_
+#define XFA_FXFA_APP_CXFA_TEXTPIECE_H_
#include <vector>
@@ -17,10 +17,10 @@
class CXFA_LinkUserData;
-class XFA_TextPiece {
+class CXFA_TextPiece {
public:
- XFA_TextPiece();
- ~XFA_TextPiece();
+ CXFA_TextPiece();
+ ~CXFA_TextPiece();
CFX_WideString szText;
std::vector<int32_t> Widths;
@@ -38,4 +38,4 @@
CFX_RetainPtr<CXFA_LinkUserData> pLinkData;
};
-#endif // XFA_FXFA_APP_XFA_TEXTPIECE_H_
+#endif // XFA_FXFA_APP_CXFA_TEXTPIECE_H_
diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/cxfa_textprovider.cpp
similarity index 95%
rename from xfa/fxfa/app/xfa_ffwidgetacc.cpp
rename to xfa/fxfa/app/cxfa_textprovider.cpp
index 2ac27cf..01bc021 100644
--- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp
+++ b/xfa/fxfa/app/cxfa_textprovider.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
+#include "xfa/fxfa/app/cxfa_textprovider.h"
#include <algorithm>
#include <memory>
@@ -16,10 +16,9 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_textout.h"
-#include "xfa/fxfa/app/xfa_ffcheckbutton.h"
-#include "xfa/fxfa/app/xfa_ffchoicelist.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
+#include "xfa/fxfa/app/cxfa_ffcheckbutton.h"
+#include "xfa/fxfa/app/cxfa_fffield.h"
+#include "xfa/fxfa/app/cxfa_fwladapterwidgetmgr.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.h b/xfa/fxfa/app/cxfa_textprovider.h
similarity index 90%
rename from xfa/fxfa/app/xfa_ffwidgetacc.h
rename to xfa/fxfa/app/cxfa_textprovider.h
index 7840186..08fc6f3 100644
--- a/xfa/fxfa/app/xfa_ffwidgetacc.h
+++ b/xfa/fxfa/app/cxfa_textprovider.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_APP_XFA_FFWIDGETACC_H_
-#define XFA_FXFA_APP_XFA_FFWIDGETACC_H_
+#ifndef XFA_FXFA_APP_CXFA_TEXTPROVIDER_H_
+#define XFA_FXFA_APP_CXFA_TEXTPROVIDER_H_
#include "core/fxcrt/fx_string.h"
#include "xfa/fxfa/app/cxfa_textlayout.h"
@@ -47,4 +47,4 @@
XFA_TEXTPROVIDERTYPE m_eType;
};
-#endif // XFA_FXFA_APP_XFA_FFWIDGETACC_H_
+#endif // XFA_FXFA_APP_CXFA_TEXTPROVIDER_H_
diff --git a/xfa/fxfa/app/xfa_ffpath.h b/xfa/fxfa/app/xfa_ffpath.h
deleted file mode 100644
index 6df53f4..0000000
--- a/xfa/fxfa/app/xfa_ffpath.h
+++ /dev/null
@@ -1,48 +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_FXFA_APP_XFA_FFPATH_H_
-#define XFA_FXFA_APP_XFA_FFPATH_H_
-
-#include "xfa/fxfa/app/xfa_ffdraw.h"
-
-class CXFA_FFLine : public CXFA_FFDraw {
- public:
- explicit CXFA_FFLine(CXFA_WidgetAcc* pDataAcc);
- ~CXFA_FFLine() override;
-
- // CXFA_FFWidget
- void RenderWidget(CFX_Graphics* pGS,
- CFX_Matrix* pMatrix,
- uint32_t dwStatus) override;
-
- private:
- void GetRectFromHand(CFX_RectF& rect, int32_t iHand, float fLineWidth);
-};
-
-class CXFA_FFArc : public CXFA_FFDraw {
- public:
- explicit CXFA_FFArc(CXFA_WidgetAcc* pDataAcc);
- ~CXFA_FFArc() override;
-
- // CXFA_FFWidget
- void RenderWidget(CFX_Graphics* pGS,
- CFX_Matrix* pMatrix,
- uint32_t dwStatus) override;
-};
-
-class CXFA_FFRectangle : public CXFA_FFDraw {
- public:
- explicit CXFA_FFRectangle(CXFA_WidgetAcc* pDataAcc);
- ~CXFA_FFRectangle() override;
-
- // CXFA_FFWidget
- void RenderWidget(CFX_Graphics* pGS,
- CFX_Matrix* pMatrix,
- uint32_t dwStatus) override;
-};
-
-#endif // XFA_FXFA_APP_XFA_FFPATH_H_
diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp
deleted file mode 100644
index 41305ef..0000000
--- a/xfa/fxfa/app/xfa_fftextedit.cpp
+++ /dev/null
@@ -1,706 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "xfa/fxfa/app/xfa_fftextedit.h"
-
-#include <utility>
-#include <vector>
-
-#include "xfa/fwl/cfwl_datetimepicker.h"
-#include "xfa/fwl/cfwl_edit.h"
-#include "xfa/fwl/cfwl_eventcheckword.h"
-#include "xfa/fwl/cfwl_eventselectchanged.h"
-#include "xfa/fwl/cfwl_eventtextchanged.h"
-#include "xfa/fwl/cfwl_eventvalidate.h"
-#include "xfa/fwl/cfwl_messagekillfocus.h"
-#include "xfa/fwl/cfwl_messagemouse.h"
-#include "xfa/fwl/cfwl_messagesetfocus.h"
-#include "xfa/fwl/cfwl_notedriver.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
-#include "xfa/fxfa/cxfa_eventparam.h"
-#include "xfa/fxfa/cxfa_ffapp.h"
-#include "xfa/fxfa/cxfa_ffdoc.h"
-#include "xfa/fxfa/cxfa_ffdocview.h"
-#include "xfa/fxfa/cxfa_ffpageview.h"
-#include "xfa/fxfa/cxfa_ffwidget.h"
-#include "xfa/fxfa/parser/cxfa_localevalue.h"
-#include "xfa/fxfa/parser/cxfa_node.h"
-
-CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_WidgetAcc* pDataAcc)
- : CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
-
-CXFA_FFTextEdit::~CXFA_FFTextEdit() {
- if (m_pNormalWidget) {
- CFWL_NoteDriver* pNoteDriver =
- m_pNormalWidget->GetOwnerApp()->GetNoteDriver();
- pNoteDriver->UnregisterEventTarget(m_pNormalWidget.get());
- }
-}
-
-bool CXFA_FFTextEdit::LoadWidget() {
- auto pNewWidget = pdfium::MakeUnique<CFWL_Edit>(
- GetFWLApp(), pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr);
- CFWL_Edit* pFWLEdit = pNewWidget.get();
- m_pNormalWidget = std::move(pNewWidget);
- m_pNormalWidget->SetLayoutItem(this);
-
- CFWL_NoteDriver* pNoteDriver =
- m_pNormalWidget->GetOwnerApp()->GetNoteDriver();
- pNoteDriver->RegisterEventTarget(m_pNormalWidget.get(),
- m_pNormalWidget.get());
- m_pOldDelegate = m_pNormalWidget->GetDelegate();
- m_pNormalWidget->SetDelegate(this);
- m_pNormalWidget->LockUpdate();
- UpdateWidgetProperty();
-
- CFX_WideString wsText;
- m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
- pFWLEdit->SetText(wsText);
- m_pNormalWidget->UnlockUpdate();
- return CXFA_FFField::LoadWidget();
-}
-
-void CXFA_FFTextEdit::UpdateWidgetProperty() {
- CFWL_Edit* pWidget = static_cast<CFWL_Edit*>(m_pNormalWidget.get());
- if (!pWidget)
- return;
-
- uint32_t dwStyle = 0;
- uint32_t dwExtendedStyle = FWL_STYLEEXT_EDT_ShowScrollbarFocus |
- FWL_STYLEEXT_EDT_OuterScrollbar |
- FWL_STYLEEXT_EDT_LastLineHeight;
- dwExtendedStyle |= UpdateUIProperty();
- if (m_pDataAcc->IsMultiLine()) {
- dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine | FWL_STYLEEXT_EDT_WantReturn;
- if (m_pDataAcc->GetVerticalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) {
- dwStyle |= FWL_WGTSTYLE_VScroll;
- dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoVScroll;
- }
- } else if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) {
- dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
- }
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
- !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
- dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
- dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine;
- }
-
- XFA_Element eType = XFA_Element::Unknown;
- int32_t iMaxChars = m_pDataAcc->GetMaxChars(eType);
- if (eType == XFA_Element::ExData)
- iMaxChars = 0;
-
- int32_t iNumCells = m_pDataAcc->GetNumberOfCells();
- if (iNumCells == 0) {
- dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText;
- pWidget->SetLimit(iMaxChars > 0 ? iMaxChars : 1);
- } else if (iNumCells > 0) {
- dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText;
- pWidget->SetLimit(iNumCells);
- } else {
- pWidget->SetLimit(iMaxChars);
- }
- dwExtendedStyle |= GetAlignment();
- m_pNormalWidget->ModifyStyles(dwStyle, 0xFFFFFFFF);
- m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
-}
-
-bool CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
- if (!PtInActiveRect(point))
- return false;
- if (!IsFocused()) {
- m_dwStatus |= XFA_WidgetStatus_Focused;
- UpdateFWLData();
- AddInvalidateRect();
- }
-
- SetButtonDown(true);
- CFWL_MessageMouse ms(nullptr, m_pNormalWidget.get());
- ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown;
- ms.m_dwFlags = dwFlags;
- ms.m_pos = FWLToClient(point);
- TranslateFWLMessage(&ms);
- return true;
-}
-
-bool CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open)
- return false;
- if (!PtInActiveRect(point))
- return false;
- if (!IsFocused()) {
- m_dwStatus |= XFA_WidgetStatus_Focused;
- UpdateFWLData();
- AddInvalidateRect();
- }
-
- SetButtonDown(true);
- CFWL_MessageMouse ms(nullptr, nullptr);
- ms.m_dwCmd = FWL_MouseCommand::RightButtonDown;
- ms.m_dwFlags = dwFlags;
- ms.m_pos = FWLToClient(point);
- TranslateFWLMessage(&ms);
- return true;
-}
-
-bool CXFA_FFTextEdit::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
- if (!CXFA_FFField::OnRButtonUp(dwFlags, point))
- return false;
-
- GetDoc()->GetDocEnvironment()->PopupMenu(this, point);
- return true;
-}
-
-bool CXFA_FFTextEdit::OnSetFocus(CXFA_FFWidget* pOldWidget) {
- m_dwStatus &= ~XFA_WidgetStatus_TextEditValueChanged;
- if (!IsFocused()) {
- m_dwStatus |= XFA_WidgetStatus_Focused;
- UpdateFWLData();
- AddInvalidateRect();
- }
- CXFA_FFWidget::OnSetFocus(pOldWidget);
- CFWL_MessageSetFocus ms(nullptr, m_pNormalWidget.get());
- TranslateFWLMessage(&ms);
- return true;
-}
-
-bool CXFA_FFTextEdit::OnKillFocus(CXFA_FFWidget* pNewWidget) {
- CFWL_MessageKillFocus ms(nullptr, m_pNormalWidget.get());
- TranslateFWLMessage(&ms);
- m_dwStatus &= ~XFA_WidgetStatus_Focused;
-
- SetEditScrollOffset();
- ProcessCommittedData();
- UpdateFWLData();
- AddInvalidateRect();
- CXFA_FFWidget::OnKillFocus(pNewWidget);
-
- m_dwStatus &= ~XFA_WidgetStatus_TextEditValueChanged;
- return true;
-}
-
-bool CXFA_FFTextEdit::CommitData() {
- CFX_WideString wsText =
- static_cast<CFWL_Edit*>(m_pNormalWidget.get())->GetText();
- if (m_pDataAcc->SetValue(wsText, XFA_VALUEPICTURE_Edit)) {
- m_pDataAcc->UpdateUIDisplay(this);
- return true;
- }
- ValidateNumberField(wsText);
- return false;
-}
-
-void CXFA_FFTextEdit::ValidateNumberField(const CFX_WideString& wsText) {
- CXFA_WidgetAcc* pAcc = GetDataAcc();
- if (!pAcc || pAcc->GetUIType() != XFA_Element::NumericEdit)
- return;
-
- IXFA_AppProvider* pAppProvider = GetApp()->GetAppProvider();
- if (!pAppProvider)
- return;
-
- CFX_WideString wsSomField;
- pAcc->GetNode()->GetSOMExpression(wsSomField);
-
- CFX_WideString wsMessage;
- wsMessage.Format(L"%s can not contain %s", wsText.c_str(),
- wsSomField.c_str());
- pAppProvider->MsgBox(wsMessage, pAppProvider->GetAppTitle(), XFA_MBICON_Error,
- XFA_MB_OK);
-}
-
-bool CXFA_FFTextEdit::IsDataChanged() {
- return (m_dwStatus & XFA_WidgetStatus_TextEditValueChanged) != 0;
-}
-
-uint32_t CXFA_FFTextEdit::GetAlignment() {
- CXFA_Para para = m_pDataAcc->GetPara();
- if (!para)
- return 0;
-
- uint32_t dwExtendedStyle = 0;
- switch (para.GetHorizontalAlign()) {
- case XFA_ATTRIBUTEENUM_Center:
- dwExtendedStyle |= FWL_STYLEEXT_EDT_HCenter;
- break;
- case XFA_ATTRIBUTEENUM_Justify:
- dwExtendedStyle |= FWL_STYLEEXT_EDT_Justified;
- break;
- case XFA_ATTRIBUTEENUM_JustifyAll:
- case XFA_ATTRIBUTEENUM_Radix:
- break;
- case XFA_ATTRIBUTEENUM_Right:
- dwExtendedStyle |= FWL_STYLEEXT_EDT_HFar;
- break;
- default:
- dwExtendedStyle |= FWL_STYLEEXT_EDT_HNear;
- break;
- }
-
- switch (para.GetVerticalAlign()) {
- case XFA_ATTRIBUTEENUM_Middle:
- dwExtendedStyle |= FWL_STYLEEXT_EDT_VCenter;
- break;
- case XFA_ATTRIBUTEENUM_Bottom:
- dwExtendedStyle |= FWL_STYLEEXT_EDT_VFar;
- break;
- default:
- dwExtendedStyle |= FWL_STYLEEXT_EDT_VNear;
- break;
- }
- return dwExtendedStyle;
-}
-
-bool CXFA_FFTextEdit::UpdateFWLData() {
- if (!m_pNormalWidget)
- return false;
-
- XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display;
- if (IsFocused())
- eType = XFA_VALUEPICTURE_Edit;
-
- bool bUpdate = false;
- if (m_pDataAcc->GetUIType() == XFA_Element::TextEdit &&
- m_pDataAcc->GetNumberOfCells() < 0) {
- XFA_Element elementType = XFA_Element::Unknown;
- int32_t iMaxChars = m_pDataAcc->GetMaxChars(elementType);
- if (elementType == XFA_Element::ExData)
- iMaxChars = eType == XFA_VALUEPICTURE_Edit ? iMaxChars : 0;
- if (static_cast<CFWL_Edit*>(m_pNormalWidget.get())->GetLimit() !=
- iMaxChars) {
- static_cast<CFWL_Edit*>(m_pNormalWidget.get())->SetLimit(iMaxChars);
- bUpdate = true;
- }
- }
-
- if (m_pDataAcc->GetUIType() == XFA_Element::Barcode) {
- int32_t nDataLen = 0;
- if (eType == XFA_VALUEPICTURE_Edit)
- m_pDataAcc->GetBarcodeAttribute_DataLength(&nDataLen);
- static_cast<CFWL_Edit*>(m_pNormalWidget.get())->SetLimit(nDataLen);
- bUpdate = true;
- }
-
- CFX_WideString wsText;
- m_pDataAcc->GetValue(wsText, eType);
-
- CFX_WideString wsOldText =
- static_cast<CFWL_Edit*>(m_pNormalWidget.get())->GetText();
- if (wsText != wsOldText || (eType == XFA_VALUEPICTURE_Edit && bUpdate)) {
- static_cast<CFWL_Edit*>(m_pNormalWidget.get())->SetText(wsText);
- bUpdate = true;
- }
- if (bUpdate)
- m_pNormalWidget->Update();
-
- return true;
-}
-
-void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget,
- const CFX_WideString& wsChanged,
- const CFX_WideString& wsPrevText) {
- m_dwStatus |= XFA_WidgetStatus_TextEditValueChanged;
- CXFA_EventParam eParam;
- eParam.m_eType = XFA_EVENT_Change;
- eParam.m_wsChange = wsChanged;
- eParam.m_pTarget = m_pDataAcc.Get();
- eParam.m_wsPrevText = wsPrevText;
- CFWL_Edit* pEdit = static_cast<CFWL_Edit*>(m_pNormalWidget.get());
- if (m_pDataAcc->GetUIType() == XFA_Element::DateTimeEdit) {
- CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)pEdit;
- eParam.m_wsNewText = pDateTime->GetEditText();
- int32_t iSels = pDateTime->CountSelRanges();
- if (iSels)
- eParam.m_iSelEnd = pDateTime->GetSelRange(0, &eParam.m_iSelStart);
- } else {
- eParam.m_wsNewText = pEdit->GetText();
- int32_t iSels = pEdit->CountSelRanges();
- if (iSels)
- eParam.m_iSelEnd = pEdit->GetSelRange(0, &eParam.m_iSelStart);
- }
- m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
-}
-
-void CXFA_FFTextEdit::OnTextFull(CFWL_Widget* pWidget) {
- CXFA_EventParam eParam;
- eParam.m_eType = XFA_EVENT_Full;
- eParam.m_pTarget = m_pDataAcc.Get();
- m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Full, &eParam);
-}
-
-bool CXFA_FFTextEdit::CheckWord(const CFX_ByteStringC& sWord) {
- if (sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_Element::TextEdit)
- return true;
- return false;
-}
-
-void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) {
- m_pOldDelegate->OnProcessMessage(pMessage);
-}
-
-void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) {
- CXFA_FFField::OnProcessEvent(pEvent);
- switch (pEvent->GetType()) {
- case CFWL_Event::Type::TextChanged: {
- CFWL_EventTextChanged* event =
- static_cast<CFWL_EventTextChanged*>(pEvent);
- CFX_WideString wsChange;
- OnTextChanged(m_pNormalWidget.get(), wsChange, event->wsPrevText);
- break;
- }
- case CFWL_Event::Type::TextFull: {
- OnTextFull(m_pNormalWidget.get());
- break;
- }
- case CFWL_Event::Type::CheckWord: {
- CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged");
- CFWL_EventCheckWord* event = static_cast<CFWL_EventCheckWord*>(pEvent);
- event->bCheckWord = CheckWord(event->bsWord.AsStringC());
- break;
- }
- default:
- break;
- }
- m_pOldDelegate->OnProcessEvent(pEvent);
-}
-
-void CXFA_FFTextEdit::OnDrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
- m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix);
-}
-
-CXFA_FFNumericEdit::CXFA_FFNumericEdit(CXFA_WidgetAcc* pDataAcc)
- : CXFA_FFTextEdit(pDataAcc) {}
-
-CXFA_FFNumericEdit::~CXFA_FFNumericEdit() {}
-
-bool CXFA_FFNumericEdit::LoadWidget() {
- auto pNewEdit = pdfium::MakeUnique<CFWL_Edit>(
- GetFWLApp(), pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr);
- CFWL_Edit* pWidget = pNewEdit.get();
- m_pNormalWidget = std::move(pNewEdit);
- m_pNormalWidget->SetLayoutItem(this);
-
- CFWL_NoteDriver* pNoteDriver =
- m_pNormalWidget->GetOwnerApp()->GetNoteDriver();
- pNoteDriver->RegisterEventTarget(m_pNormalWidget.get(),
- m_pNormalWidget.get());
- m_pOldDelegate = m_pNormalWidget->GetDelegate();
- m_pNormalWidget->SetDelegate(this);
- m_pNormalWidget->LockUpdate();
-
- CFX_WideString wsText;
- m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
- pWidget->SetText(wsText);
- UpdateWidgetProperty();
- m_pNormalWidget->UnlockUpdate();
- return CXFA_FFField::LoadWidget();
-}
-
-void CXFA_FFNumericEdit::UpdateWidgetProperty() {
- CFWL_Edit* pWidget = static_cast<CFWL_Edit*>(m_pNormalWidget.get());
- if (!pWidget)
- return;
-
- uint32_t dwExtendedStyle =
- FWL_STYLEEXT_EDT_ShowScrollbarFocus | FWL_STYLEEXT_EDT_OuterScrollbar |
- FWL_STYLEEXT_EDT_Validate | FWL_STYLEEXT_EDT_Number |
- FWL_STYLEEXT_EDT_LastLineHeight;
- dwExtendedStyle |= UpdateUIProperty();
- if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off)
- dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
-
- int32_t iNumCells = m_pDataAcc->GetNumberOfCells();
- if (iNumCells > 0) {
- dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText;
- pWidget->SetLimit(iNumCells);
- }
- dwExtendedStyle |= GetAlignment();
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
- !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
- dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
- }
- m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
-}
-
-void CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) {
- if (pEvent->GetType() == CFWL_Event::Type::Validate) {
- CFWL_EventValidate* event = static_cast<CFWL_EventValidate*>(pEvent);
- event->bValidate = OnValidate(m_pNormalWidget.get(), event->wsInsert);
- return;
- }
- CXFA_FFTextEdit::OnProcessEvent(pEvent);
-}
-
-bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget,
- CFX_WideString& wsText) {
- CFX_WideString wsPattern;
- m_pDataAcc->GetPictureContent(wsPattern, XFA_VALUEPICTURE_Edit);
- if (!wsPattern.IsEmpty())
- return true;
-
- int32_t iLeads = 0;
- m_pDataAcc->GetLeadDigits(iLeads);
-
- int32_t iFracs = 0;
- m_pDataAcc->GetFracDigits(iFracs);
-
- CFX_WideString wsFormat;
- CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(m_pDataAcc.Get());
- widgetValue.GetNumbericFormat(wsFormat, iLeads, iFracs);
- return widgetValue.ValidateNumericTemp(wsText, wsFormat,
- m_pDataAcc->GetLocal());
-}
-
-CXFA_FFPasswordEdit::CXFA_FFPasswordEdit(CXFA_WidgetAcc* pDataAcc)
- : CXFA_FFTextEdit(pDataAcc) {}
-
-CXFA_FFPasswordEdit::~CXFA_FFPasswordEdit() {}
-
-bool CXFA_FFPasswordEdit::LoadWidget() {
- auto pNewEdit = pdfium::MakeUnique<CFWL_Edit>(
- GetFWLApp(), pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr);
- CFWL_Edit* pWidget = pNewEdit.get();
- m_pNormalWidget = std::move(pNewEdit);
- m_pNormalWidget->SetLayoutItem(this);
-
- CFWL_NoteDriver* pNoteDriver =
- m_pNormalWidget->GetOwnerApp()->GetNoteDriver();
- pNoteDriver->RegisterEventTarget(m_pNormalWidget.get(),
- m_pNormalWidget.get());
- m_pOldDelegate = m_pNormalWidget->GetDelegate();
- m_pNormalWidget->SetDelegate(this);
- m_pNormalWidget->LockUpdate();
-
- CFX_WideString wsText;
- m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
- pWidget->SetText(wsText);
- UpdateWidgetProperty();
- m_pNormalWidget->UnlockUpdate();
- return CXFA_FFField::LoadWidget();
-}
-
-void CXFA_FFPasswordEdit::UpdateWidgetProperty() {
- CFWL_Edit* pWidget = static_cast<CFWL_Edit*>(m_pNormalWidget.get());
- if (!pWidget)
- return;
-
- uint32_t dwExtendedStyle =
- FWL_STYLEEXT_EDT_ShowScrollbarFocus | FWL_STYLEEXT_EDT_OuterScrollbar |
- FWL_STYLEEXT_EDT_Password | FWL_STYLEEXT_EDT_LastLineHeight;
- dwExtendedStyle |= UpdateUIProperty();
-
- CFX_WideString wsPassWord;
- m_pDataAcc->GetPasswordChar(wsPassWord);
- if (!wsPassWord.IsEmpty())
- pWidget->SetAliasChar(wsPassWord.GetAt(0));
- if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off)
- dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
- !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
- dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
- }
- dwExtendedStyle |= GetAlignment();
- m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
-}
-
-CXFA_FFDateTimeEdit::CXFA_FFDateTimeEdit(CXFA_WidgetAcc* pDataAcc)
- : CXFA_FFTextEdit(pDataAcc) {}
-
-CXFA_FFDateTimeEdit::~CXFA_FFDateTimeEdit() {}
-
-CFX_RectF CXFA_FFDateTimeEdit::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
- if (bDrawFocus)
- return CFX_RectF();
- return CXFA_FFWidget::GetBBox(dwStatus);
-}
-
-bool CXFA_FFDateTimeEdit::PtInActiveRect(const CFX_PointF& point) {
- auto* pPicker = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get());
- return pPicker && pPicker->GetBBox().Contains(point);
-}
-
-bool CXFA_FFDateTimeEdit::LoadWidget() {
- auto pNewPicker = pdfium::MakeUnique<CFWL_DateTimePicker>(GetFWLApp());
- CFWL_DateTimePicker* pWidget = pNewPicker.get();
- m_pNormalWidget = std::move(pNewPicker);
- m_pNormalWidget->SetLayoutItem(this);
-
- CFWL_NoteDriver* pNoteDriver =
- m_pNormalWidget->GetOwnerApp()->GetNoteDriver();
- pNoteDriver->RegisterEventTarget(m_pNormalWidget.get(),
- m_pNormalWidget.get());
- m_pOldDelegate = m_pNormalWidget->GetDelegate();
- m_pNormalWidget->SetDelegate(this);
- m_pNormalWidget->LockUpdate();
-
- CFX_WideString wsText;
- m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
- pWidget->SetEditText(wsText);
- if (CXFA_Value value = m_pDataAcc->GetFormValue()) {
- switch (value.GetChildValueClassID()) {
- case XFA_Element::Date: {
- if (!wsText.IsEmpty()) {
- CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc.Get());
- CFX_DateTime date = lcValue.GetDate();
- if (date.IsSet())
- pWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay());
- }
- } break;
- default:
- break;
- }
- }
- UpdateWidgetProperty();
- m_pNormalWidget->UnlockUpdate();
- return CXFA_FFField::LoadWidget();
-}
-
-void CXFA_FFDateTimeEdit::UpdateWidgetProperty() {
- CFWL_DateTimePicker* pWidget =
- static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get());
- if (!pWidget)
- return;
-
- uint32_t dwExtendedStyle = FWL_STYLEEXT_DTP_ShortDateFormat;
- dwExtendedStyle |= UpdateUIProperty();
- dwExtendedStyle |= GetAlignment();
- m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
- uint32_t dwEditStyles = FWL_STYLEEXT_EDT_LastLineHeight;
- int32_t iNumCells = m_pDataAcc->GetNumberOfCells();
- if (iNumCells > 0) {
- dwEditStyles |= FWL_STYLEEXT_EDT_CombText;
- pWidget->SetEditLimit(iNumCells);
- }
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
- !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
- dwEditStyles |= FWL_STYLEEXT_EDT_ReadOnly;
- }
- if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off)
- dwEditStyles |= FWL_STYLEEXT_EDT_AutoHScroll;
-
- pWidget->ModifyEditStylesEx(dwEditStyles, 0xFFFFFFFF);
-}
-
-uint32_t CXFA_FFDateTimeEdit::GetAlignment() {
- CXFA_Para para = m_pDataAcc->GetPara();
- if (!para)
- return 0;
-
- uint32_t dwExtendedStyle = 0;
- switch (para.GetHorizontalAlign()) {
- case XFA_ATTRIBUTEENUM_Center:
- dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHCenter;
- break;
- case XFA_ATTRIBUTEENUM_Justify:
- dwExtendedStyle |= FWL_STYLEEXT_DTP_EditJustified;
- break;
- case XFA_ATTRIBUTEENUM_JustifyAll:
- case XFA_ATTRIBUTEENUM_Radix:
- break;
- case XFA_ATTRIBUTEENUM_Right:
- dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHFar;
- break;
- default:
- dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHNear;
- break;
- }
-
- switch (para.GetVerticalAlign()) {
- case XFA_ATTRIBUTEENUM_Middle:
- dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVCenter;
- break;
- case XFA_ATTRIBUTEENUM_Bottom:
- dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVFar;
- break;
- default:
- dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVNear;
- break;
- }
- return dwExtendedStyle;
-}
-
-bool CXFA_FFDateTimeEdit::CommitData() {
- auto* pPicker = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get());
- if (!m_pDataAcc->SetValue(pPicker->GetEditText(), XFA_VALUEPICTURE_Edit))
- return false;
-
- m_pDataAcc->UpdateUIDisplay(this);
- return true;
-}
-
-bool CXFA_FFDateTimeEdit::UpdateFWLData() {
- if (!m_pNormalWidget)
- return false;
-
- XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display;
- if (IsFocused())
- eType = XFA_VALUEPICTURE_Edit;
-
- CFX_WideString wsText;
- m_pDataAcc->GetValue(wsText, eType);
-
- auto* normalWidget = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get());
- normalWidget->SetEditText(wsText);
- if (IsFocused() && !wsText.IsEmpty()) {
- CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc.Get());
- CFX_DateTime date = lcValue.GetDate();
- if (lcValue.IsValid()) {
- if (date.IsSet())
- normalWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay());
- }
- }
- m_pNormalWidget->Update();
- return true;
-}
-
-bool CXFA_FFDateTimeEdit::IsDataChanged() {
- if (m_dwStatus & XFA_WidgetStatus_TextEditValueChanged)
- return true;
-
- CFX_WideString wsText =
- static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get())->GetEditText();
- CFX_WideString wsOldValue;
- m_pDataAcc->GetValue(wsOldValue, XFA_VALUEPICTURE_Edit);
- return wsOldValue != wsText;
-}
-
-void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget,
- int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
- CFX_WideString wsPicture;
- m_pDataAcc->GetPictureContent(wsPicture, XFA_VALUEPICTURE_Edit);
-
- CXFA_LocaleValue date(XFA_VT_DATE, GetDoc()->GetXFADoc()->GetLocalMgr());
- date.SetDate(CFX_DateTime(iYear, iMonth, iDay, 0, 0, 0, 0));
-
- CFX_WideString wsDate;
- date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(),
- XFA_VALUEPICTURE_Edit);
-
- auto* pDateTime = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get());
- pDateTime->SetEditText(wsDate);
- pDateTime->Update();
- GetDoc()->GetDocEnvironment()->SetFocusWidget(GetDoc(), nullptr);
-
- CXFA_EventParam eParam;
- eParam.m_eType = XFA_EVENT_Change;
- eParam.m_pTarget = m_pDataAcc.Get();
- m_pDataAcc->GetValue(eParam.m_wsNewText, XFA_VALUEPICTURE_Raw);
- m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
-}
-
-void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) {
- if (pEvent->GetType() == CFWL_Event::Type::SelectChanged) {
- auto* event = static_cast<CFWL_EventSelectChanged*>(pEvent);
- OnSelectChanged(m_pNormalWidget.get(), event->iYear, event->iMonth,
- event->iDay);
- return;
- }
- CXFA_FFTextEdit::OnProcessEvent(pEvent);
-}
diff --git a/xfa/fxfa/app/xfa_fftextedit.h b/xfa/fxfa/app/xfa_fftextedit.h
deleted file mode 100644
index 9b9324f..0000000
--- a/xfa/fxfa/app/xfa_fftextedit.h
+++ /dev/null
@@ -1,105 +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_FXFA_APP_XFA_FFTEXTEDIT_H_
-#define XFA_FXFA_APP_XFA_FFTEXTEDIT_H_
-
-#include <vector>
-
-#include "xfa/fxfa/app/xfa_fffield.h"
-
-class CXFA_FFTextEdit : public CXFA_FFField {
- public:
- explicit CXFA_FFTextEdit(CXFA_WidgetAcc* pDataAcc);
- ~CXFA_FFTextEdit() override;
-
- // CXFA_FFField
- bool LoadWidget() override;
- void UpdateWidgetProperty() override;
- bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
- bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
- bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override;
- bool OnSetFocus(CXFA_FFWidget* pOldWidget) override;
- bool OnKillFocus(CXFA_FFWidget* pNewWidget) override;
- void OnProcessMessage(CFWL_Message* pMessage) override;
- void OnProcessEvent(CFWL_Event* pEvent) override;
- void OnDrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = nullptr) override;
-
- void OnTextChanged(CFWL_Widget* pWidget,
- const CFX_WideString& wsChanged,
- const CFX_WideString& wsPrevText);
- void OnTextFull(CFWL_Widget* pWidget);
- bool CheckWord(const CFX_ByteStringC& sWord);
-
- protected:
- uint32_t GetAlignment();
-
- IFWL_WidgetDelegate* m_pOldDelegate;
-
- private:
- bool CommitData() override;
- bool UpdateFWLData() override;
- bool IsDataChanged() override;
- void ValidateNumberField(const CFX_WideString& wsText);
-};
-
-class CXFA_FFNumericEdit : public CXFA_FFTextEdit {
- public:
- explicit CXFA_FFNumericEdit(CXFA_WidgetAcc* pDataAcc);
- ~CXFA_FFNumericEdit() override;
-
- // CXFA_FFTextEdit
- bool LoadWidget() override;
- void UpdateWidgetProperty() override;
- void OnProcessEvent(CFWL_Event* pEvent) override;
-
- private:
- bool OnValidate(CFWL_Widget* pWidget, CFX_WideString& wsText);
-};
-
-class CXFA_FFPasswordEdit : public CXFA_FFTextEdit {
- public:
- explicit CXFA_FFPasswordEdit(CXFA_WidgetAcc* pDataAcc);
- ~CXFA_FFPasswordEdit() override;
-
- // CXFA_FFTextEdit
- bool LoadWidget() override;
- void UpdateWidgetProperty() override;
-};
-
-enum XFA_DATETIMETYPE {
- XFA_DATETIMETYPE_Date = 0,
- XFA_DATETIMETYPE_Time,
- XFA_DATETIMETYPE_DateAndTime
-};
-
-class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit {
- public:
- explicit CXFA_FFDateTimeEdit(CXFA_WidgetAcc* pDataAcc);
- ~CXFA_FFDateTimeEdit() override;
-
- // CXFA_FFTextEdit
- CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false) override;
- bool LoadWidget() override;
- void UpdateWidgetProperty() override;
- void OnProcessEvent(CFWL_Event* pEvent) override;
-
- void OnSelectChanged(CFWL_Widget* pWidget,
- int32_t iYear,
- int32_t iMonth,
- int32_t iDay);
-
- private:
- bool PtInActiveRect(const CFX_PointF& point) override;
- bool CommitData() override;
- bool UpdateFWLData() override;
- bool IsDataChanged() override;
-
- uint32_t GetAlignment();
-};
-
-#endif // XFA_FXFA_APP_XFA_FFTEXTEDIT_H_
diff --git a/xfa/fxfa/cxfa_ffapp.cpp b/xfa/fxfa/cxfa_ffapp.cpp
index 7b97116..cb308f2 100644
--- a/xfa/fxfa/cxfa_ffapp.cpp
+++ b/xfa/fxfa/cxfa_ffapp.cpp
@@ -16,8 +16,8 @@
#include "xfa/fgas/font/cfgas_fontmgr.h"
#include "xfa/fwl/cfwl_notedriver.h"
#include "xfa/fwl/cfwl_widgetmgr.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
-#include "xfa/fxfa/app/xfa_fwltheme.h"
+#include "xfa/fxfa/app/cxfa_fwladapterwidgetmgr.h"
+#include "xfa/fxfa/app/cxfa_fwltheme.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffdochandler.h"
#include "xfa/fxfa/cxfa_ffwidgethandler.h"
diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp
index bde40ce..01c570a 100644
--- a/xfa/fxfa/cxfa_ffdoc.cpp
+++ b/xfa/fxfa/cxfa_ffdoc.cpp
@@ -22,7 +22,7 @@
#include "core/fxcrt/xml/cfx_xmlnode.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fwl/cfwl_notedriver.h"
-#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/app/cxfa_ffnotify.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index d9c97f7..620f3da 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -9,22 +9,19 @@
#include "core/fxcrt/fx_extension.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fxfa/app/xfa_ffbarcode.h"
-#include "xfa/fxfa/app/xfa_ffcheckbutton.h"
-#include "xfa/fxfa/app/xfa_ffchoicelist.h"
-#include "xfa/fxfa/app/xfa_ffdraw.h"
-#include "xfa/fxfa/app/xfa_ffexclgroup.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/app/xfa_ffimage.h"
-#include "xfa/fxfa/app/xfa_ffimageedit.h"
-#include "xfa/fxfa/app/xfa_ffpath.h"
-#include "xfa/fxfa/app/xfa_ffpushbutton.h"
-#include "xfa/fxfa/app/xfa_ffsignature.h"
-#include "xfa/fxfa/app/xfa_ffsubform.h"
-#include "xfa/fxfa/app/xfa_fftext.h"
-#include "xfa/fxfa/app/xfa_fftextedit.h"
-#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
+#include "xfa/fxfa/app/cxfa_ffbarcode.h"
+#include "xfa/fxfa/app/cxfa_ffcheckbutton.h"
+#include "xfa/fxfa/app/cxfa_ffdraw.h"
+#include "xfa/fxfa/app/cxfa_ffexclgroup.h"
+#include "xfa/fxfa/app/cxfa_fffield.h"
+#include "xfa/fxfa/app/cxfa_ffimage.h"
+#include "xfa/fxfa/app/cxfa_ffimageedit.h"
+#include "xfa/fxfa/app/cxfa_ffpushbutton.h"
+#include "xfa/fxfa/app/cxfa_ffsignature.h"
+#include "xfa/fxfa/app/cxfa_ffsubform.h"
+#include "xfa/fxfa/app/cxfa_fftext.h"
+#include "xfa/fxfa/app/cxfa_fwladapterwidgetmgr.h"
+#include "xfa/fxfa/app/cxfa_textprovider.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
diff --git a/xfa/fxfa/cxfa_ffpageview.cpp b/xfa/fxfa/cxfa_ffpageview.cpp
index c83ffae..8413186 100644
--- a/xfa/fxfa/cxfa_ffpageview.cpp
+++ b/xfa/fxfa/cxfa_ffpageview.cpp
@@ -13,13 +13,11 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_rendercontext.h"
-#include "xfa/fxfa/app/xfa_ffcheckbutton.h"
-#include "xfa/fxfa/app/xfa_ffchoicelist.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/app/xfa_ffimageedit.h"
-#include "xfa/fxfa/app/xfa_ffpushbutton.h"
-#include "xfa/fxfa/app/xfa_fftextedit.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
+#include "xfa/fxfa/app/cxfa_ffcheckbutton.h"
+#include "xfa/fxfa/app/cxfa_fffield.h"
+#include "xfa/fxfa/app/cxfa_ffimageedit.h"
+#include "xfa/fxfa/app/cxfa_ffpushbutton.h"
+#include "xfa/fxfa/app/cxfa_fwladapterwidgetmgr.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp
index 6fe24fe..680a00a 100644
--- a/xfa/fxfa/cxfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp
@@ -8,9 +8,8 @@
#include <vector>
-#include "xfa/fxfa/app/xfa_ffchoicelist.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
+#include "xfa/fxfa/app/cxfa_fffield.h"
+#include "xfa/fxfa/app/cxfa_fwladapterwidgetmgr.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index 9b52f95..d4a6125 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -14,7 +14,7 @@
#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_textout.h"
#include "xfa/fxfa/app/cxfa_textlayout.h"
-#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
+#include "xfa/fxfa/app/cxfa_textprovider.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
index 4b3b5e2..c6d5369 100644
--- a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
@@ -17,7 +17,7 @@
#include "fxjs/cfxjse_value.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/app/cxfa_ffnotify.h"
#include "xfa/fxfa/fm2js/cxfa_fmparse.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_localevalue.h"
diff --git a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp
index c57b0bd..ede5987 100644
--- a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp
@@ -7,7 +7,7 @@
#include "xfa/fxfa/parser/cscript_eventpseudomodel.h"
#include "fxjs/cfxjse_arguments.h"
-#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/app/cxfa_ffnotify.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/cxfa_ffwidgethandler.h"
#include "xfa/fxfa/parser/cxfa_document.h"
diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
index d2633ec..b229b23 100644
--- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
@@ -9,7 +9,7 @@
#include <memory>
#include "fxjs/cfxjse_arguments.h"
-#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/app/cxfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_localemgr.h"
diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
index 6e6a108..130c9f0 100644
--- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
@@ -10,7 +10,7 @@
#include "fxjs/cfxjse_arguments.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/app/cxfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_arraynodelist.h"
#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
diff --git a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp
index 0886809..023d3e5 100644
--- a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp
@@ -7,7 +7,7 @@
#include "xfa/fxfa/parser/cscript_signaturepseudomodel.h"
#include "fxjs/cfxjse_arguments.h"
-#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/app/cxfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index a1180e7..ec80866 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -7,7 +7,7 @@
#include "xfa/fxfa/parser/cxfa_document.h"
#include "core/fxcrt/fx_extension.h"
-#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/app/cxfa_ffnotify.h"
#include "xfa/fxfa/parser/cscript_datawindow.h"
#include "xfa/fxfa/parser/cscript_eventpseudomodel.h"
#include "xfa/fxfa/parser/cscript_hostpseudomodel.h"
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index b2e4e72..b6e6e7f 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -14,7 +14,7 @@
#include "third_party/base/logging.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/app/cxfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_document.h"
diff --git a/xfa/fxfa/parser/cxfa_layoutitem.cpp b/xfa/fxfa/parser/cxfa_layoutitem.cpp
index 2bac795..a769da0 100644
--- a/xfa/fxfa/parser/cxfa_layoutitem.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutitem.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_layoutitem.h"
-#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/app/cxfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index 5c94a6a..0bf091e 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -7,7 +7,7 @@
#include "xfa/fxfa/parser/cxfa_layoutpagemgr.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/app/cxfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_document.h"
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 2daa49e..845d3f3 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -23,7 +23,7 @@
#include "third_party/base/logging.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/app/cxfa_ffnotify.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxfa/parser/cxfa_arraynodelist.h"
diff --git a/xfa/fxfa/parser/cxfa_object.cpp b/xfa/fxfa/parser/cxfa_object.cpp
index bd7daec..8dd35cd 100644
--- a/xfa/fxfa/parser/cxfa_object.cpp
+++ b/xfa/fxfa/parser/cxfa_object.cpp
@@ -8,7 +8,7 @@
#include "core/fxcrt/fx_extension.h"
#include "fxjs/cfxjse_value.h"
-#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/app/cxfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_nodelist.h"
diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
index 49da63e..2100299 100644
--- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp
+++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
@@ -14,7 +14,7 @@
#include "fxjs/cfxjse_value.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/app/cxfa_ffnotify.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_localemgr.h"
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index bf9afc0..cd4aa57 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -10,7 +10,7 @@
#include "core/fxcrt/fx_extension.h"
#include "fxbarcode/BC_Library.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/app/cxfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_event.h"
#include "xfa/fxfa/parser/cxfa_localevalue.h"