blob: 5ca439d8f70f848e8a0ae25c537303bb5979793a [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#include "fpdfsdk/include/cpdfsdk_annot.h"
8
9#include <algorithm>
10
11#include "fpdfsdk/include/fsdk_mgr.h"
12
13#ifdef PDF_ENABLE_XFA
14#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h"
15#endif // PDF_ENABLE_XFA
16
17namespace {
18
19const float kMinWidth = 1.0f;
20const float kMinHeight = 1.0f;
21
22} // namespace
23
24CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView)
jaeparkd99a8332016-08-25 13:02:39 -070025 : m_pPageView(pPageView), m_bSelected(FALSE) {}
jaepark27362762016-08-11 13:10:39 -070026
27CPDFSDK_Annot::~CPDFSDK_Annot() {}
28
29#ifdef PDF_ENABLE_XFA
30
31FX_BOOL CPDFSDK_Annot::IsXFAField() {
32 return FALSE;
33}
34
35CXFA_FFWidget* CPDFSDK_Annot::GetXFAWidget() const {
36 return nullptr;
37}
38
39CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() {
40 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr;
41}
42
43#endif // PDF_ENABLE_XFA
44
45FX_FLOAT CPDFSDK_Annot::GetMinWidth() const {
46 return kMinWidth;
47}
48
49FX_FLOAT CPDFSDK_Annot::GetMinHeight() const {
50 return kMinHeight;
51}
52
53int CPDFSDK_Annot::GetLayoutOrder() const {
54 return 5;
55}
56
57CPDF_Annot* CPDFSDK_Annot::GetPDFAnnot() const {
58 return nullptr;
59}
60
jaepark9ed91372016-08-26 16:16:10 -070061CFX_ByteString CPDFSDK_Annot::GetAnnotSubtype() const {
jaepark27362762016-08-11 13:10:39 -070062 return "";
63}
64
jaepark9ed91372016-08-26 16:16:10 -070065bool CPDFSDK_Annot::IsSignatureWidget() const {
66 return false;
jaepark27362762016-08-11 13:10:39 -070067}
68
69void CPDFSDK_Annot::SetRect(const CFX_FloatRect& rect) {}
70
71CFX_FloatRect CPDFSDK_Annot::GetRect() const {
72 return CFX_FloatRect();
73}
74
75void CPDFSDK_Annot::Annot_OnDraw(CFX_RenderDevice* pDevice,
76 CFX_Matrix* pUser2Device,
77 CPDF_RenderOptions* pOptions) {}
78
79FX_BOOL CPDFSDK_Annot::IsSelected() {
80 return m_bSelected;
81}
82
83void CPDFSDK_Annot::SetSelected(FX_BOOL bSelected) {
84 m_bSelected = bSelected;
85}
86
jaepark27362762016-08-11 13:10:39 -070087UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() {
88#ifdef PDF_ENABLE_XFA
89 return GetPDFXFAPage();
90#else // PDF_ENABLE_XFA
91 return GetPDFPage();
92#endif // PDF_ENABLE_XFA
93}
94
95CPDF_Page* CPDFSDK_Annot::GetPDFPage() {
96 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr;
97}