blob: 06cfb70ccc3b7ad2b40a9df0ecba6304b5e421dc [file] [log] [blame]
jaepark27362762016-08-11 13:10:39 -07001// 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
dsinclair114e46a2016-09-29 17:18:21 -07007#ifndef FPDFSDK_CPDFSDK_ANNOT_H_
8#define FPDFSDK_CPDFSDK_ANNOT_H_
jaepark27362762016-08-11 13:10:39 -07009
dsinclair1727aee2016-09-29 13:12:56 -070010#include "core/fpdfdoc/cpdf_aaction.h"
11#include "core/fpdfdoc/cpdf_annot.h"
12#include "core/fpdfdoc/cpdf_defaultappearance.h"
Dan Sinclair65ecca42017-09-21 15:25:32 -040013#include "core/fxcrt/observable.h"
Dan Sinclairaee0db02017-09-21 16:53:58 -040014#include "core/fxcrt/unowned_ptr.h"
jaepark27362762016-08-11 13:10:39 -070015#include "fpdfsdk/cfx_systemhandler.h"
Dan Sinclair00d47a62018-03-28 18:39:04 +000016#include "fpdfsdk/cpdfsdk_common.h"
17#include "fpdfsdk/cpdfsdk_helpers.h"
jaepark27362762016-08-11 13:10:39 -070018
19class CFX_Matrix;
20class CFX_RenderDevice;
21class CPDF_Page;
22class CPDF_RenderOptions;
Tom Sepez522d77d2018-07-28 00:00:25 +000023class CPDFSDK_BAAnnot;
jaepark27362762016-08-11 13:10:39 -070024class CPDFSDK_PageView;
25
Tom Sepeza1d34422018-04-24 20:54:41 +000026#ifdef PDF_ENABLE_XFA
27class CXFA_FFWidget;
28#endif // PDF_ENABLE_XFA
29
Dan Sinclair65ecca42017-09-21 15:25:32 -040030class CPDFSDK_Annot : public Observable<CPDFSDK_Annot> {
jaepark27362762016-08-11 13:10:39 -070031 public:
32 explicit CPDFSDK_Annot(CPDFSDK_PageView* pPageView);
33 virtual ~CPDFSDK_Annot();
34
Tom Sepez522d77d2018-07-28 00:00:25 +000035 virtual CPDFSDK_BAAnnot* AsBAAnnot();
36
jaepark27362762016-08-11 13:10:39 -070037#ifdef PDF_ENABLE_XFA
Lei Zhang512adc52018-10-09 19:15:35 +000038 virtual bool IsXFAField() const;
jaepark27362762016-08-11 13:10:39 -070039 virtual CXFA_FFWidget* GetXFAWidget() const;
40#endif // PDF_ENABLE_XFA
41
jaepark27362762016-08-11 13:10:39 -070042 virtual int GetLayoutOrder() const;
43 virtual CPDF_Annot* GetPDFAnnot() const;
jaepark956553e2016-08-31 06:49:27 -070044 virtual CPDF_Annot::Subtype GetAnnotSubtype() const;
jaepark9ed91372016-08-26 16:16:10 -070045 virtual bool IsSignatureWidget() const;
jaepark27362762016-08-11 13:10:39 -070046 virtual CFX_FloatRect GetRect() const;
jaepark27362762016-08-11 13:10:39 -070047 virtual void SetRect(const CFX_FloatRect& rect);
jaepark27362762016-08-11 13:10:39 -070048
Tom Sepez8e631772018-06-13 21:26:56 +000049 IPDF_Page* GetPage(); // Returns XFA Page if possible, else PDF page.
jaepark27362762016-08-11 13:10:39 -070050 CPDF_Page* GetPDFPage();
51#ifdef PDF_ENABLE_XFA
52 CPDFXFA_Page* GetPDFXFAPage();
53#endif // PDF_ENABLE_XFA
54
Tom Sepezd0409af2017-05-25 15:53:57 -070055 CPDFSDK_PageView* GetPageView() const { return m_pPageView.Get(); }
jaepark27362762016-08-11 13:10:39 -070056
jaepark27362762016-08-11 13:10:39 -070057 protected:
Dan Sinclairaee0db02017-09-21 16:53:58 -040058 UnownedPtr<CPDFSDK_PageView> const m_pPageView;
jaepark27362762016-08-11 13:10:39 -070059};
60
Tom Sepez522d77d2018-07-28 00:00:25 +000061inline CPDFSDK_BAAnnot* ToBAAnnot(CPDFSDK_Annot* pAnnot) {
62 return pAnnot ? pAnnot->AsBAAnnot() : nullptr;
63}
64
dsinclair114e46a2016-09-29 17:18:21 -070065#endif // FPDFSDK_CPDFSDK_ANNOT_H_