OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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 <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "fpdfsdk/include/fsdk_mgr.h" | 10 #include "fpdfsdk/include/fsdk_mgr.h" |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 | 847 |
848 FX_BOOL CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) { | 848 FX_BOOL CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) { |
849 #ifdef PDF_ENABLE_XFA | 849 #ifdef PDF_ENABLE_XFA |
850 if (!pAnnot) | 850 if (!pAnnot) |
851 return FALSE; | 851 return FALSE; |
852 CPDFXFA_Page* pPage = pAnnot->GetPDFXFAPage(); | 852 CPDFXFA_Page* pPage = pAnnot->GetPDFXFAPage(); |
853 if (!pPage || (pPage->GetDocument()->GetDocType() != DOCTYPE_STATIC_XFA && | 853 if (!pPage || (pPage->GetDocument()->GetDocType() != DOCTYPE_STATIC_XFA && |
854 pPage->GetDocument()->GetDocType() != DOCTYPE_DYNAMIC_XFA)) | 854 pPage->GetDocument()->GetDocType() != DOCTYPE_DYNAMIC_XFA)) |
855 return FALSE; | 855 return FALSE; |
856 | 856 |
| 857 if (GetFocusAnnot() == pAnnot) |
| 858 KillFocusAnnot(); |
| 859 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 860 CPDFSDK_AnnotHandlerMgr* pAnnotHandler = pEnv->GetAnnotHandlerMgr(); |
| 861 if (pAnnotHandler) |
| 862 pAnnotHandler->ReleaseAnnot(pAnnot); |
| 863 |
857 auto it = std::find(m_fxAnnotArray.begin(), m_fxAnnotArray.end(), pAnnot); | 864 auto it = std::find(m_fxAnnotArray.begin(), m_fxAnnotArray.end(), pAnnot); |
858 if (it != m_fxAnnotArray.end()) | 865 if (it != m_fxAnnotArray.end()) |
859 m_fxAnnotArray.erase(it); | 866 m_fxAnnotArray.erase(it); |
860 if (m_CaptureWidget == pAnnot) | 867 if (m_CaptureWidget == pAnnot) |
861 m_CaptureWidget = nullptr; | 868 m_CaptureWidget = nullptr; |
862 | 869 |
863 return TRUE; | 870 return TRUE; |
864 #else // PDF_ENABLE_XFA | 871 #else // PDF_ENABLE_XFA |
865 return FALSE; | 872 return FALSE; |
866 #endif // PDF_ENABLE_XFA | 873 #endif // PDF_ENABLE_XFA |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); | 1196 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); |
1190 if (!pFocusAnnot) | 1197 if (!pFocusAnnot) |
1191 return nullptr; | 1198 return nullptr; |
1192 | 1199 |
1193 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { | 1200 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { |
1194 if (pAnnot == pFocusAnnot) | 1201 if (pAnnot == pFocusAnnot) |
1195 return pAnnot; | 1202 return pAnnot; |
1196 } | 1203 } |
1197 return nullptr; | 1204 return nullptr; |
1198 } | 1205 } |
OLD | NEW |