Add CPDSDK_Annot::AsBAAnnot() checked downcast method

XFA introduces some additional subclasses, so it doesn't hurt
to be sure in all cases before making a static cast.

Change-Id: I7447ca58be0b57201b39ba40a3fc5f47505cee58
Reviewed-on: https://pdfium-review.googlesource.com/39013
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_annot.h b/fpdfsdk/cpdfsdk_annot.h
index 459c6d0..708a223 100644
--- a/fpdfsdk/cpdfsdk_annot.h
+++ b/fpdfsdk/cpdfsdk_annot.h
@@ -20,6 +20,7 @@
 class CFX_RenderDevice;
 class CPDF_Page;
 class CPDF_RenderOptions;
+class CPDFSDK_BAAnnot;
 class CPDFSDK_PageView;
 
 #ifdef PDF_ENABLE_XFA
@@ -31,6 +32,8 @@
   explicit CPDFSDK_Annot(CPDFSDK_PageView* pPageView);
   virtual ~CPDFSDK_Annot();
 
+  virtual CPDFSDK_BAAnnot* AsBAAnnot();
+
 #ifdef PDF_ENABLE_XFA
   virtual bool IsXFAField();
   virtual CXFA_FFWidget* GetXFAWidget() const;
@@ -57,4 +60,8 @@
   UnownedPtr<CPDFSDK_PageView> const m_pPageView;
 };
 
+inline CPDFSDK_BAAnnot* ToBAAnnot(CPDFSDK_Annot* pAnnot) {
+  return pAnnot ? pAnnot->AsBAAnnot() : nullptr;
+}
+
 #endif  // FPDFSDK_CPDFSDK_ANNOT_H_