summaryrefslogtreecommitdiff
path: root/fpdfsdk/include/cpdfsdk_annot.h
blob: a43b8775dbbb3b581f67a35999c4324c7c781959 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright 2016 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#ifndef FPDFSDK_INCLUDE_CPDFSDK_ANNOT_H_
#define FPDFSDK_INCLUDE_CPDFSDK_ANNOT_H_

#include "core/fpdfdoc/include/cpdf_aaction.h"
#include "core/fpdfdoc/include/cpdf_annot.h"
#include "core/fpdfdoc/include/cpdf_defaultappearance.h"
#include "core/fxcrt/include/fx_basic.h"
#include "fpdfsdk/cfx_systemhandler.h"
#include "fpdfsdk/include/fsdk_common.h"
#include "fpdfsdk/include/fsdk_define.h"

class CFX_Matrix;
class CFX_RenderDevice;
class CPDF_Page;
class CPDF_RenderOptions;
class CPDFSDK_PageView;

class CPDFSDK_Annot {
 public:
  class Observer {
   public:
    explicit Observer(CPDFSDK_Annot** pWatchedPtr);
    ~Observer();
    void OnAnnotDestroyed();

   private:
    CPDFSDK_Annot** m_pWatchedPtr;
  };

  explicit CPDFSDK_Annot(CPDFSDK_PageView* pPageView);
  virtual ~CPDFSDK_Annot();

  void AddObserver(Observer* observer);
  void RemoveObserver(Observer* observer);

#ifdef PDF_ENABLE_XFA
  virtual FX_BOOL IsXFAField();
  virtual CXFA_FFWidget* GetXFAWidget() const;
#endif  // PDF_ENABLE_XFA

  virtual FX_FLOAT GetMinWidth() const;
  virtual FX_FLOAT GetMinHeight() const;
  virtual int GetLayoutOrder() const;
  virtual CPDF_Annot* GetPDFAnnot() const;
  virtual CPDF_Annot::Subtype GetAnnotSubtype() const;
  virtual bool IsSignatureWidget() const;
  virtual CFX_FloatRect GetRect() const;

  virtual void SetRect(const CFX_FloatRect& rect);
  virtual void Annot_OnDraw(CFX_RenderDevice* pDevice,
                            CFX_Matrix* pUser2Device,
                            CPDF_RenderOptions* pOptions);

  UnderlyingPageType* GetUnderlyingPage();
  CPDF_Page* GetPDFPage();
#ifdef PDF_ENABLE_XFA
  CPDFXFA_Page* GetPDFXFAPage();
#endif  // PDF_ENABLE_XFA

  void SetPage(CPDFSDK_PageView* pPageView);
  CPDFSDK_PageView* GetPageView() const { return m_pPageView; }

  FX_BOOL IsSelected();
  void SetSelected(FX_BOOL bSelected);

 protected:
  std::set<Observer*> m_Observers;
  CPDFSDK_PageView* m_pPageView;
  FX_BOOL m_bSelected;
};

#endif  // FPDFSDK_INCLUDE_CPDFSDK_ANNOT_H_