| 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 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 m_pAnnotList.reset(new CPDF_AnnotList(m_page)); | 1066 m_pAnnotList.reset(new CPDF_AnnotList(m_page)); |
| 1067 CPDF_InterForm::EnableUpdateAP(enableAPUpdate); | 1067 CPDF_InterForm::EnableUpdateAP(enableAPUpdate); |
| 1068 const size_t nCount = m_pAnnotList->Count(); | 1068 const size_t nCount = m_pAnnotList->Count(); |
| 1069 #endif // PDF_ENABLE_XFA | 1069 #endif // PDF_ENABLE_XFA |
| 1070 | 1070 |
| 1071 SetLock(TRUE); | 1071 SetLock(TRUE); |
| 1072 | 1072 |
| 1073 #ifdef PDF_ENABLE_XFA | 1073 #ifdef PDF_ENABLE_XFA |
| 1074 m_page->AddRef(); | 1074 m_page->AddRef(); |
| 1075 if (m_pSDKDoc->GetXFADocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) { | 1075 if (m_pSDKDoc->GetXFADocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) { |
| 1076 IXFA_PageView* pageView = NULL; | 1076 IXFA_PageView* pageView = m_page->GetXFAPageView(); |
| 1077 pageView = m_page->GetXFAPageView(); | |
| 1078 ASSERT(pageView != NULL); | |
| 1079 | |
| 1080 IXFA_WidgetIterator* pWidgetHander = pageView->CreateWidgetIterator( | 1077 IXFA_WidgetIterator* pWidgetHander = pageView->CreateWidgetIterator( |
| 1081 XFA_TRAVERSEWAY_Form, XFA_WIDGETFILTER_Visible | | 1078 XFA_TRAVERSEWAY_Form, XFA_WIDGETFILTER_Visible | |
| 1082 XFA_WIDGETFILTER_Viewable | | 1079 XFA_WIDGETFILTER_Viewable | |
| 1083 XFA_WIDGETFILTER_AllType); | 1080 XFA_WIDGETFILTER_AllType); |
| 1084 if (!pWidgetHander) { | 1081 if (!pWidgetHander) { |
| 1085 m_page->Release(); | 1082 m_page->Release(); |
| 1086 SetLock(FALSE); | 1083 SetLock(FALSE); |
| 1087 return; | 1084 return; |
| 1088 } | 1085 } |
| 1089 | 1086 |
| 1090 while (IXFA_Widget* pXFAAnnot = pWidgetHander->MoveToNext()) { | 1087 while (IXFA_Widget* pXFAAnnot = pWidgetHander->MoveToNext()) { |
| 1091 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pXFAAnnot, this); | 1088 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pXFAAnnot, this); |
| 1092 if (!pAnnot) | 1089 if (!pAnnot) |
| 1093 continue; | 1090 continue; |
| 1094 | 1091 |
| 1095 m_fxAnnotArray.push_back(pAnnot); | 1092 m_fxAnnotArray.push_back(pAnnot); |
| 1096 pAnnotHandlerMgr->Annot_OnLoad(pAnnot); | 1093 pAnnotHandlerMgr->Annot_OnLoad(pAnnot); |
| 1097 } | 1094 } |
| 1098 pWidgetHander->Release(); | 1095 pWidgetHander->Release(); |
| 1099 } else { | 1096 } else { |
| 1100 CPDF_Page* pPage = m_page->GetPDFPage(); | 1097 CPDF_Page* pPage = m_page->GetPDFPage(); |
| 1101 ASSERT(pPage != NULL); | 1098 ASSERT(pPage); |
| 1102 FX_BOOL enableAPUpdate = CPDF_InterForm::UpdatingAPEnabled(); | 1099 FX_BOOL enableAPUpdate = CPDF_InterForm::UpdatingAPEnabled(); |
| 1103 // Disable the default AP construction. | 1100 // Disable the default AP construction. |
| 1104 CPDF_InterForm::EnableUpdateAP(FALSE); | 1101 CPDF_InterForm::EnableUpdateAP(FALSE); |
| 1105 m_pAnnotList.reset(new CPDF_AnnotList(pPage)); | 1102 m_pAnnotList.reset(new CPDF_AnnotList(pPage)); |
| 1106 CPDF_InterForm::EnableUpdateAP(enableAPUpdate); | 1103 CPDF_InterForm::EnableUpdateAP(enableAPUpdate); |
| 1107 | 1104 |
| 1108 const size_t nCount = m_pAnnotList->Count(); | 1105 const size_t nCount = m_pAnnotList->Count(); |
| 1109 for (size_t i = 0; i < nCount; ++i) { | 1106 for (size_t i = 0; i < nCount; ++i) { |
| 1110 CPDF_Annot* pPDFAnnot = m_pAnnotList->GetAt(i); | 1107 CPDF_Annot* pPDFAnnot = m_pAnnotList->GetAt(i); |
| 1111 CheckUnSupportAnnot(GetPDFDocument(), pPDFAnnot); | 1108 CheckUnSupportAnnot(GetPDFDocument(), pPDFAnnot); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); | 1186 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); |
| 1190 if (!pFocusAnnot) | 1187 if (!pFocusAnnot) |
| 1191 return nullptr; | 1188 return nullptr; |
| 1192 | 1189 |
| 1193 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { | 1190 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { |
| 1194 if (pAnnot == pFocusAnnot) | 1191 if (pAnnot == pFocusAnnot) |
| 1195 return pAnnot; | 1192 return pAnnot; |
| 1196 } | 1193 } |
| 1197 return nullptr; | 1194 return nullptr; |
| 1198 } | 1195 } |
| OLD | NEW |