Remove keyboard event, focus and drawing code from IPDFSDK_AnnotHandler.
Move the affected IPDFSDK_AnnotHandler overrides to
CPDFSDK_Annot::UnsafeInputHandlers overrides instead. Then delete the
CPDFSDK_AnnotHandlerMgr pass-throughs.
Also rename many "nFlag" parameters to "nFlags" for consistency.
Change-Id: I2cd4cf1d586ebce7dfc51e874cdca4521b84cdd5
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/92370
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_annot.h b/fpdfsdk/cpdfsdk_annot.h
index c0e4c5b..17a68b4 100644
--- a/fpdfsdk/cpdfsdk_annot.h
+++ b/fpdfsdk/cpdfsdk_annot.h
@@ -43,6 +43,11 @@
const CFX_PointF& point) = 0;
virtual bool OnRButtonUp(Mask<FWL_EVENTFLAG> nFlags,
const CFX_PointF& point) = 0;
+ virtual bool OnChar(uint32_t nChar, Mask<FWL_EVENTFLAG> nFlags) = 0;
+ virtual bool OnKeyDown(FWL_VKEYCODE nKeyCode,
+ Mask<FWL_EVENTFLAG> nFlags) = 0;
+ virtual bool OnSetFocus(Mask<FWL_EVENTFLAG> nFlags) = 0;
+ virtual bool OnKillFocus(Mask<FWL_EVENTFLAG> nFlags) = 0;
};
virtual ~CPDFSDK_Annot();
@@ -58,6 +63,9 @@
virtual CPDF_Annot* GetPDFAnnot() const;
virtual CPDF_Annot::Subtype GetAnnotSubtype() const = 0;
virtual CFX_FloatRect GetRect() const = 0;
+ virtual void OnDraw(CFX_RenderDevice* pDevice,
+ const CFX_Matrix& mtUser2Device,
+ bool bDrawAnnots) = 0;
virtual bool DoHitTest(const CFX_PointF& point) = 0;
virtual CFX_FloatRect GetViewBBox() = 0;
virtual bool CanUndo() = 0;
@@ -93,6 +101,16 @@
static bool OnRButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
Mask<FWL_EVENTFLAG> nFlags,
const CFX_PointF& point);
+ static bool OnChar(ObservedPtr<CPDFSDK_Annot>& pAnnot,
+ uint32_t nChar,
+ Mask<FWL_EVENTFLAG> nFlags);
+ static bool OnKeyDown(ObservedPtr<CPDFSDK_Annot>& pAnnot,
+ FWL_VKEYCODE nKeyCode,
+ Mask<FWL_EVENTFLAG> nFlags);
+ static bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
+ Mask<FWL_EVENTFLAG> nFlags);
+ static bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
+ Mask<FWL_EVENTFLAG> nFlags);
// Three cases: PDF page only, XFA page only, or XFA page backed by PDF page.
IPDF_Page* GetPage(); // Returns XFA Page if possible, else PDF page.