jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 1 | // Copyright 2016 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 7 | #ifndef FPDFSDK_CPDFSDK_ANNOT_H_ |
| 8 | #define FPDFSDK_CPDFSDK_ANNOT_H_ |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 9 | |
dsinclair | 1727aee | 2016-09-29 13:12:56 -0700 | [diff] [blame] | 10 | #include "core/fpdfdoc/cpdf_aaction.h" |
| 11 | #include "core/fpdfdoc/cpdf_annot.h" |
| 12 | #include "core/fpdfdoc/cpdf_defaultappearance.h" |
Dan Sinclair | 65ecca4 | 2017-09-21 15:25:32 -0400 | [diff] [blame] | 13 | #include "core/fxcrt/observable.h" |
Dan Sinclair | aee0db0 | 2017-09-21 16:53:58 -0400 | [diff] [blame] | 14 | #include "core/fxcrt/unowned_ptr.h" |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 15 | #include "fpdfsdk/cfx_systemhandler.h" |
Dan Sinclair | 00d47a6 | 2018-03-28 18:39:04 +0000 | [diff] [blame] | 16 | #include "fpdfsdk/cpdfsdk_common.h" |
| 17 | #include "fpdfsdk/cpdfsdk_helpers.h" |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 18 | |
| 19 | class CFX_Matrix; |
| 20 | class CFX_RenderDevice; |
| 21 | class CPDF_Page; |
| 22 | class CPDF_RenderOptions; |
Tom Sepez | 522d77d | 2018-07-28 00:00:25 +0000 | [diff] [blame] | 23 | class CPDFSDK_BAAnnot; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 24 | class CPDFSDK_PageView; |
| 25 | |
Tom Sepez | a1d3442 | 2018-04-24 20:54:41 +0000 | [diff] [blame] | 26 | #ifdef PDF_ENABLE_XFA |
| 27 | class CXFA_FFWidget; |
| 28 | #endif // PDF_ENABLE_XFA |
| 29 | |
Dan Sinclair | 65ecca4 | 2017-09-21 15:25:32 -0400 | [diff] [blame] | 30 | class CPDFSDK_Annot : public Observable<CPDFSDK_Annot> { |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 31 | public: |
| 32 | explicit CPDFSDK_Annot(CPDFSDK_PageView* pPageView); |
| 33 | virtual ~CPDFSDK_Annot(); |
| 34 | |
Tom Sepez | 522d77d | 2018-07-28 00:00:25 +0000 | [diff] [blame] | 35 | virtual CPDFSDK_BAAnnot* AsBAAnnot(); |
| 36 | |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 37 | #ifdef PDF_ENABLE_XFA |
Lei Zhang | 512adc5 | 2018-10-09 19:15:35 +0000 | [diff] [blame] | 38 | virtual bool IsXFAField() const; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 39 | virtual CXFA_FFWidget* GetXFAWidget() const; |
| 40 | #endif // PDF_ENABLE_XFA |
| 41 | |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 42 | virtual int GetLayoutOrder() const; |
| 43 | virtual CPDF_Annot* GetPDFAnnot() const; |
jaepark | 956553e | 2016-08-31 06:49:27 -0700 | [diff] [blame] | 44 | virtual CPDF_Annot::Subtype GetAnnotSubtype() const; |
jaepark | 9ed9137 | 2016-08-26 16:16:10 -0700 | [diff] [blame] | 45 | virtual bool IsSignatureWidget() const; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 46 | virtual CFX_FloatRect GetRect() const; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 47 | virtual void SetRect(const CFX_FloatRect& rect); |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 48 | |
Tom Sepez | 8e63177 | 2018-06-13 21:26:56 +0000 | [diff] [blame] | 49 | IPDF_Page* GetPage(); // Returns XFA Page if possible, else PDF page. |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 50 | CPDF_Page* GetPDFPage(); |
| 51 | #ifdef PDF_ENABLE_XFA |
| 52 | CPDFXFA_Page* GetPDFXFAPage(); |
| 53 | #endif // PDF_ENABLE_XFA |
| 54 | |
Tom Sepez | d0409af | 2017-05-25 15:53:57 -0700 | [diff] [blame] | 55 | CPDFSDK_PageView* GetPageView() const { return m_pPageView.Get(); } |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 56 | |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 57 | protected: |
Dan Sinclair | aee0db0 | 2017-09-21 16:53:58 -0400 | [diff] [blame] | 58 | UnownedPtr<CPDFSDK_PageView> const m_pPageView; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 59 | }; |
| 60 | |
Tom Sepez | 522d77d | 2018-07-28 00:00:25 +0000 | [diff] [blame] | 61 | inline CPDFSDK_BAAnnot* ToBAAnnot(CPDFSDK_Annot* pAnnot) { |
| 62 | return pAnnot ? pAnnot->AsBAAnnot() : nullptr; |
| 63 | } |
| 64 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 65 | #endif // FPDFSDK_CPDFSDK_ANNOT_H_ |