| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "fpdfsdk/cpdfsdk_annot.h" | 7 #include "fpdfsdk/cpdfsdk_annot.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "fpdfsdk/cpdfsdk_pageview.h" | 11 #include "fpdfsdk/cpdfsdk_pageview.h" |
| 12 #include "third_party/base/stl_util.h" | 12 #include "third_party/base/stl_util.h" |
| 13 | 13 |
| 14 #ifdef PDF_ENABLE_XFA | 14 #ifdef PDF_ENABLE_XFA |
| 15 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" | 15 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" |
| 16 #endif // PDF_ENABLE_XFA | 16 #endif // PDF_ENABLE_XFA |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 const float kMinWidth = 1.0f; | 20 const float kMinWidth = 1.0f; |
| 21 const float kMinHeight = 1.0f; | 21 const float kMinHeight = 1.0f; |
| 22 | 22 |
| 23 } // namespace | 23 } // namespace |
| 24 | 24 |
| 25 CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView) | 25 CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView) |
| 26 : m_pPageView(pPageView), m_bSelected(FALSE) {} | 26 : m_pPageView(pPageView), m_bSelected(false) {} |
| 27 | 27 |
| 28 CPDFSDK_Annot::~CPDFSDK_Annot() {} | 28 CPDFSDK_Annot::~CPDFSDK_Annot() {} |
| 29 | 29 |
| 30 #ifdef PDF_ENABLE_XFA | 30 #ifdef PDF_ENABLE_XFA |
| 31 | 31 |
| 32 FX_BOOL CPDFSDK_Annot::IsXFAField() { | 32 bool CPDFSDK_Annot::IsXFAField() { |
| 33 return FALSE; | 33 return false; |
| 34 } | 34 } |
| 35 | 35 |
| 36 CXFA_FFWidget* CPDFSDK_Annot::GetXFAWidget() const { | 36 CXFA_FFWidget* CPDFSDK_Annot::GetXFAWidget() const { |
| 37 return nullptr; | 37 return nullptr; |
| 38 } | 38 } |
| 39 | 39 |
| 40 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { | 40 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { |
| 41 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; | 41 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; |
| 42 } | 42 } |
| 43 | 43 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 70 void CPDFSDK_Annot::SetRect(const CFX_FloatRect& rect) {} | 70 void CPDFSDK_Annot::SetRect(const CFX_FloatRect& rect) {} |
| 71 | 71 |
| 72 CFX_FloatRect CPDFSDK_Annot::GetRect() const { | 72 CFX_FloatRect CPDFSDK_Annot::GetRect() const { |
| 73 return CFX_FloatRect(); | 73 return CFX_FloatRect(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void CPDFSDK_Annot::Annot_OnDraw(CFX_RenderDevice* pDevice, | 76 void CPDFSDK_Annot::Annot_OnDraw(CFX_RenderDevice* pDevice, |
| 77 CFX_Matrix* pUser2Device, | 77 CFX_Matrix* pUser2Device, |
| 78 CPDF_RenderOptions* pOptions) {} | 78 CPDF_RenderOptions* pOptions) {} |
| 79 | 79 |
| 80 FX_BOOL CPDFSDK_Annot::IsSelected() { | 80 bool CPDFSDK_Annot::IsSelected() { |
| 81 return m_bSelected; | 81 return m_bSelected; |
| 82 } | 82 } |
| 83 | 83 |
| 84 void CPDFSDK_Annot::SetSelected(FX_BOOL bSelected) { | 84 void CPDFSDK_Annot::SetSelected(bool bSelected) { |
| 85 m_bSelected = bSelected; | 85 m_bSelected = bSelected; |
| 86 } | 86 } |
| 87 | 87 |
| 88 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() { | 88 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() { |
| 89 #ifdef PDF_ENABLE_XFA | 89 #ifdef PDF_ENABLE_XFA |
| 90 return GetPDFXFAPage(); | 90 return GetPDFXFAPage(); |
| 91 #else // PDF_ENABLE_XFA | 91 #else // PDF_ENABLE_XFA |
| 92 return GetPDFPage(); | 92 return GetPDFPage(); |
| 93 #endif // PDF_ENABLE_XFA | 93 #endif // PDF_ENABLE_XFA |
| 94 } | 94 } |
| 95 | 95 |
| 96 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { | 96 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |
| 97 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; | 97 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; |
| 98 } | 98 } |
| OLD | NEW |