OLD | NEW |
(Empty) | |
| 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) |
| 25 : m_pPageView(pPageView), m_bSelected(FALSE), m_nTabOrder(-1) {} |
| 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 |
| 61 CFX_ByteString CPDFSDK_Annot::GetType() const { |
| 62 return ""; |
| 63 } |
| 64 |
| 65 CFX_ByteString CPDFSDK_Annot::GetSubType() const { |
| 66 return ""; |
| 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 |
| 87 int CPDFSDK_Annot::GetTabOrder() { |
| 88 return m_nTabOrder; |
| 89 } |
| 90 |
| 91 void CPDFSDK_Annot::SetTabOrder(int iTabOrder) { |
| 92 m_nTabOrder = iTabOrder; |
| 93 } |
| 94 |
| 95 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() { |
| 96 #ifdef PDF_ENABLE_XFA |
| 97 return GetPDFXFAPage(); |
| 98 #else // PDF_ENABLE_XFA |
| 99 return GetPDFPage(); |
| 100 #endif // PDF_ENABLE_XFA |
| 101 } |
| 102 |
| 103 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |
| 104 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; |
| 105 } |
OLD | NEW |