diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-07-28 00:00:25 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-28 00:00:25 +0000 |
commit | 522d77db501ab7ae33f7d17e4ab456232ca5a70c (patch) | |
tree | d53f5d73117cd098bf3ee4ff6e1fc05b59becdb8 /fpdfsdk/cpdfsdk_annot.h | |
parent | f19ae5dcd0b618cdeb80d6a1df5b13610d0ff7da (diff) | |
download | pdfium-522d77db501ab7ae33f7d17e4ab456232ca5a70c.tar.xz |
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>
Diffstat (limited to 'fpdfsdk/cpdfsdk_annot.h')
-rw-r--r-- | fpdfsdk/cpdfsdk_annot.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fpdfsdk/cpdfsdk_annot.h b/fpdfsdk/cpdfsdk_annot.h index 459c6d0233..708a223a50 100644 --- a/fpdfsdk/cpdfsdk_annot.h +++ b/fpdfsdk/cpdfsdk_annot.h @@ -20,6 +20,7 @@ class CFX_Matrix; class CFX_RenderDevice; class CPDF_Page; class CPDF_RenderOptions; +class CPDFSDK_BAAnnot; class CPDFSDK_PageView; #ifdef PDF_ENABLE_XFA @@ -31,6 +32,8 @@ class CPDFSDK_Annot : public Observable<CPDFSDK_Annot> { 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 @@ class CPDFSDK_Annot : public Observable<CPDFSDK_Annot> { UnownedPtr<CPDFSDK_PageView> const m_pPageView; }; +inline CPDFSDK_BAAnnot* ToBAAnnot(CPDFSDK_Annot* pAnnot) { + return pAnnot ? pAnnot->AsBAAnnot() : nullptr; +} + #endif // FPDFSDK_CPDFSDK_ANNOT_H_ |