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 "fpdfsdk/include/fsdk_mgr.h" | 7 #include "fpdfsdk/include/fsdk_mgr.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 CPDF_InterForm::EnableUpdateAP(enableAPUpdate); | 898 CPDF_InterForm::EnableUpdateAP(enableAPUpdate); |
899 const size_t nCount = m_pAnnotList->Count(); | 899 const size_t nCount = m_pAnnotList->Count(); |
900 #endif // PDF_ENABLE_XFA | 900 #endif // PDF_ENABLE_XFA |
901 | 901 |
902 SetLock(TRUE); | 902 SetLock(TRUE); |
903 | 903 |
904 #ifdef PDF_ENABLE_XFA | 904 #ifdef PDF_ENABLE_XFA |
905 m_page->AddRef(); | 905 m_page->AddRef(); |
906 if (m_pSDKDoc->GetXFADocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) { | 906 if (m_pSDKDoc->GetXFADocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) { |
907 CXFA_FFPageView* pageView = m_page->GetXFAPageView(); | 907 CXFA_FFPageView* pageView = m_page->GetXFAPageView(); |
908 IXFA_WidgetIterator* pWidgetHander = pageView->CreateWidgetIterator( | 908 std::unique_ptr<IXFA_WidgetIterator> pWidgetHander( |
909 XFA_TRAVERSEWAY_Form, XFA_WIDGETFILTER_Visible | | 909 pageView->CreateWidgetIterator(XFA_TRAVERSEWAY_Form, |
910 XFA_WIDGETFILTER_Viewable | | 910 XFA_WIDGETFILTER_Visible | |
911 XFA_WIDGETFILTER_AllType); | 911 XFA_WIDGETFILTER_Viewable | |
| 912 XFA_WIDGETFILTER_AllType)); |
912 if (!pWidgetHander) { | 913 if (!pWidgetHander) { |
913 m_page->Release(); | 914 m_page->Release(); |
914 SetLock(FALSE); | 915 SetLock(FALSE); |
915 return; | 916 return; |
916 } | 917 } |
917 | 918 |
918 while (CXFA_FFWidget* pXFAAnnot = pWidgetHander->MoveToNext()) { | 919 while (CXFA_FFWidget* pXFAAnnot = pWidgetHander->MoveToNext()) { |
919 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pXFAAnnot, this); | 920 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pXFAAnnot, this); |
920 if (!pAnnot) | 921 if (!pAnnot) |
921 continue; | 922 continue; |
922 | |
923 m_fxAnnotArray.push_back(pAnnot); | 923 m_fxAnnotArray.push_back(pAnnot); |
924 pAnnotHandlerMgr->Annot_OnLoad(pAnnot); | 924 pAnnotHandlerMgr->Annot_OnLoad(pAnnot); |
925 } | 925 } |
926 pWidgetHander->Release(); | |
927 } else { | 926 } else { |
928 CPDF_Page* pPage = m_page->GetPDFPage(); | 927 CPDF_Page* pPage = m_page->GetPDFPage(); |
929 ASSERT(pPage); | 928 ASSERT(pPage); |
930 FX_BOOL enableAPUpdate = CPDF_InterForm::UpdatingAPEnabled(); | 929 FX_BOOL enableAPUpdate = CPDF_InterForm::UpdatingAPEnabled(); |
931 // Disable the default AP construction. | 930 // Disable the default AP construction. |
932 CPDF_InterForm::EnableUpdateAP(FALSE); | 931 CPDF_InterForm::EnableUpdateAP(FALSE); |
933 m_pAnnotList.reset(new CPDF_AnnotList(pPage)); | 932 m_pAnnotList.reset(new CPDF_AnnotList(pPage)); |
934 CPDF_InterForm::EnableUpdateAP(enableAPUpdate); | 933 CPDF_InterForm::EnableUpdateAP(enableAPUpdate); |
935 | 934 |
936 const size_t nCount = m_pAnnotList->Count(); | 935 const size_t nCount = m_pAnnotList->Count(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); | 1014 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); |
1016 if (!pFocusAnnot) | 1015 if (!pFocusAnnot) |
1017 return nullptr; | 1016 return nullptr; |
1018 | 1017 |
1019 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { | 1018 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { |
1020 if (pAnnot == pFocusAnnot) | 1019 if (pAnnot == pFocusAnnot) |
1021 return pAnnot; | 1020 return pAnnot; |
1022 } | 1021 } |
1023 return nullptr; | 1022 return nullptr; |
1024 } | 1023 } |
OLD | NEW |