jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 1 | // 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 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 7 | #include "fpdfsdk/cpdfsdk_annot.h" |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 8 | |
| 9 | #include <algorithm> |
| 10 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 11 | #include "fpdfsdk/cpdfsdk_pageview.h" |
dsinclair | ce04a45 | 2016-09-07 05:46:55 -0700 | [diff] [blame] | 12 | #include "third_party/base/stl_util.h" |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 13 | |
| 14 | #ifdef PDF_ENABLE_XFA |
dsinclair | 521b750 | 2016-11-02 13:02:28 -0700 | [diff] [blame] | 15 | #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 16 | #endif // PDF_ENABLE_XFA |
| 17 | |
| 18 | namespace { |
| 19 | |
| 20 | const float kMinWidth = 1.0f; |
| 21 | const float kMinHeight = 1.0f; |
| 22 | |
| 23 | } // namespace |
| 24 | |
| 25 | CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView) |
Lei Zhang | 3db8759 | 2017-06-02 12:48:22 -0700 | [diff] [blame] | 26 | : m_pPageView(pPageView) {} |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 27 | |
tsepez | 7b68f61 | 2016-09-07 14:11:27 -0700 | [diff] [blame] | 28 | CPDFSDK_Annot::~CPDFSDK_Annot() {} |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 29 | |
| 30 | #ifdef PDF_ENABLE_XFA |
| 31 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 32 | bool CPDFSDK_Annot::IsXFAField() { |
| 33 | return false; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | CXFA_FFWidget* CPDFSDK_Annot::GetXFAWidget() const { |
| 37 | return nullptr; |
| 38 | } |
| 39 | |
| 40 | CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { |
| 41 | return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; |
| 42 | } |
| 43 | |
| 44 | #endif // PDF_ENABLE_XFA |
| 45 | |
Dan Sinclair | 05df075 | 2017-03-14 14:43:42 -0400 | [diff] [blame] | 46 | float CPDFSDK_Annot::GetMinWidth() const { |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 47 | return kMinWidth; |
| 48 | } |
| 49 | |
Dan Sinclair | 05df075 | 2017-03-14 14:43:42 -0400 | [diff] [blame] | 50 | float CPDFSDK_Annot::GetMinHeight() const { |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 51 | return kMinHeight; |
| 52 | } |
| 53 | |
| 54 | int CPDFSDK_Annot::GetLayoutOrder() const { |
| 55 | return 5; |
| 56 | } |
| 57 | |
| 58 | CPDF_Annot* CPDFSDK_Annot::GetPDFAnnot() const { |
| 59 | return nullptr; |
| 60 | } |
| 61 | |
jaepark | 956553e | 2016-08-31 06:49:27 -0700 | [diff] [blame] | 62 | CPDF_Annot::Subtype CPDFSDK_Annot::GetAnnotSubtype() const { |
| 63 | return CPDF_Annot::Subtype::UNKNOWN; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 64 | } |
| 65 | |
jaepark | 9ed9137 | 2016-08-26 16:16:10 -0700 | [diff] [blame] | 66 | bool CPDFSDK_Annot::IsSignatureWidget() const { |
| 67 | return false; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | void CPDFSDK_Annot::SetRect(const CFX_FloatRect& rect) {} |
| 71 | |
| 72 | CFX_FloatRect CPDFSDK_Annot::GetRect() const { |
| 73 | return CFX_FloatRect(); |
| 74 | } |
| 75 | |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 76 | UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() { |
| 77 | #ifdef PDF_ENABLE_XFA |
| 78 | return GetPDFXFAPage(); |
| 79 | #else // PDF_ENABLE_XFA |
| 80 | return GetPDFPage(); |
| 81 | #endif // PDF_ENABLE_XFA |
| 82 | } |
| 83 | |
| 84 | CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |
| 85 | return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; |
| 86 | } |