blob: 4e62d93cc10bb067301118ab77e67593a2573f1d [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#include "fpdfsdk/cpdfsdk_annot.h"
jaepark27362762016-08-11 13:10:39 -07008
9#include <algorithm>
10
dsinclair114e46a2016-09-29 17:18:21 -070011#include "fpdfsdk/cpdfsdk_pageview.h"
dsinclairce04a452016-09-07 05:46:55 -070012#include "third_party/base/stl_util.h"
jaepark27362762016-08-11 13:10:39 -070013
14#ifdef PDF_ENABLE_XFA
dsinclair521b7502016-11-02 13:02:28 -070015#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
jaepark27362762016-08-11 13:10:39 -070016#endif // PDF_ENABLE_XFA
17
18namespace {
19
20const float kMinWidth = 1.0f;
21const float kMinHeight = 1.0f;
22
23} // namespace
24
25CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView)
jaeparkd99a8332016-08-25 13:02:39 -070026 : m_pPageView(pPageView), m_bSelected(FALSE) {}
jaepark27362762016-08-11 13:10:39 -070027
tsepez7b68f612016-09-07 14:11:27 -070028CPDFSDK_Annot::~CPDFSDK_Annot() {}
jaepark27362762016-08-11 13:10:39 -070029
30#ifdef PDF_ENABLE_XFA
31
32FX_BOOL CPDFSDK_Annot::IsXFAField() {
33 return FALSE;
34}
35
36CXFA_FFWidget* CPDFSDK_Annot::GetXFAWidget() const {
37 return nullptr;
38}
39
40CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() {
41 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr;
42}
43
44#endif // PDF_ENABLE_XFA
45
46FX_FLOAT CPDFSDK_Annot::GetMinWidth() const {
47 return kMinWidth;
48}
49
50FX_FLOAT CPDFSDK_Annot::GetMinHeight() const {
51 return kMinHeight;
52}
53
54int CPDFSDK_Annot::GetLayoutOrder() const {
55 return 5;
56}
57
58CPDF_Annot* CPDFSDK_Annot::GetPDFAnnot() const {
59 return nullptr;
60}
61
jaepark956553e2016-08-31 06:49:27 -070062CPDF_Annot::Subtype CPDFSDK_Annot::GetAnnotSubtype() const {
63 return CPDF_Annot::Subtype::UNKNOWN;
jaepark27362762016-08-11 13:10:39 -070064}
65
jaepark9ed91372016-08-26 16:16:10 -070066bool CPDFSDK_Annot::IsSignatureWidget() const {
67 return false;
jaepark27362762016-08-11 13:10:39 -070068}
69
70void CPDFSDK_Annot::SetRect(const CFX_FloatRect& rect) {}
71
72CFX_FloatRect CPDFSDK_Annot::GetRect() const {
73 return CFX_FloatRect();
74}
75
76void CPDFSDK_Annot::Annot_OnDraw(CFX_RenderDevice* pDevice,
77 CFX_Matrix* pUser2Device,
78 CPDF_RenderOptions* pOptions) {}
79
80FX_BOOL CPDFSDK_Annot::IsSelected() {
81 return m_bSelected;
82}
83
84void CPDFSDK_Annot::SetSelected(FX_BOOL bSelected) {
85 m_bSelected = bSelected;
86}
87
jaepark27362762016-08-11 13:10:39 -070088UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() {
89#ifdef PDF_ENABLE_XFA
90 return GetPDFXFAPage();
91#else // PDF_ENABLE_XFA
92 return GetPDFPage();
93#endif // PDF_ENABLE_XFA
94}
95
96CPDF_Page* CPDFSDK_Annot::GetPDFPage() {
97 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr;
98}