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" |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 12 | |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 13 | CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView) |
Lei Zhang | 3db8759 | 2017-06-02 12:48:22 -0700 | [diff] [blame] | 14 | : m_pPageView(pPageView) {} |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 15 | |
tsepez | 7b68f61 | 2016-09-07 14:11:27 -0700 | [diff] [blame] | 16 | CPDFSDK_Annot::~CPDFSDK_Annot() {} |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 17 | |
Tom Sepez | 522d77d | 2018-07-28 00:00:25 +0000 | [diff] [blame] | 18 | CPDFSDK_BAAnnot* CPDFSDK_Annot::AsBAAnnot() { |
| 19 | return nullptr; |
| 20 | } |
| 21 | |
Tom Sepez | 451ed2d | 2019-08-19 22:55:31 +0000 | [diff] [blame^] | 22 | CPDFXFA_Widget* CPDFSDK_Annot::AsXFAWidget() { |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 23 | return nullptr; |
| 24 | } |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 25 | |
Tom Sepez | 9bf0181 | 2019-08-19 18:59:27 +0000 | [diff] [blame] | 26 | IPDF_Page* CPDFSDK_Annot::GetXFAPage() { |
| 27 | #ifdef PDF_ENABLE_XFA |
| 28 | if (m_pPageView) |
| 29 | return m_pPageView->GetXFAPage(); |
| 30 | #endif |
| 31 | return nullptr; |
| 32 | } |
| 33 | |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 34 | int CPDFSDK_Annot::GetLayoutOrder() const { |
| 35 | return 5; |
| 36 | } |
| 37 | |
| 38 | CPDF_Annot* CPDFSDK_Annot::GetPDFAnnot() const { |
| 39 | return nullptr; |
| 40 | } |
| 41 | |
jaepark | 956553e | 2016-08-31 06:49:27 -0700 | [diff] [blame] | 42 | CPDF_Annot::Subtype CPDFSDK_Annot::GetAnnotSubtype() const { |
| 43 | return CPDF_Annot::Subtype::UNKNOWN; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 44 | } |
| 45 | |
jaepark | 9ed9137 | 2016-08-26 16:16:10 -0700 | [diff] [blame] | 46 | bool CPDFSDK_Annot::IsSignatureWidget() const { |
| 47 | return false; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | void CPDFSDK_Annot::SetRect(const CFX_FloatRect& rect) {} |
| 51 | |
| 52 | CFX_FloatRect CPDFSDK_Annot::GetRect() const { |
| 53 | return CFX_FloatRect(); |
| 54 | } |
| 55 | |
Tom Sepez | 101535f | 2018-06-12 13:36:05 +0000 | [diff] [blame] | 56 | IPDF_Page* CPDFSDK_Annot::GetPage() { |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 57 | #ifdef PDF_ENABLE_XFA |
Tom Sepez | 9bf0181 | 2019-08-19 18:59:27 +0000 | [diff] [blame] | 58 | IPDF_Page* pXFAPage = GetXFAPage(); |
Tom Sepez | 8e63177 | 2018-06-13 21:26:56 +0000 | [diff] [blame] | 59 | if (pXFAPage) |
| 60 | return pXFAPage; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 61 | #endif // PDF_ENABLE_XFA |
Tom Sepez | 8e63177 | 2018-06-13 21:26:56 +0000 | [diff] [blame] | 62 | return GetPDFPage(); |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |
| 66 | return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; |
| 67 | } |