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 | |
| 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 | |
| 17 | namespace { |
| 18 | |
| 19 | const float kMinWidth = 1.0f; |
| 20 | const float kMinHeight = 1.0f; |
| 21 | |
| 22 | } // namespace |
| 23 | |
| 24 | CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView) |
jaepark | d99a833 | 2016-08-25 13:02:39 -0700 | [diff] [blame] | 25 | : m_pPageView(pPageView), m_bSelected(FALSE) {} |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 26 | |
| 27 | CPDFSDK_Annot::~CPDFSDK_Annot() {} |
| 28 | |
| 29 | #ifdef PDF_ENABLE_XFA |
| 30 | |
| 31 | FX_BOOL CPDFSDK_Annot::IsXFAField() { |
| 32 | return FALSE; |
| 33 | } |
| 34 | |
| 35 | CXFA_FFWidget* CPDFSDK_Annot::GetXFAWidget() const { |
| 36 | return nullptr; |
| 37 | } |
| 38 | |
| 39 | CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { |
| 40 | return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; |
| 41 | } |
| 42 | |
| 43 | #endif // PDF_ENABLE_XFA |
| 44 | |
| 45 | FX_FLOAT CPDFSDK_Annot::GetMinWidth() const { |
| 46 | return kMinWidth; |
| 47 | } |
| 48 | |
| 49 | FX_FLOAT CPDFSDK_Annot::GetMinHeight() const { |
| 50 | return kMinHeight; |
| 51 | } |
| 52 | |
| 53 | int CPDFSDK_Annot::GetLayoutOrder() const { |
| 54 | return 5; |
| 55 | } |
| 56 | |
| 57 | CPDF_Annot* CPDFSDK_Annot::GetPDFAnnot() const { |
| 58 | return nullptr; |
| 59 | } |
| 60 | |
jaepark | 9ed9137 | 2016-08-26 16:16:10 -0700 | [diff] [blame^] | 61 | CFX_ByteString CPDFSDK_Annot::GetAnnotSubtype() const { |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 62 | return ""; |
| 63 | } |
| 64 | |
jaepark | 9ed9137 | 2016-08-26 16:16:10 -0700 | [diff] [blame^] | 65 | bool CPDFSDK_Annot::IsSignatureWidget() const { |
| 66 | return false; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | void CPDFSDK_Annot::SetRect(const CFX_FloatRect& rect) {} |
| 70 | |
| 71 | CFX_FloatRect CPDFSDK_Annot::GetRect() const { |
| 72 | return CFX_FloatRect(); |
| 73 | } |
| 74 | |
| 75 | void CPDFSDK_Annot::Annot_OnDraw(CFX_RenderDevice* pDevice, |
| 76 | CFX_Matrix* pUser2Device, |
| 77 | CPDF_RenderOptions* pOptions) {} |
| 78 | |
| 79 | FX_BOOL CPDFSDK_Annot::IsSelected() { |
| 80 | return m_bSelected; |
| 81 | } |
| 82 | |
| 83 | void CPDFSDK_Annot::SetSelected(FX_BOOL bSelected) { |
| 84 | m_bSelected = bSelected; |
| 85 | } |
| 86 | |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 87 | UnderlyingPageType* 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 | |
| 95 | CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |
| 96 | return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; |
| 97 | } |