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/cpdfsdk_pageview.h" | 7 #include "fpdfsdk/cpdfsdk_pageview.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "core/fpdfapi/fpdf_parser/cpdf_document.h" | 12 #include "core/fpdfapi/fpdf_parser/cpdf_document.h" |
13 #include "core/fpdfapi/fpdf_render/cpdf_renderoptions.h" | 13 #include "core/fpdfapi/fpdf_render/cpdf_renderoptions.h" |
14 #include "core/fpdfdoc/cpdf_annotlist.h" | 14 #include "core/fpdfdoc/cpdf_annotlist.h" |
15 #include "core/fpdfdoc/cpdf_interform.h" | 15 #include "core/fpdfdoc/cpdf_interform.h" |
16 #include "fpdfsdk/cpdfsdk_annot.h" | 16 #include "fpdfsdk/cpdfsdk_annot.h" |
17 #include "fpdfsdk/cpdfsdk_annothandlermgr.h" | 17 #include "fpdfsdk/cpdfsdk_annothandlermgr.h" |
18 #include "fpdfsdk/cpdfsdk_annotiterator.h" | 18 #include "fpdfsdk/cpdfsdk_annotiterator.h" |
19 #include "fpdfsdk/cpdfsdk_environment.h" | 19 #include "fpdfsdk/cpdfsdk_environment.h" |
20 #include "fpdfsdk/cpdfsdk_interform.h" | 20 #include "fpdfsdk/cpdfsdk_interform.h" |
| 21 #include "third_party/base/ptr_util.h" |
21 | 22 |
22 #ifdef PDF_ENABLE_XFA | 23 #ifdef PDF_ENABLE_XFA |
23 #include "fpdfsdk/fpdfxfa/fpdfxfa_page.h" | 24 #include "fpdfsdk/fpdfxfa/fpdfxfa_page.h" |
24 #include "xfa/fxfa/xfa_ffdocview.h" | 25 #include "xfa/fxfa/xfa_ffdocview.h" |
25 #include "xfa/fxfa/xfa_ffpageview.h" | 26 #include "xfa/fxfa/xfa_ffpageview.h" |
26 #include "xfa/fxfa/xfa_ffwidgethandler.h" | 27 #include "xfa/fxfa/xfa_ffwidgethandler.h" |
27 #include "xfa/fxfa/xfa_rendercontext.h" | 28 #include "xfa/fxfa/xfa_rendercontext.h" |
28 #include "xfa/fxgraphics/cfx_graphics.h" | 29 #include "xfa/fxgraphics/cfx_graphics.h" |
29 #endif // PDF_ENABLE_XFA | 30 #endif // PDF_ENABLE_XFA |
30 | 31 |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 SetLock(FALSE); | 488 SetLock(FALSE); |
488 return; | 489 return; |
489 } | 490 } |
490 #endif // PDF_ENABLE_XFA | 491 #endif // PDF_ENABLE_XFA |
491 | 492 |
492 CPDF_Page* pPage = GetPDFPage(); | 493 CPDF_Page* pPage = GetPDFPage(); |
493 ASSERT(pPage); | 494 ASSERT(pPage); |
494 bool bUpdateAP = CPDF_InterForm::IsUpdateAPEnabled(); | 495 bool bUpdateAP = CPDF_InterForm::IsUpdateAPEnabled(); |
495 // Disable the default AP construction. | 496 // Disable the default AP construction. |
496 CPDF_InterForm::SetUpdateAP(false); | 497 CPDF_InterForm::SetUpdateAP(false); |
497 m_pAnnotList = WrapUnique(new CPDF_AnnotList(pPage)); | 498 m_pAnnotList = pdfium::MakeUnique<CPDF_AnnotList>(pPage); |
498 CPDF_InterForm::SetUpdateAP(bUpdateAP); | 499 CPDF_InterForm::SetUpdateAP(bUpdateAP); |
499 | 500 |
500 const size_t nCount = m_pAnnotList->Count(); | 501 const size_t nCount = m_pAnnotList->Count(); |
501 for (size_t i = 0; i < nCount; ++i) { | 502 for (size_t i = 0; i < nCount; ++i) { |
502 CPDF_Annot* pPDFAnnot = m_pAnnotList->GetAt(i); | 503 CPDF_Annot* pPDFAnnot = m_pAnnotList->GetAt(i); |
503 CheckUnSupportAnnot(GetPDFDocument(), pPDFAnnot); | 504 CheckUnSupportAnnot(GetPDFDocument(), pPDFAnnot); |
504 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pPDFAnnot, this); | 505 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pPDFAnnot, this); |
505 if (!pAnnot) | 506 if (!pAnnot) |
506 continue; | 507 continue; |
507 m_fxAnnotArray.push_back(pAnnot); | 508 m_fxAnnotArray.push_back(pAnnot); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 return pAnnot; | 583 return pAnnot; |
583 } | 584 } |
584 return nullptr; | 585 return nullptr; |
585 } | 586 } |
586 | 587 |
587 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { | 588 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { |
588 CPDF_Dictionary* pDict = GetPDFPage()->m_pFormDict; | 589 CPDF_Dictionary* pDict = GetPDFPage()->m_pFormDict; |
589 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); | 590 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); |
590 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; | 591 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; |
591 } | 592 } |
OLD | NEW |