blob: a43b8775dbbb3b581f67a35999c4324c7c781959 [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
7#ifndef FPDFSDK_INCLUDE_CPDFSDK_ANNOT_H_
8#define FPDFSDK_INCLUDE_CPDFSDK_ANNOT_H_
9
10#include "core/fpdfdoc/include/cpdf_aaction.h"
11#include "core/fpdfdoc/include/cpdf_annot.h"
12#include "core/fpdfdoc/include/cpdf_defaultappearance.h"
13#include "core/fxcrt/include/fx_basic.h"
14#include "fpdfsdk/cfx_systemhandler.h"
15#include "fpdfsdk/include/fsdk_common.h"
16#include "fpdfsdk/include/fsdk_define.h"
17
18class CFX_Matrix;
19class CFX_RenderDevice;
20class CPDF_Page;
21class CPDF_RenderOptions;
22class CPDFSDK_PageView;
23
24class CPDFSDK_Annot {
25 public:
dsinclairce04a452016-09-07 05:46:55 -070026 class Observer {
27 public:
28 explicit Observer(CPDFSDK_Annot** pWatchedPtr);
29 ~Observer();
30 void OnAnnotDestroyed();
31
32 private:
33 CPDFSDK_Annot** m_pWatchedPtr;
34 };
35
jaepark27362762016-08-11 13:10:39 -070036 explicit CPDFSDK_Annot(CPDFSDK_PageView* pPageView);
37 virtual ~CPDFSDK_Annot();
38
dsinclairce04a452016-09-07 05:46:55 -070039 void AddObserver(Observer* observer);
40 void RemoveObserver(Observer* observer);
41
jaepark27362762016-08-11 13:10:39 -070042#ifdef PDF_ENABLE_XFA
43 virtual FX_BOOL IsXFAField();
44 virtual CXFA_FFWidget* GetXFAWidget() const;
45#endif // PDF_ENABLE_XFA
46
47 virtual FX_FLOAT GetMinWidth() const;
48 virtual FX_FLOAT GetMinHeight() const;
49 virtual int GetLayoutOrder() const;
50 virtual CPDF_Annot* GetPDFAnnot() const;
jaepark956553e2016-08-31 06:49:27 -070051 virtual CPDF_Annot::Subtype GetAnnotSubtype() const;
jaepark9ed91372016-08-26 16:16:10 -070052 virtual bool IsSignatureWidget() const;
jaepark27362762016-08-11 13:10:39 -070053 virtual CFX_FloatRect GetRect() const;
54
55 virtual void SetRect(const CFX_FloatRect& rect);
56 virtual void Annot_OnDraw(CFX_RenderDevice* pDevice,
57 CFX_Matrix* pUser2Device,
58 CPDF_RenderOptions* pOptions);
59
60 UnderlyingPageType* GetUnderlyingPage();
61 CPDF_Page* GetPDFPage();
62#ifdef PDF_ENABLE_XFA
63 CPDFXFA_Page* GetPDFXFAPage();
64#endif // PDF_ENABLE_XFA
65
66 void SetPage(CPDFSDK_PageView* pPageView);
67 CPDFSDK_PageView* GetPageView() const { return m_pPageView; }
68
jaepark27362762016-08-11 13:10:39 -070069 FX_BOOL IsSelected();
70 void SetSelected(FX_BOOL bSelected);
71
72 protected:
dsinclairce04a452016-09-07 05:46:55 -070073 std::set<Observer*> m_Observers;
jaepark27362762016-08-11 13:10:39 -070074 CPDFSDK_PageView* m_pPageView;
75 FX_BOOL m_bSelected;
jaepark27362762016-08-11 13:10:39 -070076};
77
78#endif // FPDFSDK_INCLUDE_CPDFSDK_ANNOT_H_