Rename CPDFSDK_BFAnnotHandler and CPDFSDK_XFAAnnotHandler.
CPDFSDK_BFAnnotHandler handles CPDFSDK_Widget, so rename it to
CPDFSDK_WidgetHandler. Similarly, CPDFSDK_XFAAnnotHandler handles
CPDFSDK_XFAWidget, so rename it to CPDFSDK_XFAWidgetHandler.
Review-Url: https://codereview.chromium.org/2298443002
diff --git a/BUILD.gn b/BUILD.gn
index 68c0950..ad7b5d1 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -70,10 +70,10 @@
"fpdfsdk/cpdfsdk_annotiterator.cpp",
"fpdfsdk/cpdfsdk_baannot.cpp",
"fpdfsdk/cpdfsdk_baannothandler.cpp",
- "fpdfsdk/cpdfsdk_bfannothandler.cpp",
"fpdfsdk/cpdfsdk_datetime.cpp",
"fpdfsdk/cpdfsdk_interform.cpp",
"fpdfsdk/cpdfsdk_widget.cpp",
+ "fpdfsdk/cpdfsdk_widgethandler.cpp",
"fpdfsdk/fpdf_dataavail.cpp",
"fpdfsdk/fpdf_ext.cpp",
"fpdfsdk/fpdf_flatten.cpp",
@@ -98,10 +98,10 @@
"fpdfsdk/include/cpdfsdk_annotiterator.h",
"fpdfsdk/include/cpdfsdk_baannot.h",
"fpdfsdk/include/cpdfsdk_baannothandler.h",
- "fpdfsdk/include/cpdfsdk_bfannothandler.h",
"fpdfsdk/include/cpdfsdk_datetime.h",
"fpdfsdk/include/cpdfsdk_interform.h",
"fpdfsdk/include/cpdfsdk_widget.h",
+ "fpdfsdk/include/cpdfsdk_widgethandler.h",
"fpdfsdk/include/fsdk_actionhandler.h",
"fpdfsdk/include/fsdk_pauseadapter.h",
"fpdfsdk/include/pdfsdk_fieldaction.h",
@@ -144,10 +144,10 @@
if (pdf_enable_xfa) {
sources += [
- "fpdfsdk/cpdfsdk_xfaannothandler.cpp",
"fpdfsdk/cpdfsdk_xfawidget.cpp",
- "fpdfsdk/include/cpdfsdk_xfaannothandler.h",
+ "fpdfsdk/cpdfsdk_xfawidgethandler.cpp",
"fpdfsdk/include/cpdfsdk_xfawidget.h",
+ "fpdfsdk/include/cpdfsdk_xfawidgethandler.h",
]
deps += [ ":fpdfxfa" ]
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
index 33c1ca9..9f5a545 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -11,12 +11,12 @@
#include "fpdfsdk/include/cpdfsdk_annot.h"
#include "fpdfsdk/include/cpdfsdk_baannot.h"
#include "fpdfsdk/include/cpdfsdk_baannothandler.h"
-#include "fpdfsdk/include/cpdfsdk_bfannothandler.h"
#include "fpdfsdk/include/cpdfsdk_datetime.h"
+#include "fpdfsdk/include/cpdfsdk_widgethandler.h"
#include "fpdfsdk/include/fsdk_mgr.h"
#ifdef PDF_ENABLE_XFA
-#include "fpdfsdk/include/cpdfsdk_xfaannothandler.h"
+#include "fpdfsdk/include/cpdfsdk_xfawidgethandler.h"
#include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h"
#include "xfa/fxfa/include/xfa_ffpageview.h"
#include "xfa/fxfa/include/xfa_ffwidget.h"
@@ -24,12 +24,12 @@
CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp)
: m_pBAAnnotHandler(new CPDFSDK_BAAnnotHandler()),
- m_pBFAnnotHandler(new CPDFSDK_BFAnnotHandler(pApp)),
+ m_pWidgetHandler(new CPDFSDK_WidgetHandler(pApp)),
#ifdef PDF_ENABLE_XFA
- m_pXFAAnnotHandler(new CPDFSDK_XFAAnnotHandler(pApp)),
+ m_pXFAWidgetHandler(new CPDFSDK_XFAWidgetHandler(pApp)),
#endif // PDF_ENABLE_XFA
m_pApp(pApp) {
- m_pBFAnnotHandler->SetFormFiller(m_pApp->GetIFormFiller());
+ m_pWidgetHandler->SetFormFiller(m_pApp->GetIFormFiller());
}
CPDFSDK_AnnotHandlerMgr::~CPDFSDK_AnnotHandlerMgr() {}
@@ -79,11 +79,11 @@
IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(
const CFX_ByteString& sType) const {
if (sType == "Widget")
- return m_pBFAnnotHandler.get();
+ return m_pWidgetHandler.get();
#ifdef PDF_ENABLE_XFA
if (sType == FSDK_XFAWIDGET_TYPENAME)
- return m_pXFAAnnotHandler.get();
+ return m_pXFAWidgetHandler.get();
#endif // PDF_ENABLE_XFA
return m_pBAAnnotHandler.get();
diff --git a/fpdfsdk/cpdfsdk_bfannothandler.cpp b/fpdfsdk/cpdfsdk_bfannothandler.cpp
deleted file mode 100644
index ff0c264..0000000
--- a/fpdfsdk/cpdfsdk_bfannothandler.cpp
+++ /dev/null
@@ -1,311 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "fpdfsdk/include/cpdfsdk_bfannothandler.h"
-
-#include <memory>
-#include <vector>
-
-#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
-#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
-#include "core/fpdfdoc/include/cpdf_interform.h"
-#include "fpdfsdk/formfiller/cffl_formfiller.h"
-#include "fpdfsdk/include/cpdfsdk_annot.h"
-#include "fpdfsdk/include/cpdfsdk_interform.h"
-#include "fpdfsdk/include/cpdfsdk_widget.h"
-#include "fpdfsdk/include/fsdk_mgr.h"
-
-#ifdef PDF_ENABLE_XFA
-#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h"
-#endif // PDF_ENABLE_XFA
-
-CPDFSDK_BFAnnotHandler::CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp)
- : m_pApp(pApp), m_pFormFiller(nullptr) {}
-
-CPDFSDK_BFAnnotHandler::~CPDFSDK_BFAnnotHandler() {}
-
-CFX_ByteString CPDFSDK_BFAnnotHandler::GetType() {
- return CFX_ByteString("Widget");
-}
-
-FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) {
- ASSERT(pAnnot->GetAnnotSubtype() == "Widget");
- if (pAnnot->IsSignatureWidget())
- return FALSE;
-
- CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot);
- if (!pWidget->IsVisible())
- return FALSE;
-
- int nFieldFlags = pWidget->GetFieldFlags();
- if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY)
- return FALSE;
-
- if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON)
- return TRUE;
-
- CPDF_Page* pPage = pWidget->GetPDFPage();
- CPDF_Document* pDocument = pPage->m_pDocument;
- uint32_t dwPermissions = pDocument->GetUserPermissions();
- return (dwPermissions & FPDFPERM_FILL_FORM) ||
- (dwPermissions & FPDFPERM_ANNOT_FORM);
-}
-
-CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot,
- CPDFSDK_PageView* pPage) {
- CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument();
- CPDFSDK_InterForm* pInterForm = pSDKDoc->GetInterForm();
- CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl(
- pInterForm->GetInterForm(), pAnnot->GetAnnotDict());
- if (!pCtrl)
- return nullptr;
-
- CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm);
- pInterForm->AddMap(pCtrl, pWidget);
- CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm();
- if (pPDFInterForm && pPDFInterForm->NeedConstructAP())
- pWidget->ResetAppearance(nullptr, FALSE);
-
- return pWidget;
-}
-
-#ifdef PDF_ENABLE_XFA
-CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CXFA_FFWidget* hWidget,
- CPDFSDK_PageView* pPage) {
- return nullptr;
-}
-#endif // PDF_ENABLE_XFA
-
-void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
- ASSERT(pAnnot);
-
- if (m_pFormFiller)
- m_pFormFiller->OnDelete(pAnnot);
-
- std::unique_ptr<CPDFSDK_Widget> pWidget(static_cast<CPDFSDK_Widget*>(pAnnot));
- CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm();
- CPDF_FormControl* pControl = pWidget->GetFormControl();
- pInterForm->RemoveMap(pControl);
-}
-
-void CPDFSDK_BFAnnotHandler::DeleteAnnot(CPDFSDK_Annot* pAnnot) {}
-
-void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
- uint32_t dwFlags) {
- if (pAnnot->IsSignatureWidget()) {
- static_cast<CPDFSDK_BAAnnot*>(pAnnot)->DrawAppearance(
- pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
- } else {
- if (m_pFormFiller)
- m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
- }
-}
-
-void CPDFSDK_BFAnnotHandler::OnDrawSleep(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
- const CFX_FloatRect& rcWindow,
- uint32_t dwFlags) {}
-
-void CPDFSDK_BFAnnotHandler::OnDelete(CPDFSDK_Annot* pAnnot) {}
-
-void CPDFSDK_BFAnnotHandler::OnRelease(CPDFSDK_Annot* pAnnot) {}
-
-void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlag) {
- if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
- m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag);
-}
-
-void CPDFSDK_BFAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlag) {
- if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
- m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag);
-}
-
-FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
- if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
- return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point);
-
- return FALSE;
-}
-
-FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
- if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
- return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point);
-
- return FALSE;
-}
-
-FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
- if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
- return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
-
- return FALSE;
-}
-
-FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
- if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
- return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point);
-
- return FALSE;
-}
-
-FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- short zDelta,
- const CFX_FloatPoint& point) {
- if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
- return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta,
- point);
-
- return FALSE;
-}
-
-FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
- if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
- return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point);
-
- return FALSE;
-}
-
-FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
- if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
- return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point);
-
- return FALSE;
-}
-
-FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
- return FALSE;
-}
-
-FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot,
- uint32_t nChar,
- uint32_t nFlags) {
- if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
- return m_pFormFiller->OnChar(pAnnot, nChar, nFlags);
-
- return FALSE;
-}
-
-FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot,
- int nKeyCode,
- int nFlag) {
- if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
- return m_pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlag);
-
- return FALSE;
-}
-
-FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot,
- int nKeyCode,
- int nFlag) {
- return FALSE;
-}
-
-void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) {
- if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
- m_pFormFiller->OnCreate(pAnnot);
-}
-
-void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) {
- if (pAnnot->IsSignatureWidget())
- return;
-
- CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot);
- if (!pWidget->IsAppearanceValid())
- pWidget->ResetAppearance(nullptr, FALSE);
-
- int nFieldType = pWidget->GetFieldType();
- if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) {
- FX_BOOL bFormated = FALSE;
- CFX_WideString sValue = pWidget->OnFormat(bFormated);
- if (bFormated && nFieldType == FIELDTYPE_COMBOBOX)
- pWidget->ResetAppearance(sValue.c_str(), FALSE);
- }
-
-#ifdef PDF_ENABLE_XFA
- CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
- CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument();
- CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
- if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
- if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty())
- pWidget->ResetAppearance(FALSE);
- }
-#endif // PDF_ENABLE_XFA
- if (m_pFormFiller)
- m_pFormFiller->OnLoad(pAnnot);
-}
-
-FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot,
- uint32_t nFlag) {
- if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
- return m_pFormFiller->OnSetFocus(pAnnot, nFlag);
-
- return TRUE;
-}
-
-FX_BOOL CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot,
- uint32_t nFlag) {
- if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
- return m_pFormFiller->OnKillFocus(pAnnot, nFlag);
-
- return TRUE;
-}
-
-#ifdef PDF_ENABLE_XFA
-FX_BOOL CPDFSDK_BFAnnotHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot,
- CPDFSDK_Annot* pNewAnnot) {
- return TRUE;
-}
-#endif // PDF_ENABLE_XFA
-
-CFX_FloatRect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot) {
- if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
- return CFX_FloatRect(m_pFormFiller->GetViewBBox(pPageView, pAnnot));
-
- return CFX_FloatRect(0, 0, 0, 0);
-}
-
-FX_BOOL CPDFSDK_BFAnnotHandler::HitTest(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- const CFX_FloatPoint& point) {
- ASSERT(pPageView);
- ASSERT(pAnnot);
-
- CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot);
- return rect.Contains(point.x, point.y);
-}
diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp
new file mode 100644
index 0000000..0fb64df
--- /dev/null
+++ b/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -0,0 +1,311 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "fpdfsdk/include/cpdfsdk_widgethandler.h"
+
+#include <memory>
+#include <vector>
+
+#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
+#include "core/fpdfdoc/include/cpdf_interform.h"
+#include "fpdfsdk/formfiller/cffl_formfiller.h"
+#include "fpdfsdk/include/cpdfsdk_annot.h"
+#include "fpdfsdk/include/cpdfsdk_interform.h"
+#include "fpdfsdk/include/cpdfsdk_widget.h"
+#include "fpdfsdk/include/fsdk_mgr.h"
+
+#ifdef PDF_ENABLE_XFA
+#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h"
+#endif // PDF_ENABLE_XFA
+
+CPDFSDK_WidgetHandler::CPDFSDK_WidgetHandler(CPDFDoc_Environment* pApp)
+ : m_pApp(pApp), m_pFormFiller(nullptr) {}
+
+CPDFSDK_WidgetHandler::~CPDFSDK_WidgetHandler() {}
+
+CFX_ByteString CPDFSDK_WidgetHandler::GetType() {
+ return CFX_ByteString("Widget");
+}
+
+FX_BOOL CPDFSDK_WidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) {
+ ASSERT(pAnnot->GetAnnotSubtype() == "Widget");
+ if (pAnnot->IsSignatureWidget())
+ return FALSE;
+
+ CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot);
+ if (!pWidget->IsVisible())
+ return FALSE;
+
+ int nFieldFlags = pWidget->GetFieldFlags();
+ if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY)
+ return FALSE;
+
+ if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON)
+ return TRUE;
+
+ CPDF_Page* pPage = pWidget->GetPDFPage();
+ CPDF_Document* pDocument = pPage->m_pDocument;
+ uint32_t dwPermissions = pDocument->GetUserPermissions();
+ return (dwPermissions & FPDFPERM_FILL_FORM) ||
+ (dwPermissions & FPDFPERM_ANNOT_FORM);
+}
+
+CPDFSDK_Annot* CPDFSDK_WidgetHandler::NewAnnot(CPDF_Annot* pAnnot,
+ CPDFSDK_PageView* pPage) {
+ CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument();
+ CPDFSDK_InterForm* pInterForm = pSDKDoc->GetInterForm();
+ CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl(
+ pInterForm->GetInterForm(), pAnnot->GetAnnotDict());
+ if (!pCtrl)
+ return nullptr;
+
+ CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm);
+ pInterForm->AddMap(pCtrl, pWidget);
+ CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm();
+ if (pPDFInterForm && pPDFInterForm->NeedConstructAP())
+ pWidget->ResetAppearance(nullptr, FALSE);
+
+ return pWidget;
+}
+
+#ifdef PDF_ENABLE_XFA
+CPDFSDK_Annot* CPDFSDK_WidgetHandler::NewAnnot(CXFA_FFWidget* hWidget,
+ CPDFSDK_PageView* pPage) {
+ return nullptr;
+}
+#endif // PDF_ENABLE_XFA
+
+void CPDFSDK_WidgetHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
+ ASSERT(pAnnot);
+
+ if (m_pFormFiller)
+ m_pFormFiller->OnDelete(pAnnot);
+
+ std::unique_ptr<CPDFSDK_Widget> pWidget(static_cast<CPDFSDK_Widget*>(pAnnot));
+ CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm();
+ CPDF_FormControl* pControl = pWidget->GetFormControl();
+ pInterForm->RemoveMap(pControl);
+}
+
+void CPDFSDK_WidgetHandler::DeleteAnnot(CPDFSDK_Annot* pAnnot) {}
+
+void CPDFSDK_WidgetHandler::OnDraw(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device,
+ uint32_t dwFlags) {
+ if (pAnnot->IsSignatureWidget()) {
+ static_cast<CPDFSDK_BAAnnot*>(pAnnot)->DrawAppearance(
+ pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
+ } else {
+ if (m_pFormFiller)
+ m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
+ }
+}
+
+void CPDFSDK_WidgetHandler::OnDrawSleep(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device,
+ const CFX_FloatRect& rcWindow,
+ uint32_t dwFlags) {}
+
+void CPDFSDK_WidgetHandler::OnDelete(CPDFSDK_Annot* pAnnot) {}
+
+void CPDFSDK_WidgetHandler::OnRelease(CPDFSDK_Annot* pAnnot) {}
+
+void CPDFSDK_WidgetHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlag) {
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
+ m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag);
+}
+
+void CPDFSDK_WidgetHandler::OnMouseExit(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlag) {
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
+ m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag);
+}
+
+FX_BOOL CPDFSDK_WidgetHandler::OnLButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
+ return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point);
+
+ return FALSE;
+}
+
+FX_BOOL CPDFSDK_WidgetHandler::OnLButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
+ return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point);
+
+ return FALSE;
+}
+
+FX_BOOL CPDFSDK_WidgetHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
+ return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
+
+ return FALSE;
+}
+
+FX_BOOL CPDFSDK_WidgetHandler::OnMouseMove(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
+ return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point);
+
+ return FALSE;
+}
+
+FX_BOOL CPDFSDK_WidgetHandler::OnMouseWheel(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlags,
+ short zDelta,
+ const CFX_FloatPoint& point) {
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
+ return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta,
+ point);
+
+ return FALSE;
+}
+
+FX_BOOL CPDFSDK_WidgetHandler::OnRButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
+ return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point);
+
+ return FALSE;
+}
+
+FX_BOOL CPDFSDK_WidgetHandler::OnRButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
+ return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point);
+
+ return FALSE;
+}
+
+FX_BOOL CPDFSDK_WidgetHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
+ return FALSE;
+}
+
+FX_BOOL CPDFSDK_WidgetHandler::OnChar(CPDFSDK_Annot* pAnnot,
+ uint32_t nChar,
+ uint32_t nFlags) {
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
+ return m_pFormFiller->OnChar(pAnnot, nChar, nFlags);
+
+ return FALSE;
+}
+
+FX_BOOL CPDFSDK_WidgetHandler::OnKeyDown(CPDFSDK_Annot* pAnnot,
+ int nKeyCode,
+ int nFlag) {
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
+ return m_pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlag);
+
+ return FALSE;
+}
+
+FX_BOOL CPDFSDK_WidgetHandler::OnKeyUp(CPDFSDK_Annot* pAnnot,
+ int nKeyCode,
+ int nFlag) {
+ return FALSE;
+}
+
+void CPDFSDK_WidgetHandler::OnCreate(CPDFSDK_Annot* pAnnot) {
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
+ m_pFormFiller->OnCreate(pAnnot);
+}
+
+void CPDFSDK_WidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) {
+ if (pAnnot->IsSignatureWidget())
+ return;
+
+ CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot);
+ if (!pWidget->IsAppearanceValid())
+ pWidget->ResetAppearance(nullptr, FALSE);
+
+ int nFieldType = pWidget->GetFieldType();
+ if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) {
+ FX_BOOL bFormated = FALSE;
+ CFX_WideString sValue = pWidget->OnFormat(bFormated);
+ if (bFormated && nFieldType == FIELDTYPE_COMBOBOX)
+ pWidget->ResetAppearance(sValue.c_str(), FALSE);
+ }
+
+#ifdef PDF_ENABLE_XFA
+ CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
+ CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument();
+ CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
+ if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
+ if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty())
+ pWidget->ResetAppearance(FALSE);
+ }
+#endif // PDF_ENABLE_XFA
+ if (m_pFormFiller)
+ m_pFormFiller->OnLoad(pAnnot);
+}
+
+FX_BOOL CPDFSDK_WidgetHandler::OnSetFocus(CPDFSDK_Annot* pAnnot,
+ uint32_t nFlag) {
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
+ return m_pFormFiller->OnSetFocus(pAnnot, nFlag);
+
+ return TRUE;
+}
+
+FX_BOOL CPDFSDK_WidgetHandler::OnKillFocus(CPDFSDK_Annot* pAnnot,
+ uint32_t nFlag) {
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
+ return m_pFormFiller->OnKillFocus(pAnnot, nFlag);
+
+ return TRUE;
+}
+
+#ifdef PDF_ENABLE_XFA
+FX_BOOL CPDFSDK_WidgetHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot,
+ CPDFSDK_Annot* pNewAnnot) {
+ return TRUE;
+}
+#endif // PDF_ENABLE_XFA
+
+CFX_FloatRect CPDFSDK_WidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot) {
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
+ return CFX_FloatRect(m_pFormFiller->GetViewBBox(pPageView, pAnnot));
+
+ return CFX_FloatRect(0, 0, 0, 0);
+}
+
+FX_BOOL CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ const CFX_FloatPoint& point) {
+ ASSERT(pPageView);
+ ASSERT(pAnnot);
+
+ CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot);
+ return rect.Contains(point.x, point.y);
+}
diff --git a/fpdfsdk/cpdfsdk_xfaannothandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
similarity index 62%
rename from fpdfsdk/cpdfsdk_xfaannothandler.cpp
rename to fpdfsdk/cpdfsdk_xfawidgethandler.cpp
index 2f4599d..9a9a7a8 100644
--- a/fpdfsdk/cpdfsdk_xfaannothandler.cpp
+++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/cpdfsdk_xfaannothandler.h"
+#include "fpdfsdk/include/cpdfsdk_xfawidgethandler.h"
#include "core/fpdfdoc/include/cpdf_interform.h"
#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h"
@@ -20,26 +20,26 @@
#include "xfa/fxgraphics/include/cfx_graphics.h"
#include "xfa/fwl/core/include/fwl_widgethit.h"
-CPDFSDK_XFAAnnotHandler::CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp)
+CPDFSDK_XFAWidgetHandler::CPDFSDK_XFAWidgetHandler(CPDFDoc_Environment* pApp)
: m_pApp(pApp) {}
-CPDFSDK_XFAAnnotHandler::~CPDFSDK_XFAAnnotHandler() {}
+CPDFSDK_XFAWidgetHandler::~CPDFSDK_XFAWidgetHandler() {}
-CFX_ByteString CPDFSDK_XFAAnnotHandler::GetType() {
+CFX_ByteString CPDFSDK_XFAWidgetHandler::GetType() {
return FSDK_XFAWIDGET_TYPENAME;
}
-FX_BOOL CPDFSDK_XFAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) {
+FX_BOOL CPDFSDK_XFAWidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) {
return !!pAnnot->GetXFAWidget();
}
-CPDFSDK_Annot* CPDFSDK_XFAAnnotHandler::NewAnnot(CPDF_Annot* pAnnot,
- CPDFSDK_PageView* pPage) {
+CPDFSDK_Annot* CPDFSDK_XFAWidgetHandler::NewAnnot(CPDF_Annot* pAnnot,
+ CPDFSDK_PageView* pPage) {
return nullptr;
}
-CPDFSDK_Annot* CPDFSDK_XFAAnnotHandler::NewAnnot(CXFA_FFWidget* pAnnot,
- CPDFSDK_PageView* pPage) {
+CPDFSDK_Annot* CPDFSDK_XFAWidgetHandler::NewAnnot(CXFA_FFWidget* pAnnot,
+ CPDFSDK_PageView* pPage) {
CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument();
CPDFSDK_InterForm* pInterForm = pSDKDoc->GetInterForm();
CPDFSDK_XFAWidget* pWidget = new CPDFSDK_XFAWidget(pAnnot, pPage, pInterForm);
@@ -47,11 +47,11 @@
return pWidget;
}
-void CPDFSDK_XFAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
- uint32_t dwFlags) {
+void CPDFSDK_XFAWidgetHandler::OnDraw(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device,
+ uint32_t dwFlags) {
ASSERT(pPageView);
ASSERT(pAnnot);
@@ -73,22 +73,22 @@
// to do highlight and shadow
}
-void CPDFSDK_XFAAnnotHandler::OnDrawSleep(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
- const CFX_FloatRect& rcWindow,
- uint32_t dwFlags) {}
+void CPDFSDK_XFAWidgetHandler::OnDrawSleep(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device,
+ const CFX_FloatRect& rcWindow,
+ uint32_t dwFlags) {}
-void CPDFSDK_XFAAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) {}
+void CPDFSDK_XFAWidgetHandler::OnCreate(CPDFSDK_Annot* pAnnot) {}
-void CPDFSDK_XFAAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) {}
+void CPDFSDK_XFAWidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) {}
-void CPDFSDK_XFAAnnotHandler::OnDelete(CPDFSDK_Annot* pAnnot) {}
+void CPDFSDK_XFAWidgetHandler::OnDelete(CPDFSDK_Annot* pAnnot) {}
-void CPDFSDK_XFAAnnotHandler::OnRelease(CPDFSDK_Annot* pAnnot) {}
+void CPDFSDK_XFAWidgetHandler::OnRelease(CPDFSDK_Annot* pAnnot) {}
-void CPDFSDK_XFAAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
+void CPDFSDK_XFAWidgetHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
CPDFSDK_XFAWidget* pWidget = reinterpret_cast<CPDFSDK_XFAWidget*>(pAnnot);
CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm();
pInterForm->RemoveXFAMap(pWidget->GetXFAWidget());
@@ -96,10 +96,10 @@
delete pWidget;
}
-void CPDFSDK_XFAAnnotHandler::DeleteAnnot(CPDFSDK_Annot* pAnnot) {}
+void CPDFSDK_XFAWidgetHandler::DeleteAnnot(CPDFSDK_Annot* pAnnot) {}
-CFX_FloatRect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot) {
+CFX_FloatRect CPDFSDK_XFAWidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot) {
ASSERT(pAnnot);
CFX_RectF rcBBox;
@@ -119,9 +119,9 @@
return rcWidget;
}
-FX_BOOL CPDFSDK_XFAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- const CFX_FloatPoint& point) {
+FX_BOOL CPDFSDK_XFAWidgetHandler::HitTest(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ const CFX_FloatPoint& point) {
if (!pPageView || !pAnnot)
return FALSE;
@@ -146,18 +146,18 @@
return dwHitTest != FWL_WidgetHit::Unknown;
}
-void CPDFSDK_XFAAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlag) {
+void CPDFSDK_XFAWidgetHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlag) {
if (!pPageView || !pAnnot)
return;
CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
pWidgetHandler->OnMouseEnter(pAnnot->GetXFAWidget());
}
-void CPDFSDK_XFAAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlag) {
+void CPDFSDK_XFAWidgetHandler::OnMouseExit(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlag) {
if (!pPageView || !pAnnot)
return;
@@ -165,10 +165,10 @@
pWidgetHandler->OnMouseExit(pAnnot->GetXFAWidget());
}
-FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
+FX_BOOL CPDFSDK_XFAWidgetHandler::OnLButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
if (!pPageView || !pAnnot)
return FALSE;
@@ -177,10 +177,10 @@
GetFWLFlags(nFlags), point.x, point.y);
}
-FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
+FX_BOOL CPDFSDK_XFAWidgetHandler::OnLButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
if (!pPageView || !pAnnot)
return FALSE;
@@ -189,10 +189,10 @@
GetFWLFlags(nFlags), point.x, point.y);
}
-FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
+FX_BOOL CPDFSDK_XFAWidgetHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
if (!pPageView || !pAnnot)
return FALSE;
@@ -201,10 +201,10 @@
GetFWLFlags(nFlags), point.x, point.y);
}
-FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
+FX_BOOL CPDFSDK_XFAWidgetHandler::OnMouseMove(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
if (!pPageView || !pAnnot)
return FALSE;
@@ -213,11 +213,11 @@
GetFWLFlags(nFlags), point.x, point.y);
}
-FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- short zDelta,
- const CFX_FloatPoint& point) {
+FX_BOOL CPDFSDK_XFAWidgetHandler::OnMouseWheel(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlags,
+ short zDelta,
+ const CFX_FloatPoint& point) {
if (!pPageView || !pAnnot)
return FALSE;
@@ -226,10 +226,10 @@
pAnnot->GetXFAWidget(), GetFWLFlags(nFlags), zDelta, point.x, point.y);
}
-FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
+FX_BOOL CPDFSDK_XFAWidgetHandler::OnRButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
if (!pPageView || !pAnnot)
return FALSE;
@@ -238,10 +238,10 @@
GetFWLFlags(nFlags), point.x, point.y);
}
-FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
+FX_BOOL CPDFSDK_XFAWidgetHandler::OnRButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
if (!pPageView || !pAnnot)
return FALSE;
@@ -250,10 +250,10 @@
GetFWLFlags(nFlags), point.x, point.y);
}
-FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
+FX_BOOL CPDFSDK_XFAWidgetHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
if (!pPageView || !pAnnot)
return FALSE;
@@ -262,9 +262,9 @@
GetFWLFlags(nFlags), point.x, point.y);
}
-FX_BOOL CPDFSDK_XFAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot,
- uint32_t nChar,
- uint32_t nFlags) {
+FX_BOOL CPDFSDK_XFAWidgetHandler::OnChar(CPDFSDK_Annot* pAnnot,
+ uint32_t nChar,
+ uint32_t nFlags) {
if (!pAnnot)
return FALSE;
@@ -273,9 +273,9 @@
GetFWLFlags(nFlags));
}
-FX_BOOL CPDFSDK_XFAAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot,
- int nKeyCode,
- int nFlag) {
+FX_BOOL CPDFSDK_XFAWidgetHandler::OnKeyDown(CPDFSDK_Annot* pAnnot,
+ int nKeyCode,
+ int nFlag) {
if (!pAnnot)
return FALSE;
@@ -284,9 +284,9 @@
GetFWLFlags(nFlag));
}
-FX_BOOL CPDFSDK_XFAAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot,
- int nKeyCode,
- int nFlag) {
+FX_BOOL CPDFSDK_XFAWidgetHandler::OnKeyUp(CPDFSDK_Annot* pAnnot,
+ int nKeyCode,
+ int nFlag) {
if (!pAnnot)
return FALSE;
@@ -295,22 +295,22 @@
GetFWLFlags(nFlag));
}
-void CPDFSDK_XFAAnnotHandler::OnDeSelected(CPDFSDK_Annot* pAnnot) {}
+void CPDFSDK_XFAWidgetHandler::OnDeSelected(CPDFSDK_Annot* pAnnot) {}
-void CPDFSDK_XFAAnnotHandler::OnSelected(CPDFSDK_Annot* pAnnot) {}
+void CPDFSDK_XFAWidgetHandler::OnSelected(CPDFSDK_Annot* pAnnot) {}
-FX_BOOL CPDFSDK_XFAAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot,
- uint32_t nFlag) {
- return TRUE;
-}
-
-FX_BOOL CPDFSDK_XFAAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot,
+FX_BOOL CPDFSDK_XFAWidgetHandler::OnSetFocus(CPDFSDK_Annot* pAnnot,
uint32_t nFlag) {
return TRUE;
}
-FX_BOOL CPDFSDK_XFAAnnotHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot,
- CPDFSDK_Annot* pNewAnnot) {
+FX_BOOL CPDFSDK_XFAWidgetHandler::OnKillFocus(CPDFSDK_Annot* pAnnot,
+ uint32_t nFlag) {
+ return TRUE;
+}
+
+FX_BOOL CPDFSDK_XFAWidgetHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot,
+ CPDFSDK_Annot* pNewAnnot) {
CXFA_FFWidgetHandler* pWidgetHandler = nullptr;
if (pOldAnnot)
@@ -335,7 +335,7 @@
return TRUE;
}
-CXFA_FFWidgetHandler* CPDFSDK_XFAAnnotHandler::GetXFAWidgetHandler(
+CXFA_FFWidgetHandler* CPDFSDK_XFAWidgetHandler::GetXFAWidgetHandler(
CPDFSDK_Annot* pAnnot) {
if (!pAnnot)
return nullptr;
@@ -366,7 +366,7 @@
const uint32_t FWL_KEYFLAG_RButton = (1 << 4);
const uint32_t FWL_KEYFLAG_MButton = (1 << 5);
-uint32_t CPDFSDK_XFAAnnotHandler::GetFWLFlags(uint32_t dwFlag) {
+uint32_t CPDFSDK_XFAWidgetHandler::GetFWLFlags(uint32_t dwFlag) {
uint32_t dwFWLFlag = 0;
if (dwFlag & FWL_EVENTFLAG_ControlKey)
diff --git a/fpdfsdk/include/cpdfsdk_annothandlermgr.h b/fpdfsdk/include/cpdfsdk_annothandlermgr.h
index 2ff35f8..016135c 100644
--- a/fpdfsdk/include/cpdfsdk_annothandlermgr.h
+++ b/fpdfsdk/include/cpdfsdk_annothandlermgr.h
@@ -19,12 +19,12 @@
class CPDFDoc_Environment;
class CPDFSDK_Annot;
class CPDFSDK_BAAnnotHandler;
-class CPDFSDK_BFAnnotHandler;
+class CPDFSDK_WidgetHandler;
class CPDFSDK_PageView;
class IPDFSDK_AnnotHandler;
#ifdef PDF_ENABLE_XFA
-class CPDFSDK_XFAAnnotHandler;
+class CPDFSDK_XFAWidgetHandler;
class CXFA_FFWidget;
#endif // PDF_ENABLE_XFA
@@ -113,9 +113,9 @@
CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, FX_BOOL bNext);
std::unique_ptr<CPDFSDK_BAAnnotHandler> m_pBAAnnotHandler;
- std::unique_ptr<CPDFSDK_BFAnnotHandler> m_pBFAnnotHandler;
+ std::unique_ptr<CPDFSDK_WidgetHandler> m_pWidgetHandler;
#ifdef PDF_ENABLE_XFA
- std::unique_ptr<CPDFSDK_XFAAnnotHandler> m_pXFAAnnotHandler;
+ std::unique_ptr<CPDFSDK_XFAWidgetHandler> m_pXFAWidgetHandler;
#endif // PDF_ENABLE_XFA
CPDFDoc_Environment* m_pApp;
diff --git a/fpdfsdk/include/cpdfsdk_bfannothandler.h b/fpdfsdk/include/cpdfsdk_widgethandler.h
similarity index 93%
rename from fpdfsdk/include/cpdfsdk_bfannothandler.h
rename to fpdfsdk/include/cpdfsdk_widgethandler.h
index be7e792..0155967 100644
--- a/fpdfsdk/include/cpdfsdk_bfannothandler.h
+++ b/fpdfsdk/include/cpdfsdk_widgethandler.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef FPDFSDK_INCLUDE_CPDFSDK_BFANNOTHANDLER_H_
-#define FPDFSDK_INCLUDE_CPDFSDK_BFANNOTHANDLER_H_
+#ifndef FPDFSDK_INCLUDE_CPDFSDK_WIDGETHANDLER_H_
+#define FPDFSDK_INCLUDE_CPDFSDK_WIDGETHANDLER_H_
#include "core/fxcrt/include/fx_basic.h"
#include "core/fxcrt/include/fx_coordinates.h"
@@ -23,10 +23,10 @@
class CXFA_FFWidget;
#endif // PDF_ENABLE_XFA
-class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler {
+class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler {
public:
- explicit CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp);
- ~CPDFSDK_BFAnnotHandler() override;
+ explicit CPDFSDK_WidgetHandler(CPDFDoc_Environment* pApp);
+ ~CPDFSDK_WidgetHandler() override;
CFX_ByteString GetType() override;
FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override;
@@ -118,4 +118,4 @@
CFFL_IFormFiller* m_pFormFiller;
};
-#endif // FPDFSDK_INCLUDE_CPDFSDK_BFANNOTHANDLER_H_
+#endif // FPDFSDK_INCLUDE_CPDFSDK_WIDGETHANDLER_H_
diff --git a/fpdfsdk/include/cpdfsdk_xfaannothandler.h b/fpdfsdk/include/cpdfsdk_xfawidgethandler.h
similarity index 93%
rename from fpdfsdk/include/cpdfsdk_xfaannothandler.h
rename to fpdfsdk/include/cpdfsdk_xfawidgethandler.h
index 2dd6f29..84e74b4 100644
--- a/fpdfsdk/include/cpdfsdk_xfaannothandler.h
+++ b/fpdfsdk/include/cpdfsdk_xfawidgethandler.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef FPDFSDK_INCLUDE_CPDFSDK_XFAANNOTHANDLER_H_
-#define FPDFSDK_INCLUDE_CPDFSDK_XFAANNOTHANDLER_H_
+#ifndef FPDFSDK_INCLUDE_CPDFSDK_XFAWIDGETHANDLER_H_
+#define FPDFSDK_INCLUDE_CPDFSDK_XFAWIDGETHANDLER_H_
#include "core/fxcrt/include/fx_basic.h"
#include "core/fxcrt/include/fx_coordinates.h"
@@ -20,10 +20,10 @@
class CXFA_FFWidget;
class CXFA_FFWidgetHandler;
-class CPDFSDK_XFAAnnotHandler : public IPDFSDK_AnnotHandler {
+class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler {
public:
- explicit CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp);
- ~CPDFSDK_XFAAnnotHandler() override;
+ explicit CPDFSDK_XFAWidgetHandler(CPDFDoc_Environment* pApp);
+ ~CPDFSDK_XFAWidgetHandler() override;
CFX_ByteString GetType() override;
FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override;
@@ -110,4 +110,4 @@
CPDFDoc_Environment* m_pApp;
};
-#endif // FPDFSDK_INCLUDE_CPDFSDK_XFAANNOTHANDLER_H_
+#endif // FPDFSDK_INCLUDE_CPDFSDK_XFAWIDGETHANDLER_H_