| 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/include/cpdfsdk_annot.h" | 7 #include "fpdfsdk/include/cpdfsdk_annot.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "fpdfsdk/include/fsdk_mgr.h" | 11 #include "fpdfsdk/include/fsdk_mgr.h" |
| 12 #include "third_party/base/stl_util.h" |
| 12 | 13 |
| 13 #ifdef PDF_ENABLE_XFA | 14 #ifdef PDF_ENABLE_XFA |
| 14 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" | 15 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" |
| 15 #endif // PDF_ENABLE_XFA | 16 #endif // PDF_ENABLE_XFA |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 const float kMinWidth = 1.0f; | 20 const float kMinWidth = 1.0f; |
| 20 const float kMinHeight = 1.0f; | 21 const float kMinHeight = 1.0f; |
| 21 | 22 |
| 22 } // namespace | 23 } // namespace |
| 23 | 24 |
| 25 CPDFSDK_Annot::Observer::~Observer() {} |
| 26 |
| 24 CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView) | 27 CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView) |
| 25 : m_pPageView(pPageView), m_bSelected(FALSE) {} | 28 : m_pPageView(pPageView), m_bSelected(FALSE) {} |
| 26 | 29 |
| 27 CPDFSDK_Annot::~CPDFSDK_Annot() {} | 30 CPDFSDK_Annot::~CPDFSDK_Annot() { |
| 31 for (auto* pObserver : m_Observers) |
| 32 pObserver->OnAnnotDestroyed(); |
| 33 } |
| 34 |
| 35 void CPDFSDK_Annot::AddObserver(Observer* pObserver) { |
| 36 ASSERT(!pdfium::ContainsKey(m_Observers, pObserver)); |
| 37 m_Observers.insert(pObserver); |
| 38 } |
| 39 |
| 40 void CPDFSDK_Annot::RemoveObserver(Observer* pObserver) { |
| 41 ASSERT(pdfium::ContainsKey(m_Observers, pObserver)); |
| 42 m_Observers.erase(pObserver); |
| 43 } |
| 28 | 44 |
| 29 #ifdef PDF_ENABLE_XFA | 45 #ifdef PDF_ENABLE_XFA |
| 30 | 46 |
| 31 FX_BOOL CPDFSDK_Annot::IsXFAField() { | 47 FX_BOOL CPDFSDK_Annot::IsXFAField() { |
| 32 return FALSE; | 48 return FALSE; |
| 33 } | 49 } |
| 34 | 50 |
| 35 CXFA_FFWidget* CPDFSDK_Annot::GetXFAWidget() const { | 51 CXFA_FFWidget* CPDFSDK_Annot::GetXFAWidget() const { |
| 36 return nullptr; | 52 return nullptr; |
| 37 } | 53 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 #ifdef PDF_ENABLE_XFA | 104 #ifdef PDF_ENABLE_XFA |
| 89 return GetPDFXFAPage(); | 105 return GetPDFXFAPage(); |
| 90 #else // PDF_ENABLE_XFA | 106 #else // PDF_ENABLE_XFA |
| 91 return GetPDFPage(); | 107 return GetPDFPage(); |
| 92 #endif // PDF_ENABLE_XFA | 108 #endif // PDF_ENABLE_XFA |
| 93 } | 109 } |
| 94 | 110 |
| 95 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { | 111 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |
| 96 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; | 112 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; |
| 97 } | 113 } |
| OLD | NEW |