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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 | 897 |
898 FX_BOOL CPDFSDK_PageView::OnKeyUp(int nKeyCode, int nFlag) { | 898 FX_BOOL CPDFSDK_PageView::OnKeyUp(int nKeyCode, int nFlag) { |
899 return FALSE; | 899 return FALSE; |
900 } | 900 } |
901 | 901 |
902 void CPDFSDK_PageView::LoadFXAnnots() { | 902 void CPDFSDK_PageView::LoadFXAnnots() { |
903 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 903 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
904 #ifdef PDF_ENABLE_XFA | 904 #ifdef PDF_ENABLE_XFA |
905 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); | 905 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
906 #else | 906 #else |
907 FX_BOOL enableAPUpdate = CPDF_InterForm::UpdatingAPEnabled(); | 907 FX_BOOL bUpdateAP = CPDF_InterForm::IsUpdateAPEnabled(); |
908 // Disable the default AP construction. | 908 // Disable the default AP construction. |
909 CPDF_InterForm::EnableUpdateAP(FALSE); | 909 CPDF_InterForm::SetUpdateAP(FALSE); |
910 m_pAnnotList.reset(new CPDF_AnnotList(m_page)); | 910 m_pAnnotList.reset(new CPDF_AnnotList(m_page)); |
911 CPDF_InterForm::EnableUpdateAP(enableAPUpdate); | 911 CPDF_InterForm::SetUpdateAP(bUpdateAP); |
912 const size_t nCount = m_pAnnotList->Count(); | 912 const size_t nCount = m_pAnnotList->Count(); |
913 #endif // PDF_ENABLE_XFA | 913 #endif // PDF_ENABLE_XFA |
914 | 914 |
915 SetLock(TRUE); | 915 SetLock(TRUE); |
916 | 916 |
917 #ifdef PDF_ENABLE_XFA | 917 #ifdef PDF_ENABLE_XFA |
918 CFX_RetainPtr<CPDFXFA_Page> protector(m_page); | 918 CFX_RetainPtr<CPDFXFA_Page> protector(m_page); |
919 if (m_pSDKDoc->GetXFADocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) { | 919 if (m_pSDKDoc->GetXFADocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) { |
920 CXFA_FFPageView* pageView = m_page->GetXFAPageView(); | 920 CXFA_FFPageView* pageView = m_page->GetXFAPageView(); |
921 std::unique_ptr<IXFA_WidgetIterator> pWidgetHander( | 921 std::unique_ptr<IXFA_WidgetIterator> pWidgetHander( |
922 pageView->CreateWidgetIterator( | 922 pageView->CreateWidgetIterator( |
923 XFA_TRAVERSEWAY_Form, | 923 XFA_TRAVERSEWAY_Form, |
924 XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable)); | 924 XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable)); |
925 if (!pWidgetHander) { | 925 if (!pWidgetHander) { |
926 SetLock(FALSE); | 926 SetLock(FALSE); |
927 return; | 927 return; |
928 } | 928 } |
929 | 929 |
930 while (CXFA_FFWidget* pXFAAnnot = pWidgetHander->MoveToNext()) { | 930 while (CXFA_FFWidget* pXFAAnnot = pWidgetHander->MoveToNext()) { |
931 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pXFAAnnot, this); | 931 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pXFAAnnot, this); |
932 if (!pAnnot) | 932 if (!pAnnot) |
933 continue; | 933 continue; |
934 m_fxAnnotArray.push_back(pAnnot); | 934 m_fxAnnotArray.push_back(pAnnot); |
935 pAnnotHandlerMgr->Annot_OnLoad(pAnnot); | 935 pAnnotHandlerMgr->Annot_OnLoad(pAnnot); |
936 } | 936 } |
937 } else { | 937 } else { |
938 CPDF_Page* pPage = m_page->GetPDFPage(); | 938 CPDF_Page* pPage = m_page->GetPDFPage(); |
939 ASSERT(pPage); | 939 ASSERT(pPage); |
940 FX_BOOL enableAPUpdate = CPDF_InterForm::UpdatingAPEnabled(); | 940 FX_BOOL bUpdateAP = CPDF_InterForm::IsUpdateAPEnabled(); |
941 // Disable the default AP construction. | 941 // Disable the default AP construction. |
942 CPDF_InterForm::EnableUpdateAP(FALSE); | 942 CPDF_InterForm::SetUpdateAP(FALSE); |
943 m_pAnnotList.reset(new CPDF_AnnotList(pPage)); | 943 m_pAnnotList.reset(new CPDF_AnnotList(pPage)); |
944 CPDF_InterForm::EnableUpdateAP(enableAPUpdate); | 944 CPDF_InterForm::SetUpdateAP(bUpdateAP); |
945 | 945 |
946 const size_t nCount = m_pAnnotList->Count(); | 946 const size_t nCount = m_pAnnotList->Count(); |
947 for (size_t i = 0; i < nCount; ++i) { | 947 for (size_t i = 0; i < nCount; ++i) { |
948 CPDF_Annot* pPDFAnnot = m_pAnnotList->GetAt(i); | 948 CPDF_Annot* pPDFAnnot = m_pAnnotList->GetAt(i); |
949 CheckUnSupportAnnot(GetPDFDocument(), pPDFAnnot); | 949 CheckUnSupportAnnot(GetPDFDocument(), pPDFAnnot); |
950 | 950 |
951 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pPDFAnnot, this); | 951 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pPDFAnnot, this); |
952 if (!pAnnot) | 952 if (!pAnnot) |
953 continue; | 953 continue; |
954 m_fxAnnotArray.push_back(pAnnot); | 954 m_fxAnnotArray.push_back(pAnnot); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { | 1043 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { |
1044 #ifdef PDF_ENABLE_XFA | 1044 #ifdef PDF_ENABLE_XFA |
1045 CPDF_Page* pPage = m_page->GetPDFPage(); | 1045 CPDF_Page* pPage = m_page->GetPDFPage(); |
1046 #else // PDF_ENABLE_XFA | 1046 #else // PDF_ENABLE_XFA |
1047 CPDF_Page* pPage = m_page; | 1047 CPDF_Page* pPage = m_page; |
1048 #endif // PDF_ENABLE_XFA | 1048 #endif // PDF_ENABLE_XFA |
1049 CPDF_Dictionary* pDict = pPage->m_pFormDict; | 1049 CPDF_Dictionary* pDict = pPage->m_pFormDict; |
1050 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); | 1050 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); |
1051 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; | 1051 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; |
1052 } | 1052 } |
OLD | NEW |