Rename IPDF_FormNotify to CPDF_InteractiveForm::NotifierIface
Associate the interface with the class that tracks/uses it. In
some ideal world, the IXXX_* classes would have multiple concrete
implementations from which to select and the *Iface classes would
exist for layering.
Change-Id: Ic78fce2200cbd00bf27fa726b4527f39d2b373e0
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/59790
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfdoc/BUILD.gn b/core/fpdfdoc/BUILD.gn
index c0478aa..9cc46ab 100644
--- a/core/fpdfdoc/BUILD.gn
+++ b/core/fpdfdoc/BUILD.gn
@@ -82,7 +82,6 @@
"csection.h",
"ctypeset.cpp",
"ctypeset.h",
- "ipdf_formnotify.h",
"ipvt_fontmap.h",
]
configs += [ "../../:pdfium_core_config" ]
diff --git a/core/fpdfdoc/cpdf_formcontrol.h b/core/fpdfdoc/cpdf_formcontrol.h
index d8e5e8c..d825634 100644
--- a/core/fpdfdoc/cpdf_formcontrol.h
+++ b/core/fpdfdoc/cpdf_formcontrol.h
@@ -15,7 +15,6 @@
#include "core/fpdfdoc/cpdf_defaultappearance.h"
#include "core/fpdfdoc/cpdf_formfield.h"
#include "core/fpdfdoc/cpdf_iconfit.h"
-#include "core/fpdfdoc/ipdf_formnotify.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/retain_ptr.h"
diff --git a/core/fpdfdoc/cpdf_interactiveform.cpp b/core/fpdfdoc/cpdf_interactiveform.cpp
index a7a4546..eeaac49 100644
--- a/core/fpdfdoc/cpdf_interactiveform.cpp
+++ b/core/fpdfdoc/cpdf_interactiveform.cpp
@@ -1088,6 +1088,6 @@
return pDoc;
}
-void CPDF_InteractiveForm::SetFormNotify(IPDF_FormNotify* pNotify) {
+void CPDF_InteractiveForm::SetNotifierIface(NotifierIface* pNotify) {
m_pFormNotify = pNotify;
}
diff --git a/core/fpdfdoc/cpdf_interactiveform.h b/core/fpdfdoc/cpdf_interactiveform.h
index 6d66f83..7d1f6c2 100644
--- a/core/fpdfdoc/cpdf_interactiveform.h
+++ b/core/fpdfdoc/cpdf_interactiveform.h
@@ -27,7 +27,6 @@
class CPDF_FormControl;
class CPDF_Object;
class CPDF_Page;
-class IPDF_FormNotify;
RetainPtr<CPDF_Font> AddNativeInteractiveFormFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
@@ -35,6 +34,20 @@
class CPDF_InteractiveForm {
public:
+ class NotifierIface {
+ public:
+ virtual ~NotifierIface() = default;
+
+ virtual bool BeforeValueChange(CPDF_FormField* pField,
+ const WideString& csValue) = 0;
+ virtual void AfterValueChange(CPDF_FormField* pField) = 0;
+ virtual bool BeforeSelectionChange(CPDF_FormField* pField,
+ const WideString& csValue) = 0;
+ virtual void AfterSelectionChange(CPDF_FormField* pField) = 0;
+ virtual void AfterCheckedStatusChange(CPDF_FormField* pField) = 0;
+ virtual void AfterFormReset(CPDF_InteractiveForm* pForm) = 0;
+ };
+
explicit CPDF_InteractiveForm(CPDF_Document* pDocument);
~CPDF_InteractiveForm();
@@ -85,11 +98,11 @@
bool bIncludeOrExclude,
NotificationOption notify);
- void SetFormNotify(IPDF_FormNotify* pNotify);
+ void SetNotifierIface(NotifierIface* pNotify);
bool HasXFAForm() const;
void FixPageFields(CPDF_Page* pPage);
- IPDF_FormNotify* GetFormNotify() const { return m_pFormNotify.Get(); }
+ NotifierIface* GetFormNotify() const { return m_pFormNotify.Get(); }
CPDF_Document* GetDocument() const { return m_pDocument.Get(); }
CPDF_Dictionary* GetFormDict() const { return m_pFormDict.Get(); }
@@ -113,7 +126,7 @@
// Points into |m_ControlMap|.
std::map<const CPDF_FormField*, std::vector<UnownedPtr<CPDF_FormControl>>>
m_ControlLists;
- UnownedPtr<IPDF_FormNotify> m_pFormNotify;
+ UnownedPtr<NotifierIface> m_pFormNotify;
};
#endif // CORE_FPDFDOC_CPDF_INTERACTIVEFORM_H_
diff --git a/core/fpdfdoc/ipdf_formnotify.h b/core/fpdfdoc/ipdf_formnotify.h
deleted file mode 100644
index 6a72c68..0000000
--- a/core/fpdfdoc/ipdf_formnotify.h
+++ /dev/null
@@ -1,31 +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
-
-#ifndef CORE_FPDFDOC_IPDF_FORMNOTIFY_H_
-#define CORE_FPDFDOC_IPDF_FORMNOTIFY_H_
-
-#include "core/fxcrt/fx_string.h"
-
-class CPDF_FormField;
-class CPDF_InteractiveForm;
-
-class IPDF_FormNotify {
- public:
- virtual ~IPDF_FormNotify() = default;
-
- virtual bool BeforeValueChange(CPDF_FormField* pField,
- const WideString& csValue) = 0;
- virtual void AfterValueChange(CPDF_FormField* pField) = 0;
-
- virtual bool BeforeSelectionChange(CPDF_FormField* pField,
- const WideString& csValue) = 0;
- virtual void AfterSelectionChange(CPDF_FormField* pField) = 0;
-
- virtual void AfterCheckedStatusChange(CPDF_FormField* pField) = 0;
- virtual void AfterFormReset(CPDF_InteractiveForm* pForm) = 0;
-};
-
-#endif // CORE_FPDFDOC_IPDF_FORMNOTIFY_H_
diff --git a/fpdfsdk/cpdfsdk_interactiveform.cpp b/fpdfsdk/cpdfsdk_interactiveform.cpp
index 2f888b4..9e7c548 100644
--- a/fpdfsdk/cpdfsdk_interactiveform.cpp
+++ b/fpdfsdk/cpdfsdk_interactiveform.cpp
@@ -115,8 +115,7 @@
: m_pFormFillEnv(pFormFillEnv),
m_pInteractiveForm(pdfium::MakeUnique<CPDF_InteractiveForm>(
m_pFormFillEnv->GetPDFDocument())) {
- ASSERT(m_pFormFillEnv);
- m_pInteractiveForm->SetFormNotify(this);
+ m_pInteractiveForm->SetNotifierIface(this);
RemoveAllHighLights();
}
diff --git a/fpdfsdk/cpdfsdk_interactiveform.h b/fpdfsdk/cpdfsdk_interactiveform.h
index ec76bee..df931d1 100644
--- a/fpdfsdk/cpdfsdk_interactiveform.h
+++ b/fpdfsdk/cpdfsdk_interactiveform.h
@@ -12,7 +12,7 @@
#include <vector>
#include "core/fpdfdoc/cpdf_action.h"
-#include "core/fpdfdoc/ipdf_formnotify.h"
+#include "core/fpdfdoc/cpdf_interactiveform.h"
#include "core/fxcrt/unowned_ptr.h"
#include "core/fxge/fx_dib.h"
#include "fpdfsdk/cpdfsdk_widget.h"
@@ -21,11 +21,11 @@
class CPDF_Dictionary;
class CPDF_FormControl;
class CPDF_FormField;
-class CPDF_InteractiveForm;
class CPDF_Object;
class CPDFSDK_FormFillEnvironment;
-class CPDFSDK_InteractiveForm final : public IPDF_FormNotify {
+class CPDFSDK_InteractiveForm final
+ : public CPDF_InteractiveForm::NotifierIface {
public:
explicit CPDFSDK_InteractiveForm(CPDFSDK_FormFillEnvironment* pFormFillEnv);
~CPDFSDK_InteractiveForm() override;
@@ -91,7 +91,7 @@
FX_COLORREF GetHighlightColor(FormFieldType fieldType);
private:
- // IPDF_FormNotify:
+ // CPDF_InteractiveForm::NotifierIface:
bool BeforeValueChange(CPDF_FormField* pField,
const WideString& csValue) override;
void AfterValueChange(CPDF_FormField* pField) override;