summaryrefslogtreecommitdiff
path: root/fpdfsdk/include
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-09-27 14:29:57 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-27 14:29:57 -0700
commitf8074cefb2f8d947fa83d151bcbe080b485d6e6b (patch)
treefe97655234318181a58827666576010abb745b18 /fpdfsdk/include
parentec7a9455c15b2cebb75a6036c8636beb601e543a (diff)
downloadpdfium-f8074cefb2f8d947fa83d151bcbe080b485d6e6b.tar.xz
Watch destruction of widgets around OnAAction() method.
We implemented the CFX_Observable mechanism for detecting stale objects some time ago; now just use it in more places. Change method signatures to required an ObservedPtr to indicate that the callers are aware that the value may be destroyed out from underneath them. BUG=649659 Review-Url: https://codereview.chromium.org/2368403002
Diffstat (limited to 'fpdfsdk/include')
-rw-r--r--fpdfsdk/include/cpdfsdk_annothandlermgr.h28
-rw-r--r--fpdfsdk/include/cpdfsdk_baannothandler.h31
-rw-r--r--fpdfsdk/include/cpdfsdk_document.h6
-rw-r--r--fpdfsdk/include/cpdfsdk_pageview.h6
-rw-r--r--fpdfsdk/include/cpdfsdk_widgethandler.h31
-rw-r--r--fpdfsdk/include/cpdfsdk_xfawidgethandler.h30
-rw-r--r--fpdfsdk/include/ipdfsdk_annothandler.h33
7 files changed, 89 insertions, 76 deletions
diff --git a/fpdfsdk/include/cpdfsdk_annothandlermgr.h b/fpdfsdk/include/cpdfsdk_annothandlermgr.h
index 9e0035cc4c..d66914aafb 100644
--- a/fpdfsdk/include/cpdfsdk_annothandlermgr.h
+++ b/fpdfsdk/include/cpdfsdk_annothandlermgr.h
@@ -13,11 +13,11 @@
#include "core/fpdfdoc/include/cpdf_annot.h"
#include "core/fxcrt/include/fx_basic.h"
#include "core/fxcrt/include/fx_coordinates.h"
+#include "fpdfsdk/include/cpdfsdk_annot.h"
class CFX_Matrix;
class CFX_RenderDevice;
class CPDFSDK_Environment;
-class CPDFSDK_Annot;
class CPDFSDK_BAAnnotHandler;
class CPDFSDK_WidgetHandler;
class CPDFSDK_PageView;
@@ -50,50 +50,50 @@ class CPDFSDK_AnnotHandlerMgr {
bool bDrawAnnots);
void Annot_OnMouseEnter(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags);
void Annot_OnMouseExit(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags);
FX_BOOL Annot_OnLButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point);
FX_BOOL Annot_OnLButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point);
FX_BOOL Annot_OnLButtonDblClk(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point);
FX_BOOL Annot_OnMouseMove(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point);
FX_BOOL Annot_OnMouseWheel(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
short zDelta,
const CFX_FloatPoint& point);
FX_BOOL Annot_OnRButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point);
FX_BOOL Annot_OnRButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point);
FX_BOOL Annot_OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags);
FX_BOOL Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
FX_BOOL Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
- FX_BOOL Annot_OnSetFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag);
- FX_BOOL Annot_OnKillFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag);
+ FX_BOOL Annot_OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag);
+ FX_BOOL Annot_OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag);
#ifdef PDF_ENABLE_XFA
- FX_BOOL Annot_OnChangeFocus(CPDFSDK_Annot* pSetAnnot,
- CPDFSDK_Annot* pKillAnnot);
+ FX_BOOL Annot_OnChangeFocus(CPDFSDK_Annot::ObservedPtr* pSetAnnot,
+ CPDFSDK_Annot::ObservedPtr* pKillAnnot);
#endif // PDF_ENABLE_XFA
CFX_FloatRect Annot_OnGetViewBBox(CPDFSDK_PageView* pPageView,
diff --git a/fpdfsdk/include/cpdfsdk_baannothandler.h b/fpdfsdk/include/cpdfsdk_baannothandler.h
index 112f8125f1..ae884526a0 100644
--- a/fpdfsdk/include/cpdfsdk_baannothandler.h
+++ b/fpdfsdk/include/cpdfsdk_baannothandler.h
@@ -50,43 +50,44 @@ class CPDFSDK_BAAnnotHandler : public IPDFSDK_AnnotHandler {
void OnLoad(CPDFSDK_Annot* pAnnot) override;
void OnDelete(CPDFSDK_Annot* pAnnot) override;
void OnRelease(CPDFSDK_Annot* pAnnot) override;
+
void OnMouseEnter(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlag) override;
void OnMouseExit(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlag) override;
FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
short zDelta,
const CFX_FloatPoint& point) override;
FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnChar(CPDFSDK_Annot* pAnnot,
@@ -96,11 +97,13 @@ class CPDFSDK_BAAnnotHandler : public IPDFSDK_AnnotHandler {
FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
void OnDeSelected(CPDFSDK_Annot* pAnnot) override;
void OnSelected(CPDFSDK_Annot* pAnnot) override;
- FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) override;
- FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) override;
+ FX_BOOL OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+ uint32_t nFlag) override;
+ FX_BOOL OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+ uint32_t nFlag) override;
#ifdef PDF_ENABLE_XFA
- FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot,
- CPDFSDK_Annot* pNewAnnot) override;
+ FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot,
+ CPDFSDK_Annot::ObservedPtr* pNewAnnot) override;
#endif // PDF_ENABLE_XFA
};
diff --git a/fpdfsdk/include/cpdfsdk_document.h b/fpdfsdk/include/cpdfsdk_document.h
index 5a83b74296..9fce00f684 100644
--- a/fpdfsdk/include/cpdfsdk_document.h
+++ b/fpdfsdk/include/cpdfsdk_document.h
@@ -12,12 +12,12 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fxcrt/include/cfx_observable.h"
+#include "fpdfsdk/include/cpdfsdk_annot.h"
#include "fpdfsdk/include/fsdk_define.h"
#include "public/fpdf_formfill.h"
class CPDF_OCContext;
class CPDFSDK_Environment;
-class CPDFSDK_Annot;
class CPDFSDK_InterForm;
class CPDFSDK_PageView;
class IJS_Runtime;
@@ -68,7 +68,7 @@ class CPDFSDK_Document : public CFX_Observable<CPDFSDK_Document> {
IJS_Runtime* GetJsRuntime();
- FX_BOOL SetFocusAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag = 0);
+ FX_BOOL SetFocusAnnot(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag = 0);
FX_BOOL KillFocusAnnot(uint32_t nFlag = 0);
FX_BOOL ExtractPages(const std::vector<uint16_t>& arrExtraPages,
@@ -98,7 +98,7 @@ class CPDFSDK_Document : public CFX_Observable<CPDFSDK_Document> {
std::map<UnderlyingPageType*, CPDFSDK_PageView*> m_pageMap;
UnderlyingDocumentType* m_pDoc;
std::unique_ptr<CPDFSDK_InterForm> m_pInterForm;
- CPDFSDK_Annot* m_pFocusAnnot;
+ CPDFSDK_Annot::ObservedPtr m_pFocusAnnot;
CPDFSDK_Environment* m_pEnv;
std::unique_ptr<CPDF_OCContext> m_pOccontent;
FX_BOOL m_bChangeMask;
diff --git a/fpdfsdk/include/cpdfsdk_pageview.h b/fpdfsdk/include/cpdfsdk_pageview.h
index d22b6b48a0..2a54dffc30 100644
--- a/fpdfsdk/include/cpdfsdk_pageview.h
+++ b/fpdfsdk/include/cpdfsdk_pageview.h
@@ -12,6 +12,7 @@
#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fxcrt/include/fx_system.h"
+#include "fpdfsdk/include/cpdfsdk_annot.h"
#include "fpdfsdk/include/cpdfsdk_document.h"
class CFX_RenderDevice;
@@ -39,7 +40,8 @@ class CPDFSDK_PageView final : public CPDF_Page::View {
const CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
CPDFSDK_Annot* GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
CPDFSDK_Annot* GetFocusAnnot();
- void SetFocusAnnot(CPDFSDK_Annot* pSDKAnnot, uint32_t nFlag = 0) {
+ void SetFocusAnnot(CPDFSDK_Annot::ObservedPtr* pSDKAnnot,
+ uint32_t nFlag = 0) {
m_pSDKDoc->SetFocusAnnot(pSDKAnnot, nFlag);
}
FX_BOOL KillFocusAnnot(uint32_t nFlag = 0) {
@@ -108,7 +110,7 @@ class CPDFSDK_PageView final : public CPDF_Page::View {
std::unique_ptr<CPDF_AnnotList> m_pAnnotList;
std::vector<CPDFSDK_Annot*> m_fxAnnotArray;
CPDFSDK_Document* const m_pSDKDoc;
- CPDFSDK_Annot* m_CaptureWidget;
+ CPDFSDK_Annot::ObservedPtr m_pCaptureWidget;
#ifndef PDF_ENABLE_XFA
bool m_bOwnsPage;
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/include/cpdfsdk_widgethandler.h b/fpdfsdk/include/cpdfsdk_widgethandler.h
index 19f977eb95..b18f623b3f 100644
--- a/fpdfsdk/include/cpdfsdk_widgethandler.h
+++ b/fpdfsdk/include/cpdfsdk_widgethandler.h
@@ -50,43 +50,44 @@ class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler {
void OnLoad(CPDFSDK_Annot* pAnnot) override;
void OnDelete(CPDFSDK_Annot* pAnnot) override;
void OnRelease(CPDFSDK_Annot* pAnnot) override;
+
void OnMouseEnter(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlag) override;
void OnMouseExit(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlag) override;
FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
short zDelta,
const CFX_FloatPoint& point) override;
FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnChar(CPDFSDK_Annot* pAnnot,
@@ -96,11 +97,13 @@ class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler {
FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
void OnDeSelected(CPDFSDK_Annot* pAnnot) override {}
void OnSelected(CPDFSDK_Annot* pAnnot) override {}
- FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) override;
- FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) override;
+ FX_BOOL OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+ uint32_t nFlag) override;
+ FX_BOOL OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+ uint32_t nFlag) override;
#ifdef PDF_ENABLE_XFA
- FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot,
- CPDFSDK_Annot* pNewAnnot) override;
+ FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot,
+ CPDFSDK_Annot::ObservedPtr* pNewAnnot) override;
#endif // PDF_ENABLE_XFA
void SetFormFiller(CFFL_InteractiveFormFiller* pFiller) {
diff --git a/fpdfsdk/include/cpdfsdk_xfawidgethandler.h b/fpdfsdk/include/cpdfsdk_xfawidgethandler.h
index c18a36f8b6..2bf977951c 100644
--- a/fpdfsdk/include/cpdfsdk_xfawidgethandler.h
+++ b/fpdfsdk/include/cpdfsdk_xfawidgethandler.h
@@ -46,42 +46,42 @@ class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler {
void OnDelete(CPDFSDK_Annot* pAnnot) override;
void OnRelease(CPDFSDK_Annot* pAnnot) override;
void OnMouseEnter(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlag) override;
void OnMouseExit(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlag) override;
FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
short zDelta,
const CFX_FloatPoint& point) override;
FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) override;
FX_BOOL OnChar(CPDFSDK_Annot* pAnnot,
@@ -91,10 +91,12 @@ class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler {
FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
void OnDeSelected(CPDFSDK_Annot* pAnnot) override;
void OnSelected(CPDFSDK_Annot* pAnnot) override;
- FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) override;
- FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) override;
- FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot,
- CPDFSDK_Annot* pNewAnnot) override;
+ FX_BOOL OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+ uint32_t nFlag) override;
+ FX_BOOL OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+ uint32_t nFlag) override;
+ FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot,
+ CPDFSDK_Annot::ObservedPtr* pNewAnnot) override;
private:
CXFA_FFWidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot);
diff --git a/fpdfsdk/include/ipdfsdk_annothandler.h b/fpdfsdk/include/ipdfsdk_annothandler.h
index d2f9010b76..f1db6983c0 100644
--- a/fpdfsdk/include/ipdfsdk_annothandler.h
+++ b/fpdfsdk/include/ipdfsdk_annothandler.h
@@ -9,11 +9,11 @@
#include "core/fxcrt/include/fx_basic.h"
#include "core/fxcrt/include/fx_coordinates.h"
+#include "fpdfsdk/include/cpdfsdk_annot.h"
class CFX_Matrix;
class CFX_RenderDevice;
class CPDF_Annot;
-class CPDFSDK_Annot;
class CPDFSDK_PageView;
#ifdef PDF_ENABLE_XFA
@@ -49,43 +49,44 @@ class IPDFSDK_AnnotHandler {
virtual void OnLoad(CPDFSDK_Annot* pAnnot) = 0;
virtual void OnDelete(CPDFSDK_Annot* pAnnot) = 0;
virtual void OnRelease(CPDFSDK_Annot* pAnnot) = 0;
+
virtual void OnMouseEnter(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlag) = 0;
virtual void OnMouseExit(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlag) = 0;
virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) = 0;
virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) = 0;
virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) = 0;
virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) = 0;
virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
short zDelta,
const CFX_FloatPoint& point) = 0;
virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) = 0;
virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) = 0;
virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) = 0;
virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot,
@@ -95,11 +96,13 @@ class IPDFSDK_AnnotHandler {
virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;
virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) = 0;
virtual void OnSelected(CPDFSDK_Annot* pAnnot) = 0;
- virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) = 0;
- virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) = 0;
+ virtual FX_BOOL OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+ uint32_t nFlag) = 0;
+ virtual FX_BOOL OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+ uint32_t nFlag) = 0;
#ifdef PDF_ENABLE_XFA
- virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot,
- CPDFSDK_Annot* pNewAnnot) = 0;
+ virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot,
+ CPDFSDK_Annot::ObservedPtr* pNewAnnot) = 0;
#endif // PDF_ENABLE_XFA
};